/* DailyLearn – "Delectable details": baby pink, with yellow, tomato red, purple and turquoise,
   held together by thin black lines, sticker-like offset shadows and lots of white space.
   Light and dark: "auto" follows the device, or the visitor picks one (data-theme on <html>). */
:root {
  --pink: #ffe3ec;
  --pink-2: #ffc9da;
  --pink-ink: #d6336c;
  --yellow: #ffd23f;
  --red: #e8392e;
  --red-soft: #ffe0dc;
  --purple: #7b5cff;
  --purple-soft: #ece6ff;
  --teal: #2ec4b6;
  --teal-ink: #0d7d72;
  --teal-soft: #d9f6f2;
  --yellow-soft: #fff4c7;
  --yellow-ink: #8a6200;

  --bg: var(--pink);
  --surface: #ffffff;
  --surface-2: #fff6f9;
  --ink: #17121c;
  --muted: #6e5f6b;
  --line: #17121c;            /* the thin black lines */
  --hair: rgba(23, 18, 28, .12);
  --shade: #17121c;           /* offset "sticker" shadow */
  --dots: rgba(214, 51, 108, .13);
  --ok: var(--teal-ink); --ok-bg: var(--teal-soft);
  --miss: #d42a20; --miss-bg: var(--red-soft);

  --radius: 22px;
  --lw: 1.5px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ease: cubic-bezier(.2, .9, .25, 1.15);
  --tabbar-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1220; --surface: #251a2e; --surface-2: #2e2139; --ink: #fff0f5; --muted: #c4b2c2;
    --line: #f3d9e4; --hair: rgba(255, 240, 245, .12); --shade: #7b5cff; --dots: rgba(255, 143, 177, .08);
    --pink-ink: #ff8fb1; --red-soft: #3d1c22; --purple-soft: #2b2250; --teal-ink: #5ee6d8; --teal-soft: #13332f;
    --yellow-soft: #3a3113; --yellow-ink: #ffd23f; --miss: #ff7a72; --miss-bg: #3d1c22;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1220; --surface: #251a2e; --surface-2: #2e2139; --ink: #fff0f5; --muted: #c4b2c2;
  --line: #f3d9e4; --hair: rgba(255, 240, 245, .12); --shade: #7b5cff; --dots: rgba(255, 143, 177, .08);
  --pink-ink: #ff8fb1; --red-soft: #3d1c22; --purple-soft: #2b2250; --teal-ink: #5ee6d8; --teal-soft: #13332f;
  --yellow-soft: #3a3113; --yellow-ink: #ffd23f; --miss: #ff7a72; --miss-bg: #3d1c22;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--ink); font: 16px/1.6 var(--font-body);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 8px 20px 64px; outline: none; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.12; margin: 0; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-size: 20px; margin-bottom: 14px; font-weight: 800; }
h2 small { color: var(--muted); font-weight: 600; font-size: 14px; }
h3 { font-size: 15px; margin: 16px 0 8px; font-weight: 800; }
p, li, small { text-wrap: pretty; }
p { hyphens: auto; -webkit-hyphens: auto; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 600; letter-spacing: -.01em; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0; }
.empty { color: var(--muted); font-size: 15px; }
.error { color: var(--miss); }
.loading { display: grid; place-items: center; padding: 90px 0; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); border-right-color: var(--yellow); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }

/* hand-drawn squiggle under highlighted words */
.squiggle { position: relative; white-space: nowrap; }
.squiggle::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: -.18em; height: .32em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 C 12 2, 22 2, 32 7 S 52 12, 62 6 S 82 1, 92 6 S 112 11, 118 5' fill='none' stroke='%23e8392e' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  transform-origin: left; animation: draw .9s .25s var(--ease) both;
}
@keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.sparkle { display: inline-block; color: var(--yellow); -webkit-text-stroke: 1px var(--ink); animation: twinkle 2.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(20deg) scale(1.2); } }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 12px max(20px, calc((100% - 920px) / 2)); padding-top: calc(12px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: var(--lw) solid var(--line);
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; border: var(--lw) solid var(--line); box-shadow: 2px 2px 0 var(--shade); flex: none; transition: transform .3s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 900; font-size: 23px; letter-spacing: -.03em; line-height: 1; }
.brand-name b { font-family: var(--font-serif); font-style: italic; font-weight: 700; color: var(--red); letter-spacing: -.01em; }
.brand-tag { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.account { display: flex; align-items: center; gap: 6px; }
.pill { font-size: 14px; font-weight: 800; background: var(--surface); border: var(--lw) solid var(--line); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.streak { background: var(--yellow); color: #17121c; }
.avatar-btn { font-size: 21px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: var(--lw) solid var(--line); text-decoration: none; box-shadow: 2px 2px 0 var(--shade); transition: transform .2s var(--ease); }
.avatar-btn:hover { transform: rotate(-10deg); }
.lang { display: flex; background: var(--surface); border: var(--lw) solid var(--line); border-radius: 999px; padding: 2px; }
.lang button { border: 0; background: none; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; color: var(--muted); transition: background .2s, color .2s; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.lang button:disabled { opacity: .35; cursor: not-allowed; }
.theme-btn { width: 36px; height: 36px; border-radius: 50%; border: var(--lw) solid var(--line); background: var(--surface); font-size: 16px; display: grid; place-items: center; transition: transform .4s var(--ease); }
.theme-btn:hover { transform: rotate(25deg); }

/* ---------- tab bar ---------- */
.tabbar {
  max-width: 920px; width: calc(100% - 40px); margin: 16px auto 4px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--surface); border: var(--lw) solid var(--line); border-radius: 999px; padding: 4px; box-shadow: 3px 3px 0 var(--shade);
}
.tabbar a { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 4px; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 14px; color: var(--muted); transition: background .25s, color .25s; }
.tabbar a:hover { color: var(--ink); background: var(--surface-2); }
.tabbar a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.badge { position: absolute; top: 2px; right: 14%; background: var(--red); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; font-style: normal; border: 1.5px solid var(--surface); }
@media (max-width: 640px) {
  body { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; margin: 0;
    height: var(--tabbar-h); border-radius: 26px; padding: 6px;
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .tabbar a { flex-direction: column; gap: 0; font-size: 11px; padding: 4px 2px; border-radius: 20px; }
  .tab-icon { font-size: 21px; line-height: 1.15; transition: transform .3s var(--ease); }
  .tabbar a[aria-current="page"] { background: var(--pink-2); color: #17121c; }
  .tabbar a[aria-current="page"] .tab-icon { transform: translateY(-2px) scale(1.15) rotate(-6deg); }
}
:root[data-theme="dark"] .tabbar a[aria-current="page"] { background: var(--purple); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabbar a[aria-current="page"] { background: var(--purple); color: #fff; } }

/* ---------- page enter animation ---------- */
.enter > * { animation: rise .55s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .05s; } .enter > *:nth-child(3) { animation-delay: .1s; }
.enter > *:nth-child(4) { animation-delay: .15s; } .enter > *:nth-child(5) { animation-delay: .2s; }
.enter > *:nth-child(n+6) { animation-delay: .25s; }
.grid > .card { animation: pop-in .5s var(--ease) both; }
.grid > .card:nth-child(2) { animation-delay: .04s; } .grid > .card:nth-child(3) { animation-delay: .08s; } .grid > .card:nth-child(4) { animation-delay: .12s; }
.grid > .card:nth-child(5) { animation-delay: .16s; } .grid > .card:nth-child(6) { animation-delay: .2s; } .grid > .card:nth-child(7) { animation-delay: .24s; } .grid > .card:nth-child(8) { animation-delay: .28s; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: translateY(16px) scale(.94) rotate(-1.5deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- hero & home ---------- */
.hero { padding: 26px 0 8px; position: relative; }
.date { display: inline-block; margin: 0 0 12px; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; background: var(--surface); border: var(--lw) solid var(--line); padding: 3px 12px; border-radius: 999px; }
.hero h1, .page-head h1 { font-size: clamp(34px, 7.5vw, 60px); font-weight: 900; letter-spacing: -.04em; }
.hero h1 .serif { color: var(--red); }
.page-head { padding: 22px 0 10px; }
.intro { color: var(--muted); margin: 14px 0 0; max-width: 620px; font-size: 18px; }
.progress { display: flex; align-items: center; gap: 12px; margin-top: 20px; font-size: 14px; font-weight: 700; }
.bar { flex: 1; height: 12px; background: var(--surface); border: var(--lw) solid var(--line); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar span { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--red) 0 8px, #ff6a5e 8px 16px); transition: width .6s var(--ease); }
.subj-row .bar, .weekly .bar { height: 10px; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: var(--lw) dashed var(--line); border-radius: 18px; padding: 12px 16px; margin-top: 18px; }
.banner p { margin: 0; flex: 1 1 220px; }
.banner.warn { background: var(--yellow-soft); border-style: solid; }

.ticker { margin: 22px -20px 0; border-block: var(--lw) solid var(--line); background: var(--yellow); color: #17121c; overflow: hidden; white-space: nowrap; font-weight: 800; font-family: var(--font-head); font-size: 15px; }
.ticker div { display: inline-flex; gap: 28px; padding: 9px 0; animation: marquee 26s linear infinite; }
.ticker span::after { content: "✦"; margin-left: 28px; }
@keyframes marquee { to { transform: translateX(-50%); } }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.card {
  --c: var(--red); position: relative; background: var(--surface); border: var(--lw) solid var(--line); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--shade); padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; min-height: 140px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s;
}
a.card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shade); }
a.card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shade); transition-duration: .08s; }
.card-icon { font-size: 25px; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--c); border: var(--lw) solid var(--line); transition: transform .4s var(--ease); }
a.card:hover .card-icon { transform: rotate(-12deg) scale(1.08); }
.card-name { font-family: var(--font-head); font-weight: 800; font-size: 17px; }
.card-status { font-size: 13px; font-weight: 800; margin-top: auto; }
.card-num { position: absolute; top: 12px; right: 14px; font-family: var(--font-serif); font-style: italic; font-weight: 700; font-size: 20px; line-height: 1; color: var(--muted); }
.status-ok { background: var(--teal-soft); }
.status-ok .card-status { color: var(--teal-ink); }
.status-miss { background: var(--red-soft); }
.status-miss .card-status { color: var(--miss); }
.status-current { background: var(--yellow-soft); }
.status-current .card-status { color: var(--ink); }
.status-current::after { content: "✦"; position: absolute; right: -9px; top: -12px; font-size: 22px; color: var(--yellow); -webkit-text-stroke: 1px #17121c; animation: twinkle 2.4s ease-in-out infinite; }
.status-open { background: var(--purple-soft); }
.status-open .card-status { color: var(--purple); font-variant-numeric: tabular-nums; }
.status-open.is-late .card-status { color: var(--miss); }
.status-locked { box-shadow: none; border-style: dashed; background: transparent; cursor: not-allowed; }
.status-locked .card-icon { background: transparent; filter: grayscale(1); opacity: .45; }
.status-locked .card-name, .status-locked .card-status { color: var(--muted); }

.cta { display: flex; justify-content: center; margin-top: 26px; }
.btn.big { padding: 15px 28px; font-size: 17px; }

.weekly { position: relative; margin-top: 26px; background: var(--surface); border: var(--lw) solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: 4px 4px 0 var(--yellow); }
.weekly-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 900; font-family: var(--font-head); }
.weekly-head small { color: var(--muted); font-weight: 700; }
.weekly p { margin: 6px 0 10px; }
.weekly .bar span { background: repeating-linear-gradient(-45deg, var(--yellow) 0 8px, #ffe27a 8px 16px); }
.weekly small { color: var(--muted); }
.weekly.is-done { background: var(--yellow-soft); }

.start-panel h2 { margin-bottom: 14px; }
.lang-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
.lang-choice .btn { padding: 14px 18px; font-size: 16px; }

/* ---------- question ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 16px; color: var(--muted); text-decoration: none; font-weight: 700; }
.back:hover { color: var(--ink); }
.question { --c: var(--red); position: relative; background: var(--surface); border: var(--lw) solid var(--line); border-radius: 28px; box-shadow: 6px 6px 0 var(--c); padding: clamp(18px, 4.5vw, 36px); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tag { font-size: 13px; font-weight: 800; padding: 4px 11px; border-radius: 999px; background: var(--surface); border: var(--lw) solid var(--line); }
.tag.subject { background: var(--c); color: #17121c; }
.timers { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.timer { font-size: 14px; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: var(--teal-soft); border: var(--lw) solid var(--line); font-variant-numeric: tabular-nums; }
.timer.hurry { background: var(--yellow); color: #17121c; animation: tick 1s steps(2) infinite; }
.timer.over { background: var(--red-soft); color: var(--miss); animation: none; }
.timer.group { background: var(--surface-2); color: var(--muted); font-size: 12px; border-style: dashed; }
.timer.group.over { text-decoration: line-through; opacity: .7; }
@keyframes tick { 50% { transform: scale(1.05); } }
.timebar { height: 8px; border-radius: 99px; background: var(--surface-2); border: var(--lw) solid var(--line); overflow: hidden; margin: 0 0 20px; }
.timebar span { display: block; height: 100%; width: 100%; background: var(--teal); transition: width .25s linear, background .3s; }
.timebar.hurry span { background: var(--yellow); }
.timebar.over span { background: var(--red); }
figure { margin: 0 0 20px; }
figure img { width: 100%; max-height: 420px; object-fit: contain; background: var(--surface-2); border: var(--lw) solid var(--line); border-radius: 18px; display: block; animation: pop .5s var(--ease) both; }
figure.img-error img { display: none; }
figure.img-error::before { content: "🖼️"; display: grid; place-items: center; height: 120px; font-size: 40px; border: var(--lw) dashed var(--line); border-radius: 18px; }
figcaption { font-size: 12px; color: var(--muted); margin-top: 8px; }
.qtext { font-size: clamp(22px, 3.8vw, 30px); font-weight: 800; margin-bottom: 22px; white-space: pre-wrap; letter-spacing: -.02em; text-wrap: pretty; }

.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; min-height: 60px;
  background: var(--surface); border: var(--lw) solid var(--line); border-radius: 18px; padding: 12px 14px; font-size: 17px; font-weight: 600;
  box-shadow: 3px 3px 0 var(--shade); transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.option:not(:disabled):hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--shade); background: var(--surface-2); }
.option:not(:disabled):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shade); transition-duration: .06s; }
.option:disabled { cursor: default; }
.letter { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: var(--lw) solid var(--line); font-weight: 700; font-size: 15px; font-family: var(--font-serif); font-style: italic; }
.option.right { background: var(--teal-soft); animation: bounce .5s var(--ease); }
.option.right .letter { background: var(--teal); color: #17121c; }
.option.wrong { background: var(--red-soft); animation: shake .4s; }
.option.wrong .letter { background: var(--red); color: #fff; }
.option.dim { opacity: .45; box-shadow: none; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes bounce { 40% { transform: scale(1.03); } }

.numform label { display: block; font-weight: 800; margin-bottom: 6px; }
.numrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.numrow input { font-size: 22px; width: 180px; font-weight: 700; }
.unit { font-weight: 800; font-size: 18px; }

.feedback { position: relative; margin-top: 24px; padding: 20px 22px; border-radius: 22px; outline: none; border: var(--lw) solid var(--line); animation: rise .45s var(--ease) both; }
.feedback.ok { background: var(--teal-soft); }
.feedback.miss { background: var(--red-soft); }
.feedback h2 { font-size: 22px; margin-bottom: 8px; }
.feedback.ok h2 { color: var(--teal-ink); }
.feedback.miss h2 { color: var(--miss); }
.feedback h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 0 4px; }
.feedback p { margin: 0; }
.points-note { font-size: 14px; color: var(--muted); margin-bottom: 6px !important; }
.plus { color: var(--teal-ink); font-size: 17px; }
.group-note { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--teal-ink); }
.trap { margin-top: 16px; padding: 12px 14px; background: var(--yellow-soft); border-radius: 16px; border: var(--lw) dashed var(--line); }
.trap h3 { margin-top: 0; }

/* ---------- calculator & notes ---------- */
.tools { margin-top: 20px; }
.tool-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: var(--lw) solid var(--line); background: var(--surface); font-weight: 800; font-size: 14px; transition: transform .2s var(--ease), background .2s, box-shadow .2s; }
.tool-btn:hover { transform: translateY(-1px); }
.tool-btn[aria-pressed="true"] { background: var(--purple); color: #fff; box-shadow: 2px 2px 0 var(--shade); }
.tool-btn[aria-pressed="true"]::after { content: "✓"; font-size: 12px; }
.calc { margin-top: 12px; max-width: 360px; background: var(--surface-2); border: var(--lw) solid var(--line); border-radius: 22px; padding: 12px; display: grid; gap: 8px; box-shadow: 4px 4px 0 var(--purple); animation: pop .3s var(--ease); }
.calc-input { font-family: ui-monospace, Menlo, monospace; font-size: 18px; }
.calc-result { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 800; text-align: right; min-height: 1.4em; color: var(--purple); }
.calc-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.calc-keys button { padding: 11px 0; border-radius: 14px; border: var(--lw) solid var(--line); background: var(--surface); font-weight: 800; font-size: 16px; transition: transform .08s; }
.calc-keys button:active { transform: scale(.92); }
.calc-keys button.op { background: var(--pink); color: #17121c; }
.calc-keys button.eq { background: var(--yellow); color: #17121c; }
#tool-notes:not([hidden]) { animation: pop .25s var(--ease); }
.notes { width: 100%; margin-top: 12px; font: inherit; padding: 10px 12px; border-radius: 16px; border: var(--lw) solid var(--line); background: var(--yellow-soft); color: var(--ink); resize: vertical; box-shadow: 4px 4px 0 var(--purple);
  background-image: repeating-linear-gradient(transparent 0 25px, var(--hair) 25px 26px); line-height: 26px; }

/* ---------- forms & buttons ---------- */
input, select, textarea { font: inherit; }
input, select {
  padding: 11px 14px; border-radius: 14px; border: var(--lw) solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
  transition: box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 3px 3px 0 var(--purple); }
.stack { display: flex; flex-direction: column; gap: 14px; margin: 10px 0 18px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; }
.stack label small { font-weight: 500; color: var(--muted); }
.stack label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 600; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--red); flex: none; }
.form-error { color: var(--miss); font-weight: 800; margin: 0; min-height: 1em; }
.inline-form { margin-top: 16px; }
.inline-form > label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.row select { width: auto; }
.small-check { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 600 !important; margin-top: 12px; font-size: 14px; }
.small-check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--red); flex: none; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none;
  background: var(--red); color: #fff; font-weight: 800; padding: 11px 22px; border-radius: 999px; font-size: 15px; white-space: nowrap;
  border: var(--lw) solid #17121c; box-shadow: 3px 3px 0 #17121c; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 #17121c; }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 #17121c; transition-duration: .06s; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn.small { padding: 6px 13px; font-size: 13px; box-shadow: 2px 2px 0 #17121c; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 3px 3px 0 var(--shade); }
.btn.ghost.small { box-shadow: 2px 2px 0 var(--shade); }
.btn.teal { background: var(--teal); color: #17121c; }
.btn.yellow { background: var(--yellow); color: #17121c; }
.btn.purple { background: var(--purple); }
.btn.danger { color: var(--miss); }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 6px 8px; border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.center { justify-content: center; text-align: center; display: flex; margin-top: 22px; }

/* ---------- panels, people, leaderboards ---------- */
.panel { background: var(--surface); border: var(--lw) solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-top: 18px; box-shadow: 4px 4px 0 var(--shade); }
.code-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.code-panel > div:first-child { display: flex; flex-direction: column; min-width: 0; flex: 1 1 240px; }
.code-panel small { color: var(--muted); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 26px; letter-spacing: .14em; font-weight: 800; }
.link { font-size: 14px; word-break: break-all; }
.person, .duel, .board li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); }
.panel h2 + .person, .panel h3 + .person, .panel .hint + .duel, .panel h2 + .duel { border-top: 0; }
.person-avatar { font-size: 24px; width: 46px; height: 46px; flex: none; display: grid; place-items: center; background: var(--pink); border: var(--lw) solid var(--line); border-radius: 50%; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-main em { font-style: normal; color: var(--pink-ink); font-weight: 700; }
.person-main small { color: var(--muted); font-size: 13px; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.today-line { color: var(--muted); font-size: 12px; }
.duel-score { font-weight: 900; font-variant-numeric: tabular-nums; font-family: var(--font-head); }
.duel-result { font-size: 13px; font-weight: 800; min-width: 80px; text-align: right; }
.duel.win .duel-result { color: var(--teal-ink); }
.duel.loss .duel-result { color: var(--miss); }
.group-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-top: 1px solid var(--hair); text-decoration: none; transition: padding .2s var(--ease); }
.group-row:hover { padding-left: 6px; }
.panel h2 + .group-row { border-top: 0; }
.group-row strong { flex: 1; }
.group-row small { color: var(--muted); }
.pupil-tag { font-size: 11px; font-weight: 800; color: #17121c; background: var(--teal); padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; border: 1px solid #17121c; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { padding: 7px 15px; border-radius: 999px; border: var(--lw) solid var(--line); background: var(--surface); text-decoration: none; font-weight: 800; font-size: 14px; white-space: nowrap; transition: transform .2s var(--ease); }
.chip:hover { transform: translateY(-2px); }
.chip[aria-current="true"] { background: var(--ink); color: var(--bg); }
.seg { display: inline-flex; margin: 12px 0 4px; background: var(--surface); border: var(--lw) solid var(--line); border-radius: 999px; padding: 3px; }
.seg a { padding: 5px 15px; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 13px; color: var(--muted); }
.seg a[aria-current="true"] { background: var(--yellow); color: #17121c; }
.board { list-style: none; margin: 8px 0 0; padding: 0; }
.board li:first-child { border-top: 0; }
.board li.me { background: var(--yellow-soft); border-radius: 16px; padding-left: 10px; padding-right: 10px; border: var(--lw) solid var(--line); }
.rank { width: 34px; text-align: center; font-size: 19px; flex: none; font-family: var(--font-serif); font-style: italic; font-weight: 700; color: var(--muted); }
.board li.top .rank { font-size: 25px; font-style: normal; }
.pts { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--font-head); }
.pts small { color: var(--muted); font-weight: 600; font-family: var(--font-body); }

/* ---------- avatar picker ---------- */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.avatar-opt { font-size: 24px; height: 46px; border-radius: 50%; border: var(--lw) solid var(--hair); background: var(--surface-2); transition: transform .25s var(--ease); }
.avatar-opt:hover { transform: rotate(-10deg) scale(1.08); }
.avatar-opt[aria-checked="true"] { border-color: var(--line); background: var(--yellow); transform: scale(1.12); box-shadow: 2px 2px 0 var(--shade); }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; padding: 24px 0 6px; }
.big-avatar { font-size: 46px; width: 86px; height: 86px; flex: none; display: grid; place-items: center; background: var(--yellow); border: var(--lw) solid var(--line); border-radius: 50%; box-shadow: 4px 4px 0 var(--shade); }
.profile-head h1 { font-size: clamp(26px, 6vw, 34px); font-weight: 900; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.tiles div, .done-stats div { background: var(--surface); border: var(--lw) solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; }
.tiles div:nth-child(4n+1) { box-shadow: 3px 3px 0 var(--red); } .tiles div:nth-child(4n+2) { box-shadow: 3px 3px 0 var(--yellow); }
.tiles div:nth-child(4n+3) { box-shadow: 3px 3px 0 var(--purple); } .tiles div:nth-child(4n+4) { box-shadow: 3px 3px 0 var(--teal); }
.tiles strong, .done-stats strong { font-size: 23px; font-family: var(--font-head); font-weight: 900; }
.tiles small, .done-stats small { color: var(--muted); font-size: 12px; font-weight: 600; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.cell { aspect-ratio: 1; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--hair); }
.cell.l1 { background: var(--pink-2); } .cell.l2 { background: #ff9bb8; } .cell.l3 { background: var(--red); } .cell.l4 { background: var(--teal); border-color: var(--line); }
.subj-row { display: grid; grid-template-columns: 150px 1fr 54px; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; font-weight: 600; }
.subj-row .bar span { background: var(--c, var(--red)); }
.subj-row small { color: var(--muted); text-align: right; }

/* achievements */
.tier-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.tier-head small { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--muted); }
.tier-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--t); border: 1px solid var(--line); }
.t1 { --t: var(--teal); } .t2 { --t: var(--yellow); } .t3 { --t: var(--red); } .t4 { --t: var(--purple); }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ach { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 16px 10px 14px; border-radius: 20px; background: var(--surface); border: var(--lw) dashed var(--hair); }
.ach-icon { font-size: 30px; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); margin-bottom: 6px; border: var(--lw) dashed var(--hair); }
.ach strong { font-size: 14px; line-height: 1.25; }
.ach small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.ach .when { margin-top: 4px; font-size: 11px; font-weight: 800; color: var(--ink); background: var(--t); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: #17121c; }
.ach.t4 .when { color: #fff; }
.ach.locked { opacity: .7; }
.ach.locked .ach-icon { filter: grayscale(1); opacity: .5; }
.ach.secret .ach-icon { filter: none; opacity: 1; font-size: 24px; }
.ach.earned { border: var(--lw) solid var(--line); box-shadow: 3px 3px 0 var(--t); }
.ach.earned .ach-icon { background: var(--t); border: var(--lw) solid var(--line); animation: pop .5s var(--ease) both; }
.ach.earned.t4 .ach-icon { background: conic-gradient(from 0deg, var(--purple), var(--red), var(--yellow), var(--teal), var(--purple)); }

/* celebration: one achievement at a time */
.celebrate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .3s ease both; }
.celebrate.out { animation: fade .3s ease reverse both; }
.celebrate-card { position: relative; width: min(340px, 100%); text-align: center; background: var(--surface); border: var(--lw) solid var(--line); border-radius: 28px; padding: 26px 22px 22px; box-shadow: 8px 8px 0 var(--t, var(--purple)); animation: sticker .7s var(--ease) both; }
.celebrate-card .big-icon { font-size: 54px; width: 96px; height: 96px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: var(--t, var(--yellow)); border: var(--lw) solid var(--line); animation: wobble 1.6s .5s ease-in-out infinite; }
.celebrate-card small { display: block; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); }
.celebrate-card h2 { font-size: 26px; margin: 4px 0 6px; }
.celebrate-card p { margin: 0 0 16px; color: var(--muted); }
.celebrate-card .count { position: absolute; top: 12px; right: 16px; font-size: 12px; font-weight: 800; color: var(--muted); }
@keyframes sticker { 0% { transform: scale(.4) rotate(-14deg); opacity: 0; } 60% { transform: scale(1.06) rotate(3deg); opacity: 1; } 100% { transform: none; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- groups, classes ---------- */
.insights .tiles { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.streak-banner { display: flex; align-items: center; gap: 14px; background: var(--yellow); color: #17121c; border: var(--lw) solid #17121c; border-radius: var(--radius); padding: 14px 18px; margin-top: 18px; box-shadow: 4px 4px 0 #17121c; }
.streak-banner strong { font-family: var(--font-head); font-size: 30px; font-weight: 900; line-height: 1; }
.streak-banner p { margin: 0; }
.streak-banner .sb-main { font-weight: 800; font-size: 16px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.streak-banner .sb-hint { font-size: 13px; font-weight: 600; opacity: .8; margin-top: 4px; }
.streak-banner .flame { font-size: 36px; animation: wobble 2s ease-in-out infinite; }
.class-code-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--purple-soft); border: var(--lw) solid var(--line); border-radius: 18px; padding: 14px 16px; margin: 12px 0; }
.class-code-box .code { color: var(--purple); }
.class-code-box > div { flex: 1 1 200px; }
.roster { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.roster th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 6px; border-bottom: var(--lw) solid var(--line); }
.roster td { padding: 8px 6px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.roster .who { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.roster .who span:first-child { font-size: 22px; }
.roster input { padding: 6px 10px; border-radius: 10px; font-size: 14px; min-width: 120px; }
.roster .acts { white-space: nowrap; text-align: right; }
.pupil-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.pupil-card { border: var(--lw) dashed var(--line); border-radius: 18px; padding: 12px 14px; background: var(--surface); break-inside: avoid; }
.pupil-card .pc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pupil-card .pc-head span { font-size: 26px; }
.pupil-card strong { display: block; font-size: 17px; font-family: var(--font-head); }
.pupil-card code { display: block; font-size: 19px; font-weight: 800; color: var(--red); margin: 2px 0 6px; letter-spacing: .02em; }
.pupil-card small { color: var(--muted); font-size: 12px; display: block; }
.pupil-card .name-line { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; font-size: 12px; color: var(--muted); }
.note-box { background: var(--teal-soft); color: var(--ink); border: var(--lw) solid var(--line); border-radius: 16px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }

/* class login: tap your avatar */
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 18px; }
.who-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px 12px; background: var(--surface); border: var(--lw) solid var(--line); border-radius: 20px; box-shadow: 3px 3px 0 var(--shade); font-weight: 800; font-size: 14px; transition: transform .2s var(--ease), box-shadow .2s var(--ease); overflow-wrap: anywhere; }
.who-btn span { font-size: 40px; transition: transform .3s var(--ease); }
.who-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--shade); }
.who-btn:hover span { transform: scale(1.15) rotate(-8deg); }
.who-btn[aria-pressed="true"] { background: var(--yellow); color: #17121c; }
.code-entry { margin-top: 18px; }
.code-entry input { font-size: 22px; font-weight: 800; letter-spacing: .04em; text-align: center; }
.big-code { font-size: clamp(40px, 12vw, 84px); font-weight: 900; letter-spacing: .12em; font-family: ui-monospace, Menlo, monospace; margin: 8px 0; }

/* ---------- done / auth / misc ---------- */
.done, .center-box { text-align: center; padding: 30px 0; max-width: 600px; margin: 0 auto; position: relative; }
.big { font-size: 66px; line-height: 1.1; }
.done .big { display: inline-grid; place-items: center; width: 130px; height: 130px; border-radius: 50%; background: var(--yellow); border: var(--lw) solid var(--line); box-shadow: 5px 5px 0 var(--shade); animation: sticker .8s var(--ease) both; }
.done h1, .center-box h1 { font-size: clamp(28px, 6vw, 42px); font-weight: 900; margin-top: 16px; letter-spacing: -.035em; }
.score { font-size: 20px; font-weight: 800; margin: 8px 0; }
.perfect { font-weight: 900; color: var(--teal-ink); font-size: 18px; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; text-align: center; }
.emoji-row { font-size: 22px; letter-spacing: 2px; line-height: 1.8; }
.countdown { color: var(--muted); margin-top: 26px; }
.countdown strong { font-variant-numeric: tabular-nums; color: var(--ink); font-family: var(--font-head); font-size: 22px; }
.auth { max-width: 480px; margin: 0 auto; padding-top: 22px; }
.auth h1 { font-size: clamp(30px, 7vw, 38px); font-weight: 900; letter-spacing: -.035em; }
.auth .switch { margin-top: 20px; padding: 14px 16px; border: var(--lw) dashed var(--line); border-radius: 18px; background: var(--surface); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.auth .switch p { margin: 0; flex: 1 1 200px; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 80; }
.confetti i { position: absolute; top: -14px; width: 10px; height: 14px; border-radius: 3px; border: 1px solid #17121c; opacity: 0; animation: fall 2.8s cubic-bezier(.3, .6, .5, 1) forwards; }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(100vh) rotate(720deg); } }

#toasts { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--surface); color: var(--ink); padding: 12px 16px; border-radius: 18px; border: var(--lw) solid var(--line); box-shadow: 4px 4px 0 var(--shade); font-weight: 700; animation: pop .3s var(--ease); transition: opacity .5s, transform .5s; }
.toast.bad { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-10px); }
.toast small { display: block; opacity: .75; font-size: 12px; }
.toast-icon { font-size: 28px; }

/* ---------- legal pages ---------- */
.legal { max-width: 760px; }
.legal h1 { font-size: 38px; font-weight: 900; margin: 22px 0 20px; }
.legal h2 { font-size: 21px; margin: 30px 0 8px; }
.legal .placeholder { background: var(--yellow); color: #17121c; padding: 0 4px; border-radius: 4px; }

/* ---------- footer ---------- */
.footer { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: center; padding: 28px 20px; font-size: 14px; color: var(--muted); border-top: var(--lw) solid var(--line); background: var(--surface); }
.footer a { text-decoration: none; font-weight: 700; }
.footer a:hover { color: var(--red); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .subj-row { grid-template-columns: minmax(0, 118px) 1fr 46px; }
}
@media (max-width: 420px) {
  .brand-text { display: none; } /* the logo is enough on small phones; keeps the header calm */
}
@media (max-width: 520px) {
  main { padding: 4px 16px 44px; }
  .topbar { gap: 6px; padding-left: 14px; padding-right: 14px; }
  .brand { gap: 8px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 10px; }
  .brand-name { font-size: 20px; }
  .brand-tag, .pill.points, .account .login-btn { display: none; }
  .topbar-right { gap: 5px; }
  .lang button { padding: 4px 6px; font-size: 11px; }
  .theme-btn { width: 32px; height: 32px; font-size: 14px; }
  .avatar-btn { width: 34px; height: 34px; font-size: 18px; }
  .pill { padding: 3px 8px; font-size: 13px; }
  .hero { padding-top: 18px; }
  .intro { font-size: 16px; }
  .ticker { margin-left: -16px; margin-right: -16px; }
  .card { padding: 14px; min-height: 126px; box-shadow: 3px 3px 0 var(--shade); }
  .card-icon { width: 44px; height: 44px; font-size: 22px; }
  .card-name { font-size: 16px; }
  .question { border-radius: 24px; box-shadow: 4px 4px 0 var(--c); }
  .tags { flex-direction: column; align-items: flex-start; }
  .timers { justify-content: flex-start; }
  .option { font-size: 16px; min-height: 56px; }
  .panel { padding: 16px; }
  .row { flex-wrap: wrap; }
  .row .btn { flex: 1 1 auto; }
  .insights .tiles { grid-template-columns: 1fr 1fr; }
  /* People rows: name on top, actions underneath, both left-aligned. */
  .person, .duel { flex-wrap: wrap; }
  .person .person-main, .duel .person-main { flex: 1 1 calc(100% - 60px); }
  .person .row-actions { flex: 1 1 100%; justify-content: flex-start; padding-left: 58px; }
  .row-actions .today-line { flex: 1 1 100%; text-align: left; }
  .duel-score, .duel-result { padding-left: 58px; text-align: left; min-width: 0; }
  .duel-result { padding-left: 0; }
  .done-stats { gap: 6px; }
  .done-stats div { padding: 10px 6px; }
  .tiles strong, .done-stats strong { font-size: 20px; }
  .achs { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ach { padding: 14px 8px 12px; }
  .ach-icon { width: 50px; height: 50px; font-size: 26px; }
  .calc { max-width: none; }
  .who-grid { grid-template-columns: repeat(2, 1fr); }
  .roster thead { display: none; }
  .roster, .roster tbody { display: block; width: 100%; }
  .roster tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who acts" "tag tag" "act act"; gap: 6px 8px; padding: 12px 0; border-bottom: 1px solid var(--hair); align-items: center; }
  .roster td { border: 0; padding: 0; }
  .roster td:nth-child(1) { grid-area: who; min-width: 0; } .roster td:nth-child(2) { grid-area: tag; }
  .roster td:nth-child(3) { grid-area: act; } .roster td:nth-child(4) { grid-area: acts; }
  .roster .who span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .roster input { width: 100%; }
  .roster .acts .btn { padding: 5px 9px; }
  .roster .acts .lbl { display: none; }
  .code-panel .row-actions { justify-content: flex-start; }
  .banner { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- printing pupil login cards ---------- */
@media print {
  body { background: #fff; color: #000; padding: 0; }
  .topbar, .tabbar, .footer, #toasts, .no-print, .back, .celebrate { display: none !important; }
  .panel { box-shadow: none; border: 0; padding: 0; }
  .pupil-sheet { grid-template-columns: repeat(3, 1fr); }
  .pupil-card { border-color: #777; }
  .enter > * { animation: none; }
}

/* Subject colours (last, so they win over the defaults of cards and questions) */
.s-math { --c: #a48cff; } .s-language { --c: #ff8a7e; } .s-biology { --c: #5fd8cb; } .s-chemistry { --c: #ffd23f; }
.s-physics { --c: #ff9fc0; } .s-history { --c: #ffb35c; } .s-art { --c: #ff6fae; } .s-geography { --c: #7fe0a8; }
