:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --bg-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-2: rgba(250, 252, 255, 0.96);
  --text: #162033;
  --muted: #5f6d82;
  --line: rgba(29, 44, 70, 0.08);
  --accent: #4f7cff;
  --accent-2: #ff89b5;
  --accent-3: #57c99a;
  --shadow: 0 18px 40px rgba(32, 48, 76, 0.12);
  --radius: 26px;
  --radius-sm: 18px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(circle at top, rgba(79, 124, 255, 0.08), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 137, 181, 0.08), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, #eef3fb 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #0f1728;
}

.skip-link:focus {
  left: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--line);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 78px;
}

.brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-nav a {
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  background: rgba(79, 124, 255, 0.08);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 0.75rem 1rem;
}

.nav-toggle-lines {
  width: 1rem;
  height: 0.75rem;
  position: relative;
  display: inline-block;
}

.nav-toggle-lines::before,
.nav-toggle-lines::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.nav-toggle-lines::before {
  top: 0;
  box-shadow: 0 0.375rem 0 var(--text);
}

.nav-toggle-lines::after {
  bottom: 0;
}

.section {
  padding: 5.5rem 0;
}

.hero {
  padding-top: 3.5rem;
  padding-bottom: 1.5rem;
}

.hero-grid,
.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.hero-copy h1,
.section-heading h2 {
  margin: 0;
  line-height: 1.08;
}

.hero-copy h1 {
  font-size: clamp(2.7rem, 6vw, 5rem);
  max-width: 10ch;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
}

.lead,
.content-card p,
.info-card p,
.game-copy p,
.hero-card dd,
.timeline-item,
.muted {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-weight: 800;
  border-color: transparent;
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: rgba(79, 124, 255, 0.24);
  background: rgba(79, 124, 255, 0.07);
}

.hero-card,
.content-card,
.info-card,
.game-board-panel,
.game-info {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(252, 253, 255, 0.98));
  box-shadow: var(--shadow);
}

.hero-card,
.content-card,
.game-info {
  padding: 1.5rem;
}

.card-label {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-list {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.profile-list div {
  display: grid;
  gap: 0.25rem;
}

.profile-list dt {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-list dd {
  margin: 0;
  font-size: 1rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.info-card {
  padding: 1.25rem;
}

.info-card h3 {
  margin: 0 0 0.5rem;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 1.25rem;
  align-items: stretch;
}

.game-board-panel {
  padding: 1rem;
  display: grid;
  place-items: stretch;
}

.game-board-frame {
  position: relative;
  width: 100%;
  min-height: 590px;
  max-width: none;
  margin: 0 auto;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(126, 161, 255, 0.54), transparent 28%),
    radial-gradient(circle at 82% 86%, rgba(255, 175, 128, 0.42), transparent 30%),
    linear-gradient(145deg, #17223b, #0d1424 68%, #121a2b);
  border: 1px solid rgba(178, 197, 255, 0.32);
  box-shadow:
    0 28px 58px rgba(34, 46, 70, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.color-stage {
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: clamp(1.4rem, 4vw, 3rem);
}

.color-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.6;
  background-image: linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.color-stage-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(242, 247, 255, 0.88);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.color-stage-mark {
  font-weight: 800;
}

.round-value {
  color: rgba(217, 227, 255, 0.64);
}

.swatch-pair {
  width: 100%;
  min-height: 282px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: min-height 180ms ease;
}

.color-swatch {
  width: min(100%, 300px);
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  background: var(--swatch, #8ea9ff);
  box-shadow:
    0 22px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: width 220ms ease, transform 220ms ease, opacity 180ms ease;
}

.color-stage.is-result .color-swatch {
  width: min(46%, 210px);
}

.color-stage.is-picking .swatch-pair {
  display: none;
}

.color-stage-copy {
  max-width: 430px;
  text-align: center;
  color: rgba(235, 241, 255, 0.78);
}

.color-kicker {
  margin: 0 0 0.4rem;
  color: rgba(205, 220, 255, 0.66);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.color-stage-copy h3 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.15;
}

.color-stage-copy p:last-child {
  margin: 0.7rem 0 0;
}

.memory-message {
  margin: 0;
  max-width: 390px;
  color: rgba(240, 245, 255, 0.82);
  text-align: center;
  font-size: 1.02rem;
}

.color-palette {
  position: relative;
  width: min(100%, 470px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 20px;
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.color-picker {
  width: 100%;
  height: 245px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.color-picker:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.88);
  outline-offset: -4px;
}

.color-picker-cursor {
  position: absolute;
  width: 32px;
  height: 32px;
  left: 50%;
  top: 50%;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--cursor-color);
  box-shadow: 0 0 0 2px rgba(11, 17, 30, 0.5), 0 5px 12px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: width 140ms ease, height 140ms ease, opacity 140ms ease;
}

.color-picker-preview {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  background: var(--preview-color);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.64);
  pointer-events: none;
}

.color-palette[hidden],
.memory-message[hidden],
.color-swatch[hidden],
.color-picker-cursor[hidden],
.color-picker-preview[hidden],
.result-card[hidden] {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.stat-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.95rem;
  border-radius: 20px;
  border: 1px solid rgba(79, 124, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  font-size: 1.3rem;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.2rem 0;
}

.game-copy {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.result-card {
  display: grid;
  gap: 0.35rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid rgba(79, 124, 255, 0.17);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.08), rgba(255, 137, 181, 0.09));
}

.result-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-card strong {
  color: var(--text);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.result-card p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .hero-grid,
  .section-grid,
  .game-shell,
  .cards {
    grid-template-columns: 1fr;
  }

  .game-board-frame {
    max-width: none;
  }
}

@media (min-width: 1041px) {
  .hero {
    padding-bottom: 1rem;
  }

  .section {
    padding: 3rem 0;
  }

  .games-section {
    padding-top: 0.75rem;
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 78px;
    left: 0;
    right: 0;
    display: grid;
    gap: 0.35rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 160ms ease, opacity 160ms ease;
  }

  .site-nav.is-open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav a {
    padding: 0.9rem 1rem;
    background: rgba(79, 124, 255, 0.04);
  }

  .section {
    padding: 4rem 0;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-board-frame {
    min-height: 520px;
  }

  .color-palette {
    width: 100%;
  }

  .color-picker {
    height: 220px;
  }

  .color-stage.is-result .color-swatch {
    width: min(46%, 150px);
  }
}
