/* Pixel Roster: a chunky pixel skin on plain HTML menus. Mobile first.
   Dark ink on light paper everywhere (contrast at least 4.5:1). */
:root {
  --ink: #2a1f33;
  --ink-soft: #5d5269;
  --paper: #fffaf0;
  --paper-2: #f6eedd;
  --bg: #bfe3f7;
  --bg-2: #a6d4ee;
  --frame: #2a1f33;
  --trim: #f3d9a6;
  --accent: #f6a53c;
  --accent-dark: #c86f12;
  --blue: #2f5fb8;
  --blue-light: #dbe7fb;
  /* Good and bad are a teal green and an orange red, not a pure green and red: they stay apart for people with
     red-green colour blindness too (node scripts/cvd-check.js). The + and - and the words still say it. */
  --good: #086c62;
  --good-bg: #dcf5f0;
  --bad: #b8321a;
  --bad-bg: #ffdccc;
  --sun: #fff1b8;
  --energy: #f2d03b;
  --mood: #ef7fb4;
  --focus: #278f8a;
  --confidence: #9a6ae0;
  --stress: #e2764a;
  --skill: #4d7fe0;
  --radius: 3px;
  --tabs-h: 64px;
  /* the studio's accessibility panel, About and foot, in the game's colours */
  --sfa-game-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sfa-paper: #fffaf0; --sfa-ink: #2a1f33; --sfa-dim: #5d5269; --sfa-line: #2a1f33; --sfa-accent: #2f5fb8; --sfa-accent-ink: #ffffff;
  --sf-studio-ink: #2a1f33; --sf-studio-muted: #4d4459;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: calc(100% * var(--textskala, 1)); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }

body {
  background: var(--bg) repeating-linear-gradient(45deg, var(--bg) 0 16px, var(--bg-2) 16px 32px);
  color: var(--ink);
  font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-wrap: break-word;
}

canvas { image-rendering: pixelated; image-rendering: crisp-edges; max-width: 100%; }
.avatar, .stat-icon, .px-num, .face { flex: none; max-width: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: var(--ink); padding: .5rem 1rem; z-index: 50; font-weight: 800; }
.skip:focus { left: 8px; top: 8px; outline: 3px solid var(--blue); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
/* Capitals by font-variant, not text-transform: a transformed word reaches screen readers in capitals and some spell it out. */
h3, h2.sub { font-size: 1.12rem; line-height: 1.05; margin-top: 1.1rem; color: var(--ink-soft); font-variant-caps: all-small-caps; letter-spacing: .05em; border-bottom: 2px solid var(--trim); padding-bottom: .15rem; }
p { margin: .4rem 0; }
.px-title { display: block; margin: 0 0 .7rem; line-height: 0; }
.px-title canvas { height: auto; }
.plain-title { font-variant-caps: all-small-caps; font-size: 1.25em; letter-spacing: .04em; }
/* A screen's heading takes the focus when the screen changes: no ring for a mouse, one for a keyboard. */
h1[tabindex='-1']:focus { outline: none; }
h1[tabindex='-1']:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.field-label { font-weight: 800; color: var(--ink-soft); margin: .8rem 0 0; }
.field-label + .big-name, .field-label + .big-code { margin-top: .2rem; }
a { color: var(--blue); }
::placeholder { color: var(--ink-soft); opacity: 1; }

.loading { text-align: center; margin-top: 30vh; font-weight: 700; }

/* ---- header ---- */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  padding: .55rem 16px; background: var(--ink); color: #fff;
  border-bottom: 4px solid var(--accent);
}
.logo { line-height: 0; }
.clock { display: flex; gap: .3rem; flex-wrap: wrap; }
.chip { background: #453756; border: 2px solid #8d7fa0; padding: 0 .45rem; border-radius: var(--radius); font-size: .8rem; font-weight: 700; color: #fff; }
.who { margin-left: auto; display: flex; gap: .7rem; align-items: center; font-size: .9rem; min-width: 0; }
.who .username { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.top .link { color: #fff; }
.top .link:focus-visible, .top a:focus-visible { outline-color: #fff; }

/* ---- tabs: a bottom bar on phones, a top bar on wide screens ---- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--paper); border-top: 3px solid var(--frame);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab {
  position: relative; font: inherit; font-size: min(.75rem, 3.4vw); font-weight: 800; color: var(--ink); /* (never wider than a fifth of a phone, at any text size) */
  background: none; border: 0; border-right: 2px solid var(--trim); cursor: pointer;
  min-height: var(--tabs-h); padding: .35rem .1rem .3rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
}
.tab:last-child { border-right: 0; }
.tab[aria-selected="true"] { background: var(--accent); box-shadow: inset 0 4px 0 var(--frame); }
.tab:focus-visible { outline: 3px solid var(--blue); outline-offset: -4px; }
.tab-avatar { height: 24px !important; width: 16px !important; }
.tab-badge {
  position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--bad); color: #fff; border: 2px solid var(--frame); border-radius: 2px;
  font-size: .7rem; line-height: 14px; text-align: center;
}
.foot { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; padding: 0 16px 20px; font-size: .8rem; color: var(--ink); }
.foot a { color: var(--ink); font-weight: 700; display: inline-block; padding: .3rem .25rem; margin: -.3rem -.25rem; min-height: 24px; }
main.has-tabs + .foot { padding-bottom: calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom, 0px)); }

@media (min-width: 760px) {
  .tabs {
    position: sticky; top: 0; bottom: auto; grid-template-columns: repeat(5, auto); justify-content: center; gap: 6px;
    background: var(--ink); border-top: 0; border-bottom: 3px solid var(--frame); padding: 8px 16px 0;
  }
  .tab {
    flex-direction: row; gap: .5rem; font-size: .95rem; min-height: 44px; padding: .4rem 1.1rem;
    background: var(--paper-2); border: 3px solid var(--frame); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
  }
  .tab:last-child { border-right: 3px solid var(--frame); }
  .tab[aria-selected="true"] { box-shadow: none; }
  .tab-badge { position: static; }
  main.has-tabs + .foot { padding-bottom: 20px; }
}

/* ---- layout ---- */
main { padding: 16px; margin: 0 auto; }
main:focus, .tabbed:focus { outline: none; }
main.narrow { max-width: 600px; }
main.wide { max-width: 1100px; }
main.has-tabs { padding: 0; }
.tabbed { max-width: 1100px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 860px) {
  /* two newspaper columns, so short cards stack without gaps */
  .tab-today, .tab-class, .tab-me { display: block; columns: 2; column-gap: 16px; }
  .tab-today > .box, .tab-class > .box, .tab-me > .box { break-inside: avoid; margin: 0 4px 16px 0; }
  .tab-today > .todo, .tab-today > .mentor-hint { margin-right: 4px; }
  .tabbed > .dev, .tabbed > .achievements { margin-top: 16px; }
  .tabbed .date-card, .tabbed .ready, .tabbed .todo, .tab-today > .mentor-hint, .tabbed .seating, .tabbed .profile, .tabbed .dev, .tabbed .achievements { column-span: all; }
  .tab-plan { max-width: 780px; }
}

/* ---- boxes: bright panel frames ---- */
.box {
  background: var(--paper);
  border: 3px solid var(--frame);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--frame), inset 0 0 0 3px #fff, inset 0 0 0 5px var(--trim);
  padding: 18px;
  min-width: 0;
}
.hero { text-align: center; margin-top: 6vh; }
.hero .px-title { display: flex; justify-content: center; }
.hero-art { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; }
.ready { display: flex; align-items: center; justify-content: space-between; gap: .8rem 1rem; flex-wrap: wrap; background: var(--sun); }
.ready-text { display: flex; align-items: center; gap: .8rem; }
/* ---- what to do today: a short list of steps, the first one still to do with the strong button ---- */
.todo-list { list-style: none; padding: 0; margin: .2rem 0 .7rem; display: grid; gap: .4rem; }
.todo-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; padding: .5rem .6rem; background: var(--paper-2); border: 2px solid var(--frame); border-radius: var(--radius); }
.todo-list li.is-done, .todo-list li.is-wait { border-color: var(--trim); }
.todo-mark { flex: none; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border: 2px solid var(--frame); border-radius: 4px; background: #fff; font-weight: 800; line-height: 1; }
.todo-list li.is-done .todo-mark { background: var(--good); color: #fff; }
.todo-list li.is-wait .todo-mark { border-style: dashed; }
.todo-text { flex: 1 1 12rem; min-width: 0; font-weight: 700; }
.todo-list li.is-done .todo-text, .todo-list li.is-wait .todo-text { font-weight: 400; }
.todo .daily-goal { margin-bottom: .7rem; }
.todo > .hint { margin-bottom: 0; }
/* ---- a hint from the mentor: the face, a few words, "Got it" ---- */
.mentor-hint { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; background: var(--blue-light); border-color: var(--blue); box-shadow: 4px 4px 0 var(--blue); padding: 12px 14px; }
.mentor-hint .hint-face { flex: none; }
.mentor-hint .hint-words { flex: 1 1 14rem; min-width: 0; }
.mentor-hint .hint-words p { margin: .15rem 0 0; }
.replay > .mentor-hint, .report > .mentor-hint { margin-bottom: 1rem; }
.box:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.dev { border-style: dashed; }
.dev-msg { font-weight: 700; }
.boot-error { max-width: 480px; margin: 20vh auto; }

.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }

/* ---- buttons ---- */
.btn {
  font: inherit; font-weight: 800; color: var(--ink); text-decoration: none; text-align: center;
  background: #fff; border: 3px solid var(--frame); border-radius: var(--radius);
  padding: .5rem .95rem; cursor: pointer; box-shadow: 3px 3px 0 var(--frame);
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
}
.btn:hover { background: var(--sun); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--frame); }
.btn.primary { background: var(--accent); color: var(--ink); }
.btn.primary:hover { background: #ffbb5c; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { background: #8f1f1f; color: #fff; }
.btn.small { padding: .2rem .6rem; min-height: 40px; font-size: .9rem; box-shadow: 2px 2px 0 var(--frame); }
.btn[disabled] { background: #e7e1d6; color: var(--ink-soft); border-style: dashed; cursor: not-allowed; box-shadow: none; }
.btn[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: inset 0 -4px 0 #1f4488, 3px 3px 0 var(--frame); }
.btn[aria-pressed="true"]:hover { background: #244d99; color: #fff; }
.btn:focus-visible, .link:focus-visible, .seg input:focus-visible + label, .mood-list input:focus-visible + label, select:focus-visible, input:focus-visible,
summary:focus-visible, .seat-inner:focus-visible, a:focus-visible, .sched-scroll:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}
.link { background: none; border: 0; padding: .6rem 0; min-height: 44px; font: inherit; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }

/* ---- forms ---- */
.form { display: grid; gap: .4rem; }
.form label { font-weight: 700; margin-top: .4rem; }
input, select {
  font: inherit; padding: .5rem .6rem; border: 3px solid var(--frame); border-radius: var(--radius);
  background: #fff; color: var(--ink); min-height: 44px; width: 100%; max-width: 100%;
}

input[type="range"] { padding: 0; border: 0; background: none; width: 11rem; accent-color: var(--blue); cursor: pointer; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--blue); }

.hint { color: var(--ink-soft); font-size: .875rem; }
.error { color: var(--bad); font-weight: 700; min-height: 1.2em; }
.saved { color: var(--good); font-weight: 700; margin: 0; min-height: 1.2em; }
.saved.error { color: var(--bad); }
.picked { font-weight: 700; color: var(--good); }

.big-name { font-size: 1.5rem; font-weight: 900; margin: .6rem 0; word-break: break-all; }
.big-code {
  font: 900 1.9rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em;
  background: var(--ink); color: #fff; padding: .8rem 1rem; border-radius: var(--radius); text-align: center; margin: .8rem 0;
  border: 3px solid var(--frame); box-shadow: inset 0 0 0 3px var(--accent);
}

/* ---- avatar maker ---- */
.maker { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.maker-preview, .profile-avatar { background: #e8f4fb; border: 3px solid var(--frame); border-radius: var(--radius); padding: 10px; line-height: 0; box-shadow: inset 0 -8px 0 #cfe6f3; }
.maker-controls { display: grid; gap: .4rem; flex: 1; min-width: 220px; }
.kit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(3.4rem, 5.4rem) auto; gap: .4rem; align-items: center; }
.kit-label { overflow-wrap: anywhere; }
.kit-row .btn.small { min-width: 44px; min-height: 44px; }
.kit-name { display: block; font-size: .78rem; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.kit-label { font-weight: 700; }
.kit-value { text-align: center; font-variant-numeric: tabular-nums; }

/* ---- stats ---- */
.username { font-weight: 800; }
.stat { display: grid; grid-template-columns: minmax(7.5rem, 9.5rem) 1fr 2rem; gap: .5rem; align-items: center; font-size: .9rem; margin: .25rem 0; }
.stat-name { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; }
.stat-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.bar { display: block; height: 14px; background: #e9e1d2; border: 2px solid var(--frame); border-radius: 0; overflow: hidden; box-shadow: inset 0 2px 0 #d3c9b6; }
.bar-fill { display: block; height: 100%; background: var(--skill); box-shadow: inset 0 3px 0 #ffffff66, inset 0 -3px 0 #00000022; }
.bar.energy .bar-fill { background: var(--energy); }
.bar.mood .bar-fill { background: var(--mood); }
.bar.focus .bar-fill { background: var(--focus); }
.bar.confidence .bar-fill { background: var(--confidence); }
.bar.stress .bar-fill { background: var(--stress); }
.bar.goal .bar-fill { background: var(--accent); }
.bar.done .bar-fill { background: #4fbf6a; }

/* ---- folds (details) ---- */
.fold { border: 2px solid var(--frame); border-radius: var(--radius); background: #fff; margin: .5rem 0; }
.fold > summary { cursor: pointer; padding: .55rem .7rem; font-weight: 800; display: flex; flex-wrap: wrap; gap: 0 .6rem; align-items: baseline; justify-content: space-between; min-height: 44px; list-style: none; background: var(--paper-2); }
.fold > summary::-webkit-details-marker { display: none; }
/* The marker is decoration: the second form gives it an empty text alternative (older browsers keep the first). */
.fold > summary::before { content: '▶'; content: '▶' / ''; font-size: .7rem; margin-right: .1rem; }
.fold[open] > summary::before { content: '▼'; content: '▼' / ''; }
.fold[open] > summary { border-bottom: 2px solid var(--frame); }
.fold-title { flex: 1; }
.fold > :not(summary) { margin-left: .6rem; margin-right: .6rem; }
.fold > .timeline { margin-left: 0; }

/* ---- Today ---- */
.date-card .term-line { font-weight: 800; margin-top: 0; }
.day-off { background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .4rem .6rem; font-weight: 700; }
.special-note { background: var(--blue-light); border: 2px solid var(--blue); border-radius: var(--radius); padding: .35rem .6rem; }
.cal-list, .hw-list, .goal-list, .inbox-list, .member-list, .candidate-list, .teacher-list, .ach-list, .earned-list, .highlight-list, .rc-summary, .grade-grid, .progress-list, .decided-list, .seats {
  list-style: none; padding: 0; margin: 0;
}
.cal-list li { display: grid; gap: .1rem; padding: .4rem .6rem; background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); margin: .35rem 0; }
.daily-goal { display: grid; gap: .15rem; background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .5rem .7rem; }
.goal-list li { margin: .55rem 0; }
.goal-head { display: flex; justify-content: space-between; gap: .6rem; font-size: .92rem; margin-bottom: .2rem; }
.goal-value { font-weight: 800; white-space: nowrap; }
.goal-list .is-done .goal-value { color: var(--good); }
.hw-list li { display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; padding: .35rem .6rem; background: var(--paper-2); border-radius: var(--radius); margin: .3rem 0; border-left: 5px solid var(--skill); }
.hw-list li.is-late { background: var(--bad-bg); border-left-color: var(--bad); }
.late-chip { background: var(--bad); color: #fff; font-weight: 800; font-size: .94rem; line-height: 1.2; padding: 0 .4rem; border-radius: 2px; font-variant-caps: all-small-caps; }
.veg-chip, .fav-chip, .item-chip { display: inline-block; font-size: .78rem; font-weight: 800; padding: 0 .4rem; border: 2px solid var(--frame); border-radius: 2px; margin-left: .4rem; background: var(--good-bg); }
.fav-chip { background: #ffd9e6; }
.item-chip { background: var(--blue-light); margin: 0 .3rem .3rem 0; }
.chips { margin: .3rem 0 0; }
.inbox-list li { display: flex; align-items: center; gap: .6rem; margin: .3rem 0; }
.gift-bubble { display: inline-block; background: #ffd9e6; border: 2px solid var(--frame); border-radius: var(--radius); padding: .1rem .5rem; font-weight: 700; }
.streak { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0; font-weight: 700; }
.streak-chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: 0 .5rem; font-weight: 800; }
.emote-bubble { display: inline-block; background: #fff; border: 2px solid var(--frame); border-radius: 8px 8px 8px 0; padding: .1rem .5rem; font-weight: 700; }
.quiz-note { background: var(--bad-bg); border: 2px solid var(--bad); border-radius: var(--radius); padding: .3rem .6rem; font-weight: 700; }
.support-note { background: var(--good-bg); border: 2px solid var(--good); border-radius: var(--radius); padding: .3rem .6rem; font-weight: 600; margin: .3rem 0; }
.today-list { list-style: none; padding: 0; margin: .4rem 0 .6rem; display: grid; gap: .25rem; }
.today-list li { display: flex; flex-wrap: wrap; gap: 0 .6rem; align-items: baseline; padding: .3rem .5rem; border-radius: var(--radius); background: var(--paper-2); }
.today-list li.is-lunch { background: #dcebf5; }
.today-time { font-variant-numeric: tabular-nums; font-weight: 700; flex: none; min-width: 6.2rem; }
.today-list li > :not(.today-time) { flex: 1 1 10rem; min-width: 0; } /* (beside the time while there is room, else under it) */
.today-chip { font-size: .88rem; line-height: 1.2; font-variant-caps: all-small-caps; font-weight: 800; background: var(--accent); color: var(--ink); border: 1px solid var(--frame); border-radius: 2px; padding: 0 .3rem; margin-left: .4rem; }

/* weather */
.forecast { background: #e8f4fb; border: 2px solid var(--frame); border-radius: var(--radius); padding: .6rem .8rem; }
.wx-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .8rem; align-items: baseline; }
.wx-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; margin-top: .4rem; }
/* Each slot is four rows (label, icon, temperature, word) that line up across the four slots, so the icons are level
   even when a label such as "After school" wraps to two lines: the slots share the row's heights (subgrid). */
.wx-slot { display: grid; grid-row: span 4; grid-template-rows: subgrid; justify-items: center; row-gap: .1rem; text-align: center; }
.wx-slot > :first-child { align-self: end; }
/* Without subgrid: a label always has room for two lines, sitting on the bottom of it, so the icons still line up. */
@supports not (grid-template-rows: subgrid) {
  .wx-slot { display: flex; flex-direction: column; align-items: center; gap: .1rem; grid-row: auto; }
  .wx-slot > :first-child { min-height: 2.5em; display: flex; align-items: flex-end; justify-content: center; }
}
.wx-word { font-size: .8rem; }
.wx-duty { margin: .5rem 0 0; font-size: .9rem; font-weight: 600; }
.wx-credit { font-size: .75rem; color: var(--ink-soft); margin: .3rem 0 0; }
.wx-report { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }

/* ---- Plan ---- */
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label {
  border: 3px solid var(--frame); border-radius: var(--radius); background: #fff; box-shadow: 2px 2px 0 var(--frame);
  padding: .3rem .65rem; font-weight: 700; font-size: .9rem; color: var(--ink); cursor: pointer; min-height: 40px;
  display: inline-flex; align-items: center; gap: .3rem;
}
.seg input:checked + label { background: var(--blue); color: #fff; box-shadow: inset 0 -4px 0 #1f4488; }
/* The day's mood: one radio group of large options. */
.mood-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: .6rem; margin-top: .6rem; }
.mood-list input { position: absolute; opacity: 0; width: 1px; height: 1px; }
/* (Only the planner's mood options: the Mood stat's bar is `.bar.mood`.) */
.mood-list .mood {
  display: grid; gap: .25rem; align-content: start; cursor: pointer; min-height: 44px;
  border: 3px solid var(--frame); border-radius: var(--radius); background: #fff; box-shadow: 2px 2px 0 var(--frame); padding: .5rem .7rem;
}
.mood-name { font-size: 1.1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .4rem; }
.mood-name::before { content: ''; width: .9rem; height: .9rem; border: 3px solid var(--frame); border-radius: 50%; background: #fff; flex: none; }
.mood-more { display: grid; gap: .25rem; }
.mood-mostly .item-chip { background: var(--paper-2); }
.mood-hint { font-size: .8rem; }
.mood-list input:checked + .mood { background: var(--sun); box-shadow: inset 0 -4px 0 var(--accent-dark); }
.mood-list input:checked + .mood .mood-name::before { background: var(--blue); box-shadow: inset 0 0 0 2px #fff; }
/* A list of choices where more than one may be picked (how a student learns) has square marks, not radio dots. */
.mood-list input[type="checkbox"] + .mood .mood-name::before { border-radius: 2px; }
/* A heading after a list of choices keeps clear of the cards' shadows. */
.mood-list + .px-title { margin-top: 1.4rem; }
.mood-line { margin: .3rem 0; }
.mood-line .item-chip { font-size: .9rem; padding: .1rem .5rem; background: var(--sun); }
.highlight-list.surprise-list li { background: var(--sun); border-left-color: var(--accent-dark); }
.choice { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; gap: .6rem; align-items: center; margin: .4rem 0; font-weight: 700; }
.homework { margin-top: .5rem; background: var(--paper-2); border-radius: var(--radius); padding: .3rem .6rem; }
.after-hint { font-weight: 700; color: var(--ink); min-height: 1.3em; }
.save-bar {
  position: sticky; bottom: calc(var(--tabs-h) + 10px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: flex; gap: .8rem; align-items: center; flex-wrap: wrap;
  background: var(--paper); border: 3px solid var(--frame); box-shadow: 4px 4px 0 var(--frame); border-radius: var(--radius); padding: .5rem .7rem;
}
@media (min-width: 760px) { .save-bar { bottom: 12px; } }
@media (max-width: 600px) {
  .choice { grid-template-columns: 1fr; gap: .2rem; }
}

/* ---- Timetable (a Swedish school schema) ---- */
.sched-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .4rem -4px; padding: 0 4px 4px; }
/* The grid owns the two rows (the day names, then the day): every column takes part in them (subgrid), so all the headers are as tall
   as the tallest (a day name that wraps) and every column's hours start on the same line as the clock's. */
.sched-grid { display: grid; grid-template-columns: 3rem repeat(5, minmax(6.5rem, 1fr)); grid-template-rows: auto auto; min-width: 560px; border: 3px solid var(--frame); border-radius: var(--radius); background: #fff; }
.sched-col, .sched-hours { border-left: 1px solid #d8d0c0; display: grid; grid-row: span 2; grid-template-rows: subgrid; }
.sched-hours { border-left: 0; }
.sched-col.is-today { background: #fff7d1; box-shadow: inset 3px 0 0 var(--accent), inset -3px 0 0 var(--accent); }
.sched-day { display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; padding: .3rem 0; border-bottom: 2px solid var(--frame); background: var(--paper-2); min-height: 2.1rem; }
.sched-col.is-today .sched-day { background: var(--accent); }
h3.sched-day { font-size: 1rem; line-height: 1.5; margin: 0; color: inherit; font-variant-caps: normal; letter-spacing: 0; }
/* One hour is 60 x 0.135 rem (REM in timetable.js): the lines follow the hours when the text size changes. */
.sched-body { position: relative; background-image: linear-gradient(#ece6da 1px, transparent 1px); background-size: 100% 8.1rem; }
.sched-hour { position: absolute; right: .3rem; transform: translateY(-50%); font-size: .7rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sched-hour:first-child { transform: none; }
.sched-block { position: absolute; left: 2px; right: 2px; border: 1px solid rgba(42, 31, 51, .6); border-radius: 2px; padding: 1px 4px; overflow: hidden; font-size: .7rem; line-height: 1.2; display: flex; flex-direction: column; background: #f3e7a8; }
.sched-block strong { font-size: .76rem; }
.sched-time { font-variant-numeric: tabular-nums; }
.sched-meta { color: rgba(42, 31, 51, .85); }
.sched-block.is-rast { background: #cfe2ee; border-style: dashed; justify-content: center; line-height: 1.05; }
.sched-block.is-lunch { background: #bcd8ea; }
.subj-swedish { background: #f4e7a6; } .subj-english { background: #f7d9a0; } .subj-maths { background: #f6cdd6; }
.subj-art { background: #e8b4ea; } .subj-home_ec { background: #eba8e0; } .subj-pe { background: #e0a6f0; }
.subj-music { background: #fbe08a; } .subj-crafts { background: #98d98a; }
.subj-biology { background: #cdf59a; } .subj-physics { background: #b8ec9e; } .subj-chemistry { background: #a8e6b8; } .subj-technology { background: #bfe0c8; }
.subj-geography { background: #f0e0b0; } .subj-history { background: #e8d4a8; } .subj-religion { background: #e6dcc2; } .subj-civics { background: #f2d8b8; }
.subj-german, .subj-french, .subj-spanish { background: #b8d4f4; }
.subj-mentor { background: #d6e4ef; }

/* ---- Class ---- */
.board { background: #2f6b4f; color: #fff; text-align: center; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: .8rem; border: 3px solid var(--frame); border-bottom-width: 6px; border-radius: var(--radius); padding: .3rem; margin: 0 auto .8rem; max-width: 420px; }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
@media (min-width: 760px) { .seats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.seat { min-width: 0; }
.seat-inner {
  width: 100%; height: 100%; font: inherit; color: var(--ink); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  background: #e9d3a8; border: 3px solid var(--frame); border-radius: var(--radius); padding: .4rem .25rem .35rem;
  box-shadow: 3px 3px 0 var(--frame), inset 0 -6px 0 #d2b680;
}
button.seat-inner { cursor: pointer; }
button.seat-inner:hover { background: #f5e3bd; }
button.seat-inner:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--frame), inset 0 -6px 0 #d2b680; }
.seat.is-me .seat-inner { background: var(--sun); }
.seat.is-blocked .seat-inner { background: #ddd8d0; }
.seat-name { font-size: .76rem; font-weight: 800; max-width: 100%; overflow-wrap: anywhere; line-height: 1.15; }
.seat-tag { font-size: .68rem; font-weight: 700; padding: 0 .3rem; border: 1px solid var(--frame); border-radius: 2px; background: #fff; white-space: nowrap; }
.blocked-tag { background: var(--bad-bg); }
.me-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hearts { font-size: .8rem; letter-spacing: 1px; white-space: nowrap; }
.hearts-on { color: #c2255c; }
.hearts-off { color: #b9ad9b; }
.member-list, .candidate-list { display: grid; gap: .4rem; margin: .5rem 0; }
.member-list li, .candidate-list li { display: flex; align-items: center; gap: .6rem; background: var(--paper-2); border-radius: var(--radius); padding: .3rem .5rem; }
.candidate-list li.is-voted { background: var(--good-bg); outline: 2px solid var(--good); }
.cand-text { display: grid; flex: 1; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; background: #fff; border: 3px solid var(--frame); border-radius: var(--radius); padding: .5rem .3rem; box-shadow: 2px 2px 0 var(--frame); }
.tile-label { font-size: .98rem; line-height: 1.2; font-weight: 800; font-variant-caps: all-small-caps; color: var(--ink-soft); }
.tile .bar { width: 100%; }

/* popover (a native dialog) */
dialog.popover {
  border: 3px solid var(--frame); border-radius: var(--radius); padding: 0; color: var(--ink);
  background: var(--paper); box-shadow: 6px 6px 0 var(--frame), inset 0 0 0 3px #fff, inset 0 0 0 5px var(--trim);
  width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
}
dialog.popover::backdrop { background: rgba(42, 31, 51, .55); }
.popover-body { padding: 16px; }
.popover-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.mate-head { display: flex; gap: .8rem; align-items: center; background: var(--paper-2); border-radius: var(--radius); padding: .4rem .6rem; }
.emote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.sticker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.report-box { background: var(--bad-bg); border: 2px solid var(--bad); border-radius: var(--radius); padding: .5rem .7rem; margin-top: .6rem; }

/* ---- Me ---- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-line { font-weight: 800; margin: 0; }
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .35rem .8rem; }
.grade-grid li { display: flex; align-items: center; gap: .5rem; font-size: .92rem; min-width: 0; }
/* Where a student is, in words (never a letter before a report card): the subject, then how it is going. */
.progress-list { display: grid; gap: .3rem; margin: .4rem 0; }
.progress-list li { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; padding: .25rem 0; border-bottom: 1px dotted var(--frame); }
.decided-list li { margin: .4rem 0; }
.decided-list .hint { display: block; }
.grade { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border: 3px solid var(--frame); border-radius: var(--radius); background: #fff; box-shadow: 2px 2px 0 var(--frame); line-height: 0; }
/* Teal green through pale to orange red, each step lighter or darker than the next: told apart with
   protanopia, deuteranopia and tritanopia too (scripts/cvd-check.js). The letter still says it all. */
.grade-A { background: #3fbfae; } .grade-B { background: #a5e6dc; } .grade-C { background: #fdf6d8; }
.grade-D { background: #ffd28a; } .grade-E { background: #f59a4c; } .grade-F { background: var(--bad); }
/* No grade (a dash): too little to go on because of time away. Plain white, and a dash, so it is not mistaken for a pass or an F. */
.grade-dash { background: #fff; font-weight: 900; font-size: 1.3rem; line-height: 1; color: var(--ink); }
.merit { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--sun); border: 3px solid var(--frame); border-radius: var(--radius); padding: .5rem .8rem; margin-top: .8rem; }
.teacher-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .1rem .6rem; align-items: center; padding: .4rem 0; border-top: 2px dotted var(--trim); }
.teacher-list li:first-child { border-top: 0; }
.teacher-name { display: grid; }
.rel-word { grid-column: 2; font-weight: 700; font-size: .9rem; }
.ach-count { display: flex; align-items: center; gap: .5rem; font-weight: 800; }
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.ach { display: flex; gap: .6rem; align-items: flex-start; border: 3px solid var(--frame); border-radius: var(--radius); padding: .45rem .55rem; background: #fff; box-shadow: 2px 2px 0 var(--frame); }
.ach-text { display: grid; gap: .1rem; font-size: .88rem; min-width: 0; }
.ach-meta { font-size: .78rem; color: var(--ink-soft); }
.medal { flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 3px solid var(--frame); border-radius: 50%; font-weight: 900; background: #ddd; }
.tier-bronze.is-earned { background: #f6e0cd; } .tier-bronze.is-earned .medal { background: #d28b53; }
.tier-silver.is-earned { background: #eef1f5; } .tier-silver.is-earned .medal { background: #c3ccd6; }
.tier-gold.is-earned { background: #fff3c4; } .tier-gold.is-earned .medal { background: #f5c93b; }
.ach.is-locked { background: #ece7de; box-shadow: none; border-style: dashed; border-color: #6f6578; }
.ach.is-locked .ach-text { color: #4d4458; }
.earned-list li, .goal-result { display: flex; gap: .6rem; align-items: center; margin: .35rem 0; }
.goal-result { border: 3px solid var(--frame); border-radius: var(--radius); padding: .5rem .7rem; background: var(--paper-2); }
.goal-result > div { display: grid; }
.goal-result.is-done { background: var(--good-bg); }
.goal-mark { flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.2rem; border: 3px solid var(--frame); background: #fff; border-radius: var(--radius); }
.goal-result.is-done .goal-mark { background: #4fbf6a; }
.earned-list .medal { background: #f5c93b; }
.day-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.day-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; padding: .5rem 0; border-bottom: 2px dotted var(--trim); }
.setting-label { display: grid; }
.volume { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; max-width: 100%; }
.volume input { min-width: 0; flex: 1 1 6rem; }
.volume output { min-width: 3.2rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.account-actions { display: grid; gap: .7rem; margin-top: 1rem; }
.confirm-box { background: var(--bad-bg); border: 2px solid var(--bad); border-radius: var(--radius); padding: .5rem .7rem; margin-top: .5rem; }

/* ---- tutorial ---- */
.tut-mentor { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.tut-dots { display: flex; gap: 4px; margin-top: .3rem; }
.tut-dots span { width: 12px; height: 12px; border: 2px solid var(--frame); background: #fff; }
.tut-dots span.on { background: var(--accent); }
.speech { position: relative; background: #fff; border: 3px solid var(--frame); border-radius: var(--radius); padding: 14px; box-shadow: 3px 3px 0 var(--frame); min-height: 11rem; }
.speech::before { content: ''; position: absolute; top: -13px; left: 28px; width: 20px; height: 20px; background: #fff; border-left: 3px solid var(--frame); border-top: 3px solid var(--frame); transform: rotate(45deg); }
.speech p { font-size: 1.02rem; }
/* The mentor beside the real screen while the tour is on, and the arrival scene above the welcome. */
.tour-guide { margin-bottom: 1rem; border-color: var(--accent); }
.tour-guide .speech { min-height: 0; margin: 0 0 .8rem; }
.tour-guide:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.arrival-scene { margin: -.2rem 0 1rem; line-height: 0; }
.arrival-scene canvas { max-width: 100%; border: 3px solid var(--frame); border-radius: var(--radius); }
/* The day being planned, on the Plan tab, and the mentor's tip for it. */
.mentor-tip { background: var(--blue-light); border: 2px solid var(--blue); border-radius: var(--radius); padding: .45rem .7rem; margin-top: .8rem; }

/* ---- replay ---- */
.replay { padding: 12px; }
.scene-wrap { display: flex; justify-content: center; background: var(--ink); border-radius: var(--radius); overflow: hidden; }
.scene { display: block; max-width: none; }
.caption { min-height: 3em; font-weight: 700; margin: .8rem 0 0; }
.replay-title { margin: 4px 4px 8px; }
.admin-banner { background: var(--bad); color: #fff; font-weight: 800; border: 3px solid var(--frame); border-radius: var(--radius); padding: .4rem .7rem; margin: 0 0 8px; }
/* The transport under the picture: the clock, the scrub bar with the day's lessons, the playback keys. */
.replay-bar {
  display: grid; gap: .45rem; margin-top: .6rem;
  background: var(--paper-2); color: var(--ink); border: 2px solid var(--frame); border-radius: var(--radius); padding: .5rem;
}
.replay-bar .btn { min-height: 44px; }
.replay-bar .btn:focus-visible, .scrub:focus-visible, .speed:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.replay-now { margin: 0; min-height: 1.5em; font-weight: 700; }
.replay-clock { font-variant-numeric: tabular-nums; font-size: 1.15rem; margin-right: .35rem; }
.scrub-wrap { display: grid; gap: 2px; }
.replay-bar input.scrub { display: block; width: 100%; min-height: 0; height: 32px; margin: 0; accent-color: var(--accent-dark); cursor: pointer; touch-action: none; }
.scrub-day { position: relative; height: 12px; margin: 0 8px; background: #fff; border: 2px solid var(--frame); border-radius: 3px; overflow: hidden; }
.scrub-day .seg { position: absolute; top: 0; bottom: 0; box-shadow: inset -1px 0 0 var(--frame); }
.scrub-day .seg-lunch { background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(42, 31, 51, .35) 3px 4px); }
.scrub-day .seg-activity { background-image: repeating-linear-gradient(90deg, transparent 0 3px, rgba(42, 31, 51, .35) 3px 4px); }
.scrub-day .tick { position: absolute; top: 0; width: 2px; height: 5px; margin-left: -1px; background: var(--ink); }
.transport { display: flex; justify-content: center; gap: .35rem; }
.transport .btn.tp { flex: 1 1 0; min-width: 44px; max-width: 76px; padding-left: .2rem; padding-right: .2rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.transport .btn.tp .glyph { margin: 0; }
.transport .btn[aria-pressed='true'], .replay-more .btn[aria-pressed='true'] { background: var(--blue-light); color: var(--ink); box-shadow: inset 0 3px 0 var(--frame); }
.replay-more { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.speed-group { display: inline-flex; align-items: center; gap: .35rem; font-weight: 800; }
.speed { min-height: 44px; min-width: 64px; font: inherit; font-weight: 800; padding: 0 .4rem; background: #fff; color: var(--ink); border: 3px solid var(--frame); border-radius: var(--radius); }
.legend { display: flex; flex-wrap: wrap; gap: .2rem 1rem; list-style: none; margin: 0; padding: 0; font-size: .9rem; font-weight: 700; }
.legend li { display: inline-flex; align-items: center; gap: .35rem; }
.legend-mark { width: 26px; height: 22px; image-rendering: pixelated; }
.day-text h2 { margin-top: 1rem; }
.day-log {
  list-style: none; margin: .4rem 0; padding: .3rem .6rem; min-height: 4.5rem; max-height: 14rem; overflow-y: auto;
  background: #fff; border: 2px solid var(--frame); border-radius: var(--radius);
}
.day-log:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.day-log li { padding: .2rem 0; border-top: 2px dotted var(--trim); }
.day-log li:first-child { border-top: 0; }
.day-log time { color: var(--ink-soft); font-weight: 800; font-variant-numeric: tabular-nums; margin-right: .4rem; }
.day-log .is-clock { font-weight: 700; }
@media (max-width: 600px) {
  main.wide { padding: 8px; }
  .replay { padding: 4px; }
  .caption, .day-text { padding: 0 8px; }
  .replay-bar { margin-left: 4px; margin-right: 4px; }
  .day-text { padding-bottom: 8px; }
  .replay > .hint { padding: 0 8px; }
}

/* ---- report and report card ---- */
.timeline { padding-left: 2.1rem; margin: .6rem 0; }
.timeline li { margin: .5rem 0; }
.pops { display: inline-flex; flex-wrap: wrap; gap: .3rem; margin-left: .4rem; font-size: .85rem; }
.up { color: var(--good); font-weight: 800; }
.down { color: var(--bad); font-weight: 800; }
.changes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .3rem .8rem; }
.changes li { display: flex; justify-content: space-between; gap: .4rem; border-bottom: 2px dotted var(--trim); }
.quiz-result { background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .6rem .8rem; margin: .6rem 0; }
.highlight-list li { background: var(--blue-light); border-left: 5px solid var(--blue); border-radius: var(--radius); padding: .4rem .6rem; margin: .35rem 0; }
.highlight-list li.hl-decision { background: var(--sun); border-left-color: var(--accent-dark); }
.highlight-list li.hl-personal { background: var(--paper-2); border-left-color: var(--ink-soft); }
.days-off { background: var(--good-bg); border: 2px solid var(--good); border-radius: var(--radius); padding: .35rem .6rem; font-weight: 700; margin-top: .8rem; }
.report-card { background: #fffdf6; }
.rc-head { text-align: center; border-bottom: 3px double var(--frame); margin-bottom: .8rem; padding-bottom: .5rem; }
.rc-head .px-title { display: flex; justify-content: center; }
.rc-term { font-weight: 800; font-size: 1.1rem; margin: 0; }
.rc-table { width: 100%; border-collapse: collapse; }
.rc-table th, .rc-table td { text-align: left; padding: .3rem .4rem; border-bottom: 2px dotted var(--trim); font-weight: 600; }
.rc-table thead th { border-bottom: 3px solid var(--frame); font-variant-caps: all-small-caps; font-size: 1rem; line-height: 1.1; letter-spacing: .05em; }
.rc-table .rc-grade { text-align: right; width: 4.5rem; }
.rc-summary li { padding: .25rem 0; }

/* ---- more school life: projects, break duty, seats, programmes, graduation ---- */
.offer-list { list-style: none; padding: 0; margin: .3rem 0 .6rem; display: grid; gap: .35rem; }
.offer-list li { display: grid; gap: .1rem; background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .4rem .6rem; }
.switch-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .1rem .6rem; align-items: center; padding: .45rem 0; border-top: 2px dotted var(--trim); min-height: 44px; }
.switch-row label { font-weight: 700; cursor: pointer; padding: .3rem 0; }
.switch-row .hint { grid-column: 2; }
/* A heading and its text, one under the other (no box in front to line up with). */
.switch-row.stacked { grid-template-columns: minmax(0, 1fr); }
.switch-row.stacked > * { grid-column: 1; margin: 0; }
h3 + .switch-row { border-top: 0; }
.switch-row input { cursor: pointer; }
/* A choice from a list in the same kind of row (glasses): the label, the list, and what was saved underneath. */
.pick-row select { min-width: 0; }
.pick-row .saved { grid-column: 1 / -1; }
.member-list li { flex-wrap: wrap; }
.person-name { font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.no-avatar { flex: none; width: 32px; height: 48px; background: #e9e1d2; border: 2px dashed var(--ink-soft); border-radius: var(--radius); }
.count-chip, .reach-chip { flex: none; font-size: .78rem; font-weight: 800; padding: 0 .4rem; border: 2px solid var(--frame); border-radius: 2px; background: #fff; white-space: nowrap; }
.reach-chip { background: var(--good-bg); }
.due-line { display: flex; align-items: center; gap: .4rem; background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .35rem .6rem; }
.rota-today { display: grid; gap: .15rem; background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .5rem .7rem; }
.rota-today strong { font-size: 1.02rem; }
.cover-line { font-weight: 700; }
.rota-table { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .88rem; }
.rota-table th, .rota-table td { text-align: left; padding: .25rem .35rem; border-bottom: 2px dotted var(--trim); vertical-align: top; }
.rota-table tbody th { white-space: nowrap; }
@media (max-width: 420px) { .rota-table { font-size: .8rem; } .rota-table th, .rota-table td { padding: .25rem .2rem; } }
.table-scroll { overflow-x: auto; }
.rota-table .wd-short { display: none; }
@media (max-width: 520px) { .rota-table .wd-long { display: none; } .rota-table .wd-short { display: inline; } }
.rota-table thead th { border-bottom: 3px solid var(--frame); font-variant-caps: all-small-caps; font-size: .94rem; line-height: 1.1; letter-spacing: .04em; }
.rota-table tr.is-today th, .rota-table tr.is-today td { background: var(--sun); font-weight: 700; }
.programme-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .35rem; }
.programme-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; background: var(--paper-2); border-radius: var(--radius); padding: .35rem .5rem; }
.programme-list li.is-chosen { background: var(--good-bg); outline: 2px solid var(--good); }
.prog-text { display: grid; flex: 1; min-width: 9rem; }
.seat-choice { background: var(--sun); border: 2px solid var(--frame); border-radius: var(--radius); padding: .5rem .7rem; margin-bottom: .8rem; }
.seat-choice .row { margin-top: .4rem; }
.seat-note { margin-top: .4rem; }
.seat.is-free .seat-inner { background: #fff; border-style: dashed; box-shadow: 3px 3px 0 var(--frame); }
.seat.is-taken .seat-inner { background: #ddd8d0; box-shadow: none; }
.free-desk { width: 32px; height: 48px; border: 2px dashed var(--ink-soft); border-radius: var(--radius); background: var(--paper-2); }
.group-tag { background: var(--sun); }
.class-tag { background: var(--paper); }
.profile-next { margin: .3rem 0 0; }
.grad-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.graduate { display: flex; gap: .6rem; align-items: flex-start; border: 3px solid var(--frame); border-radius: var(--radius); padding: .45rem .55rem; background: #fff3c4; box-shadow: 2px 2px 0 var(--frame); }
.graduate .medal { background: #f5c93b; }
.grad-text { display: grid; gap: .1rem; min-width: 0; }
.graduation { text-align: center; background: #fffdf6; }
.graduation .px-title { display: flex; justify-content: center; }
.graduation .merit, .graduation .grad-list { text-align: left; }
.graduation .row { justify-content: center; }
.grad-stars { font-size: 1.6rem; letter-spacing: .3em; color: var(--accent-dark); line-height: 1; margin-bottom: .5rem; }
.grad-hello { font-weight: 800; font-size: 1.05rem; }
.grad-outcome { background: var(--good-bg); border: 2px solid var(--good); border-radius: var(--radius); padding: .5rem .7rem; font-weight: 700; }
.subj-mother_tongue { background: #f9d2b4; }

/* ---- admin ---- */
body.admin { background: #eef0f3; }
.admin-main { max-width: 1200px; display: grid; gap: 14px; }
.admin-main .box { box-shadow: 3px 3px 0 var(--frame); padding: 14px; }
.admin-main h2 { font-variant-caps: all-small-caps; letter-spacing: .04em; font-size: 1.25rem; line-height: 1.05; }
.tbl-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; border: 2px solid var(--frame); background: #fff; }
.tbl { border-collapse: collapse; width: 100%; font-size: .82rem; }
.tbl th, .tbl td { text-align: left; padding: .25rem .5rem; border-bottom: 1px solid #ddd; white-space: nowrap; vertical-align: top; }
.tbl th { position: sticky; top: 0; background: var(--paper-2); border-bottom: 2px solid var(--frame); }
.tbl td.wrap { white-space: normal; min-width: 16rem; }
.admin-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.admin-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin: .4rem 0; }
.admin-form label { display: grid; gap: .15rem; font-weight: 700; font-size: .85rem; }
.admin-form input { width: 11rem; }
.admin-found { background: var(--paper-2); border: 2px solid var(--frame); border-radius: var(--radius); padding: .5rem .7rem; margin-top: .5rem; }
.admin-found .big-code { font-size: 1.3rem; }
.tbl-wrap:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.admin-main .btn.small { min-height: 32px; box-shadow: 1px 1px 0 var(--frame); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .15rem .8rem; font-size: .88rem; margin: 0; }
.kv dt { font-weight: 700; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.dump { background: #fff; border: 2px solid var(--frame); padding: .5rem; overflow: auto; max-height: 320px; font-size: .75rem; }

/* ---- calm menus ---- */
/* Less motion is the player's choice in the accessibility panel (shared/a11y.css stills every animation). */
html[data-a11y-motion="reduce"] .btn:active, html[data-a11y-motion="reduce"] button.seat-inner:active { transform: none; }

/* ---- the main menu: the first screen of every visit ---- */
main.menu { max-width: none; margin: 0; padding: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.menu-inner { flex: 1; width: 100%; max-width: 440px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top, 0px)) 16px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
/* the scene is pixel art: shown at 1x, and at exactly 2x where there is room */
.menu-scene { display: block; width: 320px; height: 200px; image-rendering: pixelated; border: 3px solid var(--frame); border-radius: var(--radius); box-shadow: 0 0 0 3px var(--trim), 5px 5px 0 3px var(--frame); background: var(--paper-2); margin-bottom: 22px; }
.menu-inner .px-title { display: flex; justify-content: center; margin: 0 0 .3rem; }
.menu-tagline { margin: .2rem 0 0; font-size: 1.1rem; font-weight: 700; }
.menu-inner .hint { margin: .2rem 0 0; }
.menu-list { list-style: none; margin: 1.2rem 0 0; padding: 0; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: .6rem; }
.menu-btn { width: 100%; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; font-size: 1.1rem; }
.menu-note { font-size: .8rem; font-weight: 400; }
.menu-divider { height: 0; margin: .3rem 12%; border-top: 3px dotted var(--frame); opacity: .55; }
.menu-credit { display: flex; gap: .3rem 1rem; justify-content: center; flex-wrap: wrap; margin: 1.4rem 0 0; font-size: .8rem; }
.menu-credit a { color: var(--ink); font-weight: 700; display: inline-block; padding: .3rem .25rem; margin: -.3rem -.25rem; min-height: 24px; }
.menu-inner .idle-note { width: 100%; max-width: 340px; margin: 1rem 0 0; padding: .5rem .7rem; }
.idle-note p { margin: 0 0 .5rem; }
@media (min-width: 760px) and (min-height: 980px) {
  .menu-inner { max-width: 700px; }
  .menu-scene { width: 640px; height: 400px; }
}

/* recovery codes */
.recovery { margin: 1rem 0; }
.recovery-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .35rem; }
.recovery-list li { font: 700 1.05rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; background: var(--ink); color: #fff; padding: .5rem .7rem; border-radius: var(--radius); text-align: center; }

.admin-key { white-space: pre-wrap; word-break: break-all; background: var(--ink); color: #fff; padding: .5rem .7rem; border-radius: var(--radius); font-size: .8rem; }

/* ---- cards, the album, dilemmas, traits (the newer way to play) ---- */
.card-slots { display: grid; gap: .6rem; }
.card-slot { border: 2px solid var(--frame); border-radius: var(--radius); background: #fff; padding: .5rem .6rem; display: grid; gap: .35rem; }
.card-slot .choice { display: grid; grid-template-columns: minmax(6.5rem, auto) minmax(0, 1fr); gap: .5rem; align-items: center; }
.card-about { margin: 0; }
.card-about .combo { color: #8a4700; }
.mood-list .mood.is-locked { opacity: .6; cursor: not-allowed; }
.lock-chip { font-size: .75rem; font-weight: 700; margin-left: .5rem; padding: .1rem .4rem; border: 2px solid var(--frame); border-radius: 999px; background: var(--paper-2); }
.found-card { display: flex; gap: .6rem; align-items: flex-start; border: 2px solid var(--frame); border-radius: var(--radius); background: var(--sun); padding: .5rem .7rem; margin: .6rem 0; }
.found-card > div { display: grid; gap: .1rem; }
.dilemma .dilemma-text { font-weight: 700; }
.dilemma-options { display: grid; gap: .45rem; margin: .5rem 0; }
.dilemma-options .btn { width: 100%; text-align: left; white-space: normal; }
.trait-list, .card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
/* A card's face: 20 x 26 art pixels, shown at twice (or three times) the size, never smoothed. */
.card-face { display: inline-block; flex: none; width: 40px; height: 52px; background: url('/art/cards.png') 0 0 / 320px 520px no-repeat; image-rendering: pixelated; }
.card-face.big { width: 60px; height: 78px; background-size: 480px 780px; }
.card-about .card-face { float: left; margin: 0 .5rem .2rem 0; }
.card-about::after { content: ''; display: block; clear: both; }
.card-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: .1rem .6rem; align-items: start; padding: .35rem 0; border-top: 2px dotted var(--trim); }
.card-list li:first-child { border-top: 0; }
.card-list li .card-face { grid-column: 1; grid-row: 1 / span 2; }
.card-list li strong { grid-column: 2; }
.card-list li .hint { grid-column: 2 / -1; } /* under the name and the count: the whole width */
.card-list li .count-chip { grid-column: 3; grid-row: 1; }
/* A finished set: every card in a gold frame. */
.card-set.is-done .card-face { box-shadow: 0 0 0 3px #e0a92e, 0 0 0 5px var(--frame); margin: 5px; }
.card-set.is-done .card-list li { grid-template-columns: 50px minmax(0, 1fr) auto; }
.card-list li.is-missing strong { color: var(--ink-soft); }
.card-set.is-done > summary { background: var(--sun); }
.gift-row { display: grid; gap: .4rem; margin-top: .4rem; }
.gift-row .choice { display: grid; grid-template-columns: minmax(6.5rem, auto) minmax(0, 1fr); gap: .5rem; align-items: center; }
.profile > .switch-row { margin-top: .6rem; }
@media (max-width: 520px) {
  .card-slot .choice, .gift-row .choice { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Looking around in the replay, and the panel beside it (stats, schedule, the day so far) ---- */
.scene { cursor: grab; }
.scene.is-panning { cursor: grabbing; }
.zoom-group { display: inline-flex; align-items: center; gap: .3rem; }
.zoom-word { font-weight: 700; font-size: .9rem; }
.replay-side { margin-top: .9rem; min-width: 0; }
.side-tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 3px solid var(--frame); padding: 0 4px; }
.side-tab {
  font: inherit; font-weight: 800; color: var(--ink); background: var(--paper-2); border: 3px solid var(--frame); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; padding: .45rem .7rem; min-height: 44px; cursor: pointer;
}
.side-tab:hover { background: var(--sun); }
.side-tab[aria-selected='true'] { background: var(--accent); }
.side-tab:focus-visible, .side-lesson:focus-visible, .side-panel:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.side-panel { background: #fff; border: 3px solid var(--frame); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: .6rem .7rem .8rem; }
.side-panel .day-text { padding: 0; }
.side-panel .day-text h2 { margin-top: 0; }
.side-when { margin: 0 0 .5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.side-sub { margin: .8rem 0 .3rem; }
.side-panel .stat { grid-template-columns: minmax(6.5rem, 8.5rem) 1fr 2rem; }
.side-changes { margin: 0 0 .5rem; }
.side-schedule { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .35rem; }
.side-lesson {
  display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: .5rem; width: 100%; text-align: left; align-items: start;
  font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--frame); border-radius: var(--radius);
  padding: .4rem .5rem; min-height: 44px; cursor: pointer;
}
.side-lesson:hover { background: var(--sun); }
.side-lesson[aria-current='true'] { background: var(--sun); box-shadow: inset 5px 0 0 var(--accent-dark); }
.side-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; }
.side-what { display: grid; gap: .1rem; min-width: 0; }
.side-teacher { display: block; }
.side-now { display: inline-block; justify-self: start; background: var(--ink); color: #fff; font-size: .75rem; font-weight: 800; padding: 0 .35rem; border-radius: var(--radius); }
.side-did { display: block; font-size: .9rem; }
.side-surprise { color: #6a3d00; font-weight: 700; }
.side-quiz { font-weight: 700; }
@media (min-width: 1180px) {
  main.wide:has(.replay-cols) { max-width: 1500px; }
  .replay-cols { display: grid; grid-template-columns: minmax(0, 1fr) 23rem; gap: 12px; align-items: start; }
  .replay-side { margin-top: 0; position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: auto; }
}
