/* ── Knight School design system ──────────────────────────────────────
   Clean and airy: warm paper, sky blue, sun gold. A storybook chess
   school in morning light — the opposite of a dark gamer den. */

:root {
  --paper:   #fbfaf6;
  --cloud:   #ffffff;
  --ink:     #2b3a49;
  --mist:    #6c7a89;
  --line:    #e7e2d6;
  --sky:     #4e8fc7;
  --sky-deep:#33689a;
  --sky-soft:#e3eef7;
  --sun:     #f2b330;
  --sun-soft:#fdf3dc;
  --grass:   #5f9a58;
  --grass-soft:#e7f2e4;
  --coral:   #e2704f;
  --coral-soft:#fbe9e2;
  --board-light: #f4eedf;
  --board-dark:  #a9c6db;
  --disp: 'Fredoka', sans-serif;
  --body: 'Atkinson Hyperlegible', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --shadow: 0 2px 10px rgba(43,58,73,.07), 0 12px 32px rgba(43,58,73,.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; }
button { font: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ── header ── */
header.site { background: var(--paper); border-bottom: 2px solid var(--line); }
.site-bar { display: flex; align-items: center; gap: 26px; padding: 16px 0; }
.logo {
  font-family: var(--disp); font-weight: 600; font-size: 21px;
  text-decoration: none; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.logo .owl-mini { width: 34px; height: 34px; flex: none; }
nav.main { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
nav.main a {
  text-decoration: none; color: var(--mist);
  font-family: var(--disp); font-weight: 500; font-size: 15px;
  padding: 8px 14px; border-radius: 999px;
}
nav.main a:hover { color: var(--sky-deep); background: var(--sky-soft); }
nav.main a.active { color: var(--sky-deep); background: var(--sky-soft); }
.mastery-chip {
  font-family: var(--disp); font-weight: 500; font-size: 14px; color: #9a6b00;
  border-radius: 999px; padding: 7px 14px;
  background: var(--sun-soft); border: 1px solid #f0dcae;
  white-space: nowrap;
}

/* ── board ── */
.board {
  position: relative; width: 100%; aspect-ratio: 1;
  border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  user-select: none;
}
.board-squares {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
}
.board.flipped .board-squares { transform: rotate(180deg); }
.square.light { background: var(--board-light); }
.square.dark  { background: var(--board-dark); }
.square.hl-move { box-shadow: inset 0 0 0 100vmax rgba(242,179,48,.45); }
.square.hl-pick { box-shadow: inset 0 0 0 4px var(--sun); }
.square.hl-hint { box-shadow: inset 0 0 0 100vmax rgba(95,154,88,.5); }
.square.hl-wrong { box-shadow: inset 0 0 0 100vmax rgba(226,112,79,.5); }

.board-pieces { position: absolute; inset: 0; pointer-events: none; }
.piece {
  position: absolute; width: 12.5%; height: 12.5%;
  transition: transform .28s cubic-bezier(.2,.85,.3,1.1), opacity .25s;
  will-change: transform;
}
.piece.no-anim { transition: none; }
.piece.captured { opacity: 0; transform-origin: center; scale: .5; }
.piece svg { width: 100%; height: 100%; display: block; }

.board-arrows {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 6;
}
.arrow { stroke-width: 2.6; stroke-linecap: round; opacity: .8; }
.arrow-good   { stroke: var(--sun); }
.arrow-idea   { stroke: var(--grass); }
.arrow-danger { stroke: var(--coral); }

.board-coords { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.coord {
  position: absolute; font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: rgba(43,58,73,.45); transform: translate(-50%, 0);
}
.coord-file { bottom: 2px; }
.coord-rank { left: 3px; transform: translate(0, -50%); }

.board.mini { border-radius: 8px; box-shadow: 0 0 0 1px var(--line); pointer-events: none; }
.board.mini .board-coords { display: none; }

/* ── buttons ── */
.btn {
  display: inline-block; text-decoration: none; border: none; border-radius: 999px;
  font-family: var(--disp); font-weight: 600; font-size: 16px;
  padding: 13px 26px; transition: transform .12s;
}
.btn:hover { transform: translateY(-2px); }
.btn-brass { background: var(--sun); color: #4a3200; box-shadow: 0 3px 0 #d29a1a; }
.btn-ghost { background: var(--cloud); color: var(--sky-deep); border: 2px solid var(--sky-soft); }
.btn-ghost:hover { border-color: var(--sky); }

.ctl {
  background: var(--cloud); color: var(--ink); border: 2px solid var(--line);
  border-radius: 999px; padding: 10px 18px; font-family: var(--disp); font-weight: 500; font-size: 15px;
}
.ctl:hover:not(:disabled) { border-color: var(--sky); color: var(--sky-deep); }
.ctl:disabled { opacity: .35; cursor: default; }
.ctl-primary { background: var(--sun); color: #4a3200; border-color: var(--sun); }
.ctl-primary:hover:not(:disabled) { background: #f7c14e; border-color: #f7c14e; color: #4a3200; }

/* ── home: today card ── */
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 44px;
  align-items: center; padding: 46px 0 26px;
}
.hero h1 {
  font-family: var(--disp); font-weight: 600;
  font-size: clamp(32px, 4.6vw, 50px); line-height: 1.12; color: var(--ink);
}
.hero h1 em { font-style: normal; color: var(--sky); }
.hero p.sub { margin-top: 14px; font-size: 19px; color: var(--mist); max-width: 46ch; }
.hero-owl { display: flex; justify-content: center; }
.hero-owl svg { width: min(300px, 70%); height: auto; }

.today {
  background: var(--cloud); border: 2px solid var(--line); border-radius: 22px;
  padding: 26px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
  margin-top: 10px;
}
.today .t-eyebrow { font-family: var(--disp); font-weight: 500; font-size: 14px; color: var(--sky); letter-spacing: .04em; }
.today h2 { font-family: var(--disp); font-weight: 600; font-size: 26px; margin-top: 4px; }
.today p { color: var(--mist); margin-top: 6px; }
.streak {
  text-align: center; background: var(--sun-soft); border-radius: 16px; padding: 14px 20px;
}
.streak .flame { font-size: 30px; }
.streak .n { font-family: var(--disp); font-weight: 600; font-size: 24px; color: #9a6b00; }
.streak .lbl { font-size: 12.5px; color: #9a6b00; }

/* ── home: cards ── */
.section-head { display: flex; align-items: baseline; gap: 14px; margin: 34px 0 16px; }
.section-head h2 { font-family: var(--disp); font-weight: 600; font-size: 24px; color: var(--ink); }
.section-head .count { font-family: var(--body); font-size: 14.5px; color: var(--mist); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile {
  background: var(--cloud); border: 2px solid var(--line); border-radius: 18px;
  padding: 20px; text-decoration: none; transition: transform .13s, border-color .13s;
  display: flex; flex-direction: column; gap: 8px;
}
.tile:hover { transform: translateY(-3px); border-color: var(--sky); }
.tile .t-emoji { font-size: 30px; }
.tile h3 { font-family: var(--disp); font-weight: 600; font-size: 19px; }
.tile p { color: var(--mist); font-size: 15px; }
.tile .t-tag { margin-top: auto; font-family: var(--disp); font-weight: 500; font-size: 13.5px; color: var(--sky-deep); }
.tile.sun { background: linear-gradient(160deg, #fff8e8, var(--cloud)); border-color: #f0dcae; }
.tile.sun:hover { border-color: var(--sun); }

.hearts { font-size: 22px; letter-spacing: 3px; }

/* ── training page ── */
.train {
  display: grid; grid-template-columns: minmax(300px, 520px) 1fr;
  gap: 34px; padding: 30px 0 80px; align-items: start;
}
.train-side { position: sticky; top: 20px; }
.coach {
  background: var(--cloud); border: 2px solid var(--line); border-radius: 18px;
  padding: 18px 20px; box-shadow: var(--shadow); position: relative;
  display: flex; gap: 14px; align-items: flex-start;
}
.coach .owl-mini { width: 46px; height: 46px; flex: none; }
.coach .coach-move { font-family: var(--disp); font-weight: 600; font-size: 16px; color: var(--sky-deep); }
.coach .coach-note { margin-top: 4px; animation: rise .25s ease-out; color: var(--ink); }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

.session-bar {
  display: flex; gap: 8px; margin-bottom: 14px; align-items: center;
  font-family: var(--disp); font-weight: 500; font-size: 14px; color: var(--mist);
}
.session-dots { display: flex; gap: 6px; }
.sdot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.sdot.now { background: var(--sky); }
.sdot.win { background: var(--grass); }
.sdot.meh { background: var(--sun); }
.sdot.miss { background: var(--coral); }

.puzzle-tag {
  display: inline-block; font-family: var(--disp); font-weight: 500; font-size: 14px;
  background: var(--sky-soft); color: var(--sky-deep); border-radius: 999px; padding: 5px 14px;
  margin-bottom: 10px;
}

.controls { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.done-card {
  background: var(--cloud); border: 2px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 34px; text-align: center; margin: 40px auto; max-width: 560px;
}
.done-card .big { font-size: 44px; }
.done-card h2 { font-family: var(--disp); font-weight: 600; font-size: 28px; margin-top: 8px; }
.done-card p { color: var(--mist); margin-top: 8px; }
.done-card .row { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* ── study pages (library) ── */
.study {
  display: grid; grid-template-columns: minmax(300px, 540px) 1fr;
  gap: 34px; padding: 30px 0 80px; align-items: start;
}
.study-title { padding: 26px 0 0; }
.study-title .crumbs { font-family: var(--disp); font-weight: 500; font-size: 13.5px; color: var(--mist); }
.study-title .crumbs a { color: var(--mist); text-decoration: none; }
.study-title .crumbs a:hover { color: var(--sky-deep); }
.study-title h1 {
  font-family: var(--disp); font-weight: 600; font-size: clamp(26px, 4vw, 38px);
  color: var(--ink); margin-top: 4px;
}
.study-title .meta-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.study-title p.vibe { color: var(--mist); margin-top: 10px; max-width: 60ch; font-size: 17.5px; }

.eco {
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--sky-deep);
  background: var(--sky-soft); border-radius: 6px; padding: 3px 8px;
}
.pill {
  font-family: var(--disp); font-weight: 500; font-size: 12.5px;
  border-radius: 999px; padding: 3px 11px;
}
.pill-white { background: #f1eee6; color: #5c554a; border: 1px solid var(--line); }
.pill-black { background: #3a4653; color: #f1f4f7; }
.pill-trap  { background: var(--coral-soft); color: #b04a2e; }
.pill-defense { background: var(--grass-soft); color: #3f7239; }
.stars { margin-left: auto; font-size: 13px; color: var(--sun); letter-spacing: 2px; }

.movelist {
  margin-top: 16px; display: flex; flex-wrap: wrap; gap: 4px 2px;
  font-family: var(--mono); font-size: 14px;
}
.movelist .mvnum { color: var(--mist); padding: 4px 2px 4px 8px; }
.movelist button.mv {
  background: none; border: none; color: var(--ink); border-radius: 6px;
  padding: 4px 7px; font-family: var(--mono); font-size: 14px;
}
.movelist button.mv:hover { background: var(--sky-soft); }
.movelist button.mv.current { background: var(--sun); color: #4a3200; font-weight: 600; }

.plan { margin-top: 26px; }
.plan h2 { font-family: var(--disp); font-weight: 600; font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.plan ol { list-style: none; }
.plan li {
  display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line);
  color: var(--mist); font-size: 15.5px;
}
.plan li::before { content: '➺'; color: var(--sky); }

.quiz-banner {
  margin-top: 16px; border-radius: 14px; padding: 14px 16px;
  font-family: var(--disp); font-weight: 500; font-size: 15px;
  background: var(--sun-soft); border: 1px solid #f0dcae; color: #9a6b00;
  display: none;
}
.quiz-banner.on { display: block; }
.quiz-banner.good { background: var(--grass-soft); border-color: #cbe2c6; color: #3f7239; }
.quiz-banner.bad  { background: var(--coral-soft); border-color: #f2cdc0; color: #b04a2e; }
.result-stars { font-size: 26px; letter-spacing: 6px; color: var(--sun); }

/* ── quest board (library) ── */
.quest { display: flex; flex-direction: column; gap: 10px; padding-bottom: 40px; }
.mission {
  display: grid; grid-template-columns: minmax(170px, 240px) 1fr;
  gap: 24px; align-items: center; text-decoration: none;
  background: var(--cloud); border: 2px solid var(--sun); border-radius: 20px; padding: 20px;
  box-shadow: var(--shadow);
}
.mission:hover { border-color: #d29a1a; }
.mission.boss { border-color: var(--coral); }
.mission .m-eyebrow { font-family: var(--disp); font-weight: 500; font-size: 13px; color: #9a6b00; letter-spacing: .06em; }
.mission.boss .m-eyebrow { color: #b04a2e; }
.mission h3 { font-family: var(--disp); font-weight: 600; font-size: 26px; color: var(--ink); margin-top: 6px; }
.mission p { color: var(--mist); margin-top: 6px; max-width: 52ch; }
.mission .m-meta { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.mission .m-meta .stars { margin-left: 0; }
.mission .m-cta { margin-top: 16px; }

.quest-row {
  display: grid; grid-template-columns: 84px 1fr auto auto;
  gap: 16px; align-items: center; text-decoration: none;
  background: var(--cloud); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 18px; font-size: 15.5px;
}
.quest-row .q-level { font-family: var(--disp); font-weight: 500; font-size: 13px; color: var(--mist); white-space: nowrap; }
.quest-row .q-name { color: var(--ink); font-weight: 700; }
.quest-row .q-stars { font-size: 12px; color: var(--sun); letter-spacing: 2px; }
.quest-row .q-action { font-family: var(--disp); font-weight: 500; font-size: 13px; color: var(--mist); }
.quest-row.done { border-color: #cbe2c6; }
.quest-row.done .q-level, .quest-row.done .q-action { color: #3f7239; }
.quest-row.done:hover { border-color: var(--grass); }
.quest-row.locked { opacity: .55; }
.quest-row.locked.boss { border-color: #f2cdc0; }
.quest-row.locked.boss .q-name { color: #b04a2e; }

/* ── cards grid (tricks) ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; padding-bottom: 72px; }
.card {
  background: var(--cloud); border: 2px solid var(--line); border-radius: 18px;
  padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 12px;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--sky); }
.card-top { display: flex; align-items: center; gap: 8px; }
.card h3 { font-family: var(--disp); font-weight: 600; font-size: 17px; color: var(--ink); }
.card p { font-size: 14.5px; color: var(--mist); }
.card .status { margin-top: auto; font-family: var(--disp); font-weight: 500; font-size: 12px; color: var(--mist); }
.card .status.studied { color: #3f7239; }
.card .status.mastered { color: #9a6b00; }

/* ── page head ── */
.page-head { padding: 40px 0 8px; }
.page-head h1 { font-family: var(--disp); font-weight: 600; font-size: clamp(28px, 4.5vw, 42px); color: var(--ink); }
.page-head p { color: var(--mist); margin-top: 10px; max-width: 62ch; font-size: 18px; }
.drops-note { font-family: var(--disp); font-weight: 500; font-size: 14px; color: #9a6b00; margin-top: 12px; }

/* ── ask the grandmaster owl ── */
.gm { margin-top: 26px; background: var(--cloud); border: 2px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); }
.gm-head { display: flex; align-items: center; gap: 10px; }
.gm-head .owl-mini { width: 38px; height: 38px; }
.gm-title { font-family: var(--disp); font-weight: 600; font-size: 17px; color: var(--ink); }
.gm-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.gm-chip {
  background: var(--sky-soft); color: var(--sky-deep); border: none;
  border-radius: 999px; padding: 7px 13px; font-family: var(--disp); font-weight: 500; font-size: 13px;
}
.gm-chip:hover { background: #cfe2f2; }
.gm-row { display: flex; gap: 10px; margin-top: 12px; align-items: stretch; }
.gm-row textarea {
  flex: 1; resize: none; background: var(--paper); color: var(--ink);
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-family: var(--body); font-size: 15px;
}
.gm-row textarea:focus { outline: none; border-color: var(--sky); }
.gm-status { display: none; margin-top: 12px; font-family: var(--disp); font-weight: 500; font-size: 14px; color: #9a6b00; }
.gm-answer {
  display: none; margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--sky-soft); border-left: 4px solid var(--sky); white-space: pre-wrap;
}
.gm-hint { margin-top: 10px; font-size: 12.5px; color: var(--mist); }

/* ── parents page ── */
.prose { max-width: 720px; padding-bottom: 80px; }
.prose h2 { font-family: var(--disp); font-weight: 600; font-size: 22px; margin: 34px 0 10px; }
.prose p, .prose li { color: #4a5a6a; font-size: 16.5px; }
.prose ul { padding-left: 22px; margin-top: 8px; }
.prose li { margin-bottom: 8px; }
.prose a { color: var(--sky-deep); }
.prose .do { color: #3f7239; font-weight: 700; }
.prose .dont { color: #b04a2e; font-weight: 700; }
.callout {
  background: var(--sun-soft); border: 1px solid #f0dcae; border-radius: 14px;
  padding: 14px 18px; margin: 16px 0; color: #6b4d00 !important;
}

/* ── footer ── */
footer.site { border-top: 2px solid var(--line); padding: 26px 0 40px; color: var(--mist); font-size: 14px; }
footer.site a { color: var(--sky-deep); }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; padding-top: 30px; gap: 8px; }
  .hero-owl svg { width: 170px; }
  .study, .train { grid-template-columns: 1fr; gap: 24px; }
  .train-side { position: static; }
  .site-bar { gap: 10px; flex-wrap: wrap; }
  nav.main { margin-left: 0; }
  .today { grid-template-columns: 1fr; }
  .mission { grid-template-columns: 1fr; }
  .quest-row { grid-template-columns: 64px 1fr; }
  .quest-row .q-stars { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
