:root {
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-soft: #eef7ff;
  --text: #18324a;
  --muted: #56708a;
  --primary: #78b7ff;
  --primary-strong: #2f7dd1;
  --mint: #a9ead2;
  --purple: #d8c7ff;
  --yellow: #ffe39b;
  --danger: #c83e4d;
  --success: #207f5f;
  --focus: #ffb703;
  --shadow: 0 16px 40px rgba(45, 88, 128, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-scale: 1;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: calc(16px * var(--font-scale));
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(169, 234, 210, 0.55), transparent 28rem),
    radial-gradient(circle at top right, rgba(216, 199, 255, 0.5), transparent 28rem),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.dark-mode {
  --bg: #132032;
  --surface: #1e2d42;
  --surface-soft: #24384f;
  --text: #f2f6fb;
  --muted: #c6d4e2;
  --primary: #7dbdff;
  --primary-strong: #a8d3ff;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

body.high-contrast {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f2f2f2;
  --text: #000000;
  --muted: #111111;
  --primary: #005fcc;
  --primary-strong: #003f88;
  --mint: #ffffff;
  --purple: #ffffff;
  --yellow: #ffffff;
  --focus: #ffcc00;
}

body.high-contrast.dark-mode {
  --bg: #000000;
  --surface: #111111;
  --surface-soft: #222222;
  --text: #ffffff;
  --muted: #ffffff;
  --primary: #80c7ff;
  --primary-strong: #ffffff;
}

body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

button, input, [role='button'] { font: inherit; }
button { cursor: pointer; }

button:focus-visible, input:focus-visible, [tabindex]:focus-visible, .game-card:focus-visible {
  outline: 5px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--text);
  color: var(--surface);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  z-index: 1000;
}
.skip-link:focus { top: 16px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 56px) 12px;
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 2rem;
  animation: softBounce 3s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-strong);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82em;
}

h1, h2, h3 { line-height: 1.12; margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 3rem); font-weight: 900; }
h2 { font-size: clamp(1.5rem, 3vw, 2.4rem); font-weight: 900; }
h3 { font-size: 1.35rem; font-weight: 900; }

.main-layout { width: min(1180px, calc(100% - 32px)); margin: 16px auto 48px; }
.view { display: none; }
.view.active { display: block; }

@keyframes softBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 720px) {
  .app-header { align-items: flex-start; }
  .brand-icon { width: 56px; height: 56px; }
}
