:root {
  color-scheme: light;
  --bg: #f4f8ff;
  --card: #ffffff;
  --ink: #18324a;
  --muted: #5b7188;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #138a4b;
  --danger: #c2410c;
  --grid-line: #c7d8ee;
  --axis: #24435f;
  --treasure: #f59e0b;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0.8rem 1.2rem;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover,
button:focus-visible {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button.secondary {
  background: #e0ecff;
  color: var(--primary-dark);
}

button.secondary:hover,
button.secondary:focus-visible {
  background: #c7dcff;
}

.app-shell {
  margin: 0 auto;
  max-width: 1100px;
  padding: 2rem;
}

.hero,
.game-card,
.lesson-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(199, 216, 238, 0.75);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(24, 50, 74, 0.12);
}

.hero {
  align-items: center;
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  line-height: 0.95;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.35rem, 4vw, 2rem);
  margin-bottom: 0.75rem;
}

.intro,
.lesson-card p,
.challenge-text {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
}

.score-card {
  align-items: center;
  background: #ecfdf5;
  border: 2px solid #b8f3d0;
  border-radius: 24px;
  display: grid;
  min-width: 116px;
  padding: 1rem;
  text-align: center;
}

.score-card span {
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-card strong {
  font-size: 3rem;
  line-height: 1;
}

.game-card {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.2fr);
  padding: 1.5rem;
}

.challenge-panel {
  align-self: center;
}

.challenge-text strong {
  color: var(--ink);
  font-size: 1.4rem;
}

.feedback {
  background: #f8fbff;
  border-radius: 18px;
  color: var(--muted);
  font-weight: 700;
  margin: 1rem 0;
  min-height: 3.4rem;
  padding: 1rem;
}

.feedback.correct {
  background: #ecfdf5;
  color: var(--success);
}

.feedback.incorrect {
  background: #fff7ed;
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.grid-wrap {
  overflow-x: auto;
  padding: 0.5rem;
}

.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  height: min(68vw, 560px);
  min-height: 340px;
  min-width: 340px;
  position: relative;
  width: min(68vw, 560px);
}

.point-cell {
  align-items: center;
  background: white;
  border-bottom: 1px solid var(--grid-line);
  border-right: 1px solid var(--grid-line);
  color: var(--muted);
  display: flex;
  font-weight: 700;
  justify-content: center;
  position: relative;
}

.point-cell.axis-x {
  border-top: 4px solid var(--axis);
}

.point-cell.axis-y {
  border-right: 4px solid var(--axis);
}

.point-cell.origin {
  border-right: 4px solid var(--axis);
  border-top: 4px solid var(--axis);
}

.point-button {
  align-items: center;
  background: #dbeafe;
  border: 2px solid #9ec5ff;
  border-radius: 50%;
  color: var(--primary-dark);
  display: flex;
  height: 58%;
  justify-content: center;
  min-height: 30px;
  min-width: 30px;
  padding: 0;
  width: 58%;
}

.point-button:hover,
.point-button:focus-visible {
  background: #bfdbfe;
}

.point-button.target {
  background: var(--treasure);
  border-color: #b45309;
  color: #431407;
}

.axis-label {
  bottom: 0.25rem;
  color: var(--axis);
  font-size: 0.8rem;
  position: absolute;
  right: 0.35rem;
}

.lesson-card {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
}

.lesson-card p {
  margin-bottom: 0;
}

@media (max-width: 800px) {
  .app-shell {
    padding: 1rem;
  }

  .hero,
  .game-card {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: stretch;
    display: grid;
  }
}
