/* Look and feel borrowed from wesbos/photo-frame-dashboard (tokens.css / base.css). Touch kiosk, Android WebView safe. */
:root {
  --paper: #F2EEE6; --paper-2: #E8E2D5; --card: #FBF9F4;
  --ink: #111111; --ink-2: #3B3934; --mute: #5E594F; --line: #D6CFC0;
  --alert: #C8102E; --amber: #FF9500; --ok: #00875A;
  --c: #111; --c-ink: #fff; --c-text: #111;
  --sans: 'Archivo', 'Roboto Condensed', 'Roboto', system-ui, sans-serif;
  --serif: 'Instrument Serif', 'Noto Serif', Georgia, serif;
  --r: 18px; --gap: 14px; --tap: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); }
body { font-family: var(--sans); font-size: 21px; color: var(--ink); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; text-align: left; cursor: pointer; -webkit-appearance: none; }
button:active { transform: scale(.97); }
::-webkit-scrollbar { width: 0; height: 0; }
.num { font-stretch: 62%; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.label { font-size: 16px; font-weight: 800; font-stretch: 80%; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); line-height: 1.2; }

/* Stage: design height 800 (680 on small screens), width follows the screen; scaled to fit by app.js */
.stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 800px; margin: -400px 0 0 -640px;
  transform-origin: 50% 50%; background: var(--paper); overflow: hidden; padding: 16px 22px 20px;
  display: flex; flex-direction: column; gap: 14px; }

/* ---- top bar */
.top { height: 112px; flex: none; display: flex; gap: 18px; border-bottom: 3px solid var(--ink); padding-bottom: 12px; }
.clock { flex: none; width: 260px; display: flex; flex-direction: column; justify-content: flex-end; }
.time { font-size: 84px; line-height: .8; letter-spacing: -.035em; }
.time small { font-size: 22px; letter-spacing: .06em; margin-left: 8px; vertical-align: top; }
.date { font-family: var(--serif); font-size: 24px; margin-top: 8px; white-space: nowrap; }
.date b { font-family: var(--sans); font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .06em; font-size: 18px; margin-right: 6px; }
.mid { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.tabs { display: flex; gap: 10px; }
.tab { flex: 1; min-width: 0; height: 72px; border-radius: 36px; border: 3px solid var(--c); background: var(--card); color: var(--ink);
  font-size: 28px; font-weight: 900; font-stretch: 78%; letter-spacing: .01em; display: flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; }
.tab .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); flex: none; }
.tab.is-on { background: var(--c); color: var(--c-ink); box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.tab.is-on .dot { background: var(--c-ink); }
.tab-all { --c: #111; --c-ink: #fff; }
.updated { height: 26px; font-size: 16px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; font-weight: 600; }
.updated .refresh { margin-left: 8px; font-weight: 900; }
.sample { display: inline-block; background: var(--amber); color: #111; font-size: 12px; font-weight: 900; letter-spacing: .1em;
  text-transform: uppercase; padding: 2px 7px 1px; border-radius: 6px; vertical-align: middle; margin-left: 6px; }
.fun { flex: none; width: 380px; background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 8px 16px 8px;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden; position: relative; }
.fun .label { color: #FFC45C; display: flex; justify-content: space-between; }
.fun-n { color: #BDB6A8; }
.fun-text { flex: none; font-size: 21px; line-height: 1.08; max-height: 2.16em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fun-next { margin-top: auto; font-size: 14px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #FFC45C; }
.fun.is-flip .fun-text { animation: flip .35s ease-out; }
@keyframes flip { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- views */
.view { flex: 1; min-height: 0; }
.view.is-all { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; }
.kid { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; gap: 12px; }
.kid-head { flex: none; height: 68px; background: var(--c); color: var(--c-ink); border-radius: var(--r); padding: 0 20px;
  display: flex; align-items: center; gap: 14px; min-width: 0; }
.kid-head[data-act] { cursor: pointer; }
.kid-head[data-act]:active { transform: scale(.985); }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--c-ink); color: var(--c); display: grid; place-items: center;
  font-weight: 900; font-stretch: 70%; font-size: 27px; padding-top: 3px; flex: none; }
.kid-name { font-size: 34px; font-weight: 900; font-stretch: 75%; letter-spacing: .01em; flex: none; }
.kid-class { font-size: 17px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .95; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.open { margin-left: auto; flex: none; font-size: 18px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  background: var(--c-ink); color: var(--c); border-radius: 22px; padding: 10px 16px 8px; }

/* countdown chips (horizontal touch scroll) */
.chips { flex: none; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; min-width: 0; }
.chip { flex: none; height: 64px; border-radius: 32px; background: var(--card); border: 3px solid var(--c); padding: 0 20px 0 8px;
  display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; max-width: 380px; white-space: nowrap; }
.chip b { background: var(--c); color: var(--c-ink); border-radius: 24px; padding: 9px 14px 7px; font-weight: 900; font-stretch: 80%; text-transform: uppercase; letter-spacing: .03em; font-size: 18px; }
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip.is-hot b { background: var(--alert); color: #fff; }
.chip.is-done { opacity: .5; }
.chip.is-quiet { border-style: dashed; padding: 0 20px; color: var(--mute); font-family: var(--serif); font-weight: 400; }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 0 14px 10px; min-height: 0; display: flex; flex-direction: column;
  border-top: 6px solid var(--c); overflow: hidden; }
.card-head { flex: none; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.card-head .count { font-size: 18px; font-weight: 900; color: var(--c-text); letter-spacing: .03em; white-space: nowrap; }
.card-head.is-static { cursor: default; }
.card-head.is-static:active { transform: none; }
.list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px; }
.row { flex: none; display: flex; align-items: stretch; gap: 8px; min-height: var(--tap); background: var(--paper); border-radius: 14px; }
.row-main { flex: 1; min-width: 0; padding: 9px 14px 8px; display: flex; flex-direction: column; justify-content: center; font-size: 20px; line-height: 1.18; border-left: 6px solid var(--c); border-radius: 14px; }
.row.is-notice .row-main { border-left-color: var(--c); }
.row:not(.is-notice) .row-main { border-left: 0; padding-left: 4px; }
.row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-title b { font-weight: 800; }
.meta { display: block; font-size: 16px; color: var(--mute); font-weight: 700; margin-top: 2px; }
.row.is-urgent .row-main { border-left-color: var(--alert); }
.row.is-urgent .meta { color: var(--alert); font-weight: 800; }
.tick { flex: none; width: var(--tap); display: grid; place-items: center; }
.tick span { width: 42px; height: 42px; border-radius: 12px; border: 4px solid var(--c); background: #fff; display: grid; place-items: center;
  color: var(--c-ink); font-size: 28px; font-weight: 900; line-height: 1; }
.row.is-done .tick span { background: var(--c); }
.row.is-done .row-title { text-decoration: line-through; color: var(--mute); }
.row.is-done { opacity: .72; }
.empty { font-family: var(--serif); font-size: 23px; color: var(--mute); padding: 6px 2px; }

/* timetable */
.periods { gap: 6px; }
.period { flex: none; display: flex; align-items: center; gap: 12px; min-height: 52px; background: var(--paper); border-radius: 12px; padding: 6px 12px 5px 6px; font-size: 22px; font-weight: 700; }
.pn { flex: none; min-width: 40px; height: 40px; border-radius: 20px; background: var(--c); color: var(--c-ink); display: grid; place-items: center;
  font-size: 17px; font-weight: 900; font-stretch: 75%; padding: 2px 8px 0; }
.ps small { display: block; font-size: 16px; color: var(--mute); font-weight: 600; }
.days { flex: none; display: flex; gap: 6px; margin-bottom: 10px; }
.day { flex: 1; height: 60px; border-radius: 14px; background: var(--paper); font-size: 20px; font-weight: 900; font-stretch: 80%;
  text-transform: uppercase; letter-spacing: .04em; text-align: center; position: relative; border: 3px solid transparent; }
.day.is-today { border-color: var(--c); }
.day.is-today::after { content: 'today'; position: absolute; left: 0; right: 0; bottom: 3px; font-size: 11px; letter-spacing: .08em; }
.day.is-on { background: var(--c); color: var(--c-ink); }

/* overview grid: notices left (tall), homework + timetable right */
.ov-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); grid-template-rows: minmax(0,1fr) minmax(0,1fr); gap: var(--gap); }
.ov-grid .notices { grid-row: 1 / span 2; }

/* single-kid view */
.banner { flex: none; display: flex; gap: 14px; align-items: center; min-width: 0; }
.banner .kid-head { flex: none; max-width: 48%; }
.banner .chips { flex: 1; }
.full-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) minmax(0,1fr); gap: var(--gap); }
.stack { min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) minmax(0,1fr); gap: var(--gap); }

/* detail sheet */
.modal { position: absolute; inset: 0; top: 0; left: 0; right: 0; bottom: 0; background: rgba(17,17,17,.62); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 28px; }
.modal[hidden] { display: none; }
.sheet { width: 960px; max-width: 100%; max-height: 100%; background: var(--card); border-radius: 26px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.sheet-head { flex: none; background: var(--c); color: var(--c-ink); display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 26px; }
.sheet-label { flex: 1; font-size: 22px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; font-stretch: 80%; }
.sheet-btn { flex: none; height: 64px; padding: 0 24px; border-radius: 32px; background: var(--c-ink); color: var(--c); font-size: 22px; font-weight: 900; letter-spacing: .03em; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 22px 30px 26px; display: flex; flex-direction: column; gap: 16px; }
.sheet-tags { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-tags:empty { display: none; }
.tag { font-size: 18px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; padding: 8px 14px 6px; border-radius: 20px; background: var(--c); color: var(--c-ink); }
.tag.is-hot { background: var(--alert); color: #fff; }
.tag.is-ok { background: var(--ok); color: #fff; }
.sheet-title { font-size: 46px; line-height: 1.06; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.facts div { background: var(--paper); border-radius: 14px; padding: 10px 14px; }
.facts dt { font-size: 15px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.facts dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; }
.sheet-text { font-size: 26px; line-height: 1.35; color: var(--ink-2); -webkit-user-select: text; user-select: text; }
.sheet-foot { flex: none; padding: 0 30px 24px; }
.big-btn { width: 100%; height: 76px; border-radius: 38px; background: var(--c); color: var(--c-ink); font-size: 26px; font-weight: 900; text-align: center; letter-spacing: .03em; }
.big-btn.is-done { background: var(--ok); color: #fff; }
.big-list .row { min-height: 72px; }
.big-list .row-main { font-size: 23px; }
.big-list .row-title { -webkit-line-clamp: 3; }

.status { position: absolute; right: 24px; bottom: 2px; font-size: 13px; color: var(--mute); }
.status.is-bad { color: var(--alert); font-weight: 800; }

/* short stage (e.g. 1024x600): tighter header so content still fits */
.stage.is-short { padding: 12px 18px 16px; gap: 10px; }
.stage.is-short .top { height: 100px; padding-bottom: 8px; }
.stage.is-short .time { font-size: 72px; }
.stage.is-short .tab { height: 64px; font-size: 26px; }
.stage.is-short .kid-head { height: 60px; }
.stage.is-short .chips .chip { height: 60px; }
.stage.is-short .sheet-title { font-size: 40px; }
.stage.is-short .fun { padding: 6px 14px; }
.stage.is-short .fun-text { font-size: 20px; -webkit-line-clamp: 3; max-height: 3.24em; }
.stage.is-short .fun-next { display: none; }

/* colour picker */
.pal-btn { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--c-ink); display: grid; place-items: center; margin-left: auto; position: relative; }
.pal-btn::before { content: ''; position: absolute; inset: -8px; } /* bigger touch target */
.pal-btn + .open { margin-left: 0; }
.pal-btn:active { transform: scale(.92); }
.pal-ico { width: 30px; height: 30px; border-radius: 50%;
  background: conic-gradient(#1F6FEB 0 45deg, #7E3FBF 0 90deg, #D6336C 0 135deg, #C92A2A 0 180deg, #E8590C 0 225deg, #F2B705 0 270deg, #237032 0 315deg, #0B7285 0); }
.pal-body { gap: 22px; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.swatch { height: 150px; border-radius: 22px; background: var(--paper); border: 4px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.swatch.is-on { border-color: var(--ink); background: #fff; }
.swatch:active { transform: scale(.96); }
.sw-dot { width: 84px; height: 84px; border-radius: 50%; background: var(--s); color: var(--s-ink); display: grid; place-items: center; font-size: 46px; font-weight: 900; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.sw-name { font-size: 22px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.big-btn.reset.is-off { background: var(--paper-2); color: var(--mute); }
.is-short .swatch { height: 118px; }
.is-short .sw-dot { width: 66px; height: 66px; font-size: 36px; }
