/* Shared look for the sign-in and parent pages: paper cards on a pale sky. */
:root {
  --sky: #dff4fb; --sky-top: #8fd3f4; --ink: #2b2d42; --muted: #5d6079; --paper: #fffaf0; --line: #e6dcc8;
  --engine: #e2483d; --go: #1f9d61; --gold: #ffc94a; --trace: #3d7bea;
  --font: "Fredoka", ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px);
  background: linear-gradient(var(--sky-top), var(--sky) 320px) var(--sky) no-repeat;
  color: var(--ink); font: 500 17px/1.45 var(--font); }
main { max-width: 860px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 64px; display: grid; gap: 20px; }
main.narrow { max-width: 440px; padding-top: 6vh; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(28px, 6vw, 40px); } h2 { font-size: 22px; } h3 { font-size: 17px; }
p { margin: 0; } .muted { color: var(--muted); font-size: 15px; }
a { color: var(--trace); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 5px 0 var(--ink);
  padding: 18px; display: grid; gap: 14px; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; min-width: 0; }
.stack { display: grid; gap: 10px; align-content: start; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
input, select, textarea { font: inherit; font-size: 16px; color: inherit; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px;
  background: #fff; width: 100%; min-width: 0; }
textarea { padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; width: 100%; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--trace); outline-offset: 2px; }
button, .btn { font: inherit; font-weight: 700; color: var(--ink); padding: 9px 16px; border: 2px solid var(--ink);
  border-radius: 99px; background: #fff; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
button.primary, .btn.primary { background: var(--go); color: #fff; }
button.danger { color: var(--engine); border-color: var(--engine); }
button.small, .btn.small { padding: 5px 12px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }
.msg { font-weight: 700; color: var(--engine); min-height: 1.4em; }
.msg.ok { color: var(--go); }
.tabs { display: flex; gap: 8px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.kid { border: 2px solid var(--line); border-radius: 16px; padding: 12px; display: grid; gap: 10px; background: #fff; }
.kid .who { font-size: 20px; font-weight: 700; }
.avatar { font-size: 34px; line-height: 1; }
.avatars { display: flex; gap: 6px; flex-wrap: wrap; }
.avatars button { font-size: 24px; padding: 4px 8px; border-color: var(--line); }
.avatars button[aria-pressed="true"] { border-color: var(--ink); background: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.tile { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.tile b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num, th.num { text-align: right; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.train { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.train .cars { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 200px; }
.wordcar { background: var(--gold); border: 2px solid var(--ink); border-radius: 10px; padding: 2px 10px; font-weight: 700; letter-spacing: .06em; }
.wordrow { display: grid; grid-template-columns: 1fr 76px; gap: 8px; align-items: center; }
.wordrow input.emoji { text-align: center; font-size: 20px; padding: 6px; }
.ticket { background: #fff; border: 2px dashed var(--ink); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.settings label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; padding-bottom: 10px; }
.settings label.check input { width: auto; }
.tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.wordrow.sentence { grid-template-columns: 1fr 76px; }
.unlocks summary { font-weight: 700; cursor: pointer; }
.unlocks[open] { display: grid; gap: 10px; }
.settings label.wide { grid-column: 1 / -1; }
.panel { display: grid; gap: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); }
.kid .tabs { margin-bottom: -4px; flex-wrap: wrap; }
.danger-row { justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
select { text-overflow: ellipsis; }
.kid .tabs button { flex: 1 1 0; padding: 9px 6px; font-size: 15px; white-space: nowrap; }
.settings { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.settings label.check.wide { grid-column: 1 / -1; }
.kid .tabs button { flex: 1 1 40%; }
.top.pinned { flex-wrap: nowrap; align-items: flex-start; }
.top.pinned h2 { min-width: 0; }
.top.pinned button { flex: none; }
.game-head { font-size: 20px; padding-top: 10px; border-top: 2px solid var(--line); }
.game-head:first-child { border-top: 0; padding-top: 0; }
.tile span { line-height: 1.25; display: block; }
/* iPhone Safari gives time boxes their own width and ignores the grid: make them obey their column. */
.settings > label, .cols > * { min-width: 0; }
input[type="time"], input[type="date"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%;
  box-sizing: border-box; min-height: 46px; text-align: left; }
input[type="time"]::-webkit-date-and-time-value { text-align: left; }
select { min-width: 0; max-width: 100%; }
/* Charts (assets/charts.js). Marks carry the colour; all text stays in the ink colours. */
.viz { display: grid; gap: 6px; min-width: 0; align-content: start; }
.viz-plot { min-width: 0; } .viz-plot svg { display: block; overflow: visible; }
.viz-axis { font-size: 12px; fill: var(--muted); color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); align-items: center; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; flex: none; }
.viz-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px;
  font-size: 13px; box-shadow: 0 3px 0 var(--ink); max-width: 260px; }
.viz-tip-title { color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; } .viz-tip-row b { font-variant-numeric: tabular-nums; } .viz-tip-row span { color: var(--muted); }
.viz-table summary { font-size: 13px; color: var(--muted); cursor: pointer; } .viz-table table { font-size: 14px; }
.viz-bars { display: grid; grid-template-columns: minmax(70px, max-content) 1fr max-content; gap: 6px 10px; align-items: center; font-size: 14px; }
.viz-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
.viz-bar-track { height: 14px; min-width: 40px; } .viz-bar-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.viz-bars b { font-variant-numeric: tabular-nums; text-align: right; } .viz-bars small { color: var(--muted); font-weight: 500; }
.viz-heat { display: grid; gap: 2px; align-items: center; min-width: 0; }
.viz-heat i { display: block; height: 18px; border-radius: 3px; font-style: normal; }
.viz-heat i.none { background: none; }
.viz-heat.with-text i { height: 26px; font-size: 12px; font-weight: 700; text-align: center; line-height: 26px; font-variant-numeric: tabular-nums; }
.viz-heat-col { text-align: center; } .viz-heat-row { padding-right: 6px; white-space: nowrap; }
.viz-empty { padding: 18px 0; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 22px 26px; }
.charts > .wide { grid-column: 1 / -1; }
.tile .delta { display: block; font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.tile .delta.up { color: #156f44; } .tile .delta.down { color: #b3372e; }
td .delta.up { color: #156f44; font-weight: 700; } td .delta.down { color: #b3372e; font-weight: 700; }
main.wide { max-width: 1180px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.loading { opacity: .5; transition: opacity .15s; }
.stack > *, .charts > *, #stats > * { min-width: 0; }
/* Admin sign-up codes: a QR beside its numbers. */
.codes { display: grid; gap: 14px; }
.code { display: grid; grid-template-columns: 170px 1fr; gap: 16px; padding: 14px; border: 2px solid var(--line); border-radius: 16px; background: #fff; align-items: start; }
.code > * { min-width: 0; } .code.off .qr { opacity: .35; }
.code .qr svg { display: block; width: 100%; height: auto; border: 2px solid var(--ink); border-radius: 10px; }
.code .who { font-size: 20px; } .code details summary { font-weight: 700; cursor: pointer; }
.settings .msg.wide { grid-column: 1 / -1; min-height: 0; }
@media (max-width: 560px) { .code { grid-template-columns: 1fr; } .code .qr { max-width: 220px; } }
fieldset.games { border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; background: #fff; min-width: 0; }
fieldset.games legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
fieldset.games label.check { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 15px; }
fieldset.games input { width: auto; }
.edit-access[open] { display: grid; gap: 8px; }
.settings > .wide { grid-column: 1 / -1; min-width: 0; }
.preview { display: grid; max-width: 320px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #eef0f4; font-size: 14px; }
.preview img { width: 100%; aspect-ratio: 1200 / 630; display: block; object-fit: cover; }
.preview b { padding: 8px 12px 0; } .preview span { padding: 2px 12px; color: var(--muted); font-size: 13px; } .preview small { padding: 2px 12px 9px; color: var(--muted); font-size: 12px; }
.credit { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.credit img { height: 32px; width: auto; display: block; }
