:root {
  --font-family: "Inter", "Segoe UI", sans-serif;
  --landing-bg: linear-gradient(135deg, #f7fbff 0%, #eef4ff 42%, #ffffff 100%);
  --landing-ink: #122033;
  --landing-muted: #5f6f87;
  --accent: #2d6cdf;
  --accent-2: #0f4ea7;
  --grid-blue: #4bcffa;
  --grid-white: #ffffff;
  --grid-red: #e74c3c;
  --clinical-bg: #f8f9fa;
  --clinical-border: #c9cdd3;
  --clinical-ink: #333333;
  --results-bg: #eceff3;
  --shadow-soft: 0 24px 60px rgba(18, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-family);
  color: var(--landing-ink);
  background: #fff;
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.view {
  min-height: 100vh;
}

.landing-view {
  display: grid;
  place-items: center;
  justify-items: center;
  gap: 1.5rem;
  padding: 32px;
  background: var(--landing-bg);
  position: relative;
  overflow: hidden;
}

.landing-view::before,
.landing-view::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.landing-view::before {
  width: 26rem;
  height: 26rem;
  right: -8rem;
  top: -7rem;
  background: radial-gradient(circle, rgba(45, 108, 223, 0.16) 0%, rgba(45, 108, 223, 0) 70%);
}

.landing-view::after {
  width: 20rem;
  height: 20rem;
  left: -6rem;
  bottom: -7rem;
  background: radial-gradient(circle, rgba(15, 78, 167, 0.14) 0%, rgba(15, 78, 167, 0) 70%);
}

.landing-hero {
  width: min(920px, 100%);
  text-align: center;
  padding: clamp(2rem, 6vw, 4.5rem);
  border: 1px solid rgba(18, 32, 51, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.landing-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(45, 108, 223, 0.1);
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 5.2rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.landing-subtitle {
  width: min(42rem, 100%);
  margin: 1rem auto 0;
  color: var(--landing-muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.7;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.landing-github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  color: #111111;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow: 0 12px 28px rgba(18, 32, 51, 0.08);
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
  z-index: 1;
}

.landing-github-link:hover {
  transform: translateY(-2px);
  border-color: rgba(17, 17, 17, 0.18);
  box-shadow: 0 16px 34px rgba(18, 32, 51, 0.12);
}

.landing-github-link__icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #111111;
  flex: 0 0 auto;
}

.landing-github-link span {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.cta-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.5rem;
  min-width: 14.5rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.cta-button:hover {
  transform: translateY(-2px);
}

.cta-button--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 14px 32px rgba(45, 108, 223, 0.25);
}

.cta-button--primary:hover {
  box-shadow: 0 18px 38px rgba(45, 108, 223, 0.3);
}

.cta-button--secondary {
  color: var(--accent-2);
  background: #fff;
  border: 1px solid rgba(15, 78, 167, 0.18);
  box-shadow: 0 12px 28px rgba(18, 32, 51, 0.08);
}

.cta-button--secondary:hover {
  border-color: rgba(15, 78, 167, 0.34);
}

.game-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-view--grid {
  background: var(--grid-blue);
  color: var(--grid-white);
  padding: 0.8rem clamp(1rem, 3vw, 2rem) 2rem;
}

.game-view--geo {
  background: var(--clinical-bg);
  color: var(--clinical-ink);
  padding: 1rem clamp(1rem, 3vw, 2rem) 2rem;
}

.game-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.game-header__labels {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.game-header__status {
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.game-header__subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.88;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-header__timer {
  min-width: 5rem;
  text-align: right;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.game-view--geo .game-header__timer {
  color: var(--clinical-ink);
}

.game-progress {
  width: 100%;
  height: 4px;
  margin: 0.75rem 0 1.25rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

.game-progress__fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.98) 0%, rgba(231, 76, 60, 0.95) 100%);
  transform-origin: left center;
  transition: width 60ms linear;
}

.game-stage {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
}

.game-stage--grid {
  min-height: calc(100vh - 140px);
}

.game-stage--geo {
  min-height: calc(100vh - 94px);
}

.grid-memory-stage,
.grid-recall-stage,
.grid-symmetry-stage {
  width: min(100%, 1120px);
}

.grid-result-stage {
  width: min(100%, 1120px);
  min-height: 60vh;
  display: grid;
  place-items: center;
}

.grid-result-card {
  width: min(32rem, 100%);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.grid-result-card__label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}

.grid-result-card__score {
  margin-top: 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.grid-result-card__text {
  margin-top: 0.65rem;
  line-height: 1.6;
}

.grid-memory-stage {
  position: relative;
  min-height: 70vh;
}

.dot-field {
  position: absolute;
  inset: 0;
}

.grid-dot {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.grid-dot--target {
  background: var(--grid-red);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 0 6px rgba(231, 76, 60, 0.18);
  animation: pulse-dot 1s ease-in-out infinite alternate;
}

.grid-memory-caption,
.grid-recall-caption,
.grid-symmetry-caption {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.grid-memory-caption {
  position: relative;
  z-index: 1;
  margin-bottom: 1rem;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}

.grid-recall-caption,
.grid-symmetry-caption {
  margin-bottom: 1.25rem;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
}

.symmetry-wrap {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
}

.symmetry-grids {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  width: min(100%, 840px);
}

.symmetry-divider {
  width: 1px;
  height: clamp(12rem, 34vw, 18rem);
  background: rgba(255, 255, 255, 0.9);
}

.symmetry-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  aspect-ratio: 1 / 1;
  width: min(34vw, 16rem);
  min-width: 12rem;
}

.symmetry-cell {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.symmetry-square {
  background: #fff;
  border-radius: 2px;
}

.symmetry-square--small {
  width: 38%;
  height: 38%;
}

.symmetry-square--large {
  width: 74%;
  height: 74%;
}

.symmetry-actions,
.recall-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.grid-answer-button,
.grid-submit-button,
.grid-back-button,
.geo-option-button {
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  padding: 0.85rem 1.45rem;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.grid-answer-button:hover,
.grid-submit-button:hover,
.grid-back-button:hover,
.geo-option-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.18);
}

.grid-submit-button {
  min-width: 11rem;
  margin-top: 1rem;
  background: #fff;
  color: var(--grid-red);
  border-color: #fff;
}

.grid-submit-button:hover {
  background: rgba(255, 255, 255, 0.95);
}

.grid-answer-button.is-selected {
  background: rgba(255, 255, 255, 0.24);
}

.flash-feedback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: clamp(5rem, 16vw, 9rem);
  font-weight: 900;
  opacity: 0;
  transform: scale(0.92);
  animation: flash-pop 420ms ease forwards;
}

.flash-feedback--correct {
  color: #7cff9b;
  text-shadow: 0 0 36px rgba(124, 255, 155, 0.3);
}

.flash-feedback--incorrect {
  color: var(--grid-red);
  text-shadow: 0 0 36px rgba(231, 76, 60, 0.26);
}

.recall-board {
  position: relative;
  width: min(100%, 1120px);
  min-height: 64vh;
}

.recall-dot {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.recall-dot.is-locked {
  cursor: default;
}

.recall-badge {
  position: absolute;
  inset: -0.1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grid-red);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 120ms ease, transform 120ms ease;
}

.recall-dot.is-marked .recall-badge {
  opacity: 1;
  transform: scale(1);
}

.geo-stage-shell {
  width: min(100%, 1120px);
  display: grid;
  gap: 1rem;
  justify-items: center;
}

.geo-instructions {
  width: min(100%, 920px);
  margin: 0;
  text-align: center;
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 600;
}

.geo-board {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: 3rem repeat(5, minmax(2.8rem, 1fr));
  gap: 0;
  border: 1px solid var(--clinical-border);
  background: #fff;
}

.geo-board--size-4 {
  grid-template-columns: 3rem repeat(4, minmax(3.1rem, 1fr));
}

.geo-board__corner,
.geo-board__header,
.geo-board__row-header,
.geo-board__cell {
  border-right: 1px solid var(--clinical-border);
  border-bottom: 1px solid var(--clinical-border);
  min-height: clamp(3rem, 9vw, 4.4rem);
}

.geo-board__corner {
  background: #f1f3f5;
}

.geo-board__header,
.geo-board__row-header {
  display: grid;
  place-items: center;
  background: #f1f3f5;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.02em;
}

.geo-board__row-header {
  border-left: 0;
}

.geo-board__cell {
  display: grid;
  place-items: center;
  background: #fff;
  border-left: 0;
}

.geo-board__cell--target {
  font-size: clamp(1.4rem, 3.5vw, 2.3rem);
  font-weight: 900;
  color: #111;
}

.geo-cell-shape {
  width: 1.45rem;
  height: 1.45rem;
  fill: #111;
}

.geo-cell-shape--large {
  width: 1.8rem;
  height: 1.8rem;
}

.geo-options-shell {
  width: min(100%, 920px);
  display: grid;
  gap: 1rem;
}

.geo-divider {
  height: 1px;
  background: var(--clinical-border);
}

.geo-options-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(3rem, 1fr));
  gap: 0.75rem;
}

.geo-option-button {
  border: 1px solid var(--clinical-border);
  background: #fff;
  color: #333;
  border-radius: 4px;
  aspect-ratio: 1 / 1;
  min-width: 3rem;
  padding: 0;
  display: grid;
  place-items: center;
}

.geo-option-button:hover {
  background: #f1f3f5;
}

.geo-option-button__icon {
  width: 1.45rem;
  height: 1.45rem;
  fill: #111;
}

.geo-option-button__icon--large {
  width: 1.8rem;
  height: 1.8rem;
}

.geo-option-button__label {
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.results-view {
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--results-bg);
}

.results-card {
  width: min(32rem, 100%);
  text-align: center;
  padding: clamp(2rem, 6vw, 3.2rem);
  border: 1px solid rgba(51, 51, 51, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 42px rgba(51, 51, 51, 0.08);
}

.results-card__label {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b7280;
}

.results-card h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.04em;
}

.results-card__note {
  margin: 0.85rem 0 0;
  color: #6b7280;
  line-height: 1.7;
}

.cta-button--results {
  margin-top: 1.5rem;
  min-width: 12rem;
  color: #fff;
  background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
}

.cta-button--results:hover {
  box-shadow: 0 16px 34px rgba(55, 65, 81, 0.25);
}

@keyframes pulse-dot {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes flash-pop {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.05);
  }
}

@media (max-width: 820px) {
  .landing-hero {
    padding: 1.75rem;
    border-radius: 22px;
  }

  .landing-view {
    gap: 1rem;
  }

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

  .landing-github-link {
    width: min(100%, 28rem);
    justify-content: center;
  }

  .cta-button {
    width: 100%;
    min-width: 0;
  }

  .symmetry-grids {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .symmetry-divider {
    width: min(70vw, 16rem);
    height: 1px;
  }

  .symmetry-grid {
    width: min(82vw, 16rem);
  }

  .geo-options-row {
    grid-template-columns: repeat(3, minmax(3rem, 1fr));
  }
}

@media (max-width: 560px) {
  .game-header {
    align-items: center;
  }

  .game-header__status {
    font-size: 0.98rem;
  }

  .game-header__subtitle {
    font-size: 0.72rem;
  }

  .game-header__timer {
    min-width: 4rem;
    font-size: 0.95rem;
  }

  .grid-memory-caption,
  .grid-recall-caption,
  .grid-symmetry-caption {
    font-size: 1.05rem;
  }

  .geo-board {
    grid-template-columns: 2.6rem repeat(5, minmax(2.35rem, 1fr));
  }

  .geo-board--size-4 {
    grid-template-columns: 2.6rem repeat(4, minmax(2.45rem, 1fr));
  }

  .geo-options-row {
    grid-template-columns: repeat(2, minmax(3rem, 1fr));
  }
}