/* AssessTalk. Colour tokens on :root, dark mode by the system setting. Sticky notes: yellow = waiting to talk,
   green = talked and written down (a coin), grey = removed by the teacher, red = flagged (a red card). */
:root{
  --bg:#f6f4ee; --surface:#ffffff; --surface-2:#efece3; --ink:#1d2330; --muted:#5f6675; --border:#e2ddd0; --border-strong:#c9c2b1;
  --brand:#1f6f78; --brand-ink:#ffffff; --brand-soft:#dcefed; --sun:#ffd65c; --bad:#b42318; --bad-soft:#fdecea; --ok-soft:#e3f4ea;
  --paper-asked:#fff1a8; --paper-done:#d6f2e1; --paper-removed:#eceff3; --paper-flagged:#fde3e1; --note-ink:#2b2a1e;
  --radius:16px; --shadow:0 1px 2px rgba(20,20,10,.05), 0 8px 24px -12px rgba(20,20,10,.18);
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --bg:#12161c; --surface:#1a2029; --surface-2:#232b36; --ink:#e8ebf0; --muted:#9aa3b2; --border:#2c3441; --border-strong:#3c4656;
  --brand:#4fb3bd; --brand-ink:#0d1a1c; --brand-soft:#1c3336; --bad:#ff8a7a; --bad-soft:#3a1f1c; --ok-soft:#1b3326;
  --paper-asked:#f3e27f; --paper-done:#b9e6cb; --paper-removed:#c9ced6; --paper-flagged:#f7c6c0;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
} }
:root[data-theme="dark"]{
  --bg:#12161c; --surface:#1a2029; --surface-2:#232b36; --ink:#e8ebf0; --muted:#9aa3b2; --border:#2c3441; --border-strong:#3c4656;
  --brand:#4fb3bd; --brand-ink:#0d1a1c; --brand-soft:#1c3336; --bad:#ff8a7a; --bad-soft:#3a1f1c; --ok-soft:#1b3326;
  --paper-asked:#f3e27f; --paper-done:#b9e6cb; --paper-removed:#c9ced6; --paper-flagged:#f7c6c0;
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{ margin:0; background:var(--bg); color:var(--ink); font:16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3{ font-family:Outfit, Inter, system-ui, sans-serif; line-height:1.2; margin:0 0 .5em; letter-spacing:-.01em; }
h1{ font-size:clamp(28px, 4vw, 40px); font-weight:800; } h2{ font-size:22px; font-weight:700; } h3{ font-size:18px; font-weight:700; }
a{ color:var(--brand); } a:hover{ text-decoration-thickness:2px; }
p{ margin:0 0 .8em; }
.wrap{ max-width:960px; margin:0 auto; padding:0 16px; }
.wrap.wide{ max-width:1180px; }
main.wrap{ padding-top:28px; padding-bottom:56px; min-height:60vh; }
.muted{ color:var(--muted); } .small{ font-size:14px; }
.lead{ font-size:18px; color:var(--muted); max-width:62ch; }
.eyebrow{ font:700 13px/1.3 Inter, sans-serif; letter-spacing:.06em; text-transform:uppercase; color:var(--brand); margin:0 0 6px; }
.eyebrow a{ color:inherit; }

/* top bar */
.topbar{ background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:10; }
.topbar-in{ display:flex; align-items:center; gap:16px; min-height:60px; flex-wrap:wrap; }
.brand{ display:inline-flex; align-items:center; gap:8px; text-decoration:none; color:var(--ink); font:600 22px Outfit, sans-serif; }
.brand b{ color:var(--brand); font-weight:800; }
.brand .logo{ width:34px; height:34px; }
.brand-sm{ font-size:17px; } .brand-sm .logo{ width:24px; height:24px; }
.topnav{ margin-left:auto; display:flex; align-items:center; gap:6px 16px; flex-wrap:wrap; font-weight:600; font-size:15px; }
.topnav a{ text-decoration:none; color:var(--ink); } .topnav a:hover{ color:var(--brand); }
.topnav a.btn{ color:var(--brand-ink); }
.who{ display:inline-grid; place-items:center; width:32px; height:32px; border-radius:50%; background:var(--brand-soft); color:var(--brand); font-weight:800; }
.inline{ display:inline; margin:0; }

/* buttons, forms */
.btn{ display:inline-flex; align-items:center; gap:6px; font:600 15px/1 Inter, sans-serif; padding:11px 18px; border-radius:999px; border:1.5px solid var(--brand);
  background:var(--brand); color:var(--brand-ink); text-decoration:none; cursor:pointer; list-style:none; }
.btn:hover{ filter:brightness(1.07); }
.btn-ghost{ background:transparent; color:var(--brand); }
.btn-sm{ padding:7px 13px; font-size:14px; }
.linkbtn{ font:inherit; font-size:14px; background:none; border:none; padding:0; color:var(--brand); cursor:pointer; text-decoration:underline; list-style:none; }
.linkbtn.danger{ color:var(--bad); }
summary.btn::-webkit-details-marker, summary.linkbtn::-webkit-details-marker{ display:none; }
label{ font-weight:600; font-size:14px; display:grid; gap:4px; }
input, select, textarea{ font:inherit; font-size:15px; color:var(--ink); background:var(--surface); border:1.5px solid var(--border-strong); border-radius:10px; padding:9px 11px; width:100%; min-width:0; }
input:focus, select:focus, textarea:focus{ outline:2px solid var(--brand); outline-offset:1px; border-color:var(--brand); }
textarea{ resize:vertical; }
.code-input{ font:700 20px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing:.18em; text-transform:uppercase; }
.stack{ display:grid; gap:10px; }
.stack > .btn{ justify-self:start; }
.row{ display:flex; flex-wrap:wrap; gap:10px; align-items:end; }
.row > label{ flex:0 1 auto; } .row > .grow{ flex:1 1 220px; }
.flash{ padding:12px 16px; border-radius:12px; background:var(--ok-soft); margin:0 0 18px; font-weight:600; }
.flash-bad{ background:var(--bad-soft); color:var(--bad); }
.note{ color:var(--muted); font-size:14px; }
.pill{ font:700 13px Inter, sans-serif; background:var(--surface-2); color:var(--muted); border-radius:99px; padding:2px 10px; vertical-align:middle; }

/* cards, layout */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); margin:0 0 18px; }
.card.narrow{ max-width:560px; margin:24px auto; }
.two{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap:0 18px; align-items:start; }
.cards{ display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap:16px; margin:0 0 26px; }
.pagehead{ display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-end; gap:16px 28px; margin:0 0 22px; }
.sect{ display:flex; align-items:center; gap:10px; margin:30px 0 14px; }
.plain{ list-style:none; margin:0 0 14px; padding:0; }
.classes li{ padding:6px 0; border-bottom:1px solid var(--border); }
.table{ width:100%; border-collapse:collapse; background:var(--surface); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); font-size:15px; }
.table th, .table td{ text-align:left; padding:10px 14px; border-bottom:1px solid var(--border); vertical-align:top; }
.table th{ font-size:13px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); background:var(--surface-2); }
.table tr.st-pending td{ background:color-mix(in srgb, var(--sun) 18%, transparent); }
@media (max-width:700px){ .table{ display:block; overflow-x:auto; } }

/* home */
.hero{ display:grid; grid-template-columns:1.3fr 1fr; gap:32px; align-items:center; padding:24px 0 36px; }
.hero h1 span{ color:var(--brand); }
.hero .actions{ display:flex; gap:10px; flex-wrap:wrap; }
.hero-notes{ position:relative; min-height:260px; }
.hero-notes .n-asked{ --tilt:-3deg; width:78%; } .hero-notes .n-done{ --tilt:2.5deg; width:82%; margin:-14px 0 0 auto; }
@media (max-width:760px){ .hero{ grid-template-columns:1fr; } .hero-notes{ min-height:0; } }
.steps{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap:14px; margin:0 0 26px; }
.steps > div{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; position:relative; }
.steps span{ position:absolute; top:14px; right:16px; font:800 28px Outfit, sans-serif; color:var(--surface-2); }
.steps p{ color:var(--muted); font-size:15px; margin:0; }
.why blockquote{ margin:0 0 14px; padding:14px 18px; border-left:5px solid var(--brand); background:var(--brand-soft); border-radius:0 12px 12px 0; font-size:18px; }
.why cite{ display:block; margin-top:8px; font-size:14px; font-style:normal; color:var(--muted); }
.login{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap:18px; scroll-margin-top:80px; }
.login .card.pick{ outline:3px solid var(--sun); }
.gbtn{ min-height:44px; margin:6px 0; } .gbtn.busy{ opacity:.5; pointer-events:none; }
.gerr{ color:var(--bad); font-size:14px; margin:0; } .gerr:empty{ display:none; }
.prose{ max-width:760px; margin:0 auto; } .prose h2{ margin-top:1.3em; } .prose li{ margin:0 0 6px; }

/* sticky notes */
.wall{ display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap:24px 18px; align-items:start; }
.note-card{ --paper:var(--paper-asked); position:relative; background:var(--paper); color:var(--note-ink); padding:22px 16px 14px; border-radius:3px 3px 16px 3px;
  box-shadow:0 14px 20px -16px rgba(40,35,0,.6); transform:rotate(var(--tilt, 0deg)); min-width:0; }
.note-card::before{ content:""; position:absolute; top:-9px; left:50%; width:74px; height:20px; margin-left:-37px; background:rgba(255,255,255,.55); border:1px solid rgba(0,0,0,.05); transform:rotate(-2deg); }
.note-card.n-done{ --paper:var(--paper-done); } .note-card.n-removed{ --paper:var(--paper-removed); color:#5d6672; } .note-card.n-flagged{ --paper:var(--paper-flagged); color:#6b2320; }
.note-card small{ display:block; font-size:12.5px; color:rgba(0,0,0,.6); margin:0 0 6px; overflow-wrap:anywhere; }
.note-card p{ margin:0 0 8px; overflow-wrap:anywhere; }
.note-card .q, .hero-notes p{ font:600 17px/1.35 Outfit, sans-serif; }
.note-card .rec{ font-size:14.5px; background:rgba(255,255,255,.55); border-radius:8px; padding:8px 10px; margin:0 0 8px; overflow-wrap:anywhere; }
.note-card .rec span{ display:block; font-size:11.5px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:rgba(0,0,0,.5); margin-bottom:3px; }
.note-card .when{ font-size:12.5px; color:rgba(0,0,0,.58); }
.note-card .acts{ margin:0 0 8px; } .note-card .acts[open] > summary{ margin-bottom:8px; }
.note-card .linkbtn{ color:#1b4f55; }
.note-card textarea{ background:rgba(255,255,255,.85); color:var(--note-ink); border-color:rgba(0,0,0,.2); }
.note-card .write{ display:grid; gap:6px; } .note-card .write label{ font-size:13.5px; } .note-card .write .btn{ justify-self:start; }
.purse{ display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:12px 18px 12px 12px; }
.purse b{ display:block; font:700 20px Outfit, sans-serif; } .purse span{ display:block; color:var(--muted); font-size:13px; }
.purse .reds{ color:var(--bad); margin-top:4px; }
.coin{ display:inline-grid !important; place-items:center; width:52px; height:52px; border-radius:50%; font:800 22px Outfit, sans-serif; color:#6b4a00 !important;
  background:radial-gradient(circle at 35% 30%, #fff3b0, #f5c542 55%, #d99a12); box-shadow:inset 0 0 0 2px rgba(160,105,0,.35); }

/* the student's game: level, streak, badges (lib/game.php) */
.game{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap:14px 18px; margin:0 0 18px; }
.game-box{ display:flex; align-items:center; gap:14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; box-shadow:var(--shadow); }
.game-box b{ display:block; font:700 19px Outfit, sans-serif; } .game-box span{ display:block; color:var(--muted); font-size:13.5px; }
.game-box .grow{ flex:1; min-width:0; }
.game-box .big-emoji{ font-size:38px; line-height:1; flex:none; color:inherit; }
.streak:not(.on) .big-emoji{ filter:grayscale(1); opacity:.45; }
.bar{ height:12px; border-radius:99px; background:var(--surface-2); overflow:hidden; margin:6px 0 4px; }
.bar i{ display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg, #5cbf8a, var(--brand)); }
.badges summary{ cursor:pointer; list-style:none; } .badges summary::-webkit-details-marker{ display:none; }
.badges summary h2{ display:inline-flex; align-items:center; gap:10px; margin:0; }
.badges summary h2::after{ content:"▾"; font-size:16px; color:var(--muted); } .badges:not([open]) summary h2::after{ content:"▸"; }
.badges[open] summary{ margin-bottom:14px; }
.badge-grid{ list-style:none; margin:0 0 10px; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap:10px; }
.badge{ display:grid; justify-items:center; text-align:center; gap:2px; padding:12px 10px; border-radius:14px; border:1.5px dashed var(--border-strong); color:var(--muted); }
.badge b{ font:700 15px Outfit, sans-serif; color:var(--ink); } .badge span:last-child{ font-size:12.5px; line-height:1.35; }
.badge .b-emoji{ font-size:30px; line-height:1.1; opacity:.5; }
.badge.got{ border:1.5px solid color-mix(in srgb, var(--sun) 70%, var(--border)); background:color-mix(in srgb, var(--sun) 16%, var(--surface)); }
.badge.got .b-emoji{ opacity:1; }
.badge.fresh{ animation:at-glow 1.4s ease-in-out 3; }
.flash-win{ background:color-mix(in srgb, var(--sun) 35%, var(--surface)); color:var(--ink); display:flex; align-items:center; gap:10px; }
.flash-win::before{ content:"🎉"; font-size:24px; animation:at-pop .7s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes at-pop{ from{ transform:scale(0) rotate(-30deg); } to{ transform:none; } }
@keyframes at-glow{ 50%{ box-shadow:0 0 0 6px color-mix(in srgb, var(--sun) 55%, transparent); transform:scale(1.04); } }

/* teacher */
.class-card{ text-decoration:none; color:var(--ink); display:block; transition:transform .15s; margin:0; }
.class-card:hover{ transform:translateY(-2px); border-color:var(--brand); }
.class-card small{ color:var(--muted); } .class-card h3{ margin:4px 0 12px; }
.class-card.archived{ opacity:.6; }
.stats{ display:flex; flex-wrap:wrap; gap:6px 14px; font-size:14px; color:var(--muted); }
.table + .note{ margin-top:10px; } .nowrap{ white-space:nowrap; } .risk{ font-size:12.5px; font-weight:700; color:#b45309; margin-left:4px; }
.badge-row{ font-size:19px; letter-spacing:2px; } .badge-row span{ cursor:help; } .badge-row .muted{ font-size:14px; letter-spacing:0; cursor:auto; }
.stats b{ color:var(--ink); font-size:16px; } .stats .hot b{ color:#b45309; }
.stats.big span{ background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:8px 14px; }
.stats.big b{ display:block; font:800 24px Outfit, sans-serif; }
.tabs{ display:flex; gap:4px; border-bottom:2px solid var(--border); margin:0 0 20px; overflow-x:auto; }
.tabs a{ padding:10px 16px; text-decoration:none; color:var(--muted); font-weight:600; border-bottom:3px solid transparent; margin-bottom:-2px; white-space:nowrap; }
.tabs a.on{ color:var(--brand); border-bottom-color:var(--brand); }
.filters{ display:flex; flex-wrap:wrap; gap:10px; align-items:end; margin:0 0 16px; }
.filters label{ font-size:12.5px; color:var(--muted); } .filters select, .filters input{ width:auto; }
.filters .spacer{ flex:1; }
.record summary{ cursor:pointer; } .record[open] summary{ margin-bottom:12px; }
.waitlist{ list-style:none; margin:0 0 8px; padding:0; display:grid; gap:8px; }
.waitlist li{ display:grid; grid-template-columns:minmax(120px, 190px) 1fr auto; gap:4px 14px; align-items:baseline; background:var(--paper-asked); color:var(--note-ink);
  border-radius:12px; padding:10px 14px; }
.waitlist li a{ color:inherit; } .waitlist .muted{ color:rgba(0,0,0,.6); } .waitlist .linkbtn{ color:#1b4f55; margin-left:8px; }
.waitlist .q{ overflow-wrap:anywhere; }
@media (max-width:640px){ .waitlist li{ grid-template-columns:1fr; } }
.day{ margin:24px 0 10px; }
.convs{ display:grid; gap:12px; }
.conv{ background:var(--surface); border:1px solid var(--border); border-left:5px solid #5cbf8a; border-radius:12px; padding:12px 16px; break-inside:avoid; }
.conv.st-removed{ border-left-color:var(--border-strong); opacity:.75; }
.conv.st-flagged{ border-left-color:var(--bad); background:var(--bad-soft); }
.conv.one{ border-left-width:8px; box-shadow:0 0 0 3px var(--brand-soft); }
.conv-head{ display:flex; flex-wrap:wrap; gap:4px 12px; align-items:baseline; margin-bottom:6px; }
.conv-head b a{ color:inherit; } .conv-head .muted{ font-size:13.5px; }
.flagtag{ font-size:13px; font-weight:700; color:var(--bad); }
.conv h4{ margin:8px 0 2px; font-size:12px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); }
.conv h4 .lc{ text-transform:none; letter-spacing:0; }
.conv p{ margin:0; overflow-wrap:anywhere; }
.tnote{ background:var(--brand-soft); border-radius:8px; padding:4px 10px 8px; margin-top:8px; }
.conv-acts{ display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:10px; font-size:14px; align-items:flex-start; }
.conv-acts details{ flex-basis:auto; } .conv-acts details[open]{ flex-basis:100%; } .conv-acts details form{ margin-top:8px; }
.conv-acts form.inline{ display:inline-flex; gap:16px; }
.joinbox{ display:flex; flex-wrap:wrap; gap:18px 28px; align-items:center; justify-content:space-between; }
.joinbox > div:first-child{ flex:1 1 320px; }
.joinlink{ display:flex; gap:8px; } .joinlink input{ font-family:ui-monospace, Menlo, monospace; font-size:14px; }
.bigcode{ font:800 clamp(36px, 7vw, 60px)/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing:.14em; background:var(--surface-2); border-radius:16px; padding:18px 24px; }
.print-head{ display:none; }

.foot{ border-top:1px solid var(--border); background:var(--surface); font-size:14px; color:var(--muted); }
.foot-in{ display:flex; flex-wrap:wrap; gap:8px 20px; align-items:center; padding-top:18px; padding-bottom:18px; }
.foot nav{ margin-left:auto; }

@media print{
  .topbar, .foot, .tabs, .no-print, .game, .badges, .conv-acts, .filters, .pagehead .stats{ display:none !important; }
  body{ background:#fff; color:#000; } main.wrap{ padding:0; max-width:none; }
  .print-head{ display:block; margin:0 0 10px; }
  .conv.st-removed, .conv.st-flagged, .waitlist .linkbtn{ display:none !important; }
  .conv{ border:1px solid #bbb; border-left:4px solid #888; background:#fff; }
  .waitlist li{ background:none; border:1px solid #bbb; }
  .tnote{ background:#f3f3f3; }
}
@media (prefers-reduced-motion:reduce){ .class-card{ transition:none; } .badge.fresh, .flash-win::before{ animation:none; } }
