/* ═══════════════════════════════════════════════════════
   ClipSync — Design System & Styles
   ═══════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);

  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.2);
  --danger: #f87171;
  --danger-glow: rgba(248, 113, 113, 0.2);
  --warning: #fbbf24;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px var(--accent-glow);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-glass: rgba(0, 0, 0, 0.03);
  --border-glass: rgba(0, 0, 0, 0.1);
  --border-focus: rgba(79, 70, 229, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #4f46e5;
  --accent-light: #6366f1;
  --accent-glow: rgba(79, 70, 229, 0.2);
  --accent-gradient: linear-gradient(135deg, #4f46e5, #7c3aed, #9333ea);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
}

[data-theme="light"] .bg-noise {
  opacity: 0.05;
  filter: invert(1);
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
}

[data-theme="light"] .btn-secondary:hover {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.15);
}

[data-theme="light"] #main-header {
  background: rgba(248, 250, 252, 0.7);
}

[data-theme="light"] .clip-textarea {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .code-input {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .history-item {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .session-id-label {
  background: rgba(0, 0, 0, 0.05);
}

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

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

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

/* ── Animated Background ── */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(52, 211, 153, 0.05) 0%, transparent 70%);
  animation: bgShift 15s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0%   { transform: scale(1) translate(0, 0); }
  50%  { transform: scale(1.08) translate(-2%, 3%); }
  100% { transform: scale(1) translate(2%, -2%); }
}

.bg-noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Header ── */
#main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  backdrop-filter: blur(16px) saturate(1.5);
  background: rgba(10, 14, 26, 0.7);
  border-bottom: 1px solid var(--border-glass);
}

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

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-light);
}

.logo-text {
  font-weight: 700;
  font-size: 1.2rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.offline { background: var(--text-muted); }
.status-dot.online  { background: var(--success); box-shadow: 0 0 8px var(--success-glow); animation: pulse-dot 2s ease-in-out infinite; }
.status-dot.connecting { background: var(--warning); animation: pulse-dot 1s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.7; }
}

/* ── Screens ── */
.screen {
  position: relative;
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 100px 24px 60px;
  animation: fadeUp 0.45s ease-out;
}

.screen.active { display: flex; }

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

/* ── Landing / Hero ── */
.hero {
  text-align: center;
  max-width: 640px;
  margin-bottom: 64px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  margin-bottom: 28px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 500px;
  margin: 0 auto 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Feature Cards ── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 720px;
  width: 100%;
}

.feature-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  text-align: center;
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 10px 22px;
  font-size: 0.88rem;
}
.btn-ghost:hover { background: rgba(99, 102, 241, 0.08); }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost-sm:hover { background: rgba(99, 102, 241, 0.1); }

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 12px var(--accent-glow);
  margin-bottom: 5px;
}
.btn-primary-sm svg { width: 15px; height: 15px; }
.btn-primary-sm:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.25);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger-sm:hover { background: rgba(248, 113, 113, 0.08); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 24px;
  align-self: flex-start;
  max-width: 500px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  transition: var(--transition);
}
.btn-back svg { width: 18px; height: 18px; }
.btn-back:hover { color: var(--text-primary); }

.full-w { width: 100%; justify-content: center; }

/* ── Glass Card ── */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ── Session Card (Create & Join) ── */
.session-card {
  max-width: 460px;
  width: 100%;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.card-header {
  text-align: center;
}

.card-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-header p {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* ── Code Display (Create) ── */
.code-display {
  display: flex;
  gap: 10px;
}

.code-char {
  width: 52px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  animation: charPop 0.35s ease-out both;
}

.code-char:nth-child(1) { animation-delay: 0.05s; }
.code-char:nth-child(2) { animation-delay: 0.10s; }
.code-char:nth-child(3) { animation-delay: 0.15s; }
.code-char:nth-child(4) { animation-delay: 0.20s; }
.code-char:nth-child(5) { animation-delay: 0.25s; }
.code-char:nth-child(6) { animation-delay: 0.30s; }

@keyframes charPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Timer ── */
.timer-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}

.timer-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 100px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent-gradient);
  border-radius: 100px;
  transition: width 1s linear;
}

.timer-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

/* ── Waiting Indicator ── */
.waiting-indicator {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.pulse-ring {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulseRing 1.8s ease-out infinite;
}

@keyframes pulseRing {
  0%   { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* ── QR Reader Overrides ── */
#qr-reader {
  border: none !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(0, 0, 0, 0.2);
}
[data-theme="light"] #qr-reader { background: rgba(255, 255, 255, 0.4); }

#qr-reader a, #qr-reader button {
  display: inline-block !important;
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-glass) !important;
  padding: 8px 16px !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: var(--transition) !important;
  margin: 6px !important;
  text-decoration: none !important;
}

#qr-reader a:hover, #qr-reader button:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1px) !important;
}

#qr-reader span {
  display: none !important; /* Hides the " | " separator html5-qrcode adds between the links */
}

#qr-reader select, #qr-reader input[type="file"] {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-glass) !important;
  padding: 8px 12px !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
  font-size: 0.85rem !important;
  margin: 6px !important;
  outline: none !important;
}
#qr-reader select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-glow) !important;
}

/* ── Code Input (Join) ── */
.code-input-group {
  display: flex;
  gap: 10px;
}

.code-input {
  width: 52px;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-sm);
  outline: none;
  caret-color: var(--accent);
  transition: var(--transition);
  text-transform: uppercase;
}

.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(99, 102, 241, 0.06);
}

.code-input.filled {
  border-color: var(--accent-light);
  color: var(--accent-light);
}

.join-error {
  font-size: 0.85rem;
  color: var(--danger);
  min-height: 20px;
  text-align: center;
}

/* ── Clipboard Screen ── */
.clipboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 900px;
  margin-bottom: 24px;
}

.connection-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.session-id-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 400;
}

/* ── Chat Interface ── */
.chat-interface {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  height: 65vh;
  min-height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  background: var(--bg-card);
}

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

.chat-history::-webkit-scrollbar { width: 6px; }
.chat-history::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 100px; }

.chat-empty {
  margin: auto;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.25s ease-out;
}

.chat-bubble.sent {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.chat-bubble.received {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

[data-theme="light"] .chat-bubble.received {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-end;
  margin-top: 4px;
}

.chat-bubble .time {
  font-size: 0.7rem;
  opacity: 0.7;
}

.msg-status {
  font-size: 0.7rem;
  opacity: 0.8;
}

.msg-status[data-status="pending"] { opacity: 0.6; }
.msg-status[data-status="sent"] { opacity: 0.75; }
.msg-status[data-status="delivered"] { opacity: 0.9; }
.msg-status[data-status="seen"] { opacity: 1; }
.msg-status[data-status="failed"] { color: var(--danger); opacity: 1; }

/* Chat Input Area */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-glass);
}

[data-theme="light"] .chat-input-area {
  background: rgba(255, 255, 255, 0.6);
}

.chat-input-area textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-primary);
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 42px;
  line-height: 1.4;
  transition: var(--transition);
}

[data-theme="light"] .chat-input-area textarea {
  background: #ffffff;
  color: #000;
}

.chat-input-area textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  margin-bottom: 2px;
}

.btn-icon:hover {
  color: var(--accent-light);
  background: rgba(255, 255, 255, 0.08);
}

.btn-icon svg { width: 22px; height: 22px; }

/* File Attachment Display */
.file-attachment {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.2);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
}

[data-theme="light"] .chat-bubble.received .file-attachment {
  background: rgba(0,0,0,0.05);
}

.chat-bubble.sent .file-attachment {
  background: rgba(0,0,0,0.15);
}

.file-attachment-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 200px;
}

.file-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  opacity: 0.8;
}

.file-download {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: var(--transition);
}

.file-download:hover {
  background: rgba(255,255,255,0.2);
}

/* ── Recording Bar ── */
.recording-bar {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(248, 113, 113, 0.3);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

[data-theme="light"] .recording-bar {
  background: rgba(255, 255, 255, 0.85);
}

.chat-input-area {
  position: relative;
}

.recording-bar.active {
  display: flex;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f87171;
  animation: recPulse 1s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.rec-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f87171;
}

.rec-timer {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

.recording-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-cancel {
  color: var(--text-secondary) !important;
}
.rec-cancel:hover {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.1) !important;
}

.rec-send {
  color: var(--success) !important;
}
.rec-send:hover {
  color: #34d399 !important;
  background: rgba(52, 211, 153, 0.1) !important;
}

/* ── Voice Note Player ── */
.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  min-width: 200px;
}

.voice-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.chat-bubble.sent .voice-play-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.chat-bubble.sent .voice-play-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-bubble.received .voice-play-btn {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
}
.chat-bubble.received .voice-play-btn:hover {
  background: rgba(99, 102, 241, 0.25);
}

.voice-play-btn svg { width: 16px; height: 16px; }

.voice-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.voice-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: 100px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.chat-bubble.sent .voice-progress-bar {
  background: rgba(255, 255, 255, 0.2);
}
.chat-bubble.received .voice-progress-bar {
  background: rgba(99, 102, 241, 0.12);
}

.voice-progress-fill {
  height: 100%;
  border-radius: 100px;
  width: 0%;
  transition: width 0.1s linear;
}

.chat-bubble.sent .voice-progress-fill {
  background: rgba(255, 255, 255, 0.7);
}
.chat-bubble.received .voice-progress-fill {
  background: var(--accent-light);
}

.voice-duration {
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  align-self: flex-end;
}

.voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}

.voice-waveform-bar {
  width: 3px;
  border-radius: 100px;
  min-height: 3px;
}

.chat-bubble.sent .voice-waveform-bar { background: rgba(255, 255, 255, 0.4); }
.chat-bubble.received .voice-waveform-bar { background: rgba(99, 102, 241, 0.3); }

.chat-image {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 6px;
  max-height: 250px;
  object-fit: contain;
  cursor: zoom-in;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-image:hover {
  opacity: 0.88;
  transform: scale(1.02);
}

/* ── Image Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-content {
  max-width: min(90vw, 1000px);
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.lightbox.open .lightbox-image {
  transform: scale(1);
  opacity: 1;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.18s ease;
  z-index: 10001;
}

.lightbox-close svg { width: 20px; height: 20px; }

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.1);
}

.lightbox-download {
  position: fixed;
  top: 20px;
  right: 76px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease;
  z-index: 10001;
}

.lightbox-download svg { width: 15px; height: 15px; }

.lightbox-download:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-label {
  margin-top: 16px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
  max-width: 60ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Remove old history item specific overrides */
.history-item .direction {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.history-item .direction.sent {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
}

.history-item .direction.received {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.history-item .preview {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  color: var(--text-primary);
  animation: slideIn 0.35s ease-out;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

.toast.fade-out { animation: slideOut 0.3s ease-in forwards; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ── Logo as Link ── */
.logo {
  text-decoration: none;
  color: inherit;
}

/* ── Link Display (Host Screen) ── */
.link-display {
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.15);
  text-align: center;
  overflow-x: auto;
}

.link-url {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-light);
  word-break: break-all;
  user-select: all;
  letter-spacing: 0.01em;
}

.link-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.link-actions .btn {
  flex: 1;
  justify-content: center;
}

.code-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.code-label {
  color: var(--text-muted);
}

.code-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-light);
  letter-spacing: 0.12em;
  background: rgba(99, 102, 241, 0.08);
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

/* ── Connecting Screen ── */
.connecting-card {
  text-align: center;
}

.connecting-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.connecting-sub {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.connecting-sub strong {
  color: var(--accent-light);
  letter-spacing: 0.1em;
}

.big-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent-light);
  animation: spinnerRotate 0.9s linear infinite;
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .clipboard-container {
    grid-template-columns: 1fr;
  }

  .sync-indicator {
    padding-top: 0;
  }

  .sync-arrows svg {
    transform: rotate(90deg);
  }

  @keyframes spin {
    from { transform: rotate(90deg); }
    to   { transform: rotate(450deg); }
  }

  .session-card {
    padding: 28px 22px;
  }

  .code-display, .code-input-group {
    gap: 6px;
  }

  .code-char, .code-input {
    width: 44px;
    height: 56px;
    font-size: 1.3rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-sub {
    font-size: 0.95rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    justify-content: center;
  }

  #main-header {
    padding: 12px 18px;
  }
}

@media (max-width: 400px) {
  .code-char, .code-input {
    width: 38px;
    height: 50px;
    font-size: 1.1rem;
  }

  .features {
    grid-template-columns: 1fr;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ── Selection ── */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════
   SEO / GEO — New Landing Page Sections
   ═══════════════════════════════════════════════════════ */

/* ── Shared Section Styles ── */
.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto 48px;
  line-height: 1.6;
}

/* ── How It Works ── */
.how-it-works {
  width: 100%;
  max-width: 900px;
  padding: 72px 0 48px;
}

.steps-grid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

.step-card {
  flex: 1;
  max-width: 260px;
  text-align: center;
  padding: 32px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  position: relative;
  transition: var(--transition);
}

.step-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-glow);
}

.step-number {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-light);
  opacity: 0.6;
  margin-bottom: 16px;
}

.step-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.step-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent-light);
}

.step-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.step-connector {
  display: flex;
  align-items: center;
  padding-top: 60px;
  flex-shrink: 0;
}

.step-connector svg {
  width: 36px;
  height: 24px;
  color: var(--text-muted);
  opacity: 0.4;
}

/* ── Comparison Section ── */
.comparison-section {
  width: 100%;
  max-width: 760px;
  padding: 48px 0;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.comparison-card {
  padding: 32px 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
}

.comparison-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-glass);
}

.comparison-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comparison-card li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.comparison-x {
  color: var(--danger);
  font-weight: 700;
  flex-shrink: 0;
  font-size: 1rem;
}

.comparison-check {
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  font-size: 1rem;
}

.comparison-card--them {
  opacity: 0.7;
}

.comparison-card--us {
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 32px rgba(99, 102, 241, 0.08);
}

/* ── FAQ Section ── */
.faq-section {
  width: 100%;
  max-width: 700px;
  padding: 48px 0;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.faq-item[open] {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.06);
}

.faq-question {
  padding: 20px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
  transition: color var(--transition);
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-left: 16px;
}

.faq-item[open] .faq-question::after {
  content: '−';
  color: var(--accent-light);
}

.faq-question:hover {
  color: var(--accent-light);
}

.faq-answer {
  padding: 0 24px 20px;
  animation: faqSlide 0.3s ease-out;
}

.faq-answer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

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

/* ── AdSense Placeholder Slots ── */
.ad-slot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 32px auto;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(99, 102, 241, 0.12);
  background: rgba(99, 102, 241, 0.02);
  position: relative;
  overflow: hidden;
  min-height: 50px;
}

.ad-slot--banner {
  max-width: 728px;
  min-height: 90px;
}

.ad-slot--rectangle {
  max-width: 336px;
  min-height: 280px;
}

.ad-slot__label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.5;
}

/* Hide ad slots when they only contain the placeholder label (no AdSense code yet) */
.ad-slot:not(:has(ins)):not(:has(script)) {
  /* Show with subtle styling as placeholders — remove this rule once ads are live */
}

/* ── Privacy Tools / Affiliate Section ── */
.privacy-tools-section {
  width: 100%;
  max-width: 800px;
  padding: 48px 0;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  cursor: pointer;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-glow);
}

.tool-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

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

.tool-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.tool-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tool-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: var(--transition);
}

.tool-card:hover .tool-arrow {
  color: var(--accent-light);
  transform: translateX(4px);
}

/* ── Footer ── */
.site-footer {
  width: 100%;
  max-width: 900px;
  padding: 48px 0 32px;
  margin-top: 32px;
  border-top: 1px solid var(--border-glass);
}

.footer-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1rem;
}

.footer-brand img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.5;
}

.footer-bottom {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Responsive — New Sections ── */
@media (max-width: 768px) {
  .steps-grid {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .step-connector {
    padding-top: 0;
    transform: rotate(90deg);
  }

  .step-card {
    max-width: 100%;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .ad-slot--banner {
    min-height: 60px;
  }

  .ad-slot--rectangle {
    max-width: 100%;
  }

  .section-subtitle {
    margin-bottom: 36px;
  }
}

@media (max-width: 400px) {
  .tool-card {
    padding: 16px 18px;
    gap: 12px;
  }

  .tool-icon {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
}
