/* Chess Quest: bright, friendly, tablet-first. No external fonts or libraries (works offline). */
:root {
  --ink: #2b2d42;
  --soft: #6b6f8a;
  --card: #ffffff;
  --sun: #ffd166;
  --pink: #ef476f;
  --mint: #06d6a0;
  --sky: #118ab2;
  --grape: #7c5cff;
  --light-sq: #f4f4f4;   /* the default board: black & white (themes.js) */
  --dark-sq: #3d3d3d;
  --radius: 22px;
  --font: "Nunito", "Segoe UI Rounded", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,.35) 0 60px, transparent 61px),
    radial-gradient(circle at 85% 12%, rgba(255,255,255,.25) 0 90px, transparent 91px),
    radial-gradient(circle at 70% 85%, rgba(255,255,255,.2) 0 120px, transparent 121px),
    linear-gradient(135deg, #8ec5ff 0%, #b79cff 45%, #ffa8d5 100%);
  background-attachment: fixed;
}
a { color: inherit; }
button, .btn {
  font-family: var(--font); font-weight: 800; font-size: 1.05rem;
  border: none; border-radius: 999px; padding: .7em 1.3em; cursor: pointer;
  background: var(--sun); color: var(--ink); text-decoration: none; display: inline-block;
  box-shadow: 0 5px 0 rgba(0,0,0,.18); transition: transform .08s, box-shadow .08s;
}
button:active, .btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
button:disabled { opacity: .5; cursor: default; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-mint { background: var(--mint); color: #053b2f; }
.btn-sky { background: var(--sky); color: #fff; }
.btn-grape { background: var(--grape); color: #fff; }
.btn-white { background: #fff; }
.btn-small { font-size: .9rem; padding: .45em .95em; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: .7rem 1.2rem; background: rgba(255,255,255,.85); backdrop-filter: blur(6px);
  box-shadow: 0 3px 12px rgba(60,40,120,.15);
}
.logo { font-size: 1.5rem; font-weight: 900; text-decoration: none; letter-spacing: .5px; }
.logo .k { display: inline-block; animation: hop 2.5s infinite; }
@keyframes hop { 0%, 80%, 100% { transform: translateY(0) } 88% { transform: translateY(-8px) rotate(-10deg) } }
.logo b { color: var(--pink); }
.nav { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.nav a { text-decoration: none; font-weight: 800; padding: .45em .9em; border-radius: 999px; background: #f1edff; }
.nav a:hover { background: var(--sun); }
.chip { display: inline-flex; align-items: center; gap: .35em; font-weight: 800; background: #fff3c4;
  padding: .35em .8em; border-radius: 999px; }
.chip .em { font-size: 1.4rem; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.2rem; }
h1 { font-size: 2.1rem; margin: .4em 0; text-shadow: 0 2px 0 rgba(255,255,255,.6); }
h2 { margin: .4em 0; }
.card { background: var(--card); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 8px 24px rgba(60,40,120,.18); }
.muted { color: var(--soft); }
.flash { background: #fff3c4; border-radius: 14px; padding: .7rem 1rem; margin: .6rem 0; font-weight: 700; }

/* learner picker */
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.who-grid form { margin: 0; }
.who-btn {
  width: 100%; background: #fff; border-radius: var(--radius); padding: 1.3rem .8rem; font-size: 1.3rem;
  display: flex; flex-direction: column; align-items: center; gap: .3rem; box-shadow: 0 8px 0 rgba(60,40,120,.18);
}
.who-btn .em { font-size: 4rem; transition: transform .2s; }
.who-btn:hover .em { transform: scale(1.15) rotate(-6deg); }

/* hero + skill cards */
.hero { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.hero .big-em { font-size: 4.5rem; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) } }
.stats { display: flex; gap: .6rem; flex-wrap: wrap; }
.stat { background: #fff; border-radius: 16px; padding: .5rem .9rem; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.1); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.skill-card {
  --c: var(--grape);
  display: block; text-decoration: none; color: #fff; border-radius: var(--radius); padding: 1.1rem;
  background: linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 55%, #000); transition: transform .15s;
  position: relative; overflow: hidden;
}
.skill-card:hover { transform: translateY(-4px) rotate(-.6deg); }
.skill-card .em { font-size: 2.8rem; }
.skill-card h3 { margin: .2em 0; font-size: 1.35rem; }
.skill-card .stars { font-size: 1.5rem; letter-spacing: 2px; color: #fff3a6; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.35); overflow: hidden; margin-top: .5rem; }
.bar > i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.skill-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255,255,255,.15); }
.play-card { --c: #118ab2; }
.friends-card { --c: #ff8c42; }
.mixed-card { --c: #ff8c42; }

/* layout for board pages */
.board-page { display: grid; grid-template-columns: minmax(280px, 560px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .board-page { grid-template-columns: 1fr; } }

/* mascot speech */
.mascot { display: flex; gap: .7rem; align-items: flex-start; }
.mascot .face { font-size: 3rem; line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
/* Hugo the hippo (hippo.svg) stands in for the 🦛 emoji, so he looks the same on every device */
.mascot .face.hippo { width: 3.6rem; height: 3.6rem; flex: none; color: transparent; overflow: hidden; text-indent: -999px;
  background: var(--hippo) center / contain no-repeat; }
.bubble { background: #fff; border-radius: 20px; padding: .9rem 1.1rem; position: relative; font-size: 1.12rem;
  font-weight: 700; box-shadow: 0 6px 18px rgba(60,40,120,.15); flex: 1; }
.bubble::before { content: ""; position: absolute; left: -10px; top: 18px; border: 10px solid transparent;
  border-right-color: #fff; border-left: 0; }

/* board */
.board-wrap { position: relative; }
.board {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1; width: 100%;
  border-radius: 18px; overflow: hidden; border: 8px solid #fff; box-shadow: 0 10px 30px rgba(60,40,120,.3);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.sq { position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sq.l { background: var(--light-sq); }
.sq.d { background: var(--dark-sq); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: rgba(255, 209, 102, .55); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(124, 92, 255, .45); }
.sq.check::before { content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(239,71,111,.95) 0 35%, rgba(239,71,111,0) 72%); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55 } }
.sq.target::after { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%;
  background: rgba(43,45,66,.28); }
.sq.target.cap::after { width: 86%; height: 86%; background: transparent; border: 6px solid rgba(43,45,66,.28); }
.sq.good::before { content: ""; position: absolute; inset: 0; background: rgba(6,214,160,.55); }
.sq.bad::before { content: ""; position: absolute; inset: 0; background: rgba(239,71,111,.45); }
.pc { position: relative; z-index: 2; font-size: min(9vw, 52px); line-height: 1; display: inline-block;
  width: 1.05em; height: 1.05em; }
/* drawn pieces (pieces.js): fill = the theme's color, outline and details = --ps */
.pc svg { display: block; width: 100%; height: 100%; fill: currentColor; stroke: var(--ps, #000); stroke-width: 1.5;
  stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 2px 0 rgba(0,0,0,.28)); overflow: visible; }
.pc svg .d { fill: none; }
.pc svg .e { fill: var(--ps, #000); stroke: none; }
.pc.w { color: #fff; --ps: #2b2d42; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.pc.b { color: #2b2d42; --ps: #000; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.pc.pop { animation: pop .3s ease-out; }
@keyframes pop { 0% { transform: scale(.6) } 70% { transform: scale(1.18) } 100% { transform: scale(1) } }
.coord { position: absolute; font-size: .7rem; font-weight: 800; opacity: .55; z-index: 1; }
.coord.f { right: 4px; bottom: 2px; }
.coord.r { left: 4px; top: 2px; }

.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px) } 40%, 80% { transform: translateX(8px) } }

/* side panel */
.panel { display: flex; flex-direction: column; gap: .9rem; }
.choices { display: flex; flex-direction: column; gap: .6rem; }
.choices button { text-align: left; background: #fff; border: 3px solid #e4defc; box-shadow: 0 4px 0 #e4defc; }
.choices button:hover { border-color: var(--grape); }
.choices button.right { background: #c9f8e7; border-color: var(--mint); }
.choices button.wrong { background: #ffd6df; border-color: var(--pink); }
.feedback { border-radius: 20px; padding: 1rem 1.1rem; font-weight: 700; font-size: 1.08rem; display: none; }
.feedback.show { display: block; animation: pop .35s; }
.feedback.yes { background: #c9f8e7; }
.feedback.no { background: #ffe3ea; }
.feedback .big { font-size: 1.6rem; font-weight: 900; display: block; margin-bottom: .2rem; }
.streak { font-weight: 900; font-size: 1.15rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; border-radius: 999px; padding: .2em .7em; font-weight: 800; font-size: .85rem;
  background: #f1edff; }
.history { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; background: #faf8ff;
  border-radius: 14px; padding: .6rem .8rem; max-height: 160px; overflow: auto; }
.history .mv { display: inline-block; margin-right: .5em; }
.history .new { background: var(--sun); border-radius: 6px; padding: 0 .25em; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.meter { background: #faf8ff; border-radius: 14px; padding: .6rem .8rem; }
.meter b { font-size: 1.4rem; }
.tips { display: flex; flex-direction: column; gap: .4rem; }
.tip { background: #fff3c4; border-radius: 14px; padding: .5rem .8rem; font-weight: 700; animation: pop .3s; }
.note { background: #e0f4ff; border-radius: 14px; padding: .5rem .8rem; font-weight: 700; animation: pop .3s; }

/* modal (promotion, game over) */
.modal { position: fixed; inset: 0; background: rgba(43,45,66,.45); display: none; align-items: center;
  justify-content: center; z-index: 50; }
.modal.show { display: flex; }
.modal .card { text-align: center; max-width: 420px; animation: pop .3s; }
.promo-row { display: flex; gap: .6rem; justify-content: center; }
.promo-row button { font-size: 3rem; padding: .2em .45em; background: #f1edff; }

/* parent */
table { border-collapse: collapse; width: 100%; }
td, th { padding: .45rem; text-align: left; border-bottom: 1px solid #eee; }
input, select { font-family: var(--font); font-size: 1rem; padding: .45em .7em; border-radius: 12px; border: 2px solid #ddd; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.mini { background: #faf8ff; border-radius: 14px; padding: .6rem .8rem; }
.mini .v { font-size: 1.25rem; font-weight: 900; color: #e3a400; }

/* rule book */
.rule { border-left: 8px solid var(--grape); }
.rule h2 .em { font-size: 1.6rem; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.footer { text-align: center; color: rgba(43,45,66,.7); font-size: .85rem; padding: 1.5rem; }

/* ---------- themes: boards (body.board-*) and pieces (body.pieces-*) ---------- */
body.board-bw     { --light-sq: #f4f4f4; --dark-sq: #3d3d3d; --rim: #111111; }
body.board-mint   { --light-sq: #fff4d6; --dark-sq: #8fd3b6; --rim: #ffffff; }
body.board-candy  { --light-sq: #ffe3f1; --dark-sq: #ff8fc7; --rim: #fff0f8; }
body.board-ocean  { --light-sq: #e0f4ff; --dark-sq: #4fa3e0; --rim: #d4ecff; }
body.board-wood   { --light-sq: #f3dcb2; --dark-sq: #b07a4a; --rim: #6e4a2a; }
body.board-space  { --light-sq: #c9c4ff; --dark-sq: #5b4bc4; --rim: #1d1640; }
body.board-lava   { --light-sq: #ffe8a3; --dark-sq: #ff6b3d; --rim: #7a1f00; }
.board { border-color: var(--rim, #fff); }

/* piece sets: on the board (body class) and in the picker samples (more specific, so each sample shows its own set) */
body.pieces-bw .pc.w, .theme-grid .pieces-bw .pc.w { color: #ffffff; --ps: #000; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
body.pieces-bw .pc.b, .theme-grid .pieces-bw .pc.b { color: #000000; --ps: #ffffff; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
body.pieces-classic .pc.w, .theme-grid .pieces-classic .pc.w { color: #fff; --ps: #2b2d42; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
body.pieces-classic .pc.b, .theme-grid .pieces-classic .pc.b { color: #2b2d42; --ps: #000; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
body.pieces-candy .pc.w, .theme-grid .pieces-candy .pc.w { color: #ffd1e8; --ps: #c2185b; }
body.pieces-candy .pc.b, .theme-grid .pieces-candy .pc.b { color: #3a86ff; --ps: #0b3d91; }
body.pieces-gold .pc.w, .theme-grid .pieces-gold .pc.w { color: #ffd166; --ps: #8a5a00; }
body.pieces-gold .pc.b, .theme-grid .pieces-gold .pc.b { color: #9aa5b1; --ps: #2f3a45; }
body.pieces-neon .pc.w, .theme-grid .pieces-neon .pc.w { color: #b8ff3d; --ps: #245c00; text-shadow: 0 0 8px rgba(184,255,61,.7); }
body.pieces-neon .pc.b, .theme-grid .pieces-neon .pc.b { color: #ff5fa2; --ps: #6b0034; text-shadow: 0 0 8px rgba(255,95,162,.7); }

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: .6rem 0 1rem; }
.theme-grid button { padding: .5rem; border-radius: 16px; background: #f6f3ff; border: 3px solid transparent;
  box-shadow: none; font-size: .9rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.theme-grid button.on { border-color: var(--grape); background: #ebe5ff; }
.swatch { display: grid; grid-template-columns: repeat(4, 16px); border-radius: 6px; overflow: hidden; }
.swatch i { width: 16px; height: 16px; }
.piece-sample { font-size: 2rem; line-height: 1; display: inline-flex; gap: .1rem; }
#theme-modal .card { max-width: 520px; text-align: left; }


/* badges and adventures */
.badge-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; text-decoration: none; margin: 1rem 0 0; }
.mini-badge { font-size: 1.6rem; }
.mini-badge.locked { opacity: .35; filter: grayscale(1); font-size: 1.1rem; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin-top: .8rem; }
.badge { border-radius: 18px; padding: .7rem; text-align: center; display: flex; flex-direction: column; gap: .2rem; }
.badge.got { background: linear-gradient(160deg, #fff6c9, #ffd166); box-shadow: 0 5px 0 #e0a800; }
.badge.locked { background: #f1f0f6; color: #8b8da3; }
.badge .b-em { font-size: 2.4rem; }
.badge small { font-size: .78rem; }
.fame-row.me { outline: 4px solid var(--sun); }
.b-pop { font-size: 5rem; animation: pop .5s; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.adv-grid button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font-size: 1rem; }
.adv-grid small { font-weight: 600; opacity: .75; }

/* captured pieces, undo, move-trace switch */
.captured { display: flex; align-items: center; gap: .15rem; min-height: 2.1rem; padding: .2rem .6rem; margin: .3rem 0;
  background: rgba(255,255,255,.75); border-radius: 14px; font-weight: 800; flex-wrap: wrap; }
.captured .pc { font-size: 1.6rem; }
.captured .cap-label { margin-right: .4rem; font-size: .9rem; }
.captured .cap-pawns { display: inline-flex; align-items: center; margin-left: .3rem; }
.captured .cap-pawns b { font-size: .95rem; margin-left: .1rem; }
.captured .lead { margin-left: auto; background: var(--mint); color: #053b2f; border-radius: 999px; padding: .05em .6em; }
.switch { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .slider { width: 46px; height: 26px; border-radius: 99px; background: #cfcfe0; position: relative; transition: background .2s; }
.switch .slider::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .slider { background: var(--mint); }
.switch input:checked + .slider::after { transform: translateX(20px); }


/* v0.4: friends, online games, chat */
.who-form .who-btn { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.pin-in { width: 9em; text-align: center; border: 2px solid #ddd6ff; border-radius: 99px; padding: .35em .6em; font: inherit; }
.friends-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1rem; }
.code-in { font: inherit; font-size: 1.1rem; border: 2px solid #ddd6ff; border-radius: 99px; padding: .45em .9em; min-width: 0; flex: 1; }
.code-big { font-size: 1.6rem; font-weight: 900; letter-spacing: .03em; background: #fff3c4; border-radius: 14px; padding: .3em .7em; display: inline-block; user-select: all; }
.game-list { display: flex; flex-direction: column; gap: .45rem; }
.game-item { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: #f7f4ff; border-radius: 14px; padding: .5rem .7rem; }
.game-item .grow { flex: 1; min-width: 140px; }
.game-item.turn { background: #e9fff6; box-shadow: 0 0 0 2px var(--mint) inset; }
.game-item.invite { background: #fff3c4; box-shadow: 0 0 0 2px var(--sun) inset; }
.players { display: flex; justify-content: space-between; gap: .5rem; font-weight: 800; }
.players .p { display: flex; align-items: center; gap: .35rem; padding: .2em .6em; border-radius: 99px; background: #fff; }
.players .p.turn { box-shadow: 0 0 0 3px var(--mint); }
.dot { width: .6em; height: .6em; border-radius: 50%; background: #cfcfe0; display: inline-block; }
.dot.on { background: var(--mint); }
.chat-log { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.cl { padding: .3em .5em; border-radius: 10px; background: #f7f4ff; overflow-wrap: anywhere; }
.cl.blocked { background: #ffe3ea; }
.cl.reported { box-shadow: 0 0 0 2px var(--pink) inset; }
.cl .tag { font-size: .75rem; background: #fff; border-radius: 99px; padding: .1em .5em; margin-left: .3em; }
.handoff { text-align: center; }
.reports { margin-bottom: .8rem; display: flex; flex-direction: column; gap: .3rem; }
.reports .grow { flex: 1; min-width: 200px; }
.chat-sum { border-collapse: collapse; width: 100%; margin: .4rem 0; }
.chat-sum th, .chat-sum td { text-align: left; padding: .3em .5em; border-bottom: 1px solid #eee8ff; }
.phrase-chip { display: inline-flex; align-items: center; gap: .3rem; border: 2px solid var(--grape); border-radius: 99px; padding: .15em .3em .15em .7em; background: #fff; }
.phrase-chip button { border: 0; background: #f1ecff; border-radius: 50%; width: 1.6em; height: 1.6em; padding: 0; cursor: pointer; font-size: .75rem; }
/* v0.6: clocks, watchers */
.timer-row { margin: .5rem 0; }
.timer-min input { width: 4.2em; font: inherit; border: 2px solid #ddd6ff; border-radius: 12px; padding: .2em .4em; }
.timer-row.off .timer-min, .timer-min:has(input:disabled) { opacity: .4; }
.players .clock { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 1.15rem; background: #fff; border-radius: 12px;
  padding: .1em .6em; margin-left: auto; min-width: 4.2em; text-align: center; }
.players .clock:empty { display: none; }
.players .clock.run { background: var(--mint); color: #053b2f; }
.players .clock.low { background: var(--pink); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.watchers { padding: .7rem; }
.watch-chip { display: inline-flex; align-items: center; gap: .25rem; background: #f7f4ff; border-radius: 99px; padding: .1em .5em; margin: .1rem; color: var(--ink); }
.watch-chip button { border: 0; background: none; cursor: pointer; padding: 0 .1em; }
.ready-box { text-align: center; font-weight: 800; background: #fff3c4; }
/* v0.7: hints, reviews */
.btn-sun { background: var(--sun); color: #5a3d00; }
.sq.hint::before { content: ""; position: absolute; inset: 0; background: rgba(255,209,102,.75); box-shadow: inset 0 0 0 4px #e0a800; animation: hint-glow 1s infinite alternate; }
.sq.hint-to::before { content: ""; position: absolute; inset: 0; background: rgba(6,214,160,.55); box-shadow: inset 0 0 0 4px var(--mint); animation: hint-glow 1s infinite alternate; }
@keyframes hint-glow { from { opacity: .55; } to { opacity: 1; } }
.games-table { width: 100%; border-collapse: collapse; }
.games-table th, .games-table td { text-align: left; padding: .45em .5em; border-bottom: 1px solid #eee8ff; }
.result-win { color: #0a8f5f; font-weight: 800; } .result-loss { color: #c0003c; font-weight: 800; } .result-draw { font-weight: 800; }
.counts { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }
.count { background: #f7f4ff; border-radius: 14px; padding: .4em .8em; font-weight: 800; text-align: center; min-width: 5.5em; }
.count b { display: block; font-size: 1.5rem; }
.moment { background: #fff7f9; border-radius: 16px; padding: .7rem .9rem; margin: .5rem 0; cursor: pointer; border: 2px solid transparent; }
.moment:hover, .moment.on { border-color: var(--pink); }
.moment h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.replay-ctrl { display: flex; gap: .4rem; justify-content: center; margin: .5rem 0; }
.replay-ctrl button { font-size: 1.2rem; padding: .3em .8em; }
.mv.great { background: #fff3c4; } .mv.mistake { background: #ffe3ea; } .mv.blunder { background: #ffc2d1; } .mv.ok { background: #f1ecff; }
.mv.cur { outline: 3px solid var(--grape); }
.history .mv[data-ply] { cursor: pointer; }
.legend { font-size: .85rem; }
.spinner { font-size: 2.5rem; animation: spin 1.2s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 2.3rem; height: 2.3rem; padding: 0; border-radius: 50%; border: 0; background: #fff; font-size: 1.15rem;
  box-shadow: 0 3px 0 rgba(60,40,120,.18); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.icon-btn:hover { transform: translateY(-1px); background: #f1ecff; }
/* v0.8: lessons */
.learn-strip { display: flex; align-items: center; gap: .8rem; text-decoration: none; margin: 1rem 0 0; background: linear-gradient(120deg, #fff, #e9fff6); }
.learn-strip .em { font-size: 2.4rem; }
.learn-strip .grow { flex: 1; }
.learn-count { background: var(--mint); color: #053b2f; font-weight: 900; border-radius: 99px; padding: .3em .9em; white-space: nowrap; }
.path { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; margin-top: 1rem; }
.lesson-card { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; background: #fff; border-radius: 20px; padding: .9rem;
  box-shadow: 0 6px 0 rgba(60,40,120,.15); position: relative; transition: transform .15s; }
.lesson-card:hover { transform: translateY(-3px); }
.lesson-card .num { position: absolute; top: .6rem; right: .8rem; font-weight: 900; color: var(--soft); }
.lesson-card .em { font-size: 2.2rem; }
.lesson-card.complete { background: linear-gradient(160deg, #fff, #e9fff6); }
.lesson-card.next { box-shadow: 0 0 0 4px var(--sun), 0 6px 0 rgba(60,40,120,.15); }
.lesson-card .stars { color: #e0a800; letter-spacing: .1em; }
.lesson-top { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.step-dots { display: flex; gap: .3rem; flex-wrap: wrap; }
.step-dots span { width: 1.6rem; height: .6rem; border-radius: 99px; background: #e4ddff; }
.step-dots span.done { background: var(--mint); }
.step-dots span.cur { background: var(--grape); }
.sq.star::after { content: "⭐"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.1em; z-index: 2; animation: hint-glow 1.2s infinite alternate; pointer-events: none; }
.sq.show::after { content: ""; position: absolute; width: 34%; height: 34%; border-radius: 50%; background: rgba(6,214,160,.85); left: 33%; top: 33%; z-index: 2; }
.sq.sel-mark::before { content: ""; position: absolute; inset: 0; background: rgba(124, 92, 255, .45); }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choices button { font-size: 1.1rem; }
.lesson-done { text-align: center; }
.big-board-msg { font-weight: 800; }
/* v0.10: opening lines */
.line-notes { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; background: #fff; border-radius: 16px; padding: .5rem .7rem; }
.line-note { padding: .25em .5em; border-radius: 10px; background: #f7f4ff; }
.line-note.mine { background: #e9fff6; }
.line-note b { margin-right: .3em; }
/* v0.11: watch an opening */
.tips-card { background: #fff8db; padding: .7rem .9rem; }
.tips-card ul { margin: .3rem 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .25rem; }
.line-note.current { box-shadow: 0 0 0 2px var(--grape); }
/* black & white board: readable square names on the dark squares, a dark frame */
body.board-bw .sq.d .coord { color: #fff; opacity: .7; }
body.board-bw .board { background: #111; box-shadow: 0 0 0 6px #111, 0 10px 28px rgba(0,0,0,.3); }
body.board-bw .sq.d.last { background: #6b6a3a; }
body.board-bw .sq.l.last { background: #e6e2a8; }
/* full-screen board (focus.js): double-tap a square, or ⛶ */
.focus-open { position: absolute; right: -6px; bottom: -6px; z-index: 5; width: 2rem; height: 2rem; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: pointer; font-size: 1rem; padding: 0; line-height: 1; }
.focus-bar { display: none; }
body.board-focus { overflow: hidden; }
body.board-focus .focus-wrap { position: fixed; inset: 0; z-index: 900; margin: 0; padding: 6px 6px max(6px, env(safe-area-inset-bottom));
  background: #1b1930; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
body.board-focus .focus-wrap > * { width: min(calc(100vw - 12px), calc(100dvh - 170px)); max-width: none; }
body.board-focus .focus-wrap .board { border-width: 4px; border-radius: 10px; }
body.board-focus .focus-wrap .pc { font-size: min(10.5vw, 9dvh); }
body.board-focus .focus-wrap .captured, body.board-focus .focus-wrap .players .p { background: rgba(255,255,255,.92); }
body.board-focus .focus-bar { display: flex; align-items: center; gap: .5rem; background: #fff; border-radius: 14px; padding: .35rem .5rem .35rem .8rem;
  font-weight: 800; font-size: .95rem; min-height: 2.4rem; }
body.board-focus .focus-say { flex: 1; }
body.board-focus .focus-exit { border: 0; background: #f1ecff; border-radius: 50%; width: 2rem; height: 2rem; padding: 0; cursor: pointer; font-size: 1rem; }
body.board-focus .focus-open { display: none; }
.modal { z-index: 1000; }

/* a tap was heard: dim the tapped card and run a thin bar on top while the next page loads (forms.js) */
.cq-tapped { opacity: .6; transform: scale(.98); transition: opacity .1s, transform .1s; }
html.cq-leaving::before { content: ""; position: fixed; top: 0; left: 0; height: 4px; width: 100%; z-index: 9999;
  background: linear-gradient(90deg, transparent, var(--grape, #7b5cff), transparent); background-size: 50% 100%;
  background-repeat: no-repeat; animation: cq-load 0.9s linear infinite; }
@keyframes cq-load { from { background-position: -50% 0 } to { background-position: 150% 0 } }

/* picture avatars (avatars.py): sized by the surrounding text, with the player's emoji as a small badge */
.av { position: relative; display: inline-block; width: 1.25em; height: 1.25em; vertical-align: middle; line-height: 1; }
.av img { width: 100%; height: 100%; border-radius: 50%; display: block; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.av .av-em { position: absolute; right: -.12em; bottom: -.08em; font-size: .42em; background: #fff; border-radius: 50%;
  padding: .08em; box-shadow: 0 1px 3px rgba(0,0,0,.25); line-height: 1; }
.chip .av .av-em { display: none; }
.av-pick { flex-basis: 100%; }
.av-pick summary { cursor: pointer; font-weight: 700; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: .4rem; margin: .5rem 0; }
.av-grid label { display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; aspect-ratio: 1; }
.av-grid label:has(input:checked) { border-color: var(--grape, #7b5cff); }
.av-grid input { position: absolute; opacity: 0; pointer-events: none; }
.av-grid img { width: 100%; height: 100%; border-radius: 50%; }
.av-grid .av-none { font-size: 2rem; }
.parents-watching { display: block; margin: .4rem 0; background: #fff6c9; }
.look-link { position: relative; text-decoration: none; }
.look-link .look-edit { position: absolute; left: 0; bottom: 0; font-size: .3em; background: #fff; border-radius: 50%;
  padding: .15em; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.em-grid .em-pick { font-size: 2rem; }
.plan-form { display: flex; flex-wrap: wrap; gap: .2rem .6rem; font-size: .85rem; align-items: center; }
.plan-form label { white-space: nowrap; }
.learn-group { border: 2px solid #ece8ff; border-radius: 16px; margin: .8rem 0; padding: .4rem .8rem .7rem; }
.learn-group legend { display: flex; gap: .4rem; align-items: center; }
.lesson-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem .8rem; }
.lesson-checks.off { opacity: .4; }

/* 🧑‍🏫 tutor mode */
.palette { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; margin-top: .6rem; max-width: 520px; }
.palette button { padding: .2rem; border-radius: 12px; background: #fff; border: 3px solid transparent; box-shadow: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; min-height: 2.6rem; }
.palette button .pc { font-size: 1.9rem; }
.palette button.on { border-color: var(--grape, #7b5cff); background: #ebe5ff; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0 .6rem; }
.tabs button { background: #f1eeff; box-shadow: none; font-size: .9rem; padding: .35rem .7rem; }
.tabs button.on { background: var(--grape, #7b5cff); color: #fff; }
.bad-note { color: #b3261e; font-weight: 700; }
.bad-note:empty { display: none; }
.tutor-strip { display: flex; align-items: center; gap: .8rem; text-decoration: none; margin: 1rem 0 0;
  background: linear-gradient(120deg, #fff, #fff3d6); }
.tutor-strip .em { font-size: 2.4rem; }
.tutor-strip .grow { flex: 1; }
