@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700;800&display=swap');

/* ==========================================================================
   Design Tokens & Clean Theme Variables
   (Focused on elegance, restraint, and clarity - no garish gradients)
   ========================================================================== */
:root {
  /* Dark Theme (Default) - Sophisticated Slate / Minimalist Deep Tech */
  --bg-base: #0b0f17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-surface-solid: #111827;
  --bg-input: #0f172a;
  --bg-glass: rgba(255, 255, 255, 0.03);

  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b0f17;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-highlight: rgba(59, 130, 246, 0.4);

  /* Unified Elegant Accent: Professional Slate Blue */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-active: #1d4ed8;
  --primary-light: rgba(59, 130, 246, 0.12);

  /* Functional Status Colors */
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-light: rgba(16, 185, 129, 0.12);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.12);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 16px rgba(59, 130, 246, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables - Clean, Crisp, Apple-like */
[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-solid: #ffffff;
  --bg-input: #f8fafc;
  --bg-glass: rgba(0, 0, 0, 0.02);

  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-highlight: rgba(37, 99, 235, 0.35);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-light: rgba(37, 99, 235, 0.08);

  --emerald: #059669;
  --emerald-hover: #047857;
  --emerald-light: rgba(5, 150, 105, 0.08);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: rgba(220, 38, 38, 0.08);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 36px -6px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 16px rgba(37, 99, 235, 0.12);
}

/* ==========================================================================
   CSS Reset & Base Setup
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-base);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Subtle, unobtrusive dot pattern background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   Page Shell
   ========================================================================== */
.page-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header Navigation Bar
   ========================================================================== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}

.brand-wrapper:hover .brand-icon-box {
  transform: scale(1.04);
}

.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-highlight);
  letter-spacing: 0.02em;
}

.brand-tagline {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald);
  position: relative;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background-color: var(--emerald);
  opacity: 0.4;
  animation: livePulse 2.4s ease-out infinite;
}

@keyframes livePulse {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.device-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  color: var(--text-sub);
  border: 1px solid var(--border-subtle);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icon Buttons (Theme toggle, GitHub) */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* ==========================================================================
   Hero Banner
   ========================================================================== */
.hero-banner {
  text-align: center;
  padding: 20px 16px 32px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--border-highlight);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 10px;
  color: var(--text-main);
}

.hero-accent-text {
  color: var(--primary);
  font-weight: 800;
}

.hero-subtitle {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--text-sub);
  max-width: 600px;
  margin: 0 auto 22px;
  font-weight: 400;
  line-height: 1.6;
}

.feature-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-sub);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

.feature-pill svg {
  color: var(--primary);
}

/* ==========================================================================
   Control Panel Grid (Receive & Send Hubs) & Smart Collapse Bar
   ========================================================================== */
.panel-collapse-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-normal);
}

.panel-collapse-bar:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-elevated);
}

.collapse-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.collapse-bar-left .live-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  flex-shrink: 0;
  animation: livePulse 2s infinite;
}

.collapse-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.collapse-bar-btn .chevron-icon {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-collapse-bar.is-expanded .collapse-bar-btn .chevron-icon {
  transform: rotate(180deg);
}

.control-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
  transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, margin-bottom 0.35s ease;
  max-height: 2500px;
  overflow: hidden;
}

.control-panel.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.hub-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.hub-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.hub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.hub-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  border: 1px solid var(--border-highlight);
  display: grid;
  place-items: center;
  color: var(--primary);
  flex-shrink: 0;
}

.hub-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.hub-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.hub-desc {
  font-size: 0.88rem;
  color: var(--text-sub);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ==========================================================================
   Buttons & Form Controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-success {
  background: var(--emerald);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: var(--emerald-hover);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-outline-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 9px 16px;
  font-size: 0.85rem;
}

.btn-outline-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-input);
  color: var(--text-main);
}

.w-100 {
  width: 100%;
}

/* ==========================================================================
   Code Display Section (Receive Hub)
   ========================================================================== */
.code-section {
  display: none;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  animation: fadeIn 0.25s ease;
}

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

.code-wrapper {
  text-align: center;
  margin-bottom: 16px;
}

.code-caption {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.code-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.25em;
  padding: 8px 20px 8px 28px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.code-display:hover {
  border-color: var(--primary);
  background: var(--bg-input);
}

.code-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* QR Code Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 14px 0;
}

.qr-frame {
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: inline-block;
  line-height: 0;
}

#qrCodeCanvas {
  display: block;
  border-radius: 4px;
  max-width: 160px;
  height: auto !important;
}

.qr-desc {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 8px;
  font-weight: 500;
}

/* Exclusive Link Box */
.exclusive-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}

.exclusive-link-box input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-sub);
  outline: none;
  transition: border-color var(--transition-fast);
}

.exclusive-link-box input:focus {
  border-color: var(--primary);
}

/* Waiting Radar Indicator */
.waiting-radar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 0.8rem;
  font-weight: 500;
}

.radar-ping {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  position: relative;
}

.radar-ping::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  animation: radarWave 2s ease-out infinite;
}

@keyframes radarWave {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================================================
   Send Hub Styles
   ========================================================================== */
.input-code-group {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.code-input-field {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 5px;
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-fast);
}

.code-input-field:focus {
  border-color: var(--primary);
  background: var(--bg-surface-elevated);
}

.code-input-field::placeholder {
  letter-spacing: 3px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

.send-tips {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.send-tips svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}

/* Connected Peer Badge */
.connected-peer {
  margin-top: 14px;
  padding: 10px 16px;
  background: var(--emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  color: var(--emerald);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  animation: fadeIn 0.25s ease;
}

/* ==========================================================================
   Peer Transfer Active Area (#container & .peer-grid)
   ========================================================================== */
.peer-grid {
  margin-top: 8px;
  display: grid;
  gap: 18px;
}

@keyframes peerCardSlideIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulseSuccessRing {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7), 0 8px 24px -4px rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.9);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0), 0 12px 32px -4px rgba(16, 185, 129, 0.4);
    border-color: rgba(16, 185, 129, 1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0), 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--border-subtle);
  }
}

.peer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: peerCardSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.peer-card.pulse-success,
.progress-card.pulse-success {
  animation: pulseSuccessRing 1.8s ease-out;
}

.peer-card:hover {
  border-color: var(--border-strong);
}

.peer-header {
  padding: 14px 20px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.peer-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

.peer-state {
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  background: var(--emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--emerald);
  white-space: nowrap;
}

.peer-state.state-error {
  background: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger);
}

.peer-body {
  padding: 20px;
}

/* Transfer Controls */
.transfer-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-control:hover,
.form-control:focus {
  border-color: var(--primary);
}

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Progress Cards */
.progress-card {
  margin-top: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--bg-surface-elevated);
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.25s ease;
}

.progress {
  border-radius: var(--radius-full);
  background-color: var(--bg-input);
  height: 12px;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.2s ease;
}

.status-note {
  font-size: 0.82rem;
  color: var(--text-sub);
  font-weight: 500;
}

/* Download Link */
.download-link {
  display: none;
  margin-top: 12px;
  padding: 12px 20px;
  background: var(--emerald);
  color: #ffffff !important;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
  word-break: break-all;
}

.download-link:hover {
  background: var(--emerald-hover);
}

/* Remote Media Stream */
.remote-media {
  margin-top: 12px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--bg-surface-elevated);
}

.remote-media video {
  width: 100%;
  min-height: 140px;
  max-height: 280px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: #000000;
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  font-size: 0.86rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.7s forwards;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
}

.toast-info {
  border-color: var(--border-highlight);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
}

@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* ==========================================================================
   Transfer Confirmation Modal & Mobile Bottom Sheet
   ========================================================================== */
.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 13, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
  box-sizing: border-box;
}

.confirm-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.confirm-modal-dialog {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  transform: scale(0.92) translateY(14px);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .confirm-modal-dialog {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.confirm-modal-backdrop.show .confirm-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Mobile Pull Handle (Hidden on Desktop) */
.confirm-sheet-handle {
  display: none;
}

/* Modal Header */
.confirm-modal-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

[data-theme="light"] .confirm-modal-header {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

.confirm-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.confirm-pulse-icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .confirm-pulse-icon {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.pulse-ring {
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  border: 2px solid rgba(59, 130, 246, 0.4);
  animation: pulseAura 2s infinite ease-out;
}

@keyframes pulseAura {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}

.confirm-modal-title-wrap {
  min-width: 0;
}

.confirm-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confirm-modal-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

[data-theme="light"] .confirm-modal-title {
  color: #0f172a;
}

.confirm-status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  white-space: nowrap;
}

.confirm-modal-subtitle {
  margin: 4px 0 0 0;
  font-size: 0.84rem;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 4px;
}

[data-theme="light"] .confirm-modal-subtitle {
  color: #64748b;
}

.confirm-modal-device {
  font-weight: 600;
  color: var(--primary);
  font-family: var(--font-mono);
  background: rgba(59, 130, 246, 0.1);
  padding: 1px 6px;
  border-radius: 6px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

.confirm-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.confirm-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

[data-theme="light"] .confirm-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Modal Body */
.confirm-modal-body {
  padding: 20px 22px 14px;
}

/* Frosted File Card */
.confirm-file-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .confirm-file-card {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.confirm-file-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.confirm-file-icon-box.type-video {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}
.confirm-file-icon-box.type-audio {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}
.confirm-file-icon-box.type-image {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}
.confirm-file-icon-box.type-archive {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.confirm-file-icon-box.type-doc,
.confirm-file-icon-box.type-generic {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

[data-theme="light"] .confirm-file-icon-box.type-video { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
[data-theme="light"] .confirm-file-icon-box.type-audio { background: rgba(236, 72, 153, 0.12); color: #db2777; }
[data-theme="light"] .confirm-file-icon-box.type-image { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
[data-theme="light"] .confirm-file-icon-box.type-archive { background: rgba(245, 158, 11, 0.12); color: #d97706; }
[data-theme="light"] .confirm-file-icon-box.type-doc,
[data-theme="light"] .confirm-file-icon-box.type-generic { background: rgba(37, 99, 235, 0.1); color: #2563eb; }

.confirm-file-info {
  flex: 1;
  min-width: 0;
}

.confirm-file-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text-main);
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

[data-theme="light"] .confirm-file-name {
  color: #0f172a;
}

.confirm-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.confirm-file-size {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--emerald);
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.confirm-file-type-pill {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 1px 7px;
  border-radius: 6px;
}

[data-theme="light"] .confirm-file-type-pill {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #64748b;
}

/* Security notice banner */
.confirm-modal-warning {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.45;
}

[data-theme="light"] .confirm-modal-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.warning-icon-wrap {
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 2px;
}

.warning-text strong {
  color: #f59e0b;
  font-weight: 600;
}

[data-theme="light"] .warning-text strong {
  color: #b45309;
}

/* Modal Footer */
.confirm-modal-footer {
  padding: 16px 22px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
}

[data-theme="light"] .confirm-modal-footer {
  background: #f8fafc;
  border-top-color: #e2e8f0;
}

.confirm-btn-reject {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-sub);
  padding: 11px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

[data-theme="light"] .confirm-btn-reject {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

.confirm-btn-reject:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.confirm-btn-reject:active {
  transform: scale(0.98);
}

.confirm-btn-accept {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid #10b981;
  color: #ffffff !important;
  padding: 11px 26px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.confirm-btn-accept:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.confirm-btn-accept:active {
  transform: translateY(0) scale(0.98);
}

/* Keyboard hint on Desktop */
.confirm-desktop-hint {
  display: block;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 0 20px 12px;
  background: var(--bg-surface-elevated);
}

[data-theme="light"] .confirm-desktop-hint {
  background: #f8fafc;
}

.confirm-desktop-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .confirm-desktop-hint kbd {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 820px) {
  .control-panel {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 14px 12px 36px;
  }

  .site-header {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
  }

  .device-pill {
    display: none;
  }

  .hero-banner {
    padding: 12px 8px 20px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.86rem;
    margin-bottom: 14px;
  }

  .hub-card {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .hub-header {
    gap: 10px;
  }

  .hub-icon {
    width: 38px;
    height: 38px;
  }

  .hub-title-group h2 {
    font-size: 1.05rem;
  }

  .code-display {
    font-size: 1.8rem;
    letter-spacing: 0.16em;
    padding: 6px 14px 6px 20px;
  }

  .exclusive-link-box {
    flex-direction: column;
    align-items: stretch;
  }

  .input-code-group {
    flex-direction: column;
  }

  .code-input-field {
    font-size: 1.2rem;
    padding: 9px;
  }

  .btn {
    width: 100%;
    padding: 11px 16px;
  }

  .panel-collapse-bar {
    padding: 10px 14px;
    margin-bottom: 14px;
  }

  .collapse-bar-left {
    font-size: 0.8rem;
    gap: 8px;
  }

  .collapse-bar-btn {
    padding: 4px 10px;
    font-size: 0.74rem;
  }

  #toastContainer {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  /* Mobile Bottom-Sheet Ergonomics Optimization */
  .confirm-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .confirm-modal-dialog {
    max-width: 100%;
    width: 100%;
    border-radius: 26px 26px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }

  .confirm-modal-backdrop.show .confirm-modal-dialog {
    transform: translateY(0);
  }

  /* Show the pull bar handle on mobile */
  .confirm-sheet-handle {
    display: block;
    width: 42px;
    height: 5px;
    background: rgba(148, 163, 184, 0.4);
    border-radius: 10px;
    margin: 10px auto 4px;
  }

  .confirm-modal-header {
    padding: 12px 18px 12px;
  }

  .confirm-pulse-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .confirm-modal-title {
    font-size: 1.05rem;
  }

  .confirm-modal-body {
    padding: 16px 18px 12px;
  }

  .confirm-file-card {
    padding: 12px 14px;
    gap: 12px;
  }

  .confirm-file-icon-box {
    width: 44px;
    height: 44px;
  }

  .confirm-file-name {
    font-size: 0.92rem;
  }

  .confirm-modal-warning {
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  /* Mobile ergonomic button bar: side by side, large touch targets */
  .confirm-modal-footer {
    padding: 12px 18px 8px;
    display: flex;
    flex-direction: row;
    gap: 10px;
  }

  .confirm-btn-reject {
    flex: 1;
    min-height: 48px;
    padding: 10px 14px;
    font-size: 0.92rem;
    border-radius: 14px;
  }

  .confirm-btn-accept {
    flex: 1.6;
    min-height: 48px;
    padding: 10px 16px;
    font-size: 0.96rem;
    border-radius: 14px;
  }

  .confirm-desktop-hint {
    display: none;
  }
}

