/* app.css — PandaBookUp. iPad landscape first, then portrait, then phone.
   Home is a game lobby (blue checkered hero, one big Play); Play is a big
   square board with the panda coach beside it (below it on narrow screens). */

:root {
  --bg: #0d1220;
  --bg-2: #141b2d;
  --card: #1a2338;
  --card-2: #233050;
  --glass: rgba(255, 255, 255, .055);
  --ink: #f4f6fb;
  --ink-dim: #a9b3c9;
  --line: #2e3b5a;
  --navy: #0F2747;
  --blue: #2E6CB8;
  --accent: #7dc4ff;
  --gold: #ffcf5a;
  --gold-ink: #2a1e00;
  --good: #52d48f;
  --warn: #ff8a7a;
  --white-side: #f4f1e8;
  --black-side: #1b1f29;
  --radius: 20px;
  --pad: 16px;
  --head: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; min-height: 100%;
  background: radial-gradient(1100px 700px at 50% -20%, #1b2a4a 0%, transparent 70%), var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
h1, h2, .card-title, .cele-h, .stat-v, .play-btn { font-family: var(--head); }

/* Line icons (no emoji anywhere) and the panda logo standing in for the
   mascot. The round logo sits on white; the full-body panda gets a thin
   white die-cut outline on dark and blue, never an inverted panda. */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ic .fill { fill: currentColor; }
img.face { display: block; box-sizing: border-box; background: #fff; border-radius: 50%; padding: 3px; object-fit: contain; }
.diecut { filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 10px 18px rgba(0,0,0,.35)); }
.ex-book .ic { width: 1.1em; height: 1.1em; vertical-align: -2px; stroke-width: 3; }

/* ---- header (library, settings, explore, admin; home and play have their own) */
.app-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--pad) 6px; padding-right: 120px;
  max-width: 980px; margin: 0 auto;
}
body[data-screen="menu-screen"] .app-header, body[data-screen="drill-screen"] .app-header { display: none; }
.app-logo { width: 42px; height: 42px; box-sizing: border-box; padding: 3px; border-radius: 50%; background: #fff; object-fit: contain; }
.app-title h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.app-title p { margin: 2px 0 0; color: var(--ink-dim); font-size: 13px; }

main { max-width: 980px; margin: 0 auto; padding: 8px var(--pad) 40px; }
body[data-screen="drill-screen"] main { max-width: none; padding: 0; }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card-2); cursor: pointer;
  font-size: 17px; font-weight: 600; transition: transform .08s ease, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 42px; padding: 8px 14px; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }
.play-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 72px; padding: 14px 40px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 55%, #f2b632); color: var(--gold-ink);
  font-size: 30px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 6px 0 #c48a12, 0 14px 30px rgba(0,0,0,.35);
  transition: transform .1s ease, box-shadow .1s ease;
}
.play-btn .ic { width: 28px; height: 28px; }
.play-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #c48a12, 0 8px 18px rgba(0,0,0,.3); }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn .ic { width: 24px; height: 24px; }

/* ---- home -------------------------------------------------------------- */
/* The blue checkered hero (SundayClass): navy to blue, a faint chessboard
   fading downward, the full-body panda on the left. */
.hero {
  position: relative; overflow: hidden; margin: 8px 0 0; border-radius: 28px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 28px;
  padding: 30px 36px 34px;
  background:
    radial-gradient(ellipse 60% 70% at 25% 40%, rgba(96,150,220,.38), transparent 70%),
    linear-gradient(150deg, var(--navy) 0%, #1A3D70 55%, var(--blue) 100%);
  box-shadow: 0 24px 50px -20px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12);
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .08; pointer-events: none;
  background: repeating-conic-gradient(#fff 0 25%, transparent 0 50%) 0 0 / 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%); mask-image: linear-gradient(to bottom, #000, transparent 90%);
}
.hero > * { position: relative; }
.hero-panda { width: 170px; height: auto; animation: bob 3.2s ease-in-out infinite; }
.hero-panda { filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 14px 18px rgba(0,0,0,.35)); }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); background: rgba(255,255,255,.08); border: 1px solid rgba(255,207,90,.4); padding: 4px 12px; border-radius: 20px; }
.hero h1 { margin: 12px 0 4px; font-size: clamp(36px, 5.4vw, 56px); line-height: 1; font-weight: 800; letter-spacing: -.02em; }
.hero-say { margin: 0 0 20px; font-size: 20px; font-weight: 600; color: #dce8fb; }
.play-sub { margin-top: 12px; font-size: 14px; color: #c6d6ef; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0 6px; }
.stat { padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); display: grid; gap: 4px; align-content: start; }
.stat-k { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.stat-v { font-size: 38px; font-weight: 800; line-height: 1.05; }
.stat-v small { font-size: 16px; font-weight: 600; color: var(--ink-dim); font-family: Inter, system-ui, sans-serif; }
.stat-s { font-size: 13px; color: var(--ink-dim); }
.stat:first-child .stat-v { color: var(--gold); }
.goal { display: flex; gap: 8px; padding: 6px 0 3px; }
.goal i { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); background: transparent; }
.goal i.on { border-color: var(--good); background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230d1220' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat; }
.bar { height: 10px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--good)); transition: width .6s ease; }

.section-h { margin: 22px 0 10px; color: var(--ink-dim); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.stamp { margin-top: 24px; color: var(--ink-dim); font-size: 12px; text-align: center; opacity: .8; }

.plan { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin: 0 0 18px; padding: 0; list-style: none; }
.card {
  position: relative; width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: center;
  padding: 12px 16px 12px 12px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), #172036); border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  transition: transform .1s ease, border-color .15s;
}
.card:active { transform: scale(.985); }
.card.k-review { border-left-color: var(--good); }
.card.k-chain { border-left-color: #c9a6ff; }
.card.k-full { border-left-color: var(--gold); }
.card.empty { grid-template-columns: 56px 1fr; cursor: default; border-left-color: var(--line); }
.card-body { display: grid; gap: 3px; min-width: 0; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.k-review .tag { color: var(--good); } .k-chain .tag { color: #c9a6ff; } .k-full .tag { color: var(--gold); }
.pips { display: inline-flex; gap: 3px; margin-left: auto; }
.card-top .pips { margin-right: 2px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.pips i.on { background: var(--good); }
.card-title { font-size: 20px; font-weight: 700; line-height: 1.15; }
.card-sub { color: #cfd7e8; font-size: 15px; font-weight: 500; }
.card-moves { color: var(--gold); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* White / Black, said with a piece-colored disc, never a flag. */
.side { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px 3px 4px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); white-space: nowrap; }
.side i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #8794b0; }
.side-w i { background: var(--white-side); }
.side-b i { background: var(--black-side); }
.side b { font-weight: 800; }

/* Mini board: an explicit 8 x 8 grid, square, h1 light (square-board rule). */
.mini { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1 / 1; width: 100%; border-radius: 8px; overflow: hidden; border: 3px solid #0b1324; box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.mini i { position: relative; min-width: 0; min-height: 0; overflow: hidden; display: block; }
.mini i.l { background: var(--ml); } .mini i.d { background: var(--md); }
.mini i.hl::before { content: ""; position: absolute; inset: 0; background: rgba(250, 204, 21, .45); }
.mini img { position: absolute; inset: 4%; width: 92%; height: 92%; }

.home-foot { margin-top: 4px; }

/* ---- play ---------------------------------------------------------------- */
.play { min-height: 100dvh; display: flex; flex-direction: column; }
.play-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.play-logo { width: 40px; height: 40px; border-radius: 50%; background: #fff; padding: 3px; flex: none; }
.session { flex: 1; display: grid; gap: 6px; min-width: 0; }
.session-k { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 15px; }
.session-k > span:first-child { font-family: var(--head); font-size: 18px; }
.session-bar { display: flex; gap: 6px; }
.session-bar i { flex: 1; height: 10px; border-radius: 99px; background: var(--card-2); }
.session-bar i.done { background: var(--good); }
.session-bar i.now { background: linear-gradient(90deg, var(--gold), #ffe7a3); box-shadow: 0 0 10px rgba(255,207,90,.5); }

.play-grid { flex: 1; display: grid; align-content: start; grid-template-columns: auto minmax(290px, 340px); justify-content: center; align-items: start; gap: 20px; padding: 0 16px 16px; }
.play .board-wrap { position: relative; width: auto; margin: 0; }
/* The board takes all the height it can and stays square. */
.play .pb-root { --pb-size: min(calc(100dvh - 84px), calc(100vw - 400px)); --pb-gutter: 1.3rem; }
.coach { display: flex; flex-direction: column; gap: 14px; padding-top: 1.3rem; }
.coach-title h2 { margin: 0; font-size: 26px; line-height: 1.1; letter-spacing: -.01em; }
.coach-title .sub { color: var(--ink-dim); font-size: 15px; margin-top: 4px; }

.bubble {
  position: relative; display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: end;
  padding: 16px 16px 16px 12px; min-height: 120px; border-radius: 24px;
  background: var(--card); border: 1px solid var(--line);
}
.coach-panda { width: 84px; height: auto; align-self: end; transition: transform .2s; }
.coach-panda { filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff); }
.speech { position: relative; align-self: center; background: #fff; color: #15203a; border-radius: 18px; padding: 14px 16px; font-size: 20px; line-height: 1.3; font-weight: 700; min-height: 56px; }
.speech::before { content: ""; position: absolute; left: -9px; bottom: 18px; border: 9px solid transparent; border-right-color: #fff; border-left: 0; }
.speech .why { display: block; }
.speech .why:empty { display: none; }
.speech .tip { display: block; color: #55607a; font-size: 15px; font-weight: 600; margin-top: 4px; }
.speech .tip:empty { display: none; }
.bubble.win { border-color: rgba(82,212,143,.6); box-shadow: 0 0 0 3px rgba(82,212,143,.15); }
.bubble.win .coach-panda { animation: hop .5s; }
.bubble.miss { border-color: rgba(255,207,90,.6); }
.bubble.miss .coach-panda { animation: tilt .45s; }
.bubble.show { border-color: rgba(255,207,90,.6); }
@keyframes hop { 0%,100% { transform: translateY(0) } 40% { transform: translateY(-14px) } }
@keyframes tilt { 0%,100% { transform: rotate(0) } 30% { transform: rotate(-7deg) } 70% { transform: rotate(5deg) } }

.moves { display: flex; flex-wrap: wrap; gap: 6px; }
.mv { display: inline-flex; align-items: baseline; gap: 3px; min-width: 46px; justify-content: center; padding: 6px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 16px; color: var(--ink-dim); }
.mv small { font-size: 12px; opacity: .7; font-weight: 600; }
.mv.you { color: var(--ink); border-color: rgba(82,212,143,.55); background: rgba(82,212,143,.1); }
.mv.ask { color: var(--gold-ink); background: var(--gold); border-color: transparent; animation: breathe 1.4s ease-in-out infinite; }
.mv.todo { background: transparent; border-style: dashed; min-height: 34px; }
@keyframes breathe { 0%,100% { transform: scale(1) } 50% { transform: scale(1.06) } }

.pockets-wrap { display: flex; align-items: center; gap: 12px; }
.pockets-k { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.pockets { display: flex; gap: 10px; }
.pocket { display: flex; gap: 4px; padding: 6px 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.pocket i { width: 14px; height: 14px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); transition: background .2s, transform .2s; }
.pocket i.got { background: var(--gold); border-color: var(--gold); transform: scale(1.1); }
.pocket.full { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,207,90,.35); }
.drill-foot { display: flex; gap: 10px; }
.drill-foot .btn { white-space: nowrap; }

/* Highlights the page paints through PandaBoard.highlight(sq, kind). */
/* Pieces sit above the highlight wash, so a moved piece is never tinted. */
.pb-sq img { position: relative; z-index: 6; }
.pb-hl { position: absolute; inset: 0; pointer-events: none; border-radius: 4px; }
.pb-hl-sel  { background: rgba(125, 196, 255, .45); }
.pb-hl-last { background: rgba(255, 207, 90, .35); }
.pb-hl-hint { box-shadow: inset 0 0 0 5px var(--gold); animation: glow 1s infinite alternate; }
.pb-hl-dot  { background: radial-gradient(circle, rgba(13,18,32,.35) 0 18%, transparent 20%); }
@keyframes glow { from { box-shadow: inset 0 0 0 3px var(--gold) } to { box-shadow: inset 0 0 0 7px var(--gold) } }
/* A right move: a green ring opens out from the square. */
.pop-ring { position: absolute; inset: 6%; border-radius: 50%; border: 5px solid var(--good); pointer-events: none; z-index: 30; animation: ring .65s ease-out forwards; }
@keyframes ring { from { transform: scale(.4); opacity: 1 } to { transform: scale(1.5); opacity: 0 } }
.board-wrap.nudge { animation: nudge .35s; }
@keyframes nudge { 0%,100% { transform: translateX(0) } 30% { transform: translateX(-5px) } 70% { transform: translateX(5px) } }
/* Drag and drop: the piece follows the finger; its square shows a faint copy. */
#board { user-select: none; -webkit-user-select: none; }
.drag-ghost { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -50%) scale(1.12); filter: drop-shadow(0 10px 12px rgba(0,0,0,.6)); }
.pb-sq.is-from img { opacity: .28; }

/* The celebration: a card over the board, paper confetti, the panda hops. */
.celebrate { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(8, 12, 24, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); padding: 16px; animation: fade .2s; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }
@keyframes fade { from { opacity: 0 } }
.cele-card { position: relative; width: min(440px, 100%); text-align: center; padding: 26px 26px 20px; border-radius: 28px; overflow: hidden;
  background: linear-gradient(160deg, var(--navy), #1A3D70 60%, var(--blue)); box-shadow: 0 30px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.15);
  display: grid; justify-items: center; gap: 8px; animation: popin .35s cubic-bezier(.2,1.4,.4,1); }
.cele-card::before { content: ""; position: absolute; inset: 0; opacity: .08; pointer-events: none; background: repeating-conic-gradient(#fff 0 25%, transparent 0 50%) 0 0 / 48px 48px; -webkit-mask-image: linear-gradient(#000, transparent 80%); mask-image: linear-gradient(#000, transparent 80%); }
.cele-card > * { position: relative; }
@keyframes popin { from { transform: scale(.7); opacity: 0 } }
.cele-panda { width: 112px; height: auto; animation: hop .6s .2s 2; filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 10px 14px rgba(0,0,0,.35)); }
.cele-h { font-size: 40px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.cele-sub { color: #cfe0f7; font-size: 16px; }
.cele-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.cele-chips span { font-size: 14px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); }
.cele-chips span:empty { display: none; }
.cele-card .play-btn { font-size: 24px; min-height: 64px; padding: 12px 32px; }
.cele-card .btn.ghost { border-color: rgba(255,255,255,.25); margin-top: 4px; }

/* ---- portrait iPad and phones: the board on top, the coach under it ----- */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .play-grid { grid-template-columns: 1fr; justify-items: center; gap: 12px; padding: 0 10px 16px; }
  .play .pb-root { --pb-size: min(calc(100vw - 20px), calc(100dvh - 390px)); --pb-gutter: 1.1rem; }
  .coach { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .coach .bubble { grid-column: 1 / -1; }
  .coach .moves { grid-column: 1 / -1; }
  .coach { width: min(100%, 720px); padding-top: 0; gap: 10px; }
  .coach-title { display: none; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 22px 18px 26px; }
  .hero-panda { width: 110px; }
  .hero h1 { margin-top: 8px; }
  .hero-say { font-size: 17px; margin-bottom: 16px; }
  .play-btn { width: 100%; font-size: 26px; min-height: 64px; }
  .stats { gap: 8px; }
  .stat { padding: 10px 10px; }
  .stat-v { font-size: 28px; }
  .goal i { width: 22px; height: 22px; border-width: 2px; }
  .goal { gap: 5px; }
  .stat-s { font-size: 12px; }
  .plan { grid-template-columns: 1fr; }
  .card { grid-template-columns: 84px 1fr; gap: 12px; }
  .card-title { font-size: 18px; }
  .card-sub { font-size: 14px; }
  .bubble { grid-template-columns: 60px 1fr; min-height: 0; padding: 10px 10px 10px 8px; }
  .coach-panda { width: 60px; }
  .speech { font-size: 17px; padding: 10px 12px; min-height: 0; }
  .speech .tip { font-size: 14px; }
  .play-top { padding: 8px 10px; gap: 10px; }
  .play-logo { display: none; }
  .mv { min-width: 40px; font-size: 14px; padding: 5px 8px; }
  .cele-h { font-size: 32px; }
  .pockets-k { display: none; }
  .pockets { gap: 6px; }
  .pocket { padding: 5px 6px; gap: 3px; }
  .pocket i { width: 12px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-panda, .mv.ask, .cele-panda, .bubble .coach-panda { animation: none !important; }
}

/* ---- library / settings ------------------------------------------------ */
.drill-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.drill-top h2 { margin: 0; font-size: 24px; }
.drill-top .sub { color: var(--ink-dim); font-size: 13px; }
.lines { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.line-card { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.lc-body { min-width: 0; }
.line-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.line-card .name { font-family: var(--head); font-weight: 700; font-size: 20px; }
.line-card .blurb { color: var(--ink-dim); font-size: 14px; margin: 4px 0 10px; }
.lc-n { color: var(--gold); font-weight: 600; white-space: nowrap; }
.line-card .chunks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
@media (max-width: 560px) { .line-card { grid-template-columns: 84px 1fr; gap: 12px; padding: 12px; } .line-card .top { flex-wrap: wrap; } .line-card .name { font-size: 18px; } .line-card .row { grid-column: 1 / -1; } }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); }
.chip.known { border-color: var(--good); color: var(--good); }
.chip.due { border-color: var(--gold); color: var(--gold); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting label { font-weight: 600; }
select { font: inherit; padding: 8px 10px; border-radius: 10px; background: var(--card-2); color: var(--ink); border: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 18px; font-weight: 600; z-index: 95; max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.on { opacity: 1; }

/* Explore keeps the older two-column layout with the round logo in its bubble. */
.drill-grid .board-wrap { width: min(100%, 520px); margin: 0 auto; }
.drill-grid .bubble { display: block; padding: 14px 16px 14px 64px; min-height: 64px; font-size: 18px; line-height: 1.35; font-weight: 600; }
.drill-grid .bubble .face { position: absolute; left: 12px; top: 12px; width: 40px; height: 40px; }
.drill-grid .bubble .why { display: block; }
.drill-grid .bubble .tip { display: block; color: var(--ink-dim); font-size: 14px; font-weight: 500; margin-top: 4px; }
.drill-grid .moves { display: block; color: var(--ink-dim); font-size: 14px; text-align: center; margin: 6px 0 10px; }
.drill-grid .moves b { color: var(--gold); }
@media (min-width: 640px) {
  .drill-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
  .drill-grid .board-wrap { width: 100%; }
}

/* ---- explore ----------------------------------------------------------- */
.ex-nav { margin: 0 0 8px; }
.ex-nav { flex-wrap: nowrap; }
.ex-nav .btn { flex: 1 1 0; min-width: 0; min-height: 56px; font-size: 22px; }
.btn:disabled { opacity: .35; cursor: default; }
.ex-depth { text-transform: none; letter-spacing: 0; }
.ex-lines { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.ex-line {
  display: grid; grid-template-columns: 14px 1fr auto; grid-template-areas: "dot move eval" ". pv pv" ". verdict verdict";
  gap: 2px 10px; align-items: center; padding: 10px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); cursor: pointer;
}
.ex-line.focus { border-color: var(--accent); }
.ex-dot { grid-area: dot; width: 12px; height: 12px; border-radius: 50%; }
.ex-dot.green { background: rgba(34, 197, 94, .9); } .ex-dot.blue { background: rgba(59, 130, 246, .9); } .ex-dot.yellow { background: rgba(234, 179, 8, .9); }
.ex-move { grid-area: move; font-weight: 700; font-size: 18px; }
.ex-book { font-size: 12px; font-weight: 600; color: var(--gold); margin-left: 6px; }
.ex-eval { grid-area: eval; font-variant-numeric: tabular-nums; font-weight: 700; }
.ex-pv { grid-area: pv; color: var(--ink-dim); font-size: 13px; }
.ex-verdict { grid-area: verdict; color: var(--ink-dim); font-size: 12px; }
.ex-empty { color: var(--ink-dim); padding: 10px 2px; }


/* ---- admin (?admin=1) ---------------------------------------------------- */
.adm textarea, .adm input[type=text], .adm input[type=number], .adm select { width: 100%; box-sizing: border-box; font: inherit; padding: .5rem .6rem; border-radius: .6rem; border: 1px solid rgba(127,127,127,.4); background: rgba(255,255,255,.06); color: inherit; }
.adm textarea { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.adm .setting input[type=text] { max-width: 24rem; }
.adm input[type=range] { width: 100%; max-width: 20rem; }
.adm-edit { padding: .8rem; border-radius: .9rem; border: 1px solid rgba(127,127,127,.35); margin: .6rem 0 1rem; }
.adm-edit label { display: block; margin: .45rem 0; font-size: .85rem; opacity: .9; }
.adm-row .adm-moves { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; opacity: .85; }
.adm-star { color: #f5b800; }

/* Red-pen review: board on the left, one row per move the child plays. */
.adm-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.rv { display: grid; gap: 14px; margin: 10px 0; }
.rv-board-wrap { width: min(100%, 360px); margin: 0 auto; }
.rv-caption { color: var(--ink-dim); font-size: 13px; text-align: center; margin-top: 6px; }
.rv-rows { display: grid; gap: 6px; }
.rv-chunk { margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); display: grid; gap: 6px; }
.rv-chunk-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); }
.rv-row { display: grid; grid-template-columns: 76px 1fr auto; grid-template-areas: "mv note start" ". warn warn"; gap: 2px 8px; align-items: center; padding: 4px 6px; border-radius: 10px; border: 1px solid transparent; }
.rv-row.focus { border-color: var(--gold); background: rgba(255, 207, 90, .06); }
.rv-mv { grid-area: mv; text-align: left; background: none; border: 0; padding: 6px 4px; cursor: pointer; font-family: ui-monospace, Menlo, monospace; font-weight: 700; color: var(--gold); }
.rv-row .rv-note { grid-area: note; resize: vertical; font-family: inherit; font-size: 15px; line-height: 1.35; }
.rv-start { grid-area: start; font-size: 12px; color: var(--ink-dim); white-space: nowrap; display: flex !important; align-items: center; gap: 4px; margin: 0 !important; }
.rv-warn { grid-area: warn; color: var(--warn); font-size: 12px; min-height: 0; }
.rv-warn:empty { display: none; }
.rv-warn-inline { color: var(--warn); font-weight: 600; }
.rv-tag { font-size: 12px; font-weight: 600; color: var(--ink-dim); margin-left: 6px; }
.rv-tag.done { color: var(--good); }
.rv-tag.changed { color: var(--gold); }
.rv-help { text-align: left; margin-top: 4px; }
@media (min-width: 760px) {
  .rv { grid-template-columns: 340px 1fr; align-items: start; }
  .rv-board-wrap { position: sticky; top: 10px; width: 100%; }
}
/* Dad's screen gets the width a laptop has; the kids' screens stay narrow. */
main:has(> #admin-screen:not([hidden])) { max-width: 1100px; }
