/* ═══════════════════════════════════════════════════════════════════════════
   NeonDrop — style.css  (v2 — with Device Discovery, QR, PIN modals)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg-base:        #050508;
  --bg-surface:     #0b0b14;
  --bg-raised:      #10101f;
  --bg-hover:       #16162a;

  --border-subtle:  #1a1a32;
  --border-glow:    #00ffe1;

  --cyan:           #00ffe1;
  --cyan-dim:       #00c4ad;
  --cyan-dark:      #003d38;
  --green:          #39ff6a;
  --green-dim:      #27c04e;
  --green-dark:     #003d18;
  --magenta:        #ff2de0;
  --amber:          #ffb800;
  --amber-dark:     #3d2c00;

  --text-primary:   #e8eaf6;
  --text-secondary: #7a7fa8;
  --text-muted:     #40445c;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-full: 9999px;

  --shadow-glow-cyan:  0 0 18px rgba(0, 255, 225, 0.35);
  --shadow-glow-green: 0 0 18px rgba(57, 255, 106, 0.35);
  --shadow-card:       0 4px 40px rgba(0, 0, 0, 0.7);

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="cyber-pink"] {
  --cyan: #ff2de0; --cyan-dim: #d11bb6; --cyan-dark: #3a0033;
  --green: #00ffe1; --green-dim: #00c4ad; --green-dark: #003d38;
  --border-glow: #ff2de0;
  --shadow-glow-cyan: 0 0 18px rgba(255, 45, 224, 0.35);
  --shadow-glow-green: 0 0 18px rgba(0, 255, 225, 0.35);
}

[data-theme="electric-blue"] {
  --cyan: #00aaff; --cyan-dim: #0088cc; --cyan-dark: #002233;
  --green: #ffb800; --green-dim: #cc9300; --green-dark: #3d2c00;
  --border-glow: #00aaff;
  --shadow-glow-cyan: 0 0 18px rgba(0, 170, 255, 0.35);
  --shadow-glow-green: 0 0 18px rgba(255, 184, 0, 0.35);
}

[data-theme="synthwave"] {
  --cyan: #ff7700; --cyan-dim: #cc5f00; --cyan-dark: #331800;
  --green: #b900ff; --green-dim: #9400cc; --green-dark: #2e0040;
  --border-glow: #ff7700;
  --shadow-glow-cyan: 0 0 18px rgba(255, 119, 0, 0.35);
  --shadow-glow-green: 0 0 18px rgba(185, 0, 255, 0.35);
}

/* ── Reset & base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}

/* ── Background grid ─────────────────────────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 225, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 225, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

#particles-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ── Ad Units ────────────────────────────────────────────────────────────────── */
.ad-unit {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1080px;
  background: rgba(10, 10, 20, 0.6);
  border: 1px solid rgba(0, 255, 225, 0.07);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}
.ad-unit::before {
  content: 'Ad';
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  z-index: 1;
  pointer-events: none;
}
.ad-unit ins { width: 100%; }
.ad-leaderboard { padding: 4px 0; }
.ad-footer-banner { margin-top: 12px; margin-bottom: 4px; }

/* 4 Quadrant Ads (Left/Right margins split into Top/Bottom) */
.ad-fixed {
  position: fixed;
  width: calc(50vw - 540px); /* Exactly fills the margin next to the 1080px main content */
  min-width: 100px;
  background: rgba(10, 10, 20, 0.4);
  border: 1px solid rgba(0, 255, 225, 0.05);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-top-left { top: 0; left: 0; height: 260px; border-top: none; border-left: none; }
.ad-bottom-left { top: 280px; bottom: 0; left: 0; border-bottom: none; border-left: none; }
.ad-top-right { top: 0; right: 0; height: 260px; border-top: none; border-right: none; }
.ad-bottom-right { top: 280px; bottom: 0; right: 0; border-bottom: none; border-right: none; }

/* Hide side margin ads if screen is too narrow to fit them */
@media (max-width: 1150px) {
  .ad-fixed { display: none !important; }
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

.site-header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 48px 20px 20px;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 2rem;
  color: var(--cyan);
  filter: drop-shadow(0 0 10px var(--cyan));
  animation: pulse-icon 2.5s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { filter: drop-shadow(0 0 10px var(--cyan)); }
  50%       { filter: drop-shadow(0 0 24px var(--cyan)) drop-shadow(0 0 48px var(--cyan)); }
}

.logo-text { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
.logo-accent { color: var(--cyan); text-shadow: 0 0 16px var(--cyan); }
.tagline { font-size: 0.875rem; color: var(--text-secondary); letter-spacing: 0.3px; margin-bottom: 14px; }

/* ── Identity strip ─────────────────────────────────────────────────────────── */
.identity-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.identity-label { color: var(--text-muted); }
.identity-id    { color: var(--cyan); text-shadow: 0 0 8px rgba(0,255,225,0.4); font-size: 0.82rem; }
.identity-name  { color: var(--text-primary); font-weight: 500; }
.identity-sep   { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   TAB BAR
   ══════════════════════════════════════════════════════════════════════════════ */
.tab-bar {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 1080px;
  padding: 20px 20px 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.tab-btn.active {
  background: var(--bg-raised);
  color: var(--cyan);
  border-color: rgba(0,255,225,0.25);
  border-bottom-color: var(--bg-raised); /* merges into tab panel */
  box-shadow: 0 0 20px rgba(0,255,225,0.08);
}

.tab-icon { font-size: 1rem; }

.tab-badge {
  background: var(--cyan);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Tab panels ─────────────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
  width: 100%;
  max-width: 1080px;
  border: 1px solid rgba(0,255,225,0.15);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  background: var(--bg-raised);
  padding: 20px;
  position: relative;
  z-index: 9;
  margin-bottom: 20px;
}

.tab-panel.active { display: block; }

/* ── World hero ─────────────────────────────────────────────────────────────── */
.world-hero {
  text-align: center;
  padding: 28px 20px 10px;
}

.world-hero-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(57,255,106,0.5));
  animation: pulse-icon 2.5s ease-in-out infinite;
}

.world-hero-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 20px rgba(57,255,106,0.4);
  margin-bottom: 8px;
}

.world-hero-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* World room QR (shown under the room code box) */
.world-room-qr {
  display: flex;
  justify-content: center;
  padding: 12px 0 0;
}

/* Share URL row */
.share-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-base);
  border: 1px solid rgba(57,255,106,0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.share-url-text {
  flex: 1;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  word-break: break-all;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DEVICE DISCOVERY + QR ROW
   ══════════════════════════════════════════════════════════════════════════════ */
.discovery-row {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1080px;
  padding: 16px 20px 0;
}

/* ── Discovery panel card ───────────────────────────────────────────────────── */
.discovery-panel {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.discovery-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at top left, rgba(0, 255, 225, 0.04) 0%, transparent 65%);
  pointer-events: none;
}

.qr-panel::before {
  background: radial-gradient(ellipse at top right, rgba(57, 255, 106, 0.04) 0%, transparent 65%);
}

.discovery-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dp-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}

.cyan-icon  { background: var(--cyan-dark);  border: 1px solid rgba(0,255,225,0.3);   box-shadow: 0 0 10px rgba(0,255,225,0.2); }
.green-icon { background: var(--green-dark); border: 1px solid rgba(57,255,106,0.3);  box-shadow: 0 0 10px rgba(57,255,106,0.2); }

.dp-title   { font-size: 0.95rem; font-weight: 600; line-height: 1.2; }
.dp-subtitle{ font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

.peer-count-badge {
  margin-left: auto;
  background: var(--cyan-dark);
  color: var(--cyan);
  border: 1px solid rgba(0,255,225,0.3);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  transition: all var(--transition);
}

/* ── Device list ─────────────────────────────────────────────────────────────── */
.device-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.device-list-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  justify-content: center;
}

.empty-icon { font-size: 1.1rem; }

/* Individual device card */
.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  animation: fade-slide-in 0.25s ease;
  position: relative;
  overflow: hidden;
}

.device-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,255,225,0) 0%, rgba(0,255,225,0.04) 100%);
  opacity: 0;
  transition: opacity var(--transition);
}

.device-item:hover {
  border-color: rgba(0,255,225,0.35);
  box-shadow: 0 0 16px rgba(0,255,225,0.12);
  transform: translateY(-1px);
}

.device-item:hover::before { opacity: 1; }

.device-item.self {
  border-color: rgba(57,255,106,0.2);
  cursor: default;
}
.device-item.self:hover {
  transform: none;
  box-shadow: none;
}

.device-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: var(--cyan-dark);
  border: 1px solid rgba(0,255,225,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cyan);
  flex-shrink: 0;
  text-transform: uppercase;
}

.device-item.self .device-avatar {
  background: var(--green-dark);
  border-color: rgba(57,255,106,0.25);
  color: var(--green);
}

.device-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.device-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-pid {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 2px;
}

.device-self-badge {
  font-size: 0.66rem;
  color: var(--green);
  background: var(--green-dark);
  border: 1px solid rgba(57,255,106,0.25);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  flex-shrink: 0;
}

.device-pair-btn {
  background: linear-gradient(135deg, var(--cyan-dark), rgba(0,255,225,0.1));
  border: 1px solid rgba(0,255,225,0.3);
  color: var(--cyan);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.device-pair-btn:hover {
  background: linear-gradient(135deg, rgba(0,255,225,0.25), rgba(0,255,225,0.08));
  box-shadow: 0 0 14px rgba(0,255,225,0.3);
}

/* ── QR code ─────────────────────────────────────────────────────────────────── */
.qr-panel { flex: 0 0 auto; width: 280px; align-items: center; }

.qr-container {
  width: 180px; height: 180px;
  background: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--bg-raised), 0 0 0 5px rgba(57,255,106,0.4), 0 0 30px rgba(57,255,106,0.25);
  overflow: hidden;
  position: relative;
  transition: box-shadow var(--transition);
}

.qr-container:hover {
  box-shadow: 0 0 0 3px var(--bg-raised), 0 0 0 5px rgba(57,255,106,0.7), 0 0 50px rgba(57,255,106,0.4);
}

#qr-canvas {
  width: 160px !important;
  height: 160px !important;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #666;
  font-size: 0.75rem;
}

.qr-spinner {
  width: 28px; height: 28px;
  border: 3px solid #ddd;
  border-top-color: #00c4ad;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.qr-peer-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.qr-peer-id-label { color: var(--text-muted); }
.qr-peer-id-value { color: var(--green); font-size: 0.82rem; text-shadow: 0 0 8px rgba(57,255,106,0.4); }

/* ══════════════════════════════════════════════════════════════════════════════
   TRANSFER PANELS (unchanged layout, kept below discovery)
   ══════════════════════════════════════════════════════════════════════════════ */
.panels-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: 100%;
  max-width: 1080px;
  padding: 20px 20px 60px;
}

.panel {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at top center, rgba(0,255,225,0.04) 0%, transparent 70%);
  pointer-events: none;
}

#receive-panel::before {
  background: radial-gradient(ellipse at top center, rgba(57,255,106,0.04) 0%, transparent 70%);
}

.panel:hover { border-color: rgba(0,255,225,0.2); box-shadow: var(--shadow-card), var(--shadow-glow-cyan); }
#receive-panel:hover { border-color: rgba(57,255,106,0.2); box-shadow: var(--shadow-card), var(--shadow-glow-green); }

.panel-header { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border-subtle); }

.panel-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 700; flex-shrink: 0; }
.send-icon  { background: var(--cyan-dark);  color: var(--cyan);  border: 1px solid rgba(0,255,225,0.3);  box-shadow: 0 0 14px rgba(0,255,225,0.2); }
.recv-icon  { background: var(--green-dark); color: var(--green); border: 1px solid rgba(57,255,106,0.3); box-shadow: 0 0 14px rgba(57,255,106,0.2); }

.panel-title    { font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.panel-subtitle { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Drop zone ──────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--bg-raised);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(0,255,225,0.05);
  box-shadow: inset 0 0 24px rgba(0,255,225,0.07), var(--shadow-glow-cyan);
}

.drop-zone:focus { outline: 2px solid var(--cyan); outline-offset: 2px; }
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  pointer-events: auto; /* always clickable, even if a parent has pointer-events:none */
  z-index: 2;
}

/* QR output container img sizing */
#qr-output {
  width: 100%;
  height: 100%;
}
#qr-output img,
#qr-output canvas {
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  display: block;
}
.drop-zone-inner { pointer-events: none; }

.drop-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; transition: transform var(--transition); }
.drop-zone:hover .drop-icon { transform: scale(1.15) translateY(-2px); }

.drop-primary  { font-size: 0.95rem; font-weight: 500; }
.drop-secondary{ font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.selected-file-info { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.file-icon-badge { font-size: 1.8rem; flex-shrink: 0; }
.file-meta { display: flex; flex-direction: column; text-align: left; flex: 1; min-width: 0; }
.file-name { font-size: 0.9rem; font-weight: 500; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; font-family: var(--font-mono); }

.clear-file-btn {
  background: transparent; border: 1px solid var(--border-subtle); color: var(--text-muted);
  border-radius: var(--radius-sm); width: 26px; height: 26px; cursor: pointer;
  font-size: 0.75rem; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.clear-file-btn:hover { border-color: var(--magenta); color: var(--magenta); background: rgba(255,45,224,0.08); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--transition);
  position: relative; overflow: hidden; text-decoration: none; letter-spacing: 0.2px;
}

.btn::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0); transition: background var(--transition); }
.btn:hover::after { background: rgba(255,255,255,0.05); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }
.btn-icon { font-size: 1rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-dark) 0%, rgba(0,255,225,0.15) 100%);
  color: var(--cyan); border: 1px solid rgba(0,255,225,0.4);
  box-shadow: 0 0 20px rgba(0,255,225,0.15);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0,255,225,0.25) 0%, rgba(0,255,225,0.08) 100%);
  box-shadow: 0 0 30px rgba(0,255,225,0.35), 0 0 60px rgba(0,255,225,0.1);
  border-color: var(--cyan);
}

.btn-send {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-dim) 100%);
  color: #000; box-shadow: 0 0 24px rgba(0,255,225,0.5); font-weight: 700;
}
.btn-send:hover:not(:disabled) { box-shadow: 0 0 40px rgba(0,255,225,0.7), 0 0 80px rgba(0,255,225,0.2); transform: translateY(-1px); }

.btn-join {
  background: linear-gradient(135deg, var(--green-dark) 0%, rgba(57,255,106,0.15) 100%);
  color: var(--green); border: 1px solid rgba(57,255,106,0.4);
  box-shadow: 0 0 20px rgba(57,255,106,0.15);
}
.btn-join:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(57,255,106,0.25) 0%, rgba(57,255,106,0.08) 100%);
  box-shadow: 0 0 30px rgba(57,255,106,0.35), 0 0 60px rgba(57,255,106,0.1);
  border-color: var(--green);
}

.btn-download {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dim) 100%);
  color: #000; box-shadow: 0 0 24px rgba(57,255,106,0.5); font-weight: 700; width: 100%;
}
.btn-download:hover { box-shadow: 0 0 40px rgba(57,255,106,0.7), 0 0 80px rgba(57,255,106,0.2); transform: translateY(-1px); }

.btn-danger {
  background: rgba(255,45,224,0.08);
  color: var(--magenta);
  border: 1px solid rgba(255,45,224,0.3);
}
.btn-danger:hover { background: rgba(255,45,224,0.18); border-color: var(--magenta); box-shadow: 0 0 20px rgba(255,45,224,0.25); }

/* ── Room ID box ─────────────────────────────────────────────────────────────── */
.room-id-box {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  animation: fade-slide-in 0.35s ease;
}

.room-id-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; }
.room-id-row   { display: flex; align-items: center; gap: 10px; }

.room-id-value {
  font-size: 1.5rem; font-weight: 600; color: var(--cyan);
  letter-spacing: 4px; text-shadow: 0 0 14px rgba(0,255,225,0.6); flex: 1;
}

.icon-btn {
  background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary);
  border-radius: var(--radius-sm); width: 32px; height: 32px; cursor: pointer;
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(0,255,225,0.08); }
.icon-btn.copied { border-color: var(--green); color: var(--green); background: rgba(57,255,106,0.1); }

/* ── Connection status ──────────────────────────────────────────────────────── */
.connection-status { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-secondary); padding: 4px 0; }

.status-dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--text-muted); flex-shrink: 0; transition: all var(--transition); }
.status-dot.waiting { background: var(--text-muted); }
.status-dot.active  { background: var(--cyan);    box-shadow: 0 0 10px var(--cyan);    animation: blink 1.2s ease-in-out infinite; }
.status-dot.success { background: var(--green);   box-shadow: 0 0 10px var(--green); }
.status-dot.error   { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── Input group ─────────────────────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-label { font-size: 0.78rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; }
.input-row   { display: flex; gap: 10px; }

.text-input {
  flex: 1; background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: var(--font-mono); font-size: 1rem; padding: 11px 16px;
  letter-spacing: 3px; text-transform: uppercase; transition: all var(--transition); outline: none;
}
.text-input::placeholder { color: var(--text-muted); letter-spacing: 1px; font-size: 0.85rem; }
.text-input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(57,255,106,0.15), 0 0 20px rgba(57,255,106,0.1); }

/* ── Progress bar ────────────────────────────────────────────────────────────── */
.progress-container { display: flex; flex-direction: column; gap: 8px; animation: fade-slide-in 0.3s ease; }
.progress-header { display: flex; justify-content: space-between; align-items: center; }
.progress-label  { font-size: 0.82rem; color: var(--text-secondary); }
.progress-percent{ font-size: 0.9rem; font-weight: 600; color: var(--cyan); }

.progress-bar-track { height: 10px; background: var(--bg-raised); border-radius: var(--radius-full); border: 1px solid var(--border-subtle); overflow: hidden; position: relative; }

.progress-bar-fill {
  height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  border-radius: var(--radius-full); transition: width 0.15s linear; position: relative; z-index: 1;
}

.progress-bar-glow {
  position: absolute; top: 0; left: 0; height: 100%; width: 0%;
  background: var(--cyan); filter: blur(6px); opacity: 0.5;
  border-radius: var(--radius-full); transition: width 0.15s linear;
}

.recv-fill { background: linear-gradient(90deg, var(--green-dim), var(--green)); }
.recv-glow { background: var(--green); }

.progress-sub { font-size: 0.77rem; color: var(--text-muted); font-family: var(--font-mono); text-align: right; }

/* ── Download area ───────────────────────────────────────────────────────────── */
.download-area {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px; background: rgba(57,255,106,0.05);
  border: 1px solid rgba(57,255,106,0.2); border-radius: var(--radius-md);
  animation: fade-slide-in 0.4s ease;
}
.download-ready-icon { font-size: 2rem; }
.download-ready-text { font-size: 1rem; font-weight: 600; color: var(--green); text-shadow: 0 0 14px rgba(57,255,106,0.5); }
.download-filename   { font-size: 0.82rem; color: var(--text-secondary); word-break: break-all; text-align: center; }

.send-controls { animation: fade-slide-in 0.35s ease; }

/* ── Event log ───────────────────────────────────────────────────────────────── */
.event-log {
  font-family: var(--font-mono); font-size: 0.73rem; color: var(--text-muted);
  background: var(--bg-base); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 10px 12px;
  max-height: 90px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.event-log:empty { display: none; }

.log-entry { display: flex; gap: 8px; }
.log-time  { color: var(--text-muted); flex-shrink: 0; }
.log-msg         { color: var(--text-secondary); }
.log-msg.success { color: var(--green); }
.log-msg.error   { color: var(--magenta); }
.log-msg.info    { color: var(--cyan); }

/* ── Panel divider ───────────────────────────────────────────────────────────── */
.panel-divider { display: flex; flex-direction: column; align-items: center; padding: 40px 24px; gap: 10px; flex-shrink: 0; }
.divider-line  { width: 1px; flex: 1; background: linear-gradient(to bottom, transparent, var(--border-subtle) 30%, var(--border-subtle) 70%, transparent); }
.divider-label { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 2px; font-weight: 600; padding: 6px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-full); background: var(--bg-surface); }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer { position: relative; z-index: 10; text-align: center; padding: 0 20px 32px; font-size: 0.76rem; color: var(--text-muted); }

/* ── Toasts ──────────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }

.toast {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 12px 18px;
  font-size: 0.85rem; color: var(--text-primary); box-shadow: var(--shadow-card);
  min-width: 240px; max-width: 320px; display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.success { border-color: rgba(57,255,106,0.4); }
.toast.error   { border-color: rgba(255,45,224,0.4); }
.toast.info    { border-color: rgba(0,255,225,0.4); }
.toast.out     { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(40px) scale(0.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(40px) scale(0.9); } }

/* ══════════════════════════════════════════════════════════════════════════════
   MODALS — shared overlay + floating cards
   ══════════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 1000;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 36px 32px 30px;
  width: min(420px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  box-shadow: 0 0 0 1px var(--border-subtle), var(--shadow-card), 0 0 60px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Glowing border accent */
.modal-glow {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  pointer-events: none;
  z-index: -1;
}
.cyan-glow  { border: 1px solid rgba(0,255,225,0.5);  box-shadow: 0 0 40px rgba(0,255,225,0.2),  inset 0 0 40px rgba(0,255,225,0.04); }
.green-glow { border: 1px solid rgba(57,255,106,0.5); box-shadow: 0 0 40px rgba(57,255,106,0.2), inset 0 0 40px rgba(57,255,106,0.04); }

.modal-icon     { font-size: 2.8rem; line-height: 1; }
.modal-title    { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 0.83rem; color: var(--text-secondary); line-height: 1.55; max-width: 320px; }
.modal-subtitle strong { color: var(--text-primary); }

.modal-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}

.modal-actions .btn { flex: 1; }

/* ── PIN entry (6 individual digit boxes) ────────────────────────────────────── */
.pin-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.pin-digit {
  width: 46px;
  height: 58px;
  background: var(--bg-raised);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all var(--transition);
  caret-color: var(--cyan);
}

.pin-digit:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0,255,225,0.2), 0 0 20px rgba(0,255,225,0.15);
  background: rgba(0,255,225,0.05);
}

.pin-digit.filled {
  border-color: rgba(0,255,225,0.5);
  background: rgba(0,255,225,0.06);
}

.pin-digit.error-shake {
  border-color: var(--magenta);
  box-shadow: 0 0 0 2px rgba(255,45,224,0.2), 0 0 20px rgba(255,45,224,0.15);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.pin-sep {
  font-size: 1.4rem;
  color: var(--text-muted);
  font-weight: 700;
  user-select: none;
  padding: 0 2px;
}

.pin-error {
  font-size: 0.8rem;
  color: var(--magenta);
  animation: fade-slide-in 0.2s ease;
}

/* ── PIN display box (target device) ────────────────────────────────────────── */
.pin-display-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-raised);
  border: 1px solid rgba(57,255,106,0.3);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  width: 100%;
  justify-content: center;
}

.pin-display-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 10px;
  text-shadow: 0 0 20px rgba(57,255,106,0.7);
  animation: pin-glow-pulse 1.5s ease-in-out infinite;
}

@keyframes pin-glow-pulse {
  0%, 100% { text-shadow: 0 0 20px rgba(57,255,106,0.7); }
  50%       { text-shadow: 0 0 40px rgba(57,255,106,1), 0 0 80px rgba(57,255,106,0.4); }
}

.pin-display-hint { font-size: 0.75rem; color: var(--text-muted); }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }

@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--cyan-dark); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .discovery-row   { flex-direction: column; }
  .qr-panel        { width: 100%; align-items: center; flex-direction: column; gap: 16px; }
  .qr-container    { width: 180px; height: 180px; }
  #qr-output img, #qr-output canvas { width: 100% !important; height: 100% !important; }
  .panels-container{ flex-direction: column; gap: 20px; }
  .panel-divider   { flex-direction: row; padding: 0; }
  .divider-line    { width: auto; height: 1px; flex: 1; background: linear-gradient(to right, transparent, var(--border-subtle) 30%, var(--border-subtle) 70%, transparent); }
  .input-row       { flex-direction: column; }
}

@media (max-width: 480px) {
  .site-header     { padding: 32px 16px 16px; }
  .logo-text       { font-size: 1.6rem; }
  .panel           { padding: 22px 18px; }
  .room-id-value   { font-size: 1.2rem; letter-spacing: 3px; }
  .pin-digit       { width: 38px; height: 50px; font-size: 1.3rem; }
  .pin-display-value { font-size: 1.8rem; letter-spacing: 6px; }
  .identity-strip  { flex-wrap: wrap; justify-content: center; }
}

/* ── Session panel ─────────────────────────────────────────────────────────── */

.session-panel {
  max-width: 900px;
  margin: 24px auto 0;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow: hidden;
  animation: fadeSlideIn 0.4s ease;
}

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

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(0,255,225,0.07) 0%, rgba(57,255,106,0.05) 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.session-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.session-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}
.session-dot.active  { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse-dot 2s infinite; }
.session-dot.success { background: var(--green); box-shadow: 0 0 8px var(--green); }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px var(--cyan); }
  50%       { box-shadow: 0 0 16px var(--cyan); }
}

.session-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.session-peer-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.session-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.session-section {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.session-section:first-child {
  border-right: 1px solid var(--border-subtle);
}

.session-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.session-recv-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  background: rgba(255,255,255,0.01);
  border: 1px dashed rgba(255,255,255,0.07);
  border-radius: 12px;
}

.session-recv-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.session-recv-peer {
  color: var(--cyan);
}

/* Shared log inside session */
#session-log {
  margin: 0 24px 16px;
  max-height: 100px;
}

@media (max-width: 720px) {
  .session-body {
    grid-template-columns: 1fr;
  }
  .session-section:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* -- Theme Picker ------------------------------------------------------------ */
.header-controls { display: flex; align-items: center; gap: 16px; }
.theme-picker { position: relative; }
.theme-btn { font-size: 1.2rem; }
.theme-menu {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 8px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 4px; min-width: 140px; z-index: 100;
}
.theme-option {
  background: transparent; border: none; color: var(--text-secondary);
  padding: 8px 12px; text-align: left; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; font-family: var(--font-sans);
  transition: all var(--transition);
}
.theme-option:hover { background: rgba(0,255,225,0.08); color: var(--text-primary); }
.theme-option.active { color: var(--cyan); background: rgba(0,255,225,0.15); font-weight: 600; }

/* -- Session Chat Feed -------------------------------------------------------- */
.session-chat {
  display: flex; flex-direction: column; height: 400px;
  background: var(--bg-base); border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle); position: relative; overflow: hidden;
}

.chat-feed {
  flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}

.chat-system-msg {
  text-align: center; font-size: 0.75rem; color: var(--text-muted);
  margin: 8px 0; font-family: var(--font-mono);
}

.chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 0.9rem;
  line-height: 1.4; word-wrap: break-word; animation: fade-slide-in 0.2s ease;
  display: flex; flex-direction: column; gap: 4px;
}

.chat-bubble.sent {
  align-self: flex-end; background: var(--cyan-dark); color: var(--text-primary);
  border-bottom-right-radius: 4px; border: 1px solid rgba(0,255,225,0.2);
}

.chat-bubble.received {
  align-self: flex-start; background: var(--bg-raised); color: var(--text-primary);
  border-bottom-left-radius: 4px; border: 1px solid var(--border-subtle);
}

/* File bubble specific styles */
.file-bubble {
  display: flex; align-items: center; gap: 10px; width: 260px;
}
.file-bubble-icon { font-size: 2rem; }
.file-bubble-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-bubble-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-bubble-size { font-size: 0.7rem; color: rgba(255,255,255,0.6); font-family: var(--font-mono); }
.file-bubble-progress {
  height: 4px; background: rgba(0,0,0,0.3); border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.file-bubble-bar { height: 100%; background: var(--cyan); width: 0%; transition: width 0.1s linear; }

.chat-input-area {
  display: flex; align-items: center; gap: 8px; padding: 12px;
  background: var(--bg-raised); border-top: 1px solid var(--border-subtle);
}

.chat-textarea {
  flex: 1; background: var(--bg-base); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); color: var(--text-primary); padding: 10px 14px;
  font-family: var(--font-sans); font-size: 0.9rem; resize: none; overflow-y: hidden;
  transition: border-color var(--transition);
}
.chat-textarea:focus { outline: none; border-color: var(--cyan); }

.attach-btn { font-size: 1.2rem; }
.send-chat-btn { padding: 10px 16px; }

/* Global Drop Overlay */
.session-drop-overlay {
  position: absolute; inset: 0; background: rgba(5,5,8,0.85); backdrop-filter: blur(4px);
  z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; border: 2px dashed var(--cyan); border-radius: var(--radius-md); pointer-events: none;
}
.session-drop-overlay p { font-size: 1.2rem; color: var(--cyan); font-weight: 600; }
.session-chat.drag-over .session-drop-overlay { display: flex !important; }


