 *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

  :root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface2: #1a1a26;
    --border: #2a2a3a;
    --text: #e8e8f0;
    --text-dim: #8888a0;
    --accent: #00e5a0;
    --accent-dim: #00e5a020;
    --accent-glow: #00e5a040;
    --danger: #ff4466;
    --warning: #ffaa33;
    --radius: 12px;
    --mono: 'Space Mono', monospace;
    --sans: 'DM Sans', sans-serif;
  }

  body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, #00e5a008 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, #4466ff06 0%, transparent 50%);
    animation: drift 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
  }

  @keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, 3%) rotate(2deg); }
  }

  .container { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 40px 20px; }
  .header { text-align: center; margin-bottom: 48px; }
  .logo { font-family: var(--mono); font-size: 32px; font-weight: 700; letter-spacing: -1px; margin-bottom: 8px; }
  .logo span { color: var(--accent); }
  .subtitle { color: var(--text-dim); font-size: 14px; letter-spacing: 0.5px; }

  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 20px; transition: border-color 0.3s; }
  .card:hover { border-color: #3a3a4a; }
  .card-title { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
  .card-title::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; box-shadow: 0 0 8px var(--accent-glow); }

  input, textarea { font-family: var(--mono); font-size: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; color: var(--text); outline: none; transition: border-color 0.2s, box-shadow 0.2s; width: 100%; }
  input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
  textarea { resize: vertical; min-height: 80px; font-size: 11px; line-height: 1.5; }

  .btn { font-family: var(--sans); font-weight: 600; font-size: 14px; border: none; border-radius: 8px; padding: 12px 24px; cursor: pointer; transition: all 0.2s; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
  .btn-primary { background: var(--accent); color: var(--bg); }
  .btn-primary:hover { background: #00ffb0; box-shadow: 0 0 20px var(--accent-glow); transform: translateY(-1px); }
  .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--border); }
  .btn-small { padding: 8px 16px; font-size: 12px; }

  .tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 8px; padding: 4px; margin-bottom: 20px; }
  .tab { flex: 1; padding: 10px; text-align: center; font-size: 13px; font-weight: 500; border-radius: 6px; cursor: pointer; color: var(--text-dim); transition: all 0.2s; border: none; background: none; }
  .tab.active { background: var(--surface2); color: var(--text); }
  .tab:hover:not(.active) { color: var(--text); }
  .tab-content { display: none; }
  .tab-content.active { display: block; }

  .room-row { display: flex; gap: 12px; align-items: stretch; }
  .room-hint { font-size: 12px; color: var(--text-dim); margin-top: 12px; line-height: 1.6; }

  .role-picker { display: flex; gap: 12px; margin-bottom: 20px; }
  .role-card { flex: 1; padding: 20px 16px; background: var(--bg); border: 2px solid var(--border); border-radius: 10px; text-align: center; cursor: pointer; transition: all 0.25s; }
  .role-card:hover { border-color: #4a4a5a; background: var(--surface2); }
  .role-card.selected { border-color: var(--accent); background: var(--accent-dim); }
  .role-card .role-icon { font-size: 28px; margin-bottom: 10px; }
  .role-card .role-name { font-family: var(--mono); font-size: 13px; font-weight: 700; margin-bottom: 4px; }
  .role-card .role-desc { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
  .role-card.selected .role-name { color: var(--accent); }
  .role-steps { display: none; }
  .role-steps.active { display: block; }
  .signal-steps { display: flex; flex-direction: column; gap: 16px; }
  .step-label { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
  .step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent); font-family: var(--mono); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

  .dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 48px 24px; text-align: center; cursor: pointer; transition: all 0.3s; position: relative; }
  .dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-dim); }
  .dropzone-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
  .dropzone-text { color: var(--text-dim); font-size: 14px; margin-bottom: 8px; }
  .dropzone-hint { color: var(--text-dim); font-size: 12px; opacity: 0.6; }
  .dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

  .status-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--bg); border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
  .status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .status-dot.disconnected { background: var(--danger); }
  .status-dot.connecting { background: var(--warning); animation: pulse 1s infinite; }
  .status-dot.connected { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

  .transfer-item { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; }
  .transfer-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
  .transfer-info { flex: 1; min-width: 0; }
  .transfer-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .transfer-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; font-family: var(--mono); }
  .transfer-progress { width: 100%; height: 4px; background: var(--border); border-radius: 4px; margin-top: 8px; overflow: hidden; }
  .transfer-progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.15s linear; box-shadow: 0 0 8px var(--accent-glow); }
  .transfer-progress-bar.complete { background: var(--accent); }
  .transfer-percent { font-family: var(--mono); font-size: 13px; color: var(--accent); flex-shrink: 0; min-width: 44px; text-align: right; }

  .log { max-height: 180px; overflow-y: auto; font-family: var(--mono); font-size: 11px; line-height: 1.8; color: var(--text-dim); padding: 12px; background: var(--bg); border-radius: 8px; }
  .log::-webkit-scrollbar { width: 4px; }
  .log::-webkit-scrollbar-track { background: transparent; }
  .log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
  .log-entry { padding: 2px 0; }
  .log-time { color: #555568; }
  .log-success { color: var(--accent); }
  .log-error { color: var(--danger); }
  .log-info { color: var(--text-dim); }

  .info-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: none; padding: 0; cursor: pointer; color: var(--accent); font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
  .info-toggle:hover { opacity: 0.8; }
  .info-toggle .chevron { transition: transform 0.3s; font-size: 14px; }
  .info-toggle.open .chevron { transform: rotate(180deg); }
  .info-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease, margin 0.3s ease; }
  .info-body.open { max-height: 2000px; margin-top: 20px; }
  .info-section { margin-bottom: 24px; }
  .info-section:last-child { margin-bottom: 0; }
  .info-heading { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
  .info-heading .info-icon { font-size: 18px; }
  .info-text { font-size: 13px; line-height: 1.7; color: var(--text-dim); }
  .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
  .info-badge { display: flex; align-items: flex-start; gap: 10px; padding: 14px; background: var(--bg); border-radius: 8px; border: 1px solid var(--border); }
  .info-badge .badge-icon { font-size: 22px; flex-shrink: 0; line-height: 1; margin-top: 1px; }
  .info-badge .badge-label { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
  .info-badge .badge-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
  .info-steps-visual { display: flex; align-items: center; gap: 0; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
  .info-step-item { text-align: center; padding: 10px 14px; }
  .info-step-item .step-emoji { font-size: 24px; margin-bottom: 6px; }
  .info-step-item .step-text { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
  .info-arrow { font-size: 18px; color: var(--border); flex-shrink: 0; }
  .info-highlight { background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 8px; padding: 14px 18px; margin-top: 14px; font-size: 13px; line-height: 1.6; color: var(--text); }
  .info-highlight strong { color: var(--accent); }

  /* Chat */
  .chat-messages {
    max-height: 260px;
    min-height: 80px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .chat-messages::-webkit-scrollbar { width: 4px; }
  .chat-messages::-webkit-scrollbar-track { background: transparent; }
  .chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

  .chat-empty {
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
    padding: 24px 0;
    opacity: 0.5;
  }

  .chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .chat-bubble.me {
    background: var(--accent);
    color: var(--bg);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
  }

  .chat-bubble.peer {
    background: var(--surface2);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
  }

  .chat-bubble .chat-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    font-family: var(--mono);
  }

  .chat-bubble.me .chat-time { text-align: right; }
  .chat-bubble.peer .chat-time { text-align: left; }

  .chat-input-row {
    display: flex;
    gap: 8px;
  }

  .chat-input-row input {
    flex: 1;
    font-family: var(--sans);
    font-size: 13px;
  }

  .chat-input-row .btn { flex-shrink: 0; }

  .info-method-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 10px; margin-top: 20px; display: flex; align-items: center; gap: 8px; }
  .info-method-label::before { content: ''; flex: 1; height: 1px; background: var(--border); }
  .info-method-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

  .hidden { display: none !important; }

  @media (max-width: 500px) {
    .container { padding: 20px 14px; }
    .card { padding: 20px; }
    .role-picker { flex-direction: column; }
    .room-row { flex-direction: column; }
    .info-grid { grid-template-columns: 1fr; }
  }