/* CISB House Points. Same look and layout rules as Conferences: even splits, right-aligned actions, one spacing scale.
   House colours come from /houses.css (.h-1 … .h-5 set --hc, the brand colour for bars and borders;
   --hs, the same colour nudged where needed so text on it reaches 4.5:1; and --hi, the text colour on --hs). */
:root {
  --navy: #243982;
  --navy-2: #1b2c66;
  --navy-soft: #eef1fa;
  --red: #c9251b;
  --focus: rgba(36, 57, 130, .25);
  --bg: #f4f5f9;
  --card: #ffffff;
  --ink: #1b2133;
  --muted: #5f6880;
  --line: #e2e5ee;
  --ok: #e9f6ef;
  --ok-ink: #11643c;
  --warn: #fff5e6;
  --warn-ink: #8a5300;
  --bad: #fdeeed;
  --bad-ink: #a91e16;
  --radius: 12px;
  --gap: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 2px 8px rgba(20, 30, 60, .05);
  --hc: #8a90a3;
  --hs: #8a90a3;
  --hi: #1b2133;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
.boot { padding: 4rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
/* for screen readers only */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* one focus ring for everything you can tab to (white on the navy bars) */
:where(a, button, summary, [tabindex], input[type=checkbox], input[type=radio], input[type=range], input[type=file], input[type=color]):focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
:where(.top, .room-top, .dock-top, .reveal, .seg:not(.light)) :focus-visible { outline-color: #fff; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: #fff; color: var(--navy); padding: 10px 14px; border-radius: 9px; font-weight: 700; box-shadow: var(--shadow); }
.skip:focus { top: 10px; }
main:focus { outline: none; }

/* ---------- header ---------- */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.top-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; text-decoration: none; white-space: nowrap; }
.brand-dots { display: grid; grid-template-columns: repeat(5, 8px); gap: 3px; }
.brand-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--hc); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.brand small { font-weight: 500; opacity: .75; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: rgba(255, 255, 255, .82); text-decoration: none; padding: 7px 9px; border-radius: 8px; font-weight: 500; font-size: .94rem; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--red); color: #fff; font-size: .87rem; text-align: center; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.top-right .who { opacity: .85; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-top { background: rgba(255, 255, 255, .12); border: 0; color: #fff; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.btn-top:hover { background: rgba(255, 255, 255, .22); }

/* ---------- layout ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; align-items: flex-start; gap: var(--gap); flex-wrap: wrap; margin-bottom: 18px; }
.page-head .actions { margin-left: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.actions .msg { margin-right: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.wrap > .card + .card, .wrap > .card + .grid, .wrap > .grid + .card, .wrap > .grid + .grid, .wrap > .note + .grid { margin-top: var(--gap); }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .actions { margin-left: auto; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4, .g5 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #cfd4e0; background: #fff; border-radius: 9px; padding: 8px 14px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: var(--navy); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-danger { color: var(--bad-ink); border-color: #e9b8b4; }
.btn-small { padding: 4px 10px; min-height: 30px; font-size: .88rem; }
.btn-link { border: 0; background: none; color: var(--navy); padding: 0; min-height: 0; text-decoration: underline; cursor: pointer; }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .92rem; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: .87rem; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=search], select, textarea {
  border: 1px solid #cfd4e0; border-radius: 9px; padding: 8px 11px; background: #fff; min-height: 38px; width: 100%; }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid #cfd4e0; border-radius: 9px; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--focus); border-color: var(--navy); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus), 0 0 0 1px var(--navy); border-color: var(--navy); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } }

/* ---------- houses ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border-radius: 999px; background: var(--hs); color: var(--hi); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.chip .mark, .mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .22); font-size: .87rem; font-weight: 700; }
.chip.none { background: transparent; color: var(--muted); padding: 1px 9px; border: 1.5px dashed #8a90a3; }
.chip.big { font-size: 1.05rem; padding: 4px 14px 4px 4px; }
.chip.big .mark { width: 30px; height: 30px; font-size: 1rem; }
.house-card { position: relative; overflow: hidden; padding-top: 22px; }
.house-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--hc); }
.house-card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.house-card .glyph { width: 46px; height: 46px; border-radius: 50%; background: var(--hs); color: var(--hi); display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; flex: 0 0 auto; }
.house-card .name { font-weight: 700; font-size: 1.1rem; line-height: 1.15; }
.house-card .big { font-size: 2rem; font-weight: 700; line-height: 1; }
.house-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 10px 0 0; font-size: .9rem; }
.house-card dt { color: var(--muted); }
.house-card dd { margin: 0; text-align: right; font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: #eceef4; overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; width: 0; background: var(--hc); transition: width .4s; }
.house-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.house-pick button { border: 2px solid transparent; border-radius: 999px; background: var(--hs); color: var(--hi); padding: 4px 14px 4px 4px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; opacity: .55; }
.house-pick button .mark { width: 30px; height: 30px; }
.house-pick button[aria-pressed="true"] { opacity: 1; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus); }
.house-pick button:hover { opacity: .9; }
.house-pick .rec { font-size: .87rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: rgba(255, 255, 255, .25); padding: 1px 6px; border-radius: 6px; }
.house-pick button:disabled { opacity: .2; cursor: default; }

/* ---------- stats, badges, tables ---------- */
.stat { text-align: left; text-decoration: none; color: inherit; display: block; }
.stat .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .9rem; }
a.stat:hover { border-color: var(--navy); }
.stat.warn { background: var(--warn); border-color: #f1d7a8; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .87rem; font-weight: 600; background: #eceef4; color: var(--muted); white-space: nowrap; }
.badge.warn { background: var(--warn); color: var(--warn-ink); }
.badge.bad { background: var(--bad); color: var(--bad-ink); }
.badge.ok { background: var(--ok); color: var(--ok-ink); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: .87rem; border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
table.list td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: middle; }
table.list tr[data-href] { cursor: pointer; }
table.list tr[data-href]:hover td { background: var(--navy-soft); }
table.list td.right, table.list th.right { text-align: right; }
.table-wrap.sticky { overflow: visible; }
.table-wrap.sticky thead th { position: sticky; top: 58px; background: #fff; z-index: 2; }
@media (max-width: 760px) { .table-wrap.sticky { overflow-x: auto; } .table-wrap.sticky thead th { position: static; } }
th .sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
th .sort[aria-sort] { color: var(--ink); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pager .muted { margin-right: auto; }
table.list tr.clicky { cursor: pointer; }
table.list tr.clicky:hover td { background: var(--navy-soft); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.note { background: var(--navy-soft); border-radius: 10px; padding: 10px 14px; font-size: .92rem; }
.note.warn { background: var(--warn); color: var(--warn-ink); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.history li:last-child { border-bottom: 0; }

/* ---------- unplaced families ---------- */
.family { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
@media (max-width: 860px) { .family { grid-template-columns: minmax(0, 1fr); } }
.family + .family { border-top: 1px solid var(--line); padding-top: var(--gap); margin-top: var(--gap); }
.members { list-style: none; padding: 0; margin: 0; }
.members li { padding: 3px 0; }
.why { font-size: .9rem; color: var(--muted); margin: 8px 0 10px; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; font-size: .87rem; }
.counts span { background: #f1f2f7; border-radius: 6px; padding: 1px 7px; }

/* ---------- class tiles (Phase 1: read-only) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { min-height: 64px; border-radius: 12px; background: var(--hs); color: var(--hi); display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-weight: 600; }
.tile .mark { width: 32px; height: 32px; font-size: 1rem; flex: 0 0 auto; }
.tile.none { background: #fff; color: var(--muted); border: 2px dashed #8a90a3; }
.class-card { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.class-card h3 a { color: inherit; text-decoration: none; }
.lesson-on { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.class-card:hover { border-color: var(--navy); }
.mini { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #eceef4; margin-top: 10px; }
.mini span { background: var(--hc); height: 100%; width: 0; }

/* ---------- sign-in ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 420px; }
.login .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login .brand-dots { grid-template-columns: repeat(5, 12px); gap: 4px; }
.login .brand-dots span { width: 12px; height: 12px; }
.login form { display: grid; gap: 12px; margin-top: 14px; }
.or { text-align: center; color: var(--muted); font-size: .87rem; margin: 14px 0 0; }
.demo { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; display: grid; gap: 8px; }

/* ---------- modal, toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 26, 45, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.modal form { display: grid; gap: 14px; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .93rem; }
.toast.bad { background: var(--bad-ink); }
.err { color: var(--bad-ink); font-size: .9rem; }
.ver { color: var(--muted); font-size: .87rem; text-align: center; margin-top: 18px; }

/* ---------- import preview ---------- */
[data-preview] { margin-top: var(--gap); }
[data-preview] > * + * { margin-top: var(--gap); }
details.card summary { cursor: pointer; display: flex; gap: 8px; align-items: center; }
details.card[open] summary { margin-bottom: 12px; }
input[type=file] { border: 1px dashed #cfd4e0; border-radius: 9px; padding: 14px; background: #fafbfd; }

/* ---------- balance table ---------- */
table.balance th .chip { font-size: .87rem; }
table.balance tr.group td { background: #f6f7fb; font-weight: 600; color: var(--muted); font-size: .87rem; text-transform: uppercase; letter-spacing: .03em; }
table.balance tr.total td { font-weight: 700; }

/* ================================================================ Phase 2: the classroom screens */
/* Full screen, no app header: the class screen, the dock and the reveal. Tiles at least 64px tall; taps feel instant. */
body.room-mode { background: #10162b; }
.room { min-height: 100vh; display: flex; flex-direction: column; background: #f4f5f9; }
.room-top { display: grid; gap: 8px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.rt-row, .rt-ctrl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.room-top h1 { font-size: 1.3rem; margin: 0; color: #fff; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-top .spacer { flex: 1; }
.room-top .btn-top.more { display: none; }
.rt-hint { font-size: .87rem; opacity: .85; }
.rt-hint .btn-link { color: #fff; }
.btn-end.armed { background: #fff; color: var(--bad-ink); box-shadow: 0 0 0 3px #fff; }
.room-top .btn-top { text-decoration: none; display: inline-flex; align-items: center; min-height: 38px; }
/* Picture: what is drawn above the names. Window: dock or pop-out beside the slides */
.pic { display: inline-flex; align-items: center; gap: 6px; }
.pic > .lbl, .win > summary .lbl { font-size: .87rem; font-weight: 600; color: rgba(255, 255, 255, .85); }
.win { position: relative; }
.win > summary { list-style: none; cursor: pointer; }
.win > summary::-webkit-details-marker { display: none; }
.win > summary::after { content: " ▾"; }
.win .menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  padding: 6px; display: grid; gap: 2px; min-width: 230px; z-index: 30; }
.win .menu button { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.win .menu button:hover { background: var(--navy-soft); }
.win .menu small { display: block; font-weight: 400; color: var(--muted); }
.seg { display: inline-flex; background: rgba(255, 255, 255, .12); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: rgba(255, 255, 255, .85); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem; min-height: 36px; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy); }
.btn-end { background: var(--red); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; min-height: 44px; }
.btn-end:hover { background: #a91e16; }
.qstat { display: inline-flex; align-items: center; gap: 6px; font-size: .87rem; white-space: nowrap; }
.qstat::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.qstat.saving::before { background: #93c5fd; box-shadow: 0 0 0 3px rgba(147, 197, 253, .3); animation: blink 1s infinite; }
.qstat.offline::before, .qstat.out::before { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .3); }
@keyframes blink { 50% { opacity: .35; } }
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 12px 16px 0; }
.strip .hc { background: var(--hs); color: var(--hi); border-radius: 12px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; }
.strip .hc .mark { width: 34px; height: 34px; font-size: 1.05rem; }
.strip .hc b { font-size: 1.8rem; line-height: 1; margin-left: auto; }
.strip .hc span.nm { font-weight: 600; }
.strip .hc.bump b { animation: bump .5s; }
@keyframes bump { 30% { transform: scale(1.35); } }
.room-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 14px 16px 104px; }  /* room for Oops below the last tile */
.tw { position: relative; }
.ptile { width: 100%; min-height: 76px; border: 0; border-radius: 14px; background: var(--hs); color: var(--hi); display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font: inherit; font-weight: 700; font-size: 1.05rem; text-align: left; cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; box-shadow: 0 2px 0 rgba(0, 0, 0, .15); transition: transform .08s; }
.ptile:active { transform: scale(.97); }
.ptile .mark { width: 36px; height: 36px; font-size: 1.05rem; flex: 0 0 auto; }
.ptile .nm { flex: 1; line-height: 1.15; overflow-wrap: anywhere; }
.ptile .cnt { min-width: 40px; height: 40px; border-radius: 20px; background: rgba(255, 255, 255, .25); display: grid; place-items: center; font-size: 1.15rem; padding: 0 8px; }
.ptile.none { background: #fff; color: var(--muted); cursor: default; border: 2px dashed #8a90a3; box-shadow: none; }
.ptile.none .mark { background: #eceef4; }
.ptile.pop { animation: pop .35s; }
@keyframes pop { 40% { transform: scale(1.06); } }
.ptile.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.plus { position: absolute; right: 18px; top: 4px; font-weight: 800; font-size: 1.5rem; color: var(--ink); pointer-events: none; animation: rise .8s forwards;
  text-shadow: 0 1px 0 #fff, 0 0 8px #fff; }
@keyframes rise { to { transform: translateY(-34px); opacity: 0; } }
/* Oops: one button in the bottom-right corner for the latest tap; there for 7 seconds, then it fades over 3 */
.oops-float { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 10px 22px 10px 12px; border: 0; border-left: 10px solid var(--hc); border-radius: 16px; background: #fff; color: var(--ink);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28); font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.oops-float .ico { width: 42px; height: 42px; border-radius: 50%; background: var(--hs); color: var(--hi); display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; }
.oops-float b { display: block; font-size: 1.05rem; }
.oops-float .who { display: block; font-size: .92rem; color: var(--muted); }
.room-note { margin: 0 16px; }
.room-empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- the dock: a slim column beside a slideshow ---------- */
.dock { height: 100vh; display: flex; flex-direction: column; background: #f4f5f9; font-size: .9rem; }
.dock-top { background: var(--navy); color: #fff; padding: 8px; display: grid; gap: 6px; }
.dock-top .row { display: flex; align-items: center; gap: 6px; }
.dock-top b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-top .btn-end, .dock-top .doops { min-height: 40px; padding: 6px 8px; font-size: .9rem; flex: 1; }
.doops { border: 2px solid #fff; background: none; color: #fff; border-radius: 10px; font-weight: 700; cursor: pointer; position: relative; overflow: hidden; }
.doops:disabled { opacity: .35; cursor: default; }
.dock-list { flex: 1; overflow-y: auto; padding: 6px; display: grid; gap: 5px; align-content: start; }
.dblock { border: 0; border-radius: 9px; background: var(--hs); color: var(--hi); min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  font: inherit; font-weight: 600; text-align: left; cursor: pointer; touch-action: manipulation; }
.dblock .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dblock .cnt { font-weight: 800; }
.dblock.none { background: #fff; color: var(--muted); border: 2px dashed #8a90a3; }
.dblock.pop { animation: pop .35s; }
.dock.side-right .dblock { flex-direction: row-reverse; text-align: right; }
.dock-foot { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 6px; background: #fff; border-top: 1px solid var(--line); }
.dock-foot .hc { background: var(--hs); color: var(--hi); border-radius: 7px; text-align: center; padding: 3px 0; font-weight: 800; line-height: 1.1; }
.dock-foot .hc small { display: block; font-size: .87rem; font-weight: 600; }
.dock-full { border: 0; background: #fff; border-top: 1px solid var(--line); padding: 8px; cursor: pointer; color: var(--navy); font-weight: 600; }

/* ---------- the End-class reveal: readable from the back of the room ---------- */
.reveal { min-height: 100vh; background: radial-gradient(circle at 50% 0, #26346f, #0e1430 70%); color: #fff; display: flex; flex-direction: column; align-items: center;
  padding: 3vh 4vw; gap: 2vh; }
.reveal h1 { color: #fff; font-size: clamp(1.6rem, 4vw, 3.2rem); margin: 0; text-align: center; }
.reveal .sub { opacity: .75; font-size: clamp(1rem, 2vw, 1.5rem); }
.ranks { width: 100%; max-width: 1100px; display: grid; gap: 1.4vh; }
.rank { display: flex; align-items: center; gap: 2vw; background: var(--hs); color: var(--hi); border-radius: 2vh; padding: 1.4vh 2vw; font-size: clamp(1.2rem, 3.2vw, 2.8rem);
  font-weight: 800; opacity: 0; transform: translateY(20px) scale(.96); transition: opacity .5s, transform .5s; }
.rank.show { opacity: 1; transform: none; }
.rank .place { min-width: 5ch; font-size: .75em; opacity: .85; }
.rank .glyph { width: 1.8em; height: 1.8em; border-radius: 50%; background: rgba(255, 255, 255, .22); display: grid; place-items: center; }
.rank .nm { flex: 1; }
.rank.first.show { animation: glow 1.6s ease-in-out infinite alternate; transform: scale(1.04); }
@keyframes glow { from { box-shadow: 0 0 0 0 rgba(255, 215, 90, .0); } to { box-shadow: 0 0 40px 8px rgba(255, 215, 90, .75); } }
.burst { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.burst span { position: absolute; top: 40%; left: 50%; width: 12px; height: 12px; border-radius: 3px; animation: fly 1.6s ease-out forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) rotate(540deg); opacity: 0; } }
.topscorer { font-size: clamp(1.2rem, 3vw, 2.4rem); font-weight: 800; text-align: center; opacity: 0; transition: opacity .6s; }
.topscorer.show { opacity: 1; }
.reveal .actions { margin-top: auto; }
.reveal .btn { min-height: 48px; font-size: 1.05rem; }
.anyone-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.anyone-results .ptile { min-height: 64px; font-size: .98rem; }
.anyone-results .ptile small { display: block; font-weight: 500; opacity: .85; font-size: .87rem; }
.dblock { position: relative; }
.dblock .plus { right: 6px; top: -6px; font-size: 1.1rem; }

/* ================================================================ Phase 3: the age views */
.hp-house-fill { fill: var(--hs); }
.hp-house-stroke { stroke: var(--hc); fill: none; }
.hp-house-ink { fill: var(--hi); }
.view-pick { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .85); font-size: .87rem; font-weight: 600; }
.view-pick select, .pic select { width: auto; min-height: 38px; padding: 6px 10px; border-radius: 10px; border: 0; font-weight: 600; color: var(--navy); }
.stage { margin: 12px 16px 0; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.stage > svg { display: block; width: 100%; height: auto; max-height: 50vh; }
.room.staged .room-tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.room.staged .ptile { min-height: 64px; }
/* how a new token arrives in a scene (data-token-anim on the scene's svg) */
.hp-tok { transform-box: fill-box; transform-origin: center bottom; }
.hp-hop { animation: hp-hop .75s cubic-bezier(.3, .7, .4, 1); }
@keyframes hp-hop { 0% { transform: translate(0, 110px) scale(.4); opacity: 0; } 55% { transform: translate(0, -46px) scale(1.15); opacity: 1; } 80% { transform: translate(0, 4px) scale(.95); } 100% { transform: none; } }
.hp-glow { animation: hp-glow 1.2s ease-out; }
@keyframes hp-glow { 0% { opacity: 0; transform: scale(.3); filter: drop-shadow(0 0 0 #fff3c4); } 50% { opacity: 1; transform: scale(1.25); filter: drop-shadow(0 0 14px #fff3c4); } 100% { transform: none; filter: drop-shadow(0 0 0 #fff3c4); } }
.hp-drop { animation: hp-drop .7s cubic-bezier(.4, 0, .6, 1.4); }
@keyframes hp-drop { from { transform: translate(0, -320px); opacity: 0; } to { transform: none; opacity: 1; } }
.hp-pop { animation: hp-pop .45s; }
@keyframes hp-pop { from { transform: scale(0); } 70% { transform: scale(1.2); } to { transform: none; } }
.hp-new { transform-box: fill-box; transform-origin: center; animation: hp-pop .5s; }
/* the ten-lesson chart: one small chart per house on a shared scale */
.bars { padding: 12px 14px 14px; position: relative; }
.bars-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bars-title { font-weight: 700; color: var(--ink); flex: 1; }
.bars-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .bars-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bars-panel { border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 2px; }
.bars-head { display: flex; align-items: center; gap: 6px; font-size: .95rem; }
.bars-head .mark { background: var(--hs); color: var(--hi); width: 26px; height: 26px; font-size: .87rem; }
.bars-total { margin-left: auto; color: var(--muted); font-size: .87rem; }
.bars-panel svg { display: block; width: 100%; height: auto; }
.bars-hit { cursor: pointer; }
.bars-now { stroke: var(--ink); stroke-width: 1.5; }
.bars-tip { min-height: 1.5em; margin-top: 8px; font-size: .9rem; color: var(--ink); opacity: 0; transition: opacity .15s; }
.bars-tip.on { opacity: 1; }
.dock.side-float .dblock { min-height: 40px; }

/* ================================================================ Phase 4: coordinators */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--navy); }
.seg.light { background: #e9ecf4; }
.seg.light button { color: var(--muted); }
.seg.light button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.badge.award { background: #fff4d6; color: #7a5300; border: 1px solid #f1d58a; }
.house-card .mascot { position: absolute; right: 6px; top: 12px; width: 64px; height: 64px; object-fit: contain; pointer-events: none; }
.house-card.leading { box-shadow: 0 0 0 3px var(--hc), var(--shadow); }
.stat .n.ev { font-size: 1.25rem; line-height: 1.3; }
.filters.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; }
@media (max-width: 900px) { .filters.wide { grid-template-columns: 1fr 1fr; } }
tr.voided td { color: var(--muted); }
tr.voided td:nth-child(4) { text-decoration: line-through; }
.pick-list { display: grid; gap: 4px; margin: 6px 0 10px; }
.pick { display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 6px 8px; cursor: pointer; font: inherit; }
.pick:hover { border-color: var(--navy); }
.face { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: #eceef4; color: var(--muted); font-weight: 700; }
.face.none { font-size: .87rem; }
.crop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.crop canvas { width: 220px; height: 220px; border-radius: 16px; background: #eceef4; touch-action: none; cursor: grab; }
.row-flex { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.big-event { font-size: 1.5rem; font-weight: 700; margin: 0; }
.grade-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.field > span:first-child { font-weight: 500; }
.reveal-mascots { display: flex; justify-content: center; gap: 2vw; height: 26vh; }
.reveal-mascots img { height: 100%; width: auto; animation: leap 1s cubic-bezier(.2, .8, .3, 1.2) both; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .45)); }
@keyframes leap { 0% { transform: translateY(60vh) scale(.4) rotate(-12deg); opacity: 0; } 70% { transform: translateY(-4vh) scale(1.08) rotate(4deg); opacity: 1; } 100% { transform: none; } }
code, .snippet { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .87rem; background: #f1f2f7; border-radius: 6px; padding: 1px 6px; word-break: break-all; }
.embed-kv { grid-template-columns: max-content minmax(0, 1fr); }
.embed-kv dd { line-height: 1.6; }

/* ================================================================ 0.6.0: phones, confirmations, lists */
/* The class screen on a phone: one header row (back, class, End class), the controls behind Options, the five totals
   as small squares, and Oops as a bar across the bottom. */
@media (max-width: 640px) {
  .room { overflow-x: hidden; }
  .room-top { padding: 8px 10px; gap: 6px; }
  .rt-row { flex-wrap: nowrap; gap: 8px; }
  .room-top h1 { font-size: 1.1rem; }
  .room-top .back .lbl { display: none; }
  .room-top .btn-top.more { display: inline-flex; }
  .room-top .qstat { font-size: 0; gap: 0; }
  .room-top .btn-end { padding: 8px 12px; min-height: 40px; }
  .rt-ctrl { display: none; gap: 8px; padding-top: 4px; }
  .room-top.open .rt-ctrl { display: flex; }
  .seg button { padding: 6px 9px; }
  .win .menu { left: 0; right: auto; }
  .strip { gap: 6px; padding: 8px 10px 0; }
  .strip .hc { flex-direction: column; gap: 2px; padding: 6px 2px; border-radius: 10px; min-width: 0; }
  .strip .hc .mark { width: 26px; height: 26px; font-size: .87rem; }
  .strip .hc .nm { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .strip .hc b { font-size: 1.25rem; margin: 0; }
  .room-tiles { padding: 10px 10px 104px; gap: 8px; }
  .stage { margin: 8px 10px 0; }
  .oops-float { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); justify-content: flex-start; }
}
/* On the Give points page, Oops sits on top of the search results (so it never covers them) */
.oops-float.inline { position: sticky; top: 66px; left: auto; right: auto; bottom: auto; width: 100%; margin: 12px 0 0; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.anyone-results .ptile small { display: block; }
/* the app's own confirmation (instead of the browser's) */
.confirm p { margin: 0 0 12px; }
.confirm .typed { display: grid; gap: 6px; margin: 4px 0 14px; font-weight: 500; }
/* the coordinator's to-do strip */
.todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: var(--gap); }
.todo a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.todo a:hover { border-color: var(--navy); }
.todo b { font-size: 1.6rem; line-height: 1; min-width: 1.4ch; }
.todo a.due { background: var(--warn); border-color: #f1d7a8; }
.todo a.clear b { color: var(--ok-ink); }
details.more-card > summary { cursor: pointer; font-weight: 700; font-size: 1.1rem; list-style-position: inside; }
details.more-card[open] > summary { margin-bottom: 12px; }
details.more-card + details.more-card { margin-top: var(--gap); }
.wrap > details.more-card, .wrap > .todo + .grid { margin-top: var(--gap); }
.dirty-note { color: var(--warn-ink); font-size: .87rem; }
.house-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.house-row:last-of-type { border-bottom: 0; }
.house-row .chip { justify-self: start; align-self: center; }
@media (max-width: 760px) { .house-row { grid-template-columns: 1fr 1fr; } }
/* Awards: print the list for the assembly */
.print-only { display: none; }
@media print {
  .top, .tabs, .page-head .actions, .no-print, .btn, #toasts { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0 0 12px; break-inside: avoid; }
  .print-only { display: block; }
  .chip { border: 1px solid #000; }
}
@media (max-width: 640px) {
  .top { position: static; }  /* on a phone the bar scrolls away, leaving the screen for the page */
  .oops-float.inline { top: 8px; }
}
details.more-card > summary::before { content: "▸"; color: var(--muted); width: 1em; }
details.more-card[open] > summary::before { content: "▾"; }

/* ================================================================ End of the day (a homeroom's points from every lesson) */
.day-panel { background: var(--navy-soft); border: 1px solid #d6dcef; border-radius: var(--radius); padding: 16px; margin-top: var(--gap); }
.day-panel .card-head { margin-bottom: 12px; }
.day-card { cursor: pointer; border-top: 4px solid var(--navy); }
.day-card h3 a { color: inherit; text-decoration: none; }
.day-card:hover { border-color: var(--navy); }
.day-n { margin-top: 6px; }
.day-n b { font-size: 1.6rem; line-height: 1; }
.day-card .actions { margin-top: 12px; justify-content: flex-start; }
.section-h { margin: 22px 0 12px; }
.wrap > .grid.g3 { margin-top: var(--gap); }
.btn-day { background: #fff; color: var(--navy); border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; min-height: 44px; }
.btn-day:hover { background: #e9ecf8; }
.day-sum { margin: 10px 16px 0; color: var(--muted); font-weight: 600; }
.day-tiles { list-style: none; margin: 0; padding-bottom: 32px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.dtile { cursor: default; }
.dtile:active { transform: none; }
.ptile .nm small { display: block; font-weight: 500; font-size: .87rem; opacity: .9; margin-top: 2px; }
@media (max-width: 640px) { .day-sum { margin: 8px 10px 0; } .btn-day { padding: 8px 12px; min-height: 40px; } }

/* ================================================================ Sports Day */
.sd-map { position: relative; padding: 0; overflow: hidden; }
.sd-map img { display: block; width: 100%; height: auto; }
.sd-map.editable { cursor: crosshair; }
.sd-pin { position: absolute; transform: translate(-50%, -50%); min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; border: 2px solid #fff;
  background: var(--navy); color: #fff; font-weight: 800; font-size: .95rem; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); font-family: inherit; }
button.sd-pin { cursor: pointer; }
.sd-map-wrap { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--gap); align-items: start; }
@media (max-width: 860px) { .sd-map-wrap { grid-template-columns: minmax(0, 1fr); } }
.sd-areas { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.sd-areas ul { margin: 4px 0 0; padding-left: 18px; }
.sd-faq { border-bottom: 1px solid var(--line); padding: 10px 0; }
.sd-faq:last-child { border-bottom: 0; }
.sd-faq summary { cursor: pointer; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.sd-answer { margin: 8px 0 0; white-space: pre-line; }
.sd-more { display: inline-block; position: relative; }
.sd-more > summary { list-style: none; }
.sd-more > summary::-webkit-details-marker { display: none; }
.sd-more .menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  display: grid; padding: 4px; z-index: 30; min-width: 190px; }
.sd-more .menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 7px; cursor: pointer; font: inherit; color: var(--ink); }
.sd-more .menu button:hover { background: var(--navy-soft); }
.sd-pin-show { display: flex; gap: 28px; flex-wrap: wrap; font-size: 1.2rem; }
.sd-pin-show b { font-size: 2.4rem; letter-spacing: .12em; font-family: ui-monospace, Menlo, Consolas, monospace; display: block; }
.sd-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.sd-inline select { width: auto; }
.sd-staff-card + .sd-staff-card { margin-top: 12px; }
.sd-events td { vertical-align: top; }
.sd-filters { grid-template-columns: minmax(0, 1fr) 1fr 1fr auto; }
/* Sports Day stations: outdoors on a phone. White backgrounds, house colours as thick borders, big targets */
.station h1 { font-size: 1.4rem; }
.st-list { display: grid; gap: 8px; }
.st-ev { display: grid; gap: 2px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; }
.st-ev:hover { border-color: var(--navy); }
.st-ev .badge { justify-self: start; }
.st-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.4rem; letter-spacing: .15em; text-transform: uppercase; }
.st-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.st-status { font-size: 1rem; padding: 4px 12px; }
.st-big { min-height: 52px; font-size: 1.1rem; font-weight: 700; padding: 10px 22px; }
.st-results .st-place { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.st-results .st-place > b { min-width: 3em; font-size: 1.1rem; }
.st-res { display: inline-flex; align-items: center; gap: 4px; border: 3px solid var(--hc); background: #fff; border-radius: 999px; padding: 2px 4px 2px 12px; font-weight: 700; }
.st-x { border: 0; background: #eceef4; border-radius: 50%; width: 30px; height: 30px; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.st-mode { margin: 14px 0 10px; }
.st-mode button { min-height: 44px; padding: 8px 16px; font-size: 1rem; }
.st-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.st-tools input { flex: 1; min-height: 46px; font-size: 1.05rem; }
.st-group { margin-bottom: 14px; }
.st-gh { border-left: 8px solid var(--hc); padding-left: 10px; margin: 0 0 8px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.st-kid { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px; background: #fff; color: var(--ink); border: 3px solid var(--hc);
  border-left-width: 10px; border-radius: 12px; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.st-kid.on { background: #f2fbf5; }
.st-kid:disabled { opacity: .7; cursor: default; }
.st-tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #8a90a3; display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.st-kid.on .st-tick { background: var(--ok-ink); border-color: var(--ok-ink); color: #fff; }
.st-name { flex: 1; min-width: 0; font-size: 1.05rem; }
.st-name b { font-weight: 800; }
.st-name small { display: block; color: var(--muted); }
.st-pl { font-weight: 800; background: var(--ink); color: #fff; border-radius: 8px; padding: 2px 8px; }
.st-houses { display: grid; gap: 10px; }
.st-house { border: 3px solid var(--hc); border-left-width: 12px; border-radius: 12px; padding: 10px 12px; background: #fff; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.st-house > b { flex: 1; font-size: 1.1rem; }
.st-pbtns { display: flex; gap: 8px; }
.st-pbtns.big { margin: 10px 0; }
.st-pbtns.big .st-big { flex: 1; }
.st-foot { margin-top: 24px; }
@media (max-width: 640px) { .st-grid { grid-template-columns: minmax(0, 1fr); } }
.sd-now, .sd-next { display: grid; gap: 10px; }
.sd-now { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.sd-now-ev { display: grid; gap: 3px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.sd-now-ev.big { border: 2px solid var(--ok-ink); background: var(--ok); }
.sd-now-ev.big b { font-size: 1.2rem; }
.sd-where { font-weight: 700; color: var(--navy); }
.sd-later { margin: 0; padding-left: 18px; }
.sd-later-h { margin-top: 14px; }
.sd-mini { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 8px; }
.sd-mini .bar { grid-column: 1 / -1; margin-top: 0; }
.sd-totals .sd-total { text-align: center; border-top: 6px solid var(--hc); }
.sd-total img { width: 90px; height: 90px; object-fit: contain; }
.sd-total .big { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.sd-total .nm { font-weight: 700; }
.sd-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); margin-top: var(--gap); }
.sd-result h3 { margin-bottom: 2px; }
.sd-result.mine { box-shadow: 0 0 0 3px var(--ok-ink), var(--shadow); }
.podium { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.podium li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.podium li > b { min-width: 2.6em; }
.sd-winner { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--hc); border-radius: 999px; padding: 1px 10px 1px 2px; }
.sd-winner img { width: 26px; height: 26px; object-fit: contain; }
.sd-winner small { color: var(--muted); }
.sd-winner.mine { background: var(--ok); }
.sd-rfilters { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: center; margin-bottom: 0; }
@media (max-width: 760px) { .sd-rfilters { grid-template-columns: 1fr 1fr; } }
.sd-review.waiting { box-shadow: 0 0 0 2px #f1d7a8, var(--shadow); }
.sd-review + .sd-review { margin-top: 12px; }
.sd-mine { margin-bottom: var(--gap); border-left: 6px solid var(--ok-ink); }
.st-handover { margin-top: 18px; border: 2px dashed var(--navy); }
.st-handover h2 { margin-bottom: 4px; }
/* First aid */
.btn-fa { background: #c9251b; border-color: #c9251b; color: #fff; font-weight: 700; }
.btn-fa:hover { background: #a91e16; border-color: #a91e16; }
.fa-title { color: #a91e16; }
#fa-banner { position: sticky; top: 0; z-index: 70; display: block; background: #c9251b; color: #fff; font-weight: 800; font-size: 1.1rem; text-align: center;
  padding: 12px 16px; text-decoration: none; animation: fa-pulse 1.2s ease-in-out infinite alternate; }
@keyframes fa-pulse { from { background: #c9251b; } to { background: #8f1710; } }
@media (prefers-reduced-motion: reduce) { #fa-banner { animation: none; } }
.fa-call { border: 3px solid #c9251b; background: #fff5f4; }
.fa-call + .fa-call { margin-top: 12px; }
.fa-where { font-size: 1.8rem; font-weight: 800; color: #8f1710; }
.fa-meta { margin: 4px 0; }
.fa-note { font-size: 1.15rem; font-weight: 600; }
.fa-clear { border: 2px solid var(--ok-ink); }
.fa-status { margin-bottom: 12px; font-size: 1rem; }
.fa-status.ok { background: var(--ok); color: var(--ok-ink); }
body.fa-on .top { top: 46px; }  /* the app's bar stays visible below the first aid banner */
