/* =============================================================
   ClickerTest – Main Stylesheet
   Architecture: CSS custom properties → base → layout → components
   Theme: dark (default) with light mode via [data-theme="light"]
   ============================================================= */

/* ── 1. CUSTOM PROPERTIES (DESIGN TOKENS) ─────────────────── */
:root {
  /* Accent palette */
  --accent-primary:   #0ea5e9;
  --accent-secondary: #6366f1;
  --accent-cyan:      #22d3ee;
  --accent-glow:      rgba(14, 165, 233, 0.35);
  --accent-glow-lg:   rgba(14, 165, 233, 0.15);

  /* Status colors */
  --color-success:  #22c55e;
  --color-warning:  #f59e0b;
  --color-danger:   #ef4444;
  --color-info:     #0ea5e9;

  /* Typography */
  --font-sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Z-index scale */
  --z-base:    1;
  --z-raised:  10;
  --z-overlay: 100;
  --z-toast:   1000;
  --z-header:  200;
}

/* ── Dark theme tokens (default) ─── */
[data-theme="dark"],
:root {
  --bg-base:       #0f1117;
  --bg-surface:    #161b27;
  --bg-elevated:   #1e2535;
  --bg-overlay:    #252d3d;
  --bg-input:      #1a2030;

  --border-subtle: rgba(255,255,255,0.06);
  --border-base:   rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);

  --text-primary:   #f0f4ff;
  --text-secondary: #94a3b8;
  --text-muted:     #4b5568;
  --text-inverse:   #0f1117;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px var(--accent-glow), 0 0 60px var(--accent-glow-lg);

  --glass-bg:     rgba(22, 27, 39, 0.75);
  --glass-border: rgba(255,255,255,0.08);
}

/* ── Light theme tokens ─── */
[data-theme="light"] {
  --bg-base:       #f8fafc;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f1f5f9;
  --bg-overlay:    #e2e8f0;
  --bg-input:      #ffffff;

  --border-subtle: rgba(0,0,0,0.04);
  --border-base:   rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f8fafc;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 20px rgba(14,165,233,0.25), 0 0 60px rgba(14,165,233,0.10);

  --glass-bg:     rgba(255,255,255,0.80);
  --glass-border: rgba(0,0,0,0.06);
}

/* ── 2. RESET & BASE ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Subtle grid background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: var(--z-base);
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-cyan); }
a:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

button { cursor: pointer; border: none; background: none; font-family: inherit; }
button:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; }

ul[role="list"] { list-style: none; }

/* Accessibility: skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--accent-primary);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: var(--z-toast);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-4); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 3. TYPOGRAPHY UTILITIES ─────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── 4. LAYOUT WRAPPERS ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section {
  padding-block: var(--space-16);
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.section-title svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin-inline: auto;
}

/* ── 5. BROWSER WARNING BANNER ──────────────────────────── */
.browser-warning {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
  font-size: 0.875rem;
  position: sticky;
  top: 64px;
  z-index: var(--z-overlay);
}
.browser-warning svg { flex-shrink: 0; }
.browser-warning span { flex: 1; }
.warning-dismiss {
  padding: var(--space-1);
  color: #f59e0b;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  border-radius: var(--radius-sm);
}
.warning-dismiss:hover { opacity: 1; }

/* ── 6. NAVIGATION ───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  height: 64px;
}

.nav-container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--text-primary); }

.brand-icon { flex-shrink: 0; }

.brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  -webkit-text-fill-color: white;
  margin-top: -8px;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast), background-color var(--transition-fast);
  text-decoration: none;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.nav-link svg { width: 15px; height: 15px; }

/* Nav controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  text-decoration: none;
}
.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[aria-pressed="true"] { color: var(--accent-primary); }

/* ── 7. COMPACT HERO BANNER ──────────────────────────────── */
.hero-banner {
  max-width: 1200px;
  margin-inline: auto;
  padding: var(--space-8) var(--space-6) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.hero-banner-inner {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  flex: 1;
  min-width: 0;
}

.hero-banner-left {
  flex: 1;
  min-width: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  color: var(--accent-primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.hero-badge svg { width: 12px; height: 12px; animation: pulse-ring 2s ease-in-out infinite; }

.hero-banner-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: var(--space-2);
}

.hero-banner-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.hero-banner-sub strong { color: var(--text-primary); }

.hero-banner-stats {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-shrink: 0;
}

.hero-banner-visual {
  flex-shrink: 0;
}

.stat { text-align: center; }
.stat-value {
  display: block;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--accent-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
  white-space: nowrap;
}
.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border-base);
}

/* Tester section sits immediately below banner — reduce top padding */
.tester-section--top {
  padding-top: var(--space-6);
}
.tester-section--top .section-header--compact {
  margin-bottom: var(--space-5);
}

/* Keep illustration styles — used by both old hero and new banner */

.clicker-illustration {
  position: relative;
  width: 160px;
}

.clicker-body {
  width: 80px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 40px 40px 20px 20px;
  margin-inline: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.07);
  position: relative;
  z-index: 2;
}

.clicker-btn {
  border-radius: var(--radius-full);
  background: var(--bg-overlay);
  border: 1px solid var(--border-base);
  transition: all var(--transition-fast);
  cursor: default;
}
.clicker-btn--top    { width: 28px; height: 10px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); border-color: transparent; }
.clicker-btn--up     { width: 36px; height: 18px; }
.clicker-btn--down   { width: 36px; height: 18px; }
.clicker-btn--laser  { width: 12px; height: 12px; background: var(--color-danger); border-color: transparent; border-radius: var(--radius-full); box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.clicker-usb         { width: 14px; height: 8px; background: var(--bg-overlay); border: 1px solid var(--border-base); border-radius: 2px; margin-top: 4px; }

.clicker-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(0.95);
}

/* Signal rings */
.clicker-signal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.signal-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--accent-primary);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: signal-expand 3s ease-out infinite;
}
.ring-1 { width: 120px; height: 120px; animation-delay: 0s; }
.ring-2 { width: 180px; height: 180px; animation-delay: 0.7s; }
.ring-3 { width: 240px; height: 240px; animation-delay: 1.4s; }

@keyframes signal-expand {
  0%   { opacity: 0.6; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1); }
}

/* ── 8. BUTTONS / CONTROLS ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 14px rgba(14,165,233,0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14,165,233,0.45);
  color: white;
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border-base);
}
.btn-ghost:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-base);
}
.btn-outline:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-sm { padding: 7px 14px; font-size: 0.8125rem; }

.btn-tiny {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}
.btn-tiny:hover {
  color: var(--text-primary);
  background: var(--bg-overlay);
  border-color: var(--border-base);
}
.btn-tiny svg { width: 13px; height: 13px; }

/* ── 9. MODE SWITCHER ────────────────────────────────────── */
.mode-switcher {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  width: fit-content;
  margin-inline: auto;
  margin-bottom: var(--space-6);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.mode-btn svg { width: 15px; height: 15px; }
.mode-btn:hover { color: var(--text-secondary); background: var(--bg-elevated); }
.mode-btn.active {
  background: var(--bg-elevated);
  color: var(--accent-primary);
  border-color: rgba(14,165,233,0.25);
  box-shadow: var(--shadow-sm);
}

/* ── 10. PANEL BASE ──────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ── 11. SIMPLE MODE – KEY DISPLAY ───────────────────────── */
.key-display-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xl);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.key-display-card.key-pressed {
  border-color: rgba(14,165,233,0.4);
  box-shadow: var(--shadow-glow);
}

/* Animated gradient border on press */
.key-display-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-cyan));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}
.key-display-card.key-pressed::before { opacity: 1; }

/* Idle state */
.key-display-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  animation: fade-in 0.3s ease;
}

.idle-icon {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.idle-icon svg { width: 32px; height: 32px; }

.idle-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  opacity: 0.3;
  animation: idle-breathe 2.5s ease-in-out infinite;
}

@keyframes idle-breathe {
  0%, 100% { transform: scale(0.9); opacity: 0.2; }
  50%       { transform: scale(1.1); opacity: 0.5; }
}

.idle-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.idle-subtext {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* Active key display */
.key-display-active {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  animation: key-pop 0.2s var(--transition-bounce);
}

@keyframes key-pop {
  0%   { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1);    opacity: 1; }
}

.key-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 80px;
  padding: var(--space-4) var(--space-8);
  background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(99,102,241,0.12));
  border: 2px solid rgba(14,165,233,0.3);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: -0.02em;
  box-shadow: 0 0 30px rgba(14,165,233,0.2);
  word-break: break-all;
  text-align: center;
  animation: glow-pulse 0.5s ease forwards;
}

@keyframes glow-pulse {
  0%   { box-shadow: 0 0 0 rgba(14,165,233,0); }
  50%  { box-shadow: 0 0 40px rgba(14,165,233,0.4); }
  100% { box-shadow: 0 0 20px rgba(14,165,233,0.2); }
}

.key-meta-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  width: 100%;
}

.key-meta-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}
.key-meta-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.key-meta-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-all;
}

/* Modifier chips */
.modifiers-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

.modifier-chip {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid var(--border-base);
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  user-select: none;
}
.modifier-chip[data-active="true"] {
  background: rgba(14,165,233,0.15);
  border-color: rgba(14,165,233,0.4);
  color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(14,165,233,0.2);
}

/* Match badge */
.match-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: var(--color-success);
  font-size: 0.8125rem;
  font-weight: 600;
  animation: fade-in 0.25s ease;
}
.match-badge svg { width: 14px; height: 14px; }

/* Device hint */
.device-hint {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(14,165,233,0.08);
  border: 1px solid rgba(14,165,233,0.18);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  animation: fade-in 0.25s ease;
}
.device-hint svg { width: 13px; height: 13px; color: var(--accent-primary); }

/* ── 12. HISTORY STRIP ───────────────────────────────────── */
.history-section { margin-bottom: var(--space-5); }

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.history-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.history-title svg { width: 15px; height: 15px; }

.history-strip {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-height: 48px;
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  align-items: center;
}

.history-empty {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.8125rem;
  width: 100%;
  justify-content: center;
  padding: var(--space-2);
}
.history-empty svg { width: 14px; height: 14px; }

.history-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-base);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  animation: chip-appear 0.2s var(--transition-bounce);
  flex-shrink: 0;
}
.history-chip.chip-new {
  border-color: rgba(14,165,233,0.35);
  color: var(--accent-primary);
  background: rgba(14,165,233,0.08);
}

@keyframes chip-appear {
  0%   { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── 13. PANEL TOOLBAR ───────────────────────────────────── */
.panel-toolbar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
  padding-top: var(--space-2);
}

/* ── 14. ADVANCED MODE ───────────────────────────────────── */
.advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.adv-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: border-color var(--transition-base);
}
.adv-card.updating {
  border-color: rgba(14,165,233,0.35);
}

.adv-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.adv-card-header svg { width: 16px; height: 16px; color: var(--accent-primary); flex-shrink: 0; }
.adv-card-header h3 { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }

.event-type-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.event-type-badge.keydown {
  background: rgba(14,165,233,0.12);
  color: var(--accent-primary);
  border-color: rgba(14,165,233,0.25);
}
.event-type-badge.keyup {
  background: rgba(99,102,241,0.12);
  color: #818cf8;
  border-color: rgba(99,102,241,0.25);
}

.adv-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.adv-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-4);
}
.adv-field:last-child { border-bottom: none; }

.adv-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}
.adv-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}
.adv-value.highlight { color: var(--accent-primary); }
.adv-value.true  { color: var(--color-success); }
.adv-value.false { color: var(--text-muted); }

/* Duration bar */
.duration-bar-wrap {
  margin-top: var(--space-4);
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.duration-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

/* Combo display */
.combo-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 56px;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.combo-empty { font-size: 0.8125rem; color: var(--text-muted); }

.combo-key {
  padding: 6px 12px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
  box-shadow: 0 2px 0 var(--border-strong), var(--shadow-sm);
  animation: chip-appear 0.15s var(--transition-bounce);
}
.combo-plus {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 700;
}

/* Device match */
.device-match { margin-bottom: var(--space-4); }
.device-match-idle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.device-match-idle svg { width: 15px; height: 15px; flex-shrink: 0; }

.device-match-result {
  padding: var(--space-3);
  background: rgba(14,165,233,0.08);
  border: 1px solid rgba(14,165,233,0.2);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
  text-align: center;
  animation: fade-in 0.3s ease;
}

.confidence-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  justify-content: flex-end;
}
.confidence-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.confidence-bar::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: var(--confidence, 0%);
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}
.confidence-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

/* ── 15. EVENT LOG ───────────────────────────────────────── */
.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.log-filters {
  display: flex;
  gap: var(--space-1);
}
.log-filter-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}
.log-filter-btn:hover { color: var(--text-secondary); }
.log-filter-btn.active {
  background: rgba(14,165,233,0.1);
  color: var(--accent-primary);
  border-color: rgba(14,165,233,0.25);
}

.log-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Toggle input */
.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.toggle-label input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  display: inline-block;
  width: 32px;
  height: 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  position: relative;
  border: 1px solid var(--border-base);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition-fast), background var(--transition-fast);
}
.toggle-label input:checked ~ .toggle-track { background: rgba(14,165,233,0.2); border-color: rgba(14,165,233,0.4); }
.toggle-label input:checked ~ .toggle-track::after { transform: translateX(14px); background: var(--accent-primary); }

.event-log {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xl);
  min-height: 360px;
  max-height: 480px;
  overflow-y: auto;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  scroll-behavior: smooth;
}
.event-log:focus { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* Scrollbar styling */
.event-log::-webkit-scrollbar { width: 6px; }
.event-log::-webkit-scrollbar-track { background: transparent; }
.event-log::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }

.log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 300px;
  color: var(--text-muted);
  text-align: center;
}
.log-empty svg { width: 36px; height: 36px; opacity: 0.4; }
.log-empty p { font-size: 0.875rem; }
.log-empty-sub { font-size: 0.75rem; opacity: 0.7; }

.log-entry {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 5px var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  animation: log-slide-in 0.15s ease;
  line-height: 1.5;
}
.log-entry:hover { background: var(--bg-elevated); }

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

.log-ts {
  color: var(--text-muted);
  font-size: 0.6875rem;
  flex-shrink: 0;
  min-width: 70px;
}
.log-type {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 66px;
  text-align: center;
}
.log-type.keydown { background: rgba(14,165,233,0.15); color: var(--accent-primary); }
.log-type.keyup   { background: rgba(99,102,241,0.15); color: #818cf8; }

.log-key {
  color: var(--text-primary);
  font-weight: 600;
  flex: 1;
}
.log-code { color: var(--text-secondary); font-size: 0.75rem; }
.log-repeat { color: var(--color-warning); font-size: 0.6875rem; padding: 1px 5px; background: rgba(245,158,11,0.1); border-radius: 3px; }
.log-mods   { color: var(--text-muted); font-size: 0.6875rem; }

.log-hidden { display: none; }

.log-stats {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.log-stats span::before { content: ''; }

/* ── 16. BUTTON GRID ─────────────────────────────────────── */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

.btn-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  cursor: default;
  transition: all var(--transition-base);
  overflow: hidden;
  outline: none;
}

.btn-card:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.btn-card.highlighted {
  border-color: rgba(14,165,233,0.5);
  background: rgba(14,165,233,0.06);
  box-shadow: 0 0 25px rgba(14,165,233,0.2);
  transform: scale(1.02);
}
.btn-card.highlighted .btn-card-icon { color: var(--accent-primary); }
.btn-card.highlighted .btn-card-label { color: var(--text-primary); }

.btn-card--laser { opacity: 0.6; }
.btn-card--laser.highlighted { opacity: 1; }

.btn-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: all var(--transition-base);
}
.btn-card-icon svg { width: 22px; height: 22px; }

.btn-card-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.btn-card-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}
.btn-card-keys code {
  padding: 2px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.btn-card-keys .code-note {
  font-style: italic;
  color: var(--text-muted);
  background: none;
  border: none;
}

/* Glow overlay */
.btn-card-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at center, rgba(14,165,233,0.12), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}
.btn-card.highlighted .btn-card-glow { opacity: 1; }

/* Ripple on press */
.btn-card .ripple {
  position: absolute;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  background: rgba(14,165,233,0.25);
  transform: scale(0);
  animation: ripple-expand 0.5s ease-out forwards;
  pointer-events: none;
  margin-left: -50px;
  margin-top: -50px;
}
@keyframes ripple-expand {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(3); opacity: 0; }
}

/* ── 17. COMPATIBILITY TABLE ─────────────────────────────── */
.compat-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-base);
  background: var(--bg-surface);
  margin-bottom: var(--space-4);
}

.compat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 700px;
}

.compat-table thead tr {
  border-bottom: 1px solid var(--border-base);
}
.compat-table thead th {
  padding: var(--space-4) var(--space-4);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
  white-space: nowrap;
}
.compat-table thead th:first-child { text-align: left; }
.compat-table thead th .app-icon { display: inline-block; vertical-align: middle; margin-right: 4px; }
.compat-table thead th svg { width: 14px; height: 14px; display: inline; vertical-align: middle; }

.compat-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}
.compat-table tbody tr:last-child { border-bottom: none; }
.compat-table tbody tr:hover { background: var(--bg-elevated); }
.compat-table tbody tr.detected-key {
  background: rgba(14,165,233,0.05);
}
.compat-table tbody tr.detected-key td:first-child {
  border-left: 3px solid var(--accent-primary);
  padding-left: calc(var(--space-4) - 3px);
}

.compat-table td {
  padding: var(--space-3) var(--space-4);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}
.compat-table td:first-child {
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.compat-cell-match {
  color: var(--color-success);
  font-size: 0.75rem;
  font-weight: 600;
}
.compat-cell-none {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.compat-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.compat-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }

/* ── 18. ABOUT SECTION ───────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.about-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: border-color var(--transition-base), transform var(--transition-base);
}
.about-card:hover {
  border-color: rgba(14,165,233,0.25);
  transform: translateY(-2px);
}

.about-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(14,165,233,0.1);
  color: var(--accent-primary);
  margin-bottom: var(--space-4);
}
.about-card-icon svg { width: 20px; height: 20px; }

.about-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.about-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
}
.about-card p code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent-primary);
}

/* ── 19. FOOTER ──────────────────────────────────────────── */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-base);
  margin-top: var(--space-16);
}

.footer-container {
  max-width: 1200px;
  margin-inline: auto;
  padding: var(--space-12) var(--space-6);
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: var(--space-10);
}

.footer-brand .brand-name {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-3);
}
.footer-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.footer-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}
.footer-col ul li {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.footer-col ul a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}
.footer-col ul a:hover { color: var(--accent-primary); }
.footer-col ul a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.badge-soon {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.compat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-2);
  vertical-align: middle;
}
.compat-dot.green  { background: var(--color-success); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.compat-dot.yellow { background: var(--color-warning); box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.compat-dot.red    { background: var(--color-danger);  box-shadow: 0 0 6px rgba(239,68,68,0.5); }

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-5) var(--space-6);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 1200px;
  margin-inline: auto;
}

/* ── 20. TOAST NOTIFICATIONS ─────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  animation: toast-in 0.3s var(--transition-bounce);
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
}
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success svg { color: var(--color-success); }
.toast.error   svg { color: var(--color-danger); }

.toast.removing {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateY(0)    scale(1);    opacity: 1; }
  to   { transform: translateY(10px) scale(0.95); opacity: 0; }
}

/* ── 21. UTILITY ANIMATIONS ──────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── 22. RESPONSIVE ──────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .hero-banner {
    flex-wrap: wrap;
    padding-block: var(--space-6);
  }
  .hero-banner-inner { gap: var(--space-6); }
  .hero-banner-visual { display: none; }
  .hero-banner-stats  { display: none; }

  .about-grid { grid-template-columns: repeat(2, 1fr); }

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

  .footer-container { grid-template-columns: 1fr; gap: var(--space-8); }
  .footer-links { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile */
@media (max-width: 640px) {
  :root {
    --space-6: 16px;
    --space-8: 24px;
    --space-10: 32px;
    --space-12: 40px;
    --space-16: 48px;
  }

  .nav-links { display: none; }

  .key-meta-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .footer-links { grid-template-columns: 1fr; }

  .hero-banner { padding-block: var(--space-4); }
  .hero-banner-title { font-size: 1.125rem; }
  .hero-banner-sub { display: none; }

  .mode-switcher { width: 100%; }
  .mode-btn { flex: 1; justify-content: center; }

  .panel-toolbar { justify-content: stretch; }
  .panel-toolbar .btn { flex: 1; justify-content: center; }

  .log-toolbar { flex-direction: column; align-items: flex-start; }

  .compat-table-wrap { border-radius: var(--radius-md); }

  .toast-container { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); }
  .toast { min-width: unset; width: 100%; }
}

/* Large screens / TV mode */
@media (min-width: 1600px) {
  .section { max-width: 1400px; }
  body { font-size: 16px; }
}

/* High contrast mode */
@media (forced-colors: active) {
  .key-display-card, .adv-card, .btn-card, .about-card {
    border: 2px solid ButtonText;
  }
  .gradient-text { -webkit-text-fill-color: unset; color: ButtonText; }
}
