/* ===== BeforeYouJump Design System v1.0.0 ===== */

/* --- Design Tokens --- */
:root {
  /* Brand Core */
  --brand-primary: #6366f1;
  --brand-primary-hover: #4f46e5;
  --brand-primary-light: #e0e7ff;
  --brand-secondary: #f43f5e;
  --brand-accent: #22d3ee;
  --brand-warm: #fbbf24;

  /* Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Neutrals */
  --neutral-50: #fafafa;
  --neutral-100: #f4f4f5;
  --neutral-200: #e4e4e7;
  --neutral-300: #d4d4d8;
  --neutral-400: #a1a1aa;
  --neutral-500: #71717a;
  --neutral-600: #52525b;
  --neutral-700: #3f3f46;
  --neutral-800: #27272a;
  --neutral-900: #18181b;
  --neutral-950: #09090b;

  /* Spacing */
  --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;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Inter', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;
  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.75rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.125rem);
  --text-xl: clamp(1.25rem, 1.125rem + 0.6vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.375rem + 0.6vw, 1.875rem);
  --text-3xl: clamp(1.875rem, 1.625rem + 1.2vw, 2.5rem);
  --weight-normal: 400;
  --weight-bold: 700;

  /* Z-index */
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-highest: 9999;

  /* Motion */
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
}

/* --- Kid Mode (Default) --- */
[data-mode="kid"] {
  --bg-primary: linear-gradient(135deg, #fef3c7 0%, #fce7f3 50%, #dbeafe 100%);
  --bg-card: rgba(255,255,255,0.98);
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-on-primary: #1e1e2e;
  --border-color: #fcd34d;
  --border-focus: #f59e0b;
  --wordmash-accent: #8b5cf6;
  --slither-accent: #22c55e;
  --alchemy-accent: #f97316;
  --shadow-soft: 0 4px 14px rgba(251,191,36,0.25);
  --shadow-medium: 0 8px 24px rgba(139,92,246,0.3);
  --radius-sm: 12px; --radius-md: 16px; --radius-lg: 24px;
  --radius-card: 20px; --radius-full: 9999px;
  --headline-size: 2rem;
}

/* --- Adult Mode --- */
[data-mode="adult"] {
  --bg-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-card: rgba(30,41,59,0.92);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-on-primary: #f8fafc;
  --border-color: #334155;
  --border-focus: #6366f1;
  --wordmash-accent: #818cf8;
  --slither-accent: #4ade80;
  --alchemy-accent: #fb923c;
  --shadow-soft: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-medium: 0 8px 24px rgba(0,0,0,0.35);
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px;
  --radius-card: 12px; --radius-full: 9999px;
  --headline-size: 2rem;
}

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

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

#app { max-width: 1200px; margin: 0 auto; padding: var(--space-5); }

/* --- Header --- */
header {
  text-align: center;
  color: var(--text-on-primary);
  margin-bottom: var(--space-6);
  padding: var(--space-5);
}
header img { height: 80px; margin-bottom: var(--space-3); border-radius: var(--radius-lg); }
header h1 {
  font-size: var(--headline-size);
  line-height: 1.2;
  min-height: calc(2rem * 1.2);
  margin-bottom: var(--space-2);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
header p { font-size: var(--text-lg); opacity: 0.9; }
.logo-link { display: inline-block; }
.logo-link img { height: 60px; margin-bottom: var(--space-3); border-radius: var(--radius-md); }

/* --- Game Navigation (Tab Bar) --- */
.game-nav {
  display: flex; justify-content: center; gap: var(--space-2);
  margin-bottom: var(--space-5); padding: 0 var(--space-5); flex-wrap: wrap;
}
.game-nav a {
  color: var(--text-on-primary); text-decoration: none;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.2);
  transition: all var(--duration-normal) ease;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}
.game-nav a:hover { background: rgba(255,255,255,0.3); transform: translateY(-1px); }
.game-nav a.active { background: white; color: var(--brand-primary); }

/* --- Game Card Sections --- */
.section {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  margin: 0 auto var(--space-6);
  max-width: 800px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.section h2 { margin-bottom: var(--space-4); color: var(--brand-primary); font-size: var(--text-2xl); }
.hidden { display: none !important; }
.game-content-hidden { display: none !important; }
.section:not(.hidden) { animation: fadeIn 0.5s ease-in; }

/* --- Keyframes --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* --- Landing Page Game Cards --- */
.game-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-5); max-width: 900px; margin: 0 auto; padding: var(--space-5);
}
.game-card {
  background: var(--bg-card); border-radius: var(--radius-card);
  padding: var(--space-8); text-decoration: none; color: var(--text-primary);
  text-align: center; box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 2px solid transparent;
}
.game-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-medium); }
.card-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.game-card h2 { color: var(--brand-primary); margin-bottom: var(--space-3); }
.game-card p { color: var(--text-secondary); margin-bottom: var(--space-4); }
.card-meta {
  display: inline-block; background: var(--brand-primary);
  color: white; padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full); font-size: var(--text-xs);
}

/* --- Word Grid --- */
.word-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2); margin: var(--space-4) auto; max-width: 380px;
}
.word-grid .cell {
  padding: 14px 8px; border: 2px solid var(--neutral-300);
  border-radius: var(--radius-sm); text-align: center;
  font-size: var(--text-xl); font-weight: var(--weight-bold);
  cursor: pointer; user-select: none; transition: all var(--duration-fast) ease;
  background: var(--bg-card); color: var(--text-primary);
  min-height: 48px; display: flex; align-items: center; justify-content: center;
}
.word-grid .cell:hover { border-color: var(--brand-primary); background: var(--brand-primary-light); }
.word-grid .cell.selected {
  background: var(--brand-primary); color: white;
  border-color: var(--brand-primary); transform: scale(1.05);
}
.word-grid .cell.highlight { background: var(--brand-primary-light); border-color: var(--brand-primary); opacity: 0.6; }

/* --- Controls --- */
.controls { display: flex; gap: var(--space-3); margin: var(--space-4) 0; justify-content: center; }
.controls input {
  padding: var(--space-3) var(--space-4); border: 2px solid var(--neutral-300);
  border-radius: var(--radius-md); font-size: var(--text-base);
  flex: 1; max-width: 250px; background: var(--bg-card); color: var(--text-primary);
}
.controls input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-light); }
.controls button, .btn-primary {
  padding: var(--space-3) var(--space-6); background: var(--brand-primary);
  color: white; border: none; border-radius: var(--radius-md);
  font-size: var(--text-base); cursor: pointer;
  transition: background var(--duration-fast) ease, transform var(--duration-fast) ease;
  font-weight: var(--weight-bold); min-width: 80px;
}
.controls button:hover { background: var(--brand-primary-hover); transform: translateY(-1px); }
.controls button:disabled { background: var(--neutral-400); cursor: not-allowed; transform: none; }

/* --- Mobile Controls (Slither-Pop D-pad) --- */
.mobile-controls {
  display: none; flex-direction: column; align-items: center;
  gap: var(--space-1); margin: var(--space-4) 0;
}
.ctrl-row { display: flex; gap: var(--space-1); }
.ctrl-btn {
  width: 60px; height: 60px; border: 2px solid var(--brand-primary);
  background: var(--bg-card); color: var(--brand-primary);
  border-radius: var(--radius-md); font-size: var(--text-xl);
  cursor: pointer; transition: all var(--duration-fast) ease;
  display: flex; align-items: center; justify-content: center;
}
.ctrl-btn:active { background: var(--brand-primary); color: white; transform: scale(0.95); }
/* Show D-pad on mobile/touch */
@media (hover: none) and (pointer: coarse) {
  .mobile-controls { display: flex; }
  .keyboard-hint { display: none !important; }
}

/* --- Stats --- */
.stats {
  display: flex; justify-content: center; gap: var(--space-6);
  margin: var(--space-4) 0; flex-wrap: wrap;
}
.stats span { font-size: var(--text-base); }
.stats strong { color: var(--brand-primary); }

/* --- Game Rules (persistent during play) --- */
.game-rules {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--neutral-100);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
[data-mode="kid"] .game-rules strong {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  font-size: var(--text-sm);
}
[data-mode="kid"] .rules-list li strong {
  color: var(--text-primary) !important;
}
[data-mode="adult"] .game-rules {
  background: rgba(51, 65, 85, 0.5) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(71, 85, 105, 0.5) !important;
}
[data-mode="adult"] .game-rules strong {
  display: block !important;
  margin-bottom: var(--space-2);
  color: #f1f5f9 !important;
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
}
[data-mode="adult"] .rules-list li strong {
  color: #e2e8f0 !important;
}
.rules-list {
  margin: 0;
  padding-left: var(--space-4);
  list-style: disc;
}
.rules-list li {
  margin-bottom: var(--space-1);
  line-height: 1.5;
  font-size: var(--text-xs);
}

/* --- Found Words --- */

/* --- Emoji Guess clue --- */
.emoji-clue-box {
  text-align: center;
  margin: var(--space-3) auto;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 360px;
}
.puzzle-num {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.emoji-clue {
  font-size: 3rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  min-height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
}
.clue-hint {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.hint-reveal {
  margin-top: var(--space-2);
  min-height: 1.6rem;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: 0.35em;
  color: var(--brand-primary);
}
.hint-btn {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 2px solid var(--brand-primary);
  color: var(--brand-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}
.hint-btn:hover:not(:disabled) { background: var(--brand-primary); color: #fff; }
.hint-btn:disabled { opacity: 0.5; cursor: default; }
.found-words { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--neutral-200); }
.found-words h3 { margin-bottom: var(--space-2); font-size: var(--text-sm); }
#found-list { color: var(--text-secondary); font-size: var(--text-sm); }
.found-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.found-chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3); background: var(--brand-primary-light);
  color: var(--brand-primary); border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--weight-bold);
}

/* --- Canvas --- */
#sp-canvas {
  display: block; margin: 0 auto; border: 2px solid var(--neutral-700);
  border-radius: var(--radius-md); background: #fafafa;
  max-width: 100%; height: auto;
}

/* --- Alchemy Elements Grid --- */
.elements-grid {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin: var(--space-4) 0; justify-content: center; max-height: 400px;
  overflow-y: auto;
}
.elements-grid button {
  padding: var(--space-2) var(--space-4); border: 2px solid var(--neutral-300);
  border-radius: var(--radius-full); background: var(--bg-card);
  cursor: pointer; font-size: var(--text-sm); color: var(--text-primary);
  transition: all var(--duration-fast) ease;
  min-height: 40px; min-width: 70px;
}
.elements-grid button:hover { border-color: var(--brand-primary); background: var(--brand-primary-light); }
.elements-grid button.first-selected {
  background: var(--brand-primary); color: white; border-color: var(--brand-primary);
  transform: scale(1.05); box-shadow: 0 0 12px rgba(99,102,241,0.4);
}
.elements-grid button.new-discovery {
  animation: popIn 0.5s ease;
  border-color: var(--success); background: var(--brand-primary-light);
}

/* --- Combination Area --- */
.combination-area {
  text-align: center; margin: var(--space-4) 0;
  padding: var(--space-4); background: var(--neutral-100);
  border-radius: var(--radius-md);
}
.combination-area p { margin-bottom: var(--space-2); color: var(--text-secondary); }
.selected-slots {
  display: flex; justify-content: center; align-items: center;
  gap: var(--space-2); font-size: var(--text-lg);
}
.selected-slots .slot {
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  background: var(--bg-card); border: 2px solid var(--neutral-300);
  min-width: 60px; text-align: center; color: var(--text-primary);
}
.selected-slots .slot.empty { color: var(--neutral-400); }
.selected-slots .slot.filled { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.selected-slots .slot.plus { border: none; background: none; font-weight: var(--weight-bold); color: var(--brand-primary); }

/* --- Discovered Elements --- */
.discovered-section { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--neutral-200); }
.discovered-section h3 { margin-bottom: var(--space-3); }
.discovered-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.discovered-grid .element-tag {
  padding: var(--space-1) var(--space-3); background: var(--brand-primary-light);
  border-radius: var(--radius-full); font-size: var(--text-xs);
  color: var(--brand-primary); font-weight: var(--weight-bold);
}

/* --- Progress --- */
.progress { text-align: center; margin-bottom: var(--space-4); font-size: var(--text-lg); }
.progress-ring {
  width: 80px; height: 80px; margin: var(--space-3) auto;
  position: relative;
}
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring span {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-sm); font-weight: var(--weight-bold);
  color: var(--brand-primary);
}

/* --- Timer Visual --- */
.timer-bar {
  width: 100%; height: 6px; background: var(--neutral-200);
  border-radius: var(--radius-full); overflow: hidden; margin: var(--space-2) 0;
}
.timer-bar-fill {
  height: 100%; background: var(--brand-primary);
  border-radius: var(--radius-full); transition: width 1s linear, background 0.3s ease;
}
.timer-bar-fill.warning { background: var(--warning); }
.timer-bar-fill.danger { background: var(--error); }

/* --- Game Over Overlay --- */
.game-over {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); display: flex; align-items: center;
  justify-content: center; z-index: var(--z-modal);
  animation: fadeIn 0.3s ease;
}
.game-over-content {
  background: var(--bg-card); padding: var(--space-8);
  border-radius: var(--radius-lg); text-align: center;
  max-width: 420px; width: 90%; box-shadow: var(--shadow-medium);
  animation: popIn 0.3s ease;
}
.game-over-content h2 { color: var(--brand-primary); margin-bottom: var(--space-4); font-size: var(--text-2xl); }
.game-over-content p { margin-bottom: var(--space-5); font-size: var(--text-lg); color: var(--text-primary); }
.game-over-content .stats-summary {
  display: flex; justify-content: center; gap: var(--space-6);
  margin-bottom: var(--space-5); flex-wrap: wrap;
}
.game-over-content .stat-item { text-align: center; }
.game-over-content .stat-item .stat-value {
  font-size: var(--text-3xl); font-weight: var(--weight-bold);
  color: var(--brand-primary);
}
.game-over-content .stat-item .stat-label {
  font-size: var(--text-xs); color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.game-over-content button {
  padding: var(--space-3) var(--space-6); background: var(--brand-primary);
  color: white; border: none; border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: var(--weight-bold);
  cursor: pointer; margin: var(--space-1); min-width: 120px;
  transition: background var(--duration-fast) ease, transform var(--duration-fast) ease;
}
.game-over-content button:hover { background: var(--brand-primary-hover); transform: translateY(-2px); }
.game-over-content button.btn-secondary { background: var(--neutral-500); }
.game-over-content button.btn-secondary:hover { background: var(--neutral-600); }
.game-over-content button.btn-success { background: var(--success); }
.game-over-content button.btn-success:hover { background: #16a34a; }

/* --- Start Screen --- */
.start-screen {
  text-align: center; padding: var(--space-8); max-width: 400px; margin: 0 auto;
}
.start-screen h2 { font-size: var(--text-3xl); margin-bottom: var(--space-4); }
.start-screen .game-icon { font-size: 4rem; margin-bottom: var(--space-4); }
.start-screen p { color: var(--text-secondary); margin-bottom: var(--space-3); font-size: var(--text-lg); }
.start-screen .controls-info {
  background: var(--neutral-100); border-radius: var(--radius-md);
  padding: var(--space-4); margin: var(--space-4) 0; text-align: left;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.start-screen .controls-info li { margin: var(--space-1) 0; list-style: none; }

/* --- Start Screen: Adult Mode --- */
[data-mode="adult"] .start-screen .controls-info {
  background: rgba(51, 65, 85, 0.6) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(71, 85, 105, 0.5);
}
[data-mode="adult"] .start-screen .controls-info li {
  color: #e2e8f0 !important;
}
[data-mode="adult"] .start-screen p {
  color: #94a3b8 !important;
}
.start-screen .btn-big {
  display: block; width: 100%; padding: var(--space-4);
  background: var(--brand-primary); color: white; border: none;
  border-radius: var(--radius-lg); font-size: var(--text-xl);
  font-weight: var(--weight-bold); cursor: pointer;
  transition: transform var(--duration-fast) ease, background var(--duration-fast) ease;
  margin-top: var(--space-5);
}
.start-screen .btn-big:hover { background: var(--brand-primary-hover); transform: scale(1.02); }
.start-screen .btn-big:active { transform: scale(0.98); }

/* --- Mode Toggle --- */
.mode-toggle {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
  background: var(--bg-card); border: 2px solid var(--border-color);
  color: var(--text-primary); font-size: var(--text-xs);
  cursor: pointer; transition: all var(--duration-fast) ease;
  margin-left: var(--space-2);
}
.mode-toggle:hover { border-color: var(--brand-primary); transform: translateY(-1px); }
.mode-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-primary-light); }

/* --- Toast Notifications --- */
.toast {
  position: fixed; bottom: var(--space-8); left: 50%;
  transform: translateX(-50%); background: var(--neutral-800);
  color: white; padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full); font-size: var(--text-sm);
  z-index: var(--z-toast); animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-medium); pointer-events: none;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.info { background: var(--info); }

/* --- Share Section --- */
.share-section { text-align: center; margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--neutral-200); }
.share-btn {
  padding: var(--space-3) var(--space-6); background: var(--success);
  color: white; border: none; border-radius: var(--radius-full);
  font-size: var(--text-base); font-weight: var(--weight-bold);
  cursor: pointer; transition: background var(--duration-fast) ease, transform var(--duration-fast) ease;
}
.share-btn:hover { background: #16a34a; transform: translateY(-1px); }
#share-msg { display: inline-block; margin-left: var(--space-2); color: var(--success); font-size: var(--text-sm); }

/* --- Search / Filter --- */
.search-bar {
  width: 100%; padding: var(--space-2) var(--space-4);
  border: 2px solid var(--neutral-300); border-radius: var(--radius-full);
  font-size: var(--text-sm); margin-bottom: var(--space-3);
  background: var(--bg-card); color: var(--text-primary);
}
.search-bar:focus { outline: none; border-color: var(--brand-primary); }

/* --- Footer --- */
footer {
  text-align: center; color: var(--text-on-primary);
  padding: var(--space-5); margin-top: var(--space-5); opacity: 0.8;
}
footer a { color: var(--text-on-primary); text-decoration: underline; }

/* --- Focus --- */
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-primary-light); }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; transition-duration: 0.01ms !important;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .section { padding: var(--space-4); margin: 0 var(--space-2) var(--space-4); }
  .word-grid { max-width: 280px; gap: var(--space-1); }
  .word-grid .cell { padding: 10px 6px; font-size: var(--text-lg); min-height: 42px; }
  .controls { flex-direction: column; align-items: center; }
  .controls input { max-width: 100%; width: 100%; }
  .controls button { width: 100%; }
  .stats { gap: var(--space-4); }
  .game-cards { grid-template-columns: 1fr; padding: var(--space-2); }
  .game-nav a { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
  #sp-canvas { width: 100%; }
  .elements-grid button { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); min-width: 60px; }
}

@media (max-width: 480px) {
  .section { padding: var(--space-3); }
  .word-grid .cell { padding: 8px 4px; font-size: var(--text-base); min-height: 38px; }
  .word-grid { max-width: 240px; }
  header img { height: 60px; }
  .ctrl-btn { width: 52px; height: 52px; font-size: var(--text-lg); }
  .game-over-content { padding: var(--space-5); }
}