/* Sanders Family Hub. Phone first; each person's colour comes in as --c on the element. */
[hidden] { display: none !important; }
:root {
  --ink: #0f172a; --muted: #586579; --line: #e5e8ef; --bg: #f3f5f9; --panel: #ffffff; --head: #1e293b;
  --accent: #2563eb; --today: #fef3c7; --danger: #dc2626; --ok: #16a34a; --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 4px 14px rgb(16 24 40 / 6%);
  --shadow-up: 0 2px 4px rgb(16 24 40 / 5%), 0 12px 28px rgb(16 24 40 / 11%);
  --glass: rgb(243 245 249 / 88%);
}
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --ink: #e2e8f0; --muted: #94a3b8; --line: #283447; --bg: #0b1120;
    --panel: #151e2f; --head: #020617; --today: #422006; --accent: #3b82f6;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 22%); --shadow-up: 0 12px 28px rgb(0 0 0 / 40%); --glass: rgb(11 17 32 / 88%); }
}
:root[data-theme="dark"] { color-scheme: dark; --ink: #e2e8f0; --muted: #94a3b8; --line: #283447; --bg: #0b1120;
  --panel: #151e2f; --head: #020617; --today: #422006; --accent: #3b82f6;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 22%); --shadow-up: 0 12px 28px rgb(0 0 0 / 40%); --glass: rgb(11 17 32 / 88%); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }  /* no white flash between pages in dark mode */
/* Smooth page changes: a quick cross-fade, with the header and the phone tab bar staying put (newer iPhones and browsers) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
.top { view-transition-name: hub-top; }
@media (max-width: 640px) { nav.main { view-transition-name: hub-tabs; } }
/* The header and tab bar are the same on every page, so swap them instantly instead of cross-fading: mid-fade both
   copies are half see-through, and on iPhones the light page showed through behind the clock (a white flash at the top). */
::view-transition-group(hub-top), ::view-transition-group(hub-tabs),
::view-transition-old(hub-top), ::view-transition-old(hub-tabs),
::view-transition-new(hub-top), ::view-transition-new(hub-tabs) { animation: none; }
::view-transition-old(hub-top), ::view-transition-old(hub-tabs) { display: none; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
:root:has(body.calm)::view-transition-group(*), :root:has(body.calm)::view-transition-old(*),
:root:has(body.calm)::view-transition-new(*) { animation: none; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: calc(16px * var(--ts, 1)); line-height: 1.45; }
a { color: inherit; }
h1 { font-size: 1.7rem; margin: 0 0 8px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.12rem; margin: 20px 0 8px; font-weight: 700; letter-spacing: -.01em; }
body { -webkit-font-smoothing: antialiased; }
.muted, .help { color: var(--muted); }
.help { font-size: calc(13px * var(--ts, 1)); margin: 4px 0 0; display: block; }
.small { font-size: calc(14px * var(--ts, 1)); }
.center { text-align: center; }
.sr { display: block; }
.kicker { margin: 0 0 6px; font-size: calc(14px * var(--ts, 1)); }
.kicker a { text-decoration: none; color: var(--muted); }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--head); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.main { display: flex; gap: 4px; margin-left: auto; }
.main a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: #cbd5e1; font-size: calc(15px * var(--ts, 1)); }
.main a.on, .main a:hover { background: rgba(255,255,255,.12); color: #fff; }
/* You, at the top right: your picture (and name on bigger screens), opening Settings, where you can switch. */
.me-chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: calc(14px * var(--ts, 1)); color: #fff;
  background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px 10px 4px 4px; flex: none; }
.me-chip:hover { background: rgba(255,255,255,.22); }
.me-chip .avatar.tiny { width: 28px; height: 28px; font-size: calc(14px * var(--ts, 1)); object-fit: cover; }
.top-end { display: contents; } /* phones and tablets: its contents sit in the header row */
/* Phones: your picture sits beside the family name, and the menu goes underneath. */
@media (max-width: 640px) { .brand { order: -2; } .me-chip { order: -1; margin-left: auto; padding-right: 4px; } }
/* Computers: the family name on the left, the menu in the middle, you and the light/dark button on the right. */
@media (min-width: 1024px) {
  .top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .brand { grid-column: 1; justify-self: start; min-width: 0; }
  .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { grid-column: 2; margin-left: 0; }
  .top-end { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 12px; min-width: 0; }
}
.link-btn { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; font-size: calc(14px * var(--ts, 1));
  padding: 4px 6px; opacity: .85; min-height: 40px; min-width: 40px; }  /* big enough to tap with a thumb, though it looks like a link */
@media (max-width: 640px) { .me-name { display: none; } .brand span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* layout */
.page { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
.page.wide { max-width: 1200px; }
.page.narrow { max-width: 440px; }
.card { background: var(--panel); border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); border-radius: var(--radius);
  padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.flashes { max-width: 1200px; margin: 8px auto 0; padding: 0 16px; }
.flash { padding: 11px 16px; border-radius: 14px; margin: 6px 0; background: #dbeafe; color: #1e3a8a; box-shadow: var(--shadow); }
.flash.ok { background: #dcfce7; color: #14532d; }
.flash.error { background: #fee2e2; color: #7f1d1d; }
.two-col { display: grid; gap: 16px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font: inherit; font-size: calc(15px * var(--ts, 1));
  font-weight: 600; cursor: pointer; min-height: 42px; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent-btn, var(--accent)); border-color: var(--accent-btn, var(--accent)); color: #fff; font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-btn, var(--accent)) 30%, transparent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: calc(14px * var(--ts, 1)); }
.wide-btn { width: 100%; margin-top: 12px; }
.form label { display: block; font-weight: 600; font-size: calc(14px * var(--ts, 1)); margin: 12px 0 0; }
.form input[type=text], .form input:not([type]), .form input[type=date], .form input[type=time], .form input[type=password],
.form input[type=number], .form input[type=url], .form select, .form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 14px; font: inherit; font-size: calc(16px * var(--ts, 1)); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; transition: border-color .12s, box-shadow .12s; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.form input.num { width: 5em; display: inline-block; }
.form label.check, .form label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: calc(15px * var(--ts, 1)); flex-wrap: wrap; }
.form label.check input[type=date], .form label.check input[type=number] { display: inline-block; width: auto; margin: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
legend { font-weight: 600; font-size: calc(14px * var(--ts, 1)); margin-bottom: 6px; padding: 0; }
.actions { display: flex; gap: 8px; margin-top: 18px; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.danger-zone select { width: auto; flex: 1 1 220px; margin: 0; }
.danger-zone .help { flex-basis: 100%; }

/* tick-box and radio "pills" */
.chips-pick, .weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-pick legend { width: 100%; }
.chips-pick .help { width: 100%; }
.pick { margin: 0 !important; font-weight: 400 !important; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick > span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; background: var(--panel); font-size: calc(15px * var(--ts, 1)); user-select: none; transition: background .12s, border-color .12s; }
.pick.small > span { padding: 5px 10px; font-size: calc(14px * var(--ts, 1)); }
.pick input:checked + span { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--panel)); font-weight: 600; }
.pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.colours { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.colours legend { width: 100%; }
.swatch { margin: 0 !important; position: relative; }
.swatch input[type=radio] { position: absolute; opacity: 0; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--c); }
.swatch.custom { display: flex !important; align-items: center; gap: 6px; font-weight: 400 !important; }
.swatch.custom input[type=radio] { position: static; opacity: 1; }
.swatch.custom input[type=color] { width: 40px; height: 34px; padding: 0; border: 0; background: none; }
.repeat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.repeat select { margin-top: 0; }
.repeat [data-repeat-opts] > * { margin-top: 10px; }

/* people dots and labels */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.who { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
/* Calendar with faces: everyone's picture (or initial) on their entries */
.who .avatar.tiny { width: 22px; height: 22px; font-size: calc(11px * var(--ts, 1)); object-fit: cover; flex: none; }
.chip-faces { display: inline-flex; flex: none; margin-right: 2px; }
.chip-faces .avatar.tiny { width: 20px; height: 20px; font-size: calc(11px * var(--ts, 1)); object-fit: cover; box-shadow: 0 0 0 1.5px var(--panel); }
.chip-faces .avatar.tiny + .avatar.tiny { margin-left: -6px; }
/* Today's Day view: the Now line, and things that have finished fade a little */
.now-line { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: calc(12px * var(--ts, 1)); font-weight: 700; margin: 2px 0; }
.now-line::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; }
.now-line::after { content: ""; flex: 1; height: 2px; background: var(--danger); border-radius: 2px; }
.entry.past { opacity: .55; }
.entry.past:hover { opacity: 1; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.avatar.big { width: 64px; height: 64px; font-size: calc(28px * var(--ts, 1)); }

/* calendar header */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cal-head h1 { margin: 0; min-width: 7em; text-align: center; font-size: 1.35rem; }
.nav-month { display: flex; align-items: center; gap: 6px; }
.nav-month .btn { font-size: calc(22px * var(--ts, 1)); padding: 2px 12px; }
.nav-month .btn.small { font-size: calc(14px * var(--ts, 1)); }
.views { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.views a { padding: 7px 12px; text-decoration: none; font-size: calc(14px * var(--ts, 1)); border-left: 1px solid var(--line); }
.views a:first-child { border-left: 0; }
.views a.on { background: var(--head); color: #fff; }
.filter { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); text-decoration: none; font-size: calc(14px * var(--ts, 1)); white-space: nowrap; }
.pill.on { border-color: var(--c, var(--head)); background: color-mix(in srgb, var(--c, #64748b) 18%, var(--panel)); font-weight: 600; }

/* month grid */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.dow { background: var(--panel); text-align: center; font-size: calc(12px * var(--ts, 1)); font-weight: 700; color: var(--muted); padding: 6px 0; text-transform: uppercase; letter-spacing: .5px; }
.cell { background: var(--panel); min-height: 112px; padding: 4px; display: flex; flex-direction: column; min-width: 0; }
.cell.weekend { background: color-mix(in srgb, var(--panel) 94%, var(--muted)); }
.cell.other { opacity: .66; }
.cell.today { background: var(--today); }
.cell .num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; text-decoration: none; font-size: calc(14px * var(--ts, 1)); font-weight: 600; }
.cell.today .num { background: var(--accent-btn, var(--accent)); color: var(--on-accent, #fff); }
.items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more { font-size: calc(12px * var(--ts, 1)); color: var(--muted); text-decoration: none; padding-left: 4px; }
.cell .dots { display: none; }

/* an entry chip, in its people's colours */
.chip { display: flex; align-items: center; gap: 3px; min-width: 0; padding: 2px 6px 2px 8px; border-radius: 6px; font-size: calc(13px * var(--ts, 1));
  text-decoration: none; position: relative; background: color-mix(in srgb, var(--c) 16%, var(--panel)); color: var(--ink); line-height: 1.3; }
.chip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 6px 0 0 6px; background: var(--stripe, var(--c)); }
.chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .time { font-weight: 700; font-size: calc(12px * var(--ts, 1)); flex: none; }
.chip .icon { flex: none; font-size: calc(12px * var(--ts, 1)); }
.chip.cat-holiday, .chip.cat-birthday { background: color-mix(in srgb, var(--c) 30%, var(--panel)); }
.chip.virtual.cat-holiday { background: color-mix(in srgb, #94a3b8 18%, var(--panel)); --c: #94a3b8; font-style: italic; }
.week .chip { margin: 3px 0; padding: 6px 8px 6px 10px; font-size: calc(14px * var(--ts, 1)); }
.week .chip .t { white-space: normal; }

@media (max-width: 700px) {
  .cell { min-height: 64px; padding: 3px 2px; align-items: center; }
  .cell .items { display: none; }
  .cell .dots { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; text-decoration: none; padding-top: 4px; width: 100%; flex: 1; align-content: flex-start; }
  .cell .dots .dot { width: 8px; height: 8px; }
  .cal-head { justify-content: center; }
}

/* week view */
.week { display: grid; gap: 10px; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.wday { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.wday.today { background: var(--today); }
.wday h2 { margin: 0 0 6px; font-size: calc(14px * var(--ts, 1)); }
.wday h2 a { text-decoration: none; }
.wday h2 span { font-size: calc(20px * var(--ts, 1)); margin-left: 4px; }
.empty { color: var(--muted); font-size: calc(14px * var(--ts, 1)); }
.empty.big { font-size: calc(16px * var(--ts, 1)); text-align: center; padding: 24px 0; }
/* Arrange my Home */
.tile-arrange { padding: 6px 12px; }
.tile-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line); scroll-margin-top: 120px; }
.tile-row:last-child { border-bottom: 0; }
.tile-row-icon { font-size: calc(24px * var(--ts, 1)); width: 36px; text-align: center; flex: none; }
.tile-row-name { flex: 1; min-width: 0; font-weight: 600; }
.tile-row-name small { color: var(--muted); font-weight: 400; }
.tile-row-btns { display: flex; gap: 4px; flex: none; }
.tile-row-btns .btn { min-width: 40px; }
.tile-row.off .tile-row-icon, .tile-row.off .tile-row-name { opacity: .5; }
.tiles-swatch { display: grid; place-items: center; font-size: calc(26px * var(--ts, 1)); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
/* Friendly empty pages: a big picture over the words */
.empty[data-art] { display: block; text-align: center; padding: 26px 16px; margin: 10px 0;
  border: 2px dashed var(--line); border-radius: 20px; background: color-mix(in srgb, var(--panel) 70%, transparent); }
.empty[data-art][hidden] { display: none; }
.empty[data-art]::before { content: attr(data-art); display: block; width: fit-content; margin: 0 auto 6px; font-size: calc(46px * var(--ts, 1)); line-height: 1.1; animation: bob 3s ease-in-out infinite; }
.add-here { display: block; font-size: calc(13px * var(--ts, 1)); color: var(--muted); text-decoration: none; margin-top: 6px; }

/* lists (day, agenda, person) */
.date-head { font-size: calc(15px * var(--ts, 1)); margin: 18px 0 6px; color: var(--muted); }
.date-head.today { color: var(--accent); }
.date-head a { text-decoration: none; }
.list { display: flex; flex-direction: column; gap: 8px; }
.entry { display: flex; gap: 12px; padding: 10px 12px 10px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; position: relative; overflow: hidden; margin-bottom: 8px; }
.list .entry { margin-bottom: 0; }
.entry::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--stripe, var(--c)); }
.entry .when { flex: none; width: 5.6em; font-weight: 700; font-size: calc(14px * var(--ts, 1)); padding-top: 1px; }
.entry .title { font-weight: 600; }
.entry .icon { margin-right: 6px; }
.entry .meta { font-size: calc(13px * var(--ts, 1)); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.entry .notes, .card.notes { font-size: calc(14px * var(--ts, 1)); white-space: pre-line; margin-top: 4px; }
a.entry:hover { border-color: var(--c); }

/* people */
.people { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.person-card { display: flex; gap: 14px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--c);
  border-radius: var(--radius); text-decoration: none; }
.person-card h2 { margin: 0 0 4px; }
.person-card .next { list-style: none; padding: 0; margin: 8px 0 0; font-size: calc(14px * var(--ts, 1)); }
.person-card .next li { padding: 2px 0; }
.person-card .d { display: inline-block; min-width: 3.6em; font-weight: 600; }
.person-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 16px; background: var(--panel);
  border: 1px solid var(--line); border-left: 8px solid var(--c); border-radius: var(--radius); }
.person-head h1 { margin: 0; }
.person-head p { margin: 2px 0 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* sign in */
.logo-big { width: 72px; height: 72px; border-radius: 18px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin: 20px 0; }
.who-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; background: var(--panel);
  border: 1px solid var(--line); border-bottom: 4px solid var(--c); border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.pin-box { text-align: center; font-size: calc(28px * var(--ts, 1)) !important; letter-spacing: 8px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.key { font: inherit; font-size: calc(24px * var(--ts, 1)); padding: 14px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.key.go { background: var(--accent); color: #fff; border-color: var(--accent); }
.key:active { transform: scale(.96); }

/* the add button */
.fab { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent-btn, var(--accent)); color: var(--on-accent, #fff); font-size: 32px; line-height: 58px; text-align: center; text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 20; }

/* reminders */
.flash.tomorrow { background: #fef3c7; color: #713f12; }
.flash.tomorrow a, .flash a { color: inherit; font-weight: 600; }
.flash .link-btn { color: inherit; margin-left: 6px; }
ul.plain { list-style: none; padding: 0; margin: 8px 0; }
ul.plain li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
input.short { max-width: 140px; }
.reminders h2 { margin-top: 0; }
@media (prefers-color-scheme: dark) { .flash.tomorrow { background: #422006; color: #fde68a; } }

/* tea requests */
.tea h2 { margin: 0 0 10px; font-size: calc(18px * var(--ts, 1)); }
.tea-rows { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tea-row { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.tea-who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tea-who .avatar { width: 28px; height: 28px; font-size: calc(14px * var(--ts, 1)); }
.tea-ask { display: flex; gap: 6px; }
.tea-ask input { flex: 1; min-width: 0; }
.tea-ask .btn { flex: none; }
.tea-past { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.tea-pick { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: calc(13px * var(--ts, 1)); cursor: pointer; }
.tea-pick:hover { border-color: var(--c); }
.tea-now { margin: 8px 0 0; overflow-wrap: anywhere; }
.tea-ask input { margin-top: 0 !important; }

/* home */
.hero { text-align: center; padding: 30px 16px 24px; margin: 4px 0 18px; border-radius: 26px; color: #fff; box-shadow: var(--shadow-up);
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,.9) 0 1px, transparent 2px),
              radial-gradient(circle at 70% 20%, rgba(255,255,255,.8) 0 1px, transparent 2px),
              radial-gradient(circle at 85% 70%, rgba(255,255,255,.7) 0 1px, transparent 2px),
              radial-gradient(circle at 35% 80%, rgba(255,255,255,.6) 0 1px, transparent 2px),
              radial-gradient(circle at 55% 50%, rgba(255,255,255,.5) 0 1px, transparent 2px),
              linear-gradient(135deg, #1e1b4b, #312e81 55%, #7c3aed); }
.hero h1 { font-size: clamp(26px, 7vw, 40px); margin: 0 0 6px; letter-spacing: .5px; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.hero p { margin: 0; opacity: .9; }
.news { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.news h2 { margin: 0 0 6px; font-size: calc(18px * var(--ts, 1)); }
.news h3 { margin: 10px 0 2px; font-size: calc(15px * var(--ts, 1)); }
.news ul, .news-card ul { margin: 4px 0 0; padding-left: 20px; }
.news li, .news-card li { margin: 2px 0; }
.news-actions { display: flex; align-items: center; gap: 14px; margin: 12px 0 0; flex-wrap: wrap; }
.news-card h2 { margin: 0; font-size: calc(17px * var(--ts, 1)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px; align-items: center; align-content: center;
  background: var(--panel); border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); border-radius: 22px; padding: 16px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.tile:hover, .tile:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-up); }
.tile:active { transform: scale(.98); }
.tile-icon { grid-row: span 2; font-size: calc(30px * var(--ts, 1)); line-height: 1; display: grid; place-items: center;
  width: calc(54px * var(--ts, 1)); height: calc(54px * var(--ts, 1)); border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.tile-name { font-weight: 700; font-size: calc(18px * var(--ts, 1)); }
.tile-sub { color: var(--muted); font-size: calc(14px * var(--ts, 1)); overflow-wrap: anywhere; }
/* "tap to update": shown when a new version is ready but the person is in the middle of something */
.update-bar { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 9px 16px; border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  font: inherit; font-size: calc(14px * var(--ts, 1)); font-weight: 700; box-shadow: 0 6px 20px rgb(0 0 0 / 25%); cursor: pointer; }
.badge { display: inline-block; background: var(--danger); color: #fff; border-radius: 999px; font-size: calc(12px * var(--ts, 1)); font-weight: 700;
  padding: 1px 7px; margin-left: 4px; vertical-align: middle; }

/* header nav: icons and words on wide screens; on phones a tab bar along the bottom (easy to reach with a thumb),
   icons with small words underneath, like the phone's own apps. Hidden inside a chat, where the message box sits. */
nav.main a { position: relative; }
nav.main .ni { margin-right: 5px; }
@media (max-width: 640px) {
  nav.main { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0; justify-content: space-around;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 92%, transparent);
    border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, .06); }
  nav.main a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px 3px;
    border-radius: 12px; color: color-mix(in srgb, var(--ink) 62%, var(--muted)); font-size: 11px; font-weight: 600; }
  nav.main a.on, nav.main a:hover { background: none; color: color-mix(in srgb, var(--accent) 52%, var(--ink)); }
  nav.main .ni { margin: 0; font-size: calc(22px * var(--ts, 1)); line-height: 1.15; padding: 1px 12px; border-radius: 999px; transition: background .15s; }
  nav.main a.on .ni { background: color-mix(in srgb, var(--accent) 16%, transparent); }
  nav.main .nl { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  nav.main a .badge { position: absolute; top: 0; left: calc(50% + 8px); margin: 0; }
  .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:has(.chat-send) nav.main { display: none; }  /* in a chat: the message box takes the bottom */
}

/* family chat */
.chat { display: flex; flex-direction: column; gap: 6px; padding-bottom: 84px; }
.chat.tall-send { padding-bottom: calc(var(--send-h, 84px) + var(--kb, 0px)); }
.chat-day { align-self: center; font-size: calc(12px * var(--ts, 1)); color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 10px; margin: 10px 0 4px; }
.msg { max-width: min(80%, 520px); align-self: flex-start; background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--c); border-radius: 14px; padding: 6px 10px 4px; }
.msg.mine { align-self: flex-end; border-left-width: 1px; border-right: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.msg-name { font-size: calc(12px * var(--ts, 1)); font-weight: 700; color: color-mix(in srgb, var(--c) 62%, var(--ink)); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-link { color: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px;
  text-decoration-color: var(--c); font-weight: 600; word-break: break-all; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 2px; font-size: calc(11px * var(--ts, 1)); color: var(--muted); }
.msg-del { display: inline; margin: 0; }
.msg-del .link-btn { text-decoration: none; font-size: calc(15px * var(--ts, 1)); padding: 0 2px; line-height: 1; }
.chat-send { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 10px max(16px, calc((100vw - 760px) / 2 + 16px)) calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); z-index: 5; }
.chat-send.kb-open { padding-bottom: 8px; } /* the keyboard is there: no gap needed for the phone's home bar */
.chat-row { display: flex; gap: 6px; align-items: flex-end; }
/* the button to the newest message: a round arrow just above the message box, with a count of new ones */
.chat-latest { position: fixed; right: 14px; z-index: 30; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); display: grid; place-items: center;
  font-size: 22px; font-weight: 800; cursor: pointer; padding: 0; }
.chat-latest[hidden] { display: none; }
.chat-latest:hover, .chat-latest:focus-visible { border-color: var(--accent); }
.chat-latest-n { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.chat-latest-n[hidden] { display: none; }
/* While something's written, the 📎 and 🎤 buttons step aside so the message has the whole width (they come back
   when the box is empty). */
.chat-row.has-text .chat-tool { display: none; }
.chat-tool { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  font-size: calc(22px * var(--ts, 1)); line-height: 1; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; padding: 0; }
.chat-tool:hover, .chat-tool[aria-expanded="true"] { border-color: var(--accent); }
.chat-tool:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-preview { display: flex; align-items: center; gap: 10px; font-size: calc(13px * var(--ts, 1)); color: var(--muted); }
.chat-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.chat-preview .link-btn { margin-left: auto; font-size: calc(22px * var(--ts, 1)); text-decoration: none; }
.chat-attach { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.attach-item { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; font: inherit;
  font-size: calc(15px * var(--ts, 1)); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.attach-item:hover { border-color: var(--accent); }
.chat-mentions { display: flex; flex-wrap: wrap; gap: 6px; }
.mention-pick { font: inherit; font-size: calc(14px * var(--ts, 1)); font-weight: 600; color: var(--ink); background: var(--panel); cursor: pointer;
  border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); border-radius: 999px; padding: 6px 12px; }
.mention-pick:first-child { border-color: var(--accent); border-left-color: var(--c, var(--accent)); }
.mention { font-weight: 700; color: var(--accent); }
.mention.you { color: inherit; background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; padding: 0 2px; }
.msg-place { display: flex; align-items: center; gap: 10px; margin: 4px 0; padding: 10px 12px; text-decoration: none; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.msg-place:hover { border-color: var(--accent); }
.place-pin { font-size: calc(28px * var(--ts, 1)); line-height: 1; }
.place-words { display: flex; flex-direction: column; }
.place-words small { color: var(--accent); font-size: calc(13px * var(--ts, 1)); }
.chat-emoji { max-height: min(260px, 40vh); overflow-y: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); padding: 6px 8px; }
.chat-emoji h3 { font-size: calc(12px * var(--ts, 1)); color: var(--muted); margin: 6px 2px 2px; font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-grid button { font-size: calc(24px * var(--ts, 1)); line-height: 1; padding: 6px 0; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--bg); }
.msg-pic { display: block; margin: 4px 0 2px; }
.msg-pic img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; background: var(--line); }
.msg-pic img.sized { height: auto; max-height: none; object-fit: cover; }
.msg-text.big { font-size: calc(40px * var(--ts, 1)); line-height: 1.15; }
.msg { position: relative; touch-action: pan-y; transition: transform .2s ease; }
.msg.swiping { transition: none; }
.msg::before { content: "\21A9"; position: absolute; left: -34px; top: 50%; font-size: calc(20px * var(--ts, 1)); color: var(--accent);
  opacity: var(--sw, 0); transform: translateY(-50%) scale(calc(.6 + var(--sw, 0) * .5)); pointer-events: none; }
.chat { overflow-x: clip; }
.msg.flash { animation: msg-flash 1.4s ease; }
@keyframes msg-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.msg-quote { display: block; border-left: 3px solid var(--qc, var(--accent)); background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 8px; padding: 4px 8px; margin: 4px 0; font-size: calc(13px * var(--ts, 1)); text-decoration: none; color: var(--ink); min-width: 0; }
.msg-quote b { display: block; font-size: calc(12px * var(--ts, 1)); color: var(--qc, var(--accent)); }
.msg-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted);
  overflow-wrap: anywhere; }
.msg-quote.gone { font-style: italic; color: var(--muted); border-left-color: var(--line); }
.chat-reply { display: flex; align-items: center; gap: 8px; }
.chat-reply .msg-quote { flex: 1; margin: 0; }
.chat-reply .link-btn { font-size: calc(22px * var(--ts, 1)); text-decoration: none; }
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.msg-reacts:empty { display: none; }
.msg-reacts form { margin: 0; }
.react { font: inherit; font-size: calc(15px * var(--ts, 1)); line-height: 1; padding: 3px 7px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.react span { font-size: calc(12px * var(--ts, 1)); font-weight: 600; color: var(--muted); }
.react.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.react-open { border: 0; background: none; color: var(--muted); font-size: calc(13px * var(--ts, 1)); padding: 0 6px 0 0; cursor: pointer; line-height: 1; }
/* Tidy bubbles: only the time shows; a tap (or a mouse hovering) brings up reply, react and ⋯ */
.msg { cursor: default; -webkit-tap-highlight-color: transparent; }
.msg-acts { display: none; align-items: center; gap: 2px; margin-right: 4px; }
.msg.open .msg-acts { display: inline-flex; animation: acts-in .15s ease-out; }
@media (hover: hover) { .msg:hover .msg-acts { display: inline-flex; } }
.msg.open .react-open { font-size: calc(16px * var(--ts, 1)); padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
@keyframes acts-in { from { opacity: 0; transform: translateX(6px); } }
/* Messages sent one after another by the same person: name once, bubbles closer, joined corners */
.msg.cont { margin-top: -3px; }
.msg.cont .msg-name { display: none; }
.chat .msg:not(.mine).has-next { border-bottom-left-radius: 5px; }
.chat .msg:not(.mine).cont { border-top-left-radius: 5px; }
.chat .msg.mine.has-next { border-bottom-right-radius: 5px; }
.chat .msg.mine.cont { border-top-right-radius: 5px; }
.react-open:hover { color: var(--accent); }
.react-pick { position: absolute; z-index: 20; display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.react-pick button { font-size: calc(24px * var(--ts, 1)); line-height: 1; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.react-pick button:hover, .react-pick button:focus-visible { background: var(--bg); }
.react-pick .more { font-size: calc(20px * var(--ts, 1)); color: var(--muted); }
.chat-send textarea { flex: 1; min-width: 0; resize: none; font: inherit; font-size: calc(16px * var(--ts, 1)); padding: 10px 12px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; max-height: 160px; }
.chat-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; font-size: calc(14px * var(--ts, 1)); }

/* app improvement suggestions */
.idea { border-left: 4px solid var(--c); }
.idea-text { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.idea-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: calc(13px * var(--ts, 1)); color: var(--muted); }
.idea-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.idea-actions form { margin: 0; }
.idea.done { opacity: .75; }
.done-ideas summary { cursor: pointer; font-weight: 600; margin: 16px 0 4px; }

/* profile pictures */
img.avatar { object-fit: cover; background: var(--c, var(--line)); padding: 0; border: 2px solid var(--c, transparent); }
.avatar.tiny { width: 20px; height: 20px; font-size: calc(11px * var(--ts, 1)); vertical-align: middle; }
img.avatar.tiny { border-width: 1px; }
.msg-name .avatar.tiny { margin-right: 4px; }
.avatar-link { display: inline-flex; border-radius: 50%; }
.avatar-link:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.photo-forms { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.photo-up { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.photo-forms form { margin: 0; }
.photo-up label.btn { cursor: pointer; }

/* family polls */
.poll h2 { margin: 0 0 4px; font-size: calc(18px * var(--ts, 1)); overflow-wrap: anywhere; }
.poll-by { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; }
.poll-options { display: grid; gap: 6px; }
.poll-options form { margin: 0; }
.poll-option { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; overflow: hidden; isolation: isolate; }
.poll-option::before { content: ""; position: absolute; inset: 0; width: var(--pct); z-index: -1;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); transition: width .3s; }
.poll-option.top::before { background: color-mix(in srgb, var(--ok) 22%, var(--panel)); }
.poll-option.mine { border-color: var(--accent); font-weight: 600; }
.poll-option:hover:not(:disabled) { border-color: var(--accent); }
.poll-option:disabled { cursor: default; }
.poll-text { overflow-wrap: anywhere; }
.poll-count { font-weight: 700; flex: none; }
.poll-voters { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 4px 4px; }
.poll-manage { display: flex; gap: 12px; margin-top: 10px; }
.poll-manage form { margin: 0; }
.poll.closed { opacity: .85; }
.poll-new summary { cursor: pointer; }
.poll-new form { margin-top: 12px; }
.poll-answers { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* chat: title row, pins, typing, voice, seen, menu */
.chat-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chat-title h1 { margin: 0; }
.chat-pins { position: sticky; top: var(--top-h, 56px); z-index: 4; display: flex; flex-direction: column; gap: 4px;
  margin: 8px 0; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.pin { display: flex; align-items: center; gap: 4px; border-left: 3px solid var(--qc, var(--accent)); padding-left: 6px; }
.pin-go { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; font-size: calc(14px * var(--ts, 1));
  cursor: pointer; padding: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-go b { color: var(--qc, var(--accent)); }
.pin-icon { margin-right: 4px; }
.pin-x { font-size: calc(20px * var(--ts, 1)); text-decoration: none; padding: 0 4px; }
.chat-typing { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--ts, 1)); color: var(--muted); padding: 4px 6px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.msg-voice { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; }
/* videos */
.msg-video { display: block; width: 320px; max-width: 100%; max-height: 420px; margin: 4px 0 2px; border-radius: 10px; background: #000; }
.video-failed { display: block; font-size: calc(13px * var(--ts, 1)); margin: 2px 0; }
.video-icon { font-size: calc(34px * var(--ts, 1)); line-height: 1; }
/* GIFs */
.msg-gif { display: block; width: 280px; max-width: 100%; height: auto; max-height: 360px; object-fit: contain;
  margin: 4px 0 2px; border-radius: 10px; background: var(--line); cursor: zoom-in; }
.msg-gif:fullscreen { object-fit: contain; background: #000; border-radius: 0; max-height: none; cursor: auto; }
.chat-gifs { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); padding: 8px; }
.gif-top { display: flex; gap: 6px; align-items: center; }
.gif-top input { flex: 1; min-width: 0; font: inherit; font-size: calc(16px * var(--ts, 1)); padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.gif-top .link-btn { font-size: calc(24px * var(--ts, 1)); text-decoration: none; padding: 0 6px; }
.gif-grid { flex: none; max-height: min(280px, 38vh); overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 6px; }
.gif-grid .help { grid-column: 1 / -1; margin: 8px 2px; }
/* Square tiles sized by padding (not aspect-ratio), so iPhone Safari can't squash the rows inside the scroller */
.gif-pick { position: relative; display: block; width: 100%; height: 0; padding: 100% 0 0; border: 0; border-radius: 8px;
  overflow: hidden; background: var(--line); cursor: pointer; }
.gif-pick img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gif-pick.sending { opacity: .4; }
.gif-credit { margin: 0; font-size: calc(11px * var(--ts, 1)); color: var(--muted); text-align: right; }
.msg-voice audio { height: 36px; width: min(240px, 60vw); }
.voice-len { font-size: calc(12px * var(--ts, 1)); color: var(--muted); }
.msg-seen { font-size: calc(12px * var(--ts, 1)); color: var(--muted); text-align: right; margin-top: 2px; }
.chat-record { display: flex; align-items: center; gap: 10px; font-size: calc(14px * var(--ts, 1)); }
.chat-record .help { margin: 0; flex: 1; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: rec 1s infinite; }
@keyframes rec { 50% { opacity: .3; } }
.chat-tool.on { background: var(--danger); border-color: var(--danger); }
.react-pick.menu { flex-direction: column; align-items: stretch; border-radius: 12px; padding: 4px; min-width: 170px; }
.react-pick.menu .menu-item { width: auto; height: auto; border-radius: 8px; font-size: calc(15px * var(--ts, 1)); text-align: left; padding: 9px 12px;
  color: var(--ink); }
.react-pick.menu .menu-item.danger { color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .dots i, .rec-dot { animation: none; } }

/* photo album */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.album a { position: relative; display: block; border-radius: 10px; overflow: hidden; background: var(--line); aspect-ratio: 1; }
.album img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: calc(11px * var(--ts, 1)); color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; pointer-events: none; }
.album-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%); width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center; padding-left: 3px; border-radius: 50%; font-size: calc(16px * var(--ts, 1));
  color: #fff; background: rgba(0, 0, 0, .55); }
.album-len { position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 999px; font-size: calc(11px * var(--ts, 1)); font-style: normal;
  color: #fff; background: rgba(0, 0, 0, .6); }
.album-tabs { display: flex; gap: 8px; margin: 4px 0 8px; flex-wrap: wrap; }
.album-tabs a { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: calc(14px * var(--ts, 1)); }
.album-tabs a[aria-current="page"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }

/* birthdays on Home */
.bday { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; padding: 12px 16px; margin: 0 0 16px; border-radius: 14px; border: 2px solid #f59e0b;
  background: color-mix(in srgb, #f59e0b 14%, var(--panel)); }
.bday p { margin: 0; }
.bday.mine { display: block; text-align: center; padding: 22px 16px; background: linear-gradient(135deg, #f472b6, #a855f7 55%, #3b82f6);
  color: #fff; border: 0; }
.bday.mine h2 { font-size: clamp(22px, 6vw, 32px); margin: 4px 0; text-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.bday-big { font-size: calc(40px * var(--ts, 1)); line-height: 1.1; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -16px; left: calc(var(--x) * 1%); width: 8px; height: 14px; border-radius: 2px;
  background: hsl(var(--h) 90% 60%); transform: rotate(var(--r)); animation: fall 3.2s var(--d) ease-in 3 both; }
@keyframes fall { to { transform: translateY(260px) rotate(calc(var(--r) + 540deg)); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* light or dark choice */
.theme-choice { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.theme-choice label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.theme-choice .help { display: inline; margin: 0; }
.card > h2:first-child { margin-top: 0; }

/* Christmas: the Home banner (with gentle snow) and the wish lists */
.xmas { position: relative; overflow: hidden; margin: 0 0 16px; padding: 18px 18px 16px; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, #b91c1c, #991b1b 45%, #166534); box-shadow: 0 6px 18px rgba(127, 29, 29, .25); }
.xmas h2 { margin: 0 0 6px; font-size: clamp(20px, 5.5vw, 26px); text-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.xmas p { margin: 0 0 4px; position: relative; }
.xmas .xmas-line { opacity: .9; font-size: calc(14px * var(--ts, 1)); font-style: italic; }
.xmas-actions { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.xmas-btn { background: #fff; color: #991b1b; border-color: #fff; font-weight: 700; }
.xmas-btn:hover { background: #fef2f2; }
.xmas-count { font-size: calc(14px * var(--ts, 1)); opacity: .9; }
.snow { position: absolute; inset: 0; pointer-events: none; }
.snow i { position: absolute; top: -10px; left: calc(var(--x) * 1%); width: var(--s); height: var(--s); border-radius: 50%;
  background: rgba(255, 255, 255, .8); animation: snowfall var(--d) linear var(--w) infinite; }
@keyframes snowfall { to { transform: translate(18px, 240px); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .snow { display: none; } }
.xmas-form h2 { margin-top: 0; }
.wish-list { border-left: 4px solid var(--c); }
.wish-list h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: calc(18px * var(--ts, 1)); }
.wish-n { font-size: calc(14px * var(--ts, 1)); font-weight: 400; }
.wishes { list-style: none; margin: 0; padding: 0; }
.wishes li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.wishes li:first-child { border-top: 0; }
.wish-name { flex: 1 1 12em; font-weight: 600; overflow-wrap: anywhere; }
.wish-link { font-size: calc(14px * var(--ts, 1)); overflow-wrap: anywhere; }
.wishes form { margin: 0; }


/* "I'll get this" on wish lists (never shown on your own list) */
.wish-claim { font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: #15803d; background: color-mix(in srgb, #16a34a 14%, var(--panel));
  border-radius: 999px; padding: 3px 10px; }
.wish-claim.mine { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.xmas-links { margin: 8px 0; }

/* parents' replies to suggestions */
.idea-reply { margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; border-left: 3px solid var(--rc, var(--accent));
  background: color-mix(in srgb, var(--rc, var(--accent)) 10%, var(--panel)); font-size: calc(14px * var(--ts, 1)); }
.idea-reply b { color: var(--rc, var(--accent)); }
.idea-reply p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.idea-reply-box { margin: 0 0 8px; font-size: calc(14px * var(--ts, 1)); }
.idea-reply-box summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.idea-reply-box form { margin-top: 6px; }
.idea-reply-box textarea { width: 100%; }

/* advent calendar */
.advent { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; margin: 12px 0; }
.advent form { margin: 0; }
.advent-cell { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; border-radius: 12px;
  font: inherit; font-size: calc(22px * var(--ts, 1)); font-weight: 800; text-decoration: none; border: 2px solid transparent; }
.advent-cell.locked { color: color-mix(in srgb, #fff 55%, transparent); background: linear-gradient(135deg, #14532d, #166534); cursor: default; }
.advent-cell.ready { color: #fff; background: linear-gradient(135deg, #b91c1c, #dc2626); cursor: pointer;
  box-shadow: 0 0 0 0 rgba(250, 204, 21, .7); animation: advent-glow 2s infinite; }
.advent-cell.ready.today { border-color: #facc15; }
.advent-cell.open { color: #92400e; background: repeating-linear-gradient(45deg, #fef3c7 0 8px, #fde68a 8px 16px); }
.advent-cell.open.shown { border-color: var(--accent); }
.advent-cell:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@keyframes advent-glow { 0% { box-shadow: 0 0 0 0 rgba(250, 204, 21, .7); } 70% { box-shadow: 0 0 0 10px rgba(250, 204, 21, 0); }
  100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); } }
.advent-door { border-top: 6px solid #dc2626; text-align: center; animation: advent-pop .45s ease-out; }
.advent-door.kind-fact { border-top-color: #2563eb; }
.advent-door.kind-challenge { border-top-color: #ca8a04; }
.advent-door.kind-eve { border-top-color: #16a34a; }
.advent-day { margin: 0; font-size: calc(13px * var(--ts, 1)); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.advent-door h2 { margin: 4px 0 8px; }
.advent-text { font-size: calc(18px * var(--ts, 1)); margin: 0 0 8px; }
.advent-answer summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.advent-answer p { font-size: calc(22px * var(--ts, 1)); font-weight: 800; margin: 8px 0 0; }
@keyframes advent-pop { from { transform: scale(.85) rotateY(70deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .advent-cell.ready, .advent-door { animation: none; } }
.advent-home { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 12px 16px; border-radius: 16px;
  color: #fff; text-decoration: none; background: linear-gradient(135deg, #14532d, #166534); }
.advent-home.ready { background: linear-gradient(135deg, #991b1b, #dc2626); }
.advent-home b { display: block; font-size: calc(17px * var(--ts, 1)); }
.advent-home small { opacity: .92; font-size: calc(14px * var(--ts, 1)); }
.advent-home-n { flex: none; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 12px; font-size: calc(24px * var(--ts, 1)); font-weight: 800; background: rgba(255, 255, 255, .18); border: 2px solid #facc15; }
/* weather line in the Home welcome tile */
.hero .weather { margin-top: 10px; }
.hero .weather-line { opacity: 1; font-size: calc(16px * var(--ts, 1)); font-weight: 600; line-height: 1.35; }
.hero .weather-line small { display: block; font-weight: 400; font-size: calc(13px * var(--ts, 1)); opacity: .8; margin-top: 2px; }
.weather-ask { font: inherit; font-size: calc(14px * var(--ts, 1)); color: #fff; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.weather-ask:hover { background: rgba(255, 255, 255, .24); }
/* the parents' private chat */
.parent-room h1 { color: #d97706; }
.parent-note { margin: 2px 0 0; }
.parent-tile { border-color: color-mix(in srgb, #d97706 45%, var(--line)); }
/* ---- Looks (each person picks one on /look) ----
   body classes: zaz (any look but Classic), sky, mycolour, funchat + wall-<style>. --me is the person's colour. */
@font-face { font-family: "Baloo 2"; src: url("fonts/baloo2.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
.zaz h1, .zaz h2, .zaz .brand span, .zaz .tile-name { font-family: "Baloo 2", var(--font); font-weight: 800; }
.zaz h1 { letter-spacing: 0; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.zaz .tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 8px;
  border-radius: 20px; border-color: transparent; box-shadow: 0 4px 14px rgba(15, 23, 42, .08); transition: transform .15s, box-shadow .15s; }
.zaz .tile:hover, .zaz .tile:focus-visible { transform: translateY(-3px) scale(1.02); }
.zaz .tile-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: calc(28px * var(--ts, 1));
  background: color-mix(in srgb, var(--tc, #2563eb) 20%, var(--panel)); animation: bob 3s ease-in-out infinite; }
.zaz .tile-name { font-size: calc(19px * var(--ts, 1)); line-height: 1.1; }
.zaz .tile-sub { font-size: calc(13px * var(--ts, 1)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.zaz .tile:nth-child(6n+1) { --tc: #2563eb; }
.zaz .tile:nth-child(6n+2) { --tc: #f59e0b; } .zaz .tile:nth-child(6n+2) .tile-icon { animation-delay: .5s; }
.zaz .tile:nth-child(6n+3) { --tc: #16a34a; } .zaz .tile:nth-child(6n+3) .tile-icon { animation-delay: 1s; }
.zaz .tile:nth-child(6n+4) { --tc: #db2777; } .zaz .tile:nth-child(6n+4) .tile-icon { animation-delay: 1.5s; }
.zaz .tile:nth-child(6n+5) { --tc: #7c3aed; } .zaz .tile:nth-child(6n+5) .tile-icon { animation-delay: 2s; }
.zaz .tile:nth-child(6n+6) { --tc: #0891b2; } .zaz .tile:nth-child(6n+6) .tile-icon { animation-delay: 2.5s; }
@media (max-width: 640px) { .zaz .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* My colour */
body.mycolour { --accent: var(--me); background: color-mix(in srgb, var(--me) 8%, var(--bg)); }
.mycolour .top { background: color-mix(in srgb, var(--me) 55%, #0b1020); }
.mycolour .hero { background: radial-gradient(circle at 20% 30%, rgba(255,255,255,.8) 0 1px, transparent 2px),
  radial-gradient(circle at 75% 25%, rgba(255,255,255,.7) 0 1px, transparent 2px),
  linear-gradient(135deg, color-mix(in srgb, var(--me) 45%, #020617), var(--me));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--me) 30%, transparent); }
.mycolour .card, .mycolour .tile { border-color: color-mix(in srgb, var(--me) 22%, var(--line)); }
.zaz.mycolour .tile:nth-child(n) { --tc: var(--me); }

/* Living sky: the welcome changes with the time of day */
.sky .hero { position: relative; overflow: hidden; border-radius: 24px; }
.sky .hero > :not(.sky-bits) { position: relative; }
.sky .hero h1, .sky .hero p { text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.sky .hero[data-sky="morning"] { background: linear-gradient(180deg, #0369a1 0%, #0ea5e9 60%, #f59e0b 100%); }
.sky .hero[data-sky="afternoon"] { background: linear-gradient(180deg, #1d4ed8 0%, #3b82f6 100%); }
.sky .hero[data-sky="evening"] { background: linear-gradient(180deg, #6d28d9 0%, #ea580c 78%, #f59e0b 100%); }
.sky .hero[data-sky="night"] { background: linear-gradient(180deg, #020617 0%, #1e1b4b 60%, #312e81 100%); }
.sky .hero .weather-line { display: inline-block; background: rgba(255, 255, 255, .18); padding: 8px 14px; border-radius: 999px; }
.sky-bits { position: absolute; inset: 0; pointer-events: none; }
.sky-sun { position: absolute; right: 16px; top: 12px; font-size: calc(38px * var(--ts, 1)); line-height: 1; }
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(calc(100vw + 60px)); } }
.sky-cloud { position: absolute; left: 0; font-size: calc(32px * var(--ts, 1)); opacity: .85; animation: drift 22s linear infinite; }
.sky-cloud.c1 { top: 10px; }
.sky-cloud.c2 { top: 64px; font-size: calc(22px * var(--ts, 1)); opacity: .55; animation-duration: 32s; animation-delay: -12s; }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
.sky-star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; animation: twinkle 2.4s ease-in-out infinite; }

/* Fun chat */
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(14deg) scale(1.1); } 75% { transform: rotate(-10deg); } }
.funchat .msg { border: 0; border-radius: 20px 20px 20px 6px; background: color-mix(in srgb, var(--c) 16%, var(--panel));
  box-shadow: 0 2px 8px rgba(15, 23, 42, .07); }
.funchat .msg.mine { border: 0; border-radius: 20px 20px 6px 20px; background: color-mix(in srgb, var(--c) 30%, var(--panel));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 28%, transparent); }
.funchat .msg-text.big { display: inline-block; font-size: calc(56px * var(--ts, 1)); transform-origin: 50% 80%; animation: wiggle 1.4s ease-in-out 2; }
.funchat .react { animation: pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
body.funchat.wall-doodles[data-view="chat"] { background:
  radial-gradient(circle at 20px 20px, color-mix(in srgb, #2563eb 16%, transparent) 3px, transparent 4px) 0 0 / 40px 40px,
  radial-gradient(circle at 40px 40px, color-mix(in srgb, #db2777 16%, transparent) 3px, transparent 4px) 0 0 / 40px 40px,
  color-mix(in srgb, #6366f1 6%, var(--bg)); }
body.funchat.wall-sunset[data-view="chat"] { background: linear-gradient(180deg, color-mix(in srgb, #fde68a 40%, var(--bg)),
  color-mix(in srgb, #fbcfe8 40%, var(--bg)) 60%, color-mix(in srgb, #c4b5fd 40%, var(--bg))) fixed; }

/* My look page */
/* Chat backgrounds: each person's own picture behind a chat (chat_background.html picks it) */
.chat-wall { position: fixed; inset: 0; z-index: -1; background: center / cover no-repeat; pointer-events: none; }
.chat-wall.soft::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 42%, transparent); }
body:has(.chat-wall) { background: var(--bg); }
body:has(.chat-wall) .chat-head { background: color-mix(in srgb, var(--bg) 82%, transparent); border-radius: 16px; padding: 6px 12px 8px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
body:has(.chat-wall) .chat-day, body:has(.chat-wall) .msg-seen, body:has(.chat-wall) .chat-typing, body:has(.chat-wall) .chat .empty {
  background: color-mix(in srgb, var(--panel) 88%, transparent); border-radius: 999px; padding: 2px 10px; }
body:has(.chat-wall) .msg-seen { align-self: flex-end; width: fit-content; margin-left: auto; }
.chat-title-btns { display: flex; gap: 6px; margin-left: auto; }
@media (max-width: 640px) { .chat-title-btns .btn { padding: 7px 10px; } .chat-title h1 { font-size: calc(24px * var(--ts, 1)); } }
.bg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; border: 0; padding: 0; margin: 8px 0 4px; }
.bg-pick legend { font-weight: 700; margin-bottom: 6px; }
.form label.bg-choice { position: relative; display: flex; flex-direction: column; gap: 4px; margin: 0; font-weight: 600; font-size: calc(13px * var(--ts, 1));
  text-align: center; cursor: pointer; }
.bg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.bg-thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px;
  border: 3px solid var(--line); background: var(--panel); font-size: calc(30px * var(--ts, 1)); box-sizing: border-box; }
.bg-none { background: repeating-linear-gradient(135deg, var(--panel) 0 10px, color-mix(in srgb, var(--line) 60%, var(--panel)) 10px 20px); }
.bg-choice:has(input:checked) .bg-thumb { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.bg-choice:has(input:focus-visible) .bg-thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
.bg-choice[hidden] { display: none; }

.look-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 8px 0 4px; border: 0; padding: 0; }
.look-pick legend { font-weight: 700; margin-bottom: 6px; }
.look-pick label { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--panel); cursor: pointer; margin: 0; }
.look-pick label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.look-pick input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.look-pick b { display: block; }
.look-pick small { color: color-mix(in srgb, var(--muted) 75%, var(--ink)); }
.look-swatch { width: 54px; height: 54px; flex: none; border-radius: 14px; border: 1px solid var(--line); }
.sw-classic { background: linear-gradient(135deg, #1e1b4b, #312e81 55%, #7c3aed); }
.sw-sky { background: linear-gradient(180deg, #0369a1, #0ea5e9 60%, #f59e0b); }
.sw-colour { background: linear-gradient(135deg, color-mix(in srgb, var(--me) 45%, #020617), var(--me)); }
.sw-sky-colour { background: linear-gradient(90deg, #0ea5e9 50%, var(--me) 50%); }
.sw-chat-classic { background: var(--panel); }
.sw-chat-doodles { background: radial-gradient(circle at 9px 9px, #93c5fd 3px, transparent 4px) 0 0 / 18px 18px, #eef2ff; }
.sw-chat-sunset { background: linear-gradient(180deg, #fde68a, #fbcfe8 60%, #c4b5fd); }
.sw-chat-plain { background: color-mix(in srgb, var(--me) 30%, var(--panel)); }

/* This week's stars and birthday countdowns on Home */
.stars h2 { margin: 0 0 8px; }
.star-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.star-badge { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: calc(24px * var(--ts, 1));
  background: color-mix(in srgb, #f59e0b 20%, var(--panel)); }
.star-row small { display: block; color: var(--muted); }
.countdowns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.countdown { flex: 1 1 140px; border-radius: 18px; padding: 12px 14px; background: color-mix(in srgb, var(--c) 16%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); }
.countdown b { display: block; font-size: calc(28px * var(--ts, 1)); line-height: 1; font-family: "Baloo 2", var(--font); }

@media (prefers-reduced-motion: reduce) {
  .zaz .tile-icon, .sky-cloud, .sky-star, .funchat .msg-text.big, .funchat .react { animation: none !important; }
}

/* ---- The chat hub (/chats): the family chat, the parents' chat and private messages ---- */
.chat-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 10px 0 18px; }
.chat-row-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; text-decoration: none; }
.chat-row-link:hover, .chat-row-link:focus-visible { border-color: var(--accent); }
.chat-row-link .avatar { object-fit: cover; }
.chat-row-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: calc(22px * var(--ts, 1)); flex: none;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.chat-row-main { flex: 1; min-width: 0; }
.chat-row-main b { display: block; }
.chat-row-main small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.start-head { font-size: 1rem; margin: 14px 0 8px; }
.start-chat { display: flex; flex-wrap: wrap; gap: 10px; }
.start-btn { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; font-weight: 600;
  border: 2px solid color-mix(in srgb, var(--c) 40%, var(--line)); background: var(--panel); text-decoration: none; }
.start-btn .avatar { width: 32px; height: 32px; font-size: calc(15px * var(--ts, 1)); object-fit: cover; }
.chat-title h1 .avatar { width: 34px; height: 34px; font-size: calc(16px * var(--ts, 1)); vertical-align: middle; object-fit: cover; }
/* a private chat's top bar: stays under the header while scrolling */
.chat-head.dm-room { position: sticky; top: var(--top-h, 56px); z-index: 5; margin: 0 -16px; padding: 8px 16px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
body:has(.chat-wall) .chat-head.dm-room { border-radius: 0 0 16px 16px; padding: 8px 16px; }
.dm-room .chat-title { flex-wrap: wrap; gap: 4px 8px; }
.dm-back { font-size: calc(30px * var(--ts, 1)); line-height: 1; padding: 0 6px 4px 0; text-decoration: none; color: var(--accent); }
.dm-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 0 auto; max-width: 100%; color: inherit; text-decoration: none; }
.dm-who .avatar { width: 42px; height: 42px; font-size: calc(18px * var(--ts, 1)); flex: none; object-fit: cover; }
.dm-who-text { min-width: 0; display: flex; flex-direction: column; }
.dm-who-text h1 { margin: 0; font-size: calc(20px * var(--ts, 1)); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-who-text small { color: var(--muted); font-size: calc(12px * var(--ts, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-room .chat-title-btns { gap: 4px; }
.dm-room .chat-title-btns .btn { padding: 6px 7px; }
.chat-head.dm-room ~ .chat-pins { top: calc(var(--top-h, 56px) + var(--dm-h, 60px)); }

/* ---- Settings: you, your theme, sounds and reading help ---- */
.me-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-left: 6px solid var(--c); }
.me-card .avatar.big { object-fit: cover; }
.me-card-text { flex: 1; min-width: 140px; }
.me-card-text h2 { margin: 0; }
.me-card-text p { margin: 2px 0 0; }
.me-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.me-card-actions form { margin: 0; }
.my-settings h2:first-of-type { margin-top: 0; }
.theme-now { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 8px 0; border: 2px solid var(--line);
  border-radius: 16px; text-decoration: none; }
.theme-now:hover { border-color: var(--accent); }
.theme-now { flex-wrap: wrap; }
.theme-now > span:nth-child(2) { flex: 1 1 160px; min-width: 0; }
.theme-now b, .theme-now small { display: block; }
.theme-now small { color: var(--muted); }
.sound-pick { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 8px; }
.sound-pick fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px 8px; margin: 0; }
.sound-pick legend { font-weight: 700; padding: 0 4px; }
.form .sound-opt { display: flex; align-items: center; gap: 10px; margin: 0; padding: 5px 0; font-weight: 500; font-size: calc(15px * var(--ts, 1)); }
.sound-opt > span { flex: 1; }
.sound-opt input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.play { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; width: 40px; height: 34px;
  cursor: pointer; font-size: calc(14px * var(--ts, 1)); flex: none; }
.tint-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, .2); }
.family-head { margin-top: 30px; }
.family-head small { font-size: calc(14px * var(--ts, 1)); font-weight: 400; }

/* ---- Reading help (each person's own, in Settings) ---- */
/* A coloured overlay over everything, like a coloured reading sheet laid on the page. */
.tint { position: fixed; inset: 0; z-index: 2000; pointer-events: none; background: var(--tint); opacity: var(--tint-a);
  mix-blend-mode: multiply; }
/* Clear letters: a plain, open font (the kind dyslexia charities recommend), more space, nothing slanted or squashed. */
body.easy, body.look-reading { --font: Verdana, Tahoma, "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  letter-spacing: .035em; word-spacing: .14em; line-height: 1.7; }
.easy h1, .easy h2, .easy h3, .easy .tile-name, .easy .brand span, .easy .splash-hi,
.look-reading h1, .look-reading h2, .look-reading h3, .look-reading .tile-name, .look-reading .brand span {
  font-family: var(--font) !important; text-transform: none !important; letter-spacing: .03em; line-height: 1.3; }
.easy *, .look-reading * { font-style: normal !important; }
.easy .help, .easy .tile-sub, .easy small { font-size: max(14px, 1em); }
.easy p, .easy li, .easy .msg-text { text-align: left; }
/* Text size */
/* Bigger and Biggest text: every font size is multiplied by --ts, so only the writing grows (the page itself
   isn't enlarged, which upset iPhones' keyboard and the bars fixed to the bottom). */
body.ts-large { --ts: 1.15; }
body.ts-huge { --ts: 1.3; }
/* Calm screen: nothing bouncing or moving (the welcome just fades) */
.calm *:not(.splash), .calm *::before, .calm *::after { animation: none !important; transition: none !important; }

/* ---- The welcome: your picture and name pop up when the hub opens ---- */
.splash { display: none; position: fixed; inset: 0; z-index: 1000; place-items: center; overflow: hidden; color: #fff; cursor: pointer;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c) 60%, #fff) 0, var(--c) 45%, color-mix(in srgb, var(--c) 50%, #0b1020) 100%); }
/* Shown by theme.js before the page draws; it fades by itself even if the page's script never runs. */
.splashing .splash { display: grid; animation: splash-auto 3.4s ease forwards; }
.splash.bye { animation: splash-out .45s ease forwards; }
.splash-in { text-align: center; padding: 16px; position: relative; z-index: 1; }
.splash .splash-pic { width: 132px; height: 132px; font-size: calc(60px * var(--ts, 1)); border: 5px solid #fff; object-fit: cover;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35); animation: splash-pop .75s cubic-bezier(.2, 1.7, .4, 1) both; }
.splash-hi { font-family: "Baloo 2", var(--font); font-weight: 800; font-size: clamp(34px, 11vw, 64px); line-height: 1.1;
  margin: 18px 0 0; text-shadow: 0 3px 14px rgba(0, 0, 0, .3); }
.splash-word { display: inline-block; white-space: nowrap; }
.splash-word > span { display: inline-block; animation: splash-letter .55s cubic-bezier(.2, 1.8, .4, 1) both;
  animation-delay: calc(.4s + var(--i) * .07s); }
.splash-bit { position: absolute; top: -24px; left: calc(var(--x) * 1%); width: 10px; height: 16px; border-radius: 3px;
  background: hsl(var(--h) 90% 62%); animation: splash-fall 2.4s linear both; animation-delay: var(--d); }
@keyframes splash-auto { 0%, 86% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
@keyframes splash-out { to { opacity: 0; transform: scale(1.06); visibility: hidden; } }
@keyframes splash-pop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.18) rotate(8deg); } 100% { transform: none; } }
@keyframes splash-letter { 0% { opacity: 0; transform: translateY(42px) scale(.3); } 100% { opacity: 1; transform: none; } }
@keyframes splash-fall { to { transform: translateY(115vh) rotate(560deg); } }
.calm .splash *, .calm .splash-bit { animation: none !important; }
.calm .splash-bit { display: none; }
@media (prefers-reduced-motion: reduce) { .splash *, .splash-bit { animation: none !important; } .splash-bit { display: none; } }

/* ---- New themes ---- */
/* Race day (Formula 1 style): racing red, carbon black, a chequered flag */
body.look-race { --accent: #e10600; background:
  repeating-linear-gradient(135deg, transparent 0 22px, color-mix(in srgb, var(--ink) 3%, transparent) 22px 24px), var(--bg); }
.look-race .top { background: #15151e; border-bottom: 3px solid #e10600; }
.look-race .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 7px; pointer-events: none;
  background: repeating-conic-gradient(#15151e 0 25%, #fff 0 50%) 0 0 / 7px 7px; opacity: .9; }
.look-race h1, .look-race h2, .look-race .tile-name, .look-race .brand span {
  font-family: "Arial Black", "Segoe UI Black", "Helvetica Neue", var(--font); font-weight: 900; font-style: italic;
  text-transform: uppercase; letter-spacing: .01em; }
.look-race .hero { position: relative; overflow: hidden; border-radius: 6px 28px 6px 28px;
  background: linear-gradient(100deg, #15151e 0 70%, #e10600 70% 77%, #15151e 77% 80%, #e10600 80% 83%, #15151e 83%); }
.look-race .hero::after { content: ""; position: absolute; right: -28px; top: -28px; width: 120px; height: 120px; transform: rotate(18deg);
  background: repeating-conic-gradient(#fff 0 25%, #15151e 0 50%) 0 0 / 20px 20px; opacity: .9; }
.look-race .hero > * { position: relative; z-index: 1; }
.look-race .tile { border-radius: 6px 18px 6px 18px; border-left: 6px solid var(--tc); }
.look-race .tile:nth-child(6n+1) { --tc: #e10600; } .look-race .tile:nth-child(6n+2) { --tc: #ff8000; }
.look-race .tile:nth-child(6n+3) { --tc: #00a19c; } .look-race .tile:nth-child(6n+4) { --tc: #3671c6; }
.look-race .tile:nth-child(6n+5) { --tc: #ffd400; } .look-race .tile:nth-child(6n+6) { --tc: #9ca3af; }
.look-race .btn.primary { border-radius: 4px 14px 4px 14px; font-style: italic; text-transform: uppercase; letter-spacing: .02em; }

/* Demon hunters (K-pop style): neon pink, purple and blue, like a concert stage at night */
body.look-hunters { --accent: #c026d3; background:
  radial-gradient(1100px 560px at 0% -10%, color-mix(in srgb, #ff2bd6 13%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 0%, color-mix(in srgb, #22d3ee 11%, transparent), transparent 60%), var(--bg); }
.look-hunters .top { background: linear-gradient(90deg, #1a0533, #2b0a4f 50%, #12052b);
  box-shadow: 0 2px 0 #ff2bd6, 0 6px 20px rgba(255, 43, 214, .45); }
.look-hunters .page h1, .look-hunters .brand span { background: linear-gradient(90deg, #ff2bd6, #a855f7 50%, #22d3ee);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.look-hunters .brand span { background-image: linear-gradient(90deg, #ff8be8, #d8b4fe 50%, #a5f3fc); }
.look-hunters .hero { position: relative; overflow: hidden; border-radius: 22px;
  background: radial-gradient(circle at 15% 25%, rgba(255,255,255,.9) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 18%, rgba(255,255,255,.8) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 60%, rgba(255,255,255,.7) 0 1px, transparent 2px),
    radial-gradient(circle at 35% 75%, rgba(255,255,255,.6) 0 1px, transparent 2px),
    radial-gradient(500px 220px at 50% 120%, rgba(255, 43, 214, .7), transparent 70%),
    linear-gradient(160deg, #12052b, #3b0764 55%, #86198f);
  box-shadow: 0 0 0 1px rgba(255, 43, 214, .5), 0 10px 30px rgba(168, 85, 247, .35); }
.look-hunters .hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .22) 50%, transparent 60%);
  transform: translateX(-100%); animation: stage-sweep 5s ease-in-out infinite; }
@keyframes stage-sweep { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.look-hunters .hero > * { position: relative; z-index: 1; }
.look-hunters .hero h1 { background: none; color: #fff; -webkit-text-fill-color: #fff;
  text-shadow: 0 0 8px #ff2bd6, 0 0 22px #a855f7, 0 2px 4px rgba(0, 0, 0, .4); }
.look-hunters .tile { border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--tc) 28%, transparent); }
.look-hunters .tile-icon { box-shadow: 0 0 14px color-mix(in srgb, var(--tc) 60%, transparent); }
.look-hunters .tile:nth-child(6n+1) { --tc: #ff2bd6; } .look-hunters .tile:nth-child(6n+2) { --tc: #a855f7; }
.look-hunters .tile:nth-child(6n+3) { --tc: #22d3ee; } .look-hunters .tile:nth-child(6n+4) { --tc: #f472b6; }
.look-hunters .tile:nth-child(6n+5) { --tc: #818cf8; } .look-hunters .tile:nth-child(6n+6) { --tc: #facc15; }
.look-hunters .btn.primary { background: linear-gradient(90deg, #db2777, #9333ea); border-color: transparent;
  box-shadow: 0 0 14px rgba(219, 39, 119, .45); }

/* Twilight: a misty pine forest at dusk, a pale moon, a deep red apple */
body.look-twilight { --accent: #8b1e2d;
  background: linear-gradient(180deg, color-mix(in srgb, #4a6b5d 16%, var(--bg)), var(--bg) 360px) no-repeat, var(--bg); }
.look-twilight .top { background: linear-gradient(180deg, #16211e, #24342f); border-bottom: 1px solid #3c5148; }
.look-twilight h1, .look-twilight h2, .look-twilight .tile-name, .look-twilight .brand span {
  font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .02em; }
.look-twilight .hero { position: relative; overflow: hidden; border-radius: 16px; padding-bottom: 64px;
  background: radial-gradient(circle at 84% 24%, #f1f5f9 0 16px, rgba(241, 245, 249, .25) 17px, transparent 34px),
    linear-gradient(180deg, #0f1a17 0%, #23382f 45%, #5d7b6e 80%, #93ab9f 100%); }
.look-twilight .hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 78px; pointer-events: none;
  background: conic-gradient(from 155deg at 50% 0, #0b1411 50deg, transparent 0) 0 100% / 34px 78px repeat-x,
    conic-gradient(from 155deg at 50% 0, #1b2b25 50deg, transparent 0) 17px 100% / 26px 56px repeat-x; }
.look-twilight .hero::before { content: ""; position: absolute; left: -20%; right: -20%; bottom: 10px; height: 60px; pointer-events: none; z-index: 1;
  background: radial-gradient(closest-side, rgba(226, 232, 240, .45), transparent) 0 0 / 50% 100% repeat-x;
  animation: mist 18s ease-in-out infinite alternate; }
@keyframes mist { to { transform: translateX(12%); } }
.look-twilight .hero > * { position: relative; z-index: 2; }
.look-twilight .tile { border-radius: 12px; border-top: 3px solid var(--tc); }
.look-twilight .tile:nth-child(6n+1) { --tc: #8b1e2d; } .look-twilight .tile:nth-child(6n+2) { --tc: #4a6b5d; }
.look-twilight .tile:nth-child(6n+3) { --tc: #6b7f8c; } .look-twilight .tile:nth-child(6n+4) { --tc: #6b4a7b; }
.look-twilight .tile:nth-child(6n+5) { --tc: #a3803d; } .look-twilight .tile:nth-child(6n+6) { --tc: #2f5d62; }

/* Reading comfort: soft pink paper (never stark white), dark plum-grey letters (never pure black), clear letters, calm */
body.look-reading { --accent: #9d174d; --bg: #fbeef3; --panel: #fff6f9; --ink: #2a2230; --muted: #6b5864; --line: #ecd2dd;
  --head: #5b2140; --today: #fde4ec; }
:root[data-theme="dark"] body.look-reading { --bg: #22181e; --panel: #2e2229; --ink: #f4e7ed; --muted: #c9adba; --line: #4b3541;
  --head: #3a1529; --today: #4a2233; --accent: #f472b6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.look-reading { --bg: #22181e; --panel: #2e2229; --ink: #f4e7ed; --muted: #c9adba;
    --line: #4b3541; --head: #3a1529; --today: #4a2233; --accent: #f472b6; }
}
.look-reading .hero { background: linear-gradient(135deg, #9d174d, #be185d); }
.look-reading .tile { border-radius: 16px; border-color: var(--line); box-shadow: none; }
.look-reading .tile-icon { animation: none; }
.look-reading .tile:nth-child(n) { --tc: #be185d; }

.sw-race { background: linear-gradient(110deg, #15151e 0 50%, #e10600 50% 68%, #fff 68% 72%, #15151e 72%); }
.sw-hunters { background: radial-gradient(circle at 30% 30%, #ff2bd6, transparent 55%), radial-gradient(circle at 75% 72%, #22d3ee, transparent 50%), #2b0a4f; }
.sw-twilight { background: conic-gradient(from 155deg at 50% 0, #0b1411 50deg, transparent 0) 0 100% / 14px 26px repeat-x,
  radial-gradient(circle at 74% 26%, #f1f5f9 0 5px, transparent 6px), linear-gradient(180deg, #16211e, #4a6b5d 70%, #93ab9f); }
.sw-reading { background: linear-gradient(135deg, #fbeef3 0 58%, #d6407a 58%); }
@media (prefers-reduced-motion: reduce) { .look-hunters .hero::after, .look-twilight .hero::before { animation: none; } }
.easy textarea, .look-reading textarea { letter-spacing: normal; word-spacing: normal; }
.easy textarea::placeholder, .look-reading textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Night race: a floodlit circuit at midnight, red-and-white kerbs, five red start lights that come on one by one */
body.look-night-race { --accent: #0e7490; background:
  radial-gradient(700px 320px at 0% 0%, color-mix(in srgb, #fde68a 10%, transparent), transparent 70%),
  radial-gradient(700px 320px at 100% 0%, color-mix(in srgb, #a5f3fc 10%, transparent), transparent 70%), var(--bg); }
:root[data-theme="dark"] body.look-night-race { --accent: #22d3ee; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.look-night-race { --accent: #22d3ee; } }
.look-night-race .top { background: linear-gradient(180deg, #05070f, #0b1226); }
.look-night-race .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; pointer-events: none;
  background: repeating-linear-gradient(90deg, #e10600 0 16px, #fff 16px 32px); }
.look-night-race h1, .look-night-race h2, .look-night-race .tile-name, .look-night-race .brand span {
  font-family: "Arial Black", "Segoe UI Black", "Helvetica Neue", var(--font); font-weight: 900; font-style: italic;
  text-transform: uppercase; letter-spacing: .01em; }
.look-night-race .hero { position: relative; overflow: hidden; border-radius: 6px 26px 6px 26px; padding-top: 58px; padding-bottom: 40px;
  background:
    linear-gradient(90deg, #e10600 0 50%, #fff 50% 100%) 0 100% / 32px 14px repeat-x,       /* the kerb */
    radial-gradient(240px 170px at 0% 0%, rgba(254, 240, 138, .32), transparent 70%) no-repeat,  /* floodlights */
    radial-gradient(240px 170px at 100% 0%, rgba(165, 243, 252, .32), transparent 70%) no-repeat,
    radial-gradient(circle at 22% 30%, rgba(255,255,255,.8) 0 1px, transparent 2px) no-repeat,
    radial-gradient(circle at 78% 22%, rgba(255,255,255,.7) 0 1px, transparent 2px) no-repeat,
    linear-gradient(180deg, #050816 0%, #0f1b3d 75%, #1f2937 100%); }
.look-night-race .hero::before, .look-night-race .hero::after { content: ""; position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%); height: 28px; border-radius: 8px; pointer-events: none; }
.look-night-race .hero::before { width: 150px; background: radial-gradient(circle, #3b0a0a 0 8px, transparent 9px) 0 0 / 30px 28px repeat-x, #0b0b0f;
  box-shadow: 0 0 0 2px #1f2937; }
.look-night-race .hero::after { left: calc(50% - 75px); transform: none; width: 150px; overflow: hidden;
  background: radial-gradient(circle, #ff2a1a 0 8px, transparent 9px) 0 0 / 30px 28px repeat-x;
  filter: drop-shadow(0 0 6px #ff2a1a); animation: start-lights 6s steps(1) infinite; }
@keyframes start-lights { 0% { width: 0; } 10% { width: 30px; } 20% { width: 60px; } 30% { width: 90px; } 40% { width: 120px; }
  50%, 70% { width: 150px; } 71%, 100% { width: 0; } }
.look-night-race .hero > * { position: relative; z-index: 1; }
.look-night-race .tile { border-radius: 6px 18px 6px 18px; border-left: 6px solid var(--tc);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tc) 22%, transparent); }
.look-night-race .tile:nth-child(6n+1) { --tc: #22d3ee; } .look-night-race .tile:nth-child(6n+2) { --tc: #facc15; }
.look-night-race .tile:nth-child(6n+3) { --tc: #e10600; } .look-night-race .tile:nth-child(6n+4) { --tc: #a3e635; }
.look-night-race .tile:nth-child(6n+5) { --tc: #f97316; } .look-night-race .tile:nth-child(6n+6) { --tc: #e5e7eb; }
.look-night-race .btn.primary { background: linear-gradient(180deg, #fde047, #eab308); color: #111827; border-color: #ca8a04;
  border-radius: 4px 14px 4px 14px; font-style: italic; text-transform: uppercase; letter-spacing: .02em; }

/* Candyfloss: pastel pink, lilac and baby blue, fluffy clouds and sprinkles */
body.look-candyfloss { --accent: #db2777; background:
  radial-gradient(circle at 12px 10px, color-mix(in srgb, #f472b6 22%, transparent) 0 2px, transparent 3px) 0 0 / 46px 46px,
  radial-gradient(circle at 34px 30px, color-mix(in srgb, #60a5fa 22%, transparent) 0 2px, transparent 3px) 0 0 / 46px 46px,
  radial-gradient(circle at 30px 8px, color-mix(in srgb, #a78bfa 22%, transparent) 0 2px, transparent 3px) 0 0 / 46px 46px,
  color-mix(in srgb, #ff8fc8 10%, var(--bg)); }
:root[data-theme="dark"] body.look-candyfloss { --accent: #f9a8d4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.look-candyfloss { --accent: #f9a8d4; } }
.look-candyfloss .top { background: linear-gradient(90deg, #db2777, #a855f7 55%, #3b82f6); }
.look-candyfloss .hero { position: relative; overflow: hidden; border-radius: 30px;
  background: radial-gradient(90px 60px at 12% 88%, rgba(255,255,255,.55), transparent 70%),
    radial-gradient(120px 70px at 30% 100%, rgba(255,255,255,.5), transparent 70%),
    radial-gradient(110px 70px at 82% 95%, rgba(255,255,255,.5), transparent 70%),
    radial-gradient(90px 50px at 96% 10%, rgba(255,255,255,.4), transparent 70%),
    linear-gradient(135deg, #ec4899, #c084fc 55%, #60a5fa); box-shadow: 0 10px 26px rgba(236, 72, 153, .3); }
.look-candyfloss .hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;   /* a few sprinkles */
  background: radial-gradient(circle at 8% 18%, #fde047 0 2.5px, transparent 3.5px), radial-gradient(circle at 22% 70%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 92% 30%, #86efac 0 2.5px, transparent 3.5px), radial-gradient(circle at 80% 78%, #fde047 0 2px, transparent 3px),
    radial-gradient(circle at 5% 55%, #a5f3fc 0 2px, transparent 3px), radial-gradient(circle at 95% 60%, #fff 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 15% 92%, #86efac 0 2px, transparent 3px), radial-gradient(circle at 88% 10%, #fff 0 2px, transparent 3px); }
.look-candyfloss .hero > * { position: relative; z-index: 1; }
.look-candyfloss .tile { border-radius: 26px; border: 2px solid color-mix(in srgb, var(--tc) 35%, transparent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tc) 20%, transparent); }
.look-candyfloss .tile-icon { border-radius: 50%; }
.look-candyfloss .tile:nth-child(6n+1) { --tc: #f472b6; } .look-candyfloss .tile:nth-child(6n+2) { --tc: #a78bfa; }
.look-candyfloss .tile:nth-child(6n+3) { --tc: #60a5fa; } .look-candyfloss .tile:nth-child(6n+4) { --tc: #34d399; }
.look-candyfloss .tile:nth-child(6n+5) { --tc: #fb923c; } .look-candyfloss .tile:nth-child(6n+6) { --tc: #facc15; }
.look-candyfloss .btn.primary { background: linear-gradient(90deg, #ec4899, #a855f7); border-color: transparent; border-radius: 999px; }

/* Flamingo sunset: hot pink and coral skies, a low golden sun, palm trees and the sea */
body.look-flamingo { --accent: #be185d;
  background: linear-gradient(180deg, color-mix(in srgb, #fb7185 14%, var(--bg)), var(--bg) 380px) no-repeat, var(--bg); }
:root[data-theme="dark"] body.look-flamingo { --accent: #fb7185; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.look-flamingo { --accent: #fb7185; } }
.look-flamingo .top { background: linear-gradient(90deg, #831843, #be185d 45%, #f43f5e 75%, #fb923c); }
.look-flamingo .hero { position: relative; overflow: hidden; border-radius: 24px; padding-bottom: 46px;
  background: radial-gradient(circle at 50% 100%, #fde68a 0 34px, rgba(253, 230, 138, .45) 35px, transparent 80px),
    linear-gradient(180deg, #701a75 0%, #be185d 38%, #fb7185 66%, #fdba74 88%, #fde68a 100%); }
.look-flamingo .hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.35) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #0e7490, #155e75); }
.look-flamingo .hero::before { content: "\1F334"; position: absolute; left: 6px; bottom: 14px; font-size: calc(54px * var(--ts, 1)); line-height: 1;
  pointer-events: none; filter: brightness(.35) saturate(.6); transform: scaleX(-1); z-index: 1; }
.look-flamingo .hero > * { position: relative; z-index: 2; }
.look-flamingo .hero h1::after { content: " \1F9A9"; }
.look-flamingo .tile { border-radius: 18px; border-top: 4px solid var(--tc); }
.look-flamingo .tile:nth-child(6n+1) { --tc: #ec4899; } .look-flamingo .tile:nth-child(6n+2) { --tc: #fb7185; }
.look-flamingo .tile:nth-child(6n+3) { --tc: #14b8a6; } .look-flamingo .tile:nth-child(6n+4) { --tc: #f97316; }
.look-flamingo .tile:nth-child(6n+5) { --tc: #c026d3; } .look-flamingo .tile:nth-child(6n+6) { --tc: #06b6d4; }
.look-flamingo .btn.primary { background: linear-gradient(90deg, #db2777, #f97316); border-color: transparent; }

/* Rose gold: blush pink and rose gold with a soft shimmer and sparkles, elegant letters */
body.look-rose-gold { --accent: #a2475a; background:
  radial-gradient(900px 420px at 50% -10%, color-mix(in srgb, #e8a6a1 18%, transparent), transparent 70%),
  color-mix(in srgb, #f5d0c5 10%, var(--bg)); }
:root[data-theme="dark"] body.look-rose-gold { --accent: #f0b4b0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.look-rose-gold { --accent: #f0b4b0; } }
.look-rose-gold .top { background: linear-gradient(90deg, #2e1a20, #4a2630 50%, #2e1a20); }
.look-rose-gold .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, #b76e79, #f7cac9 30%, #c98a8f 55%, #f7cac9 80%, #b76e79); }
.look-rose-gold h1, .look-rose-gold h2, .look-rose-gold .tile-name, .look-rose-gold .brand span {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-weight: 700; letter-spacing: .02em; }
.look-rose-gold .hero { position: relative; overflow: hidden; border-radius: 22px;
  background: radial-gradient(circle at 14% 28%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 80% 20%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 66% 72%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 30% 80%, #fff 0 1px, transparent 2px),
    linear-gradient(135deg, #7d3c4a, #b76e79 40%, #d99a9c 60%, #9c5560);
  box-shadow: 0 10px 28px rgba(183, 110, 121, .35); }
.look-rose-gold .hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 240, 235, .35) 50%, transparent 60%);
  transform: translateX(-100%); animation: stage-sweep 6s ease-in-out infinite; }
.look-rose-gold .hero > * { position: relative; z-index: 1; }
.look-rose-gold .tile { border-radius: 16px; border: 1px solid color-mix(in srgb, #b76e79 40%, var(--line)); }
.look-rose-gold .tile:nth-child(6n+1) { --tc: #b76e79; } .look-rose-gold .tile:nth-child(6n+2) { --tc: #d4949b; }
.look-rose-gold .tile:nth-child(6n+3) { --tc: #a05a6a; } .look-rose-gold .tile:nth-child(6n+4) { --tc: #c08497; }
.look-rose-gold .tile:nth-child(6n+5) { --tc: #d8a48f; } .look-rose-gold .tile:nth-child(6n+6) { --tc: #9b6b72; }
.look-rose-gold .btn.primary { background: linear-gradient(135deg, #a2475a, #c98a8f); border-color: transparent; }

/* Christmas cheer: holly red and pine green, gold stars, twinkly fairy lights and candy-cane buttons */
body.look-christmas { --accent: #b91c1c; background:
  radial-gradient(circle at 10px 12px, color-mix(in srgb, #eab308 30%, transparent) 0 1.5px, transparent 2.5px) 0 0 / 52px 52px,
  radial-gradient(circle at 36px 38px, color-mix(in srgb, #eab308 22%, transparent) 0 1px, transparent 2px) 0 0 / 52px 52px,
  color-mix(in srgb, #15803d 7%, var(--bg)); }
:root[data-theme="dark"] body.look-christmas { --accent: #f87171; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.look-christmas { --accent: #f87171; } }
.look-christmas .top { background: linear-gradient(90deg, #0f3d22, #166534 50%, #0f3d22); }
.look-christmas .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 10px; pointer-events: none;  /* fairy lights */
  background: radial-gradient(circle at 8px 6px, #f87171 0 3px, transparent 4px) 0 0 / 64px 10px repeat-x,
    radial-gradient(circle at 24px 6px, #fde047 0 3px, transparent 4px) 0 0 / 64px 10px repeat-x,
    radial-gradient(circle at 40px 6px, #4ade80 0 3px, transparent 4px) 0 0 / 64px 10px repeat-x,
    radial-gradient(circle at 56px 6px, #60a5fa 0 3px, transparent 4px) 0 0 / 64px 10px repeat-x,
    linear-gradient(#0f3d22, #0f3d22) 0 1px / 100% 1.5px no-repeat;
  animation: twinkle 1.4s ease-in-out infinite alternate; }
.look-christmas .hero { position: relative; overflow: hidden; border-radius: 22px; padding-bottom: 40px;
  background: radial-gradient(260px 160px at 85% 110%, rgba(253, 224, 71, .35), transparent 70%),
    linear-gradient(135deg, #7f1d1d, #b91c1c 45%, #166534);
  box-shadow: 0 10px 26px rgba(127, 29, 29, .3); }
.look-christmas .hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;  /* gold stars */
  background: radial-gradient(circle at 8% 20%, #fde68a 0 1.5px, transparent 2.5px), radial-gradient(circle at 30% 12%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 55% 26%, #fde68a 0 1px, transparent 2px), radial-gradient(circle at 70% 10%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 18% 80%, #fde68a 0 1px, transparent 2px), radial-gradient(circle at 46% 88%, #fff 0 1px, transparent 2px);
  animation: twinkle 2.2s ease-in-out infinite alternate; }
.look-christmas .hero::after { content: "\1F384"; position: absolute; right: 10px; bottom: 6px; font-size: calc(56px * var(--ts, 1)); line-height: 1;
  pointer-events: none; filter: drop-shadow(0 0 10px rgba(253, 224, 71, .6)); }
.look-christmas .hero > * { position: relative; z-index: 1; }
.look-christmas .tile { border-radius: 18px; border-top: 4px solid var(--tc); }
.look-christmas .tile:nth-child(6n+1) { --tc: #dc2626; } .look-christmas .tile:nth-child(6n+2) { --tc: #16a34a; }
.look-christmas .tile:nth-child(6n+3) { --tc: #ca8a04; } .look-christmas .tile:nth-child(6n+4) { --tc: #b91c1c; }
.look-christmas .tile:nth-child(6n+5) { --tc: #15803d; } .look-christmas .tile:nth-child(6n+6) { --tc: #d97706; }
.look-christmas .btn.primary { background: repeating-linear-gradient(135deg, #b91c1c 0 12px, #991b1b 12px 24px); border-color: transparent;
  color: #fff; border-radius: 999px; }

/* Frosty morning: a crisp clear dawn, icy blues and silver, frost creeping in from the edges (frost, not snow) */
body.look-frost { --accent: #0e6ba8; background:
  radial-gradient(1000px 480px at 50% -12%, color-mix(in srgb, #bae6fd 34%, transparent), transparent 70%),
  color-mix(in srgb, #e0f2fe 22%, var(--bg)); }
:root[data-theme="dark"] body.look-frost { --accent: #7dd3fc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.look-frost { --accent: #7dd3fc; } }
.look-frost .top { background: linear-gradient(90deg, #0c2a43, #1e4e74 50%, #0c2a43); }
.look-frost .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, #94a3b8, #f0f9ff 30%, #bfdbfe 55%, #f0f9ff 80%, #94a3b8); }
.look-frost .hero { position: relative; overflow: hidden; border-radius: 20px; padding-bottom: 40px;
  background: radial-gradient(220px 90px at 50% 104%, rgba(255, 237, 213, .95), transparent 75%),   /* the low winter sun */
    linear-gradient(180deg, #1e3a5f 0%, #33608a 38%, #8fb8da 70%, #f3d4c2 92%, #fde7d3);
  box-shadow: 0 10px 26px rgba(30, 58, 95, .28), inset 0 0 0 1px rgba(255, 255, 255, .25); }
.look-frost .hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;   /* frost feathers in the corners */
  background: radial-gradient(circle at 0 0, rgba(240, 249, 255, .55), transparent 70px),   /* an icy haze, with fine feathers through it */
    radial-gradient(circle at 100% 100%, rgba(240, 249, 255, .45), transparent 60px),
    repeating-linear-gradient(52deg, rgba(255, 255, 255, .2) 0 .6px, transparent .6px 4px),
    repeating-linear-gradient(-41deg, rgba(255, 255, 255, .14) 0 .6px, transparent .6px 7px),
    repeating-linear-gradient(17deg, rgba(255, 255, 255, .12) 0 .5px, transparent .5px 9px),
    repeating-linear-gradient(-76deg, rgba(255, 255, 255, .1) 0 .5px, transparent .5px 13px);
  -webkit-mask-image: radial-gradient(circle at 0 0, #000 0 10px, transparent 100px), radial-gradient(circle at 100% 0, #000 0 4px, transparent 70px),
    radial-gradient(circle at 100% 100%, #000 0 8px, transparent 90px), radial-gradient(circle at 0 100%, #000 0 2px, transparent 60px);
  mask-image: radial-gradient(circle at 0 0, #000 0 10px, transparent 100px), radial-gradient(circle at 100% 0, #000 0 4px, transparent 70px),
    radial-gradient(circle at 100% 100%, #000 0 8px, transparent 90px), radial-gradient(circle at 0 100%, #000 0 2px, transparent 60px); }
.look-frost .hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;   /* glints of sunlight on the frost */
  background: radial-gradient(circle at 12% 16%, #fff 0 1.2px, transparent 2.5px), radial-gradient(circle at 90% 12%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 84% 86%, #fff 0 1.4px, transparent 2.6px), radial-gradient(circle at 6% 70%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 96% 58%, #fff 0 1.2px, transparent 2.4px);
  animation: twinkle 2.6s ease-in-out infinite alternate; }
.look-frost .hero > * { position: relative; z-index: 1; }
.look-frost .tile { border-radius: 18px; background: color-mix(in srgb, #bae6fd 12%, var(--panel));
  border: 1px solid color-mix(in srgb, #7dd3fc 45%, var(--line));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 6px 16px color-mix(in srgb, #0ea5e9 12%, transparent); }
.look-frost .tile-sub { color: color-mix(in srgb, var(--muted) 78%, var(--ink)); }
.look-frost .tile:nth-child(6n+1) { --tc: #0ea5e9; } .look-frost .tile:nth-child(6n+2) { --tc: #6366f1; }
.look-frost .tile:nth-child(6n+3) { --tc: #14b8a6; } .look-frost .tile:nth-child(6n+4) { --tc: #64748b; }
.look-frost .tile:nth-child(6n+5) { --tc: #38bdf8; } .look-frost .tile:nth-child(6n+6) { --tc: #f472b6; }
.look-frost .btn.primary { background: linear-gradient(135deg, #0e6ba8, #2f7fbf); border-color: transparent; color: #fff; }

.sw-night-race { background: radial-gradient(circle, #ff2a1a 0 3px, transparent 4px) 4px 6px / 10px 12px repeat-x,
  linear-gradient(90deg, #e10600 0 50%, #fff 50%) 0 100% / 12px 30% repeat-x, linear-gradient(180deg, #050816, #0f1b3d); }
.sw-candyfloss { background: radial-gradient(circle at 30% 35%, #fff 0 3px, transparent 4px), radial-gradient(circle at 70% 65%, #fde047 0 2px, transparent 3px),
  linear-gradient(135deg, #f9a8d4, #c4b5fd 55%, #93c5fd); }
.sw-flamingo { background: radial-gradient(circle at 50% 78%, #fde68a 0 7px, transparent 8px),
  linear-gradient(180deg, #701a75, #db2777 45%, #fb923c 75%, #0e7490 78%); }
.sw-rose-gold { background: radial-gradient(circle at 28% 30%, #fff 0 1.5px, transparent 2.5px), linear-gradient(135deg, #7d3c4a, #b76e79 40%, #f7cac9 62%, #9c5560); }
.sw-christmas { background: radial-gradient(circle, #fde047 0 2.5px, transparent 3.5px) 3px 4px / 12px 10px repeat-x,
  linear-gradient(135deg, #7f1d1d, #b91c1c 45%, #166534); }
.sw-frost { background: repeating-linear-gradient(60deg, rgba(255, 255, 255, .35) 0 1px, transparent 1px 6px),
  linear-gradient(180deg, #1e3a5f, #33608a 40%, #8fb8da 72%, #fde7d3); }
@media (prefers-reduced-motion: reduce) { .look-night-race .hero::after, .look-rose-gold .hero::after,
  .look-christmas .top::after, .look-christmas .hero::before, .look-frost .hero::after { animation: none; } }

/* ---- Games ---- */
/* the Games page's three groups: big buttons that open each one */
.group-pick { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
@media (min-width: 760px) { .group-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.group-card { display: flex; align-items: center; gap: 14px; padding: 18px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); color: inherit; text-decoration: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.group-card:hover, .group-card:focus-visible { border-color: var(--accent); }
.group-icon { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; font-size: 32px; }
.gg-solo .group-icon { background: color-mix(in srgb, #22c55e 18%, var(--panel)); }
.gg-multi .group-icon { background: color-mix(in srgb, #3b82f6 18%, var(--panel)); }
.gg-advanced .group-icon { background: color-mix(in srgb, #f97316 20%, var(--panel)); }
.group-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.group-text b { font-size: calc(19px * var(--ts, 1)); }
.group-text small { color: var(--muted); }
.group-text .group-count { font-weight: 700; }
.group-go { flex: none; font-size: 30px; color: var(--muted); line-height: 1; }
.game-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
.game-card { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; text-decoration: none; }
.game-card:hover, .game-card:focus-visible { border-color: var(--accent); }
.game-icon { width: 58px; height: 58px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: calc(32px * var(--ts, 1));
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.gc-snake .game-icon { background: color-mix(in srgb, #16a34a 18%, var(--panel)); }
.gc-blocks .game-icon { background: color-mix(in srgb, #f97316 18%, var(--panel)); }
.gc-solitaire .game-icon { background: color-mix(in srgb, #dc2626 16%, var(--panel)); }
.game-text { flex: 1; min-width: 0; }
.game-text b { display: block; font-size: calc(18px * var(--ts, 1)); }
.game-text .new-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: calc(12px * var(--ts, 1)); font-weight: 800; vertical-align: middle; }
.game-text small { display: block; color: var(--muted); }
.game-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.game-head h1 { margin: 0; }
.game-stats { flex: 1; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 9em; }
.game-wrap { position: relative; margin: 12px 0; }
.game-stage { display: flex; justify-content: center; gap: 10px; align-items: flex-start; }
.game-stage canvas[data-canvas] { display: block; border-radius: 14px; border: 2px solid var(--line); touch-action: none;
  user-select: none; -webkit-user-select: none; max-width: 100%; }
.next-box { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; }
.next-box canvas { width: 80px; height: 80px; }
.pad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-areas: ". up ." "left pause right" ". down ."; gap: 6px;
  justify-content: center; margin: 12px 0 4px; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad button { height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font-size: calc(22px * var(--ts, 1)); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pad button:active { background: color-mix(in srgb, var(--accent) 20%, var(--panel)); }
.pad [data-key=up] { grid-area: up; } .pad [data-key=left] { grid-area: left; } .pad [data-key=right] { grid-area: right; }
.pad [data-key=down] { grid-area: down; } .pad [data-key=pause] { grid-area: pause; font-size: calc(15px * var(--ts, 1)); }
.pad.pad-row { grid-template-columns: repeat(5, minmax(0, 64px)); grid-template-areas: none; }
.pad.pad-row button { grid-area: auto; }
.game-over { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(2px); border-radius: 14px; z-index: 5; }
.game-over .card { text-align: center; max-width: 320px; box-shadow: 0 10px 30px rgba(15, 23, 42, .2); }
.game-over h2 { margin-top: 0; }
.leaderboard ol { margin: 8px 0 0; padding-left: 1.6em; }
.leaderboard li { padding: 4px 0; }
.leaderboard li b { float: right; font-variant-numeric: tabular-nums; }
.leaderboard li.me { font-weight: 700; }
.leaderboard .empty-row { list-style: none; color: var(--muted); margin-left: -1.6em; }
/* Solitaire: the cards are drawn here; --cw is a card's width */
.sol-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sol-draw { display: inline-flex; align-items: center; gap: 6px; font-size: calc(14px * var(--ts, 1)); }
.sol { user-select: none; -webkit-user-select: none; background: color-mix(in srgb, #15803d 82%, #052e16); border-radius: 14px;
  padding: var(--gap, 6px); min-height: 360px; }
.sol-top, .sol-tab { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--gap, 6px); }
.sol-tab { margin-top: calc(var(--gap, 6px) * 2); }
.sol .pile, .sol .col { position: relative; height: calc(var(--cw) * 1.4); }
.pc { position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * .1);
  cursor: pointer; transition: top .12s; -webkit-tap-highlight-color: transparent; }
.pc.up { background: #fff; color: #111827; border: 1px solid #cbd5e1; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.pc.red { color: #dc2626; }
.pc.down { border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  background: repeating-linear-gradient(45deg, var(--accent) 0 4px, color-mix(in srgb, var(--accent) 70%, #fff) 4px 8px); }
.pc.slot { border: 2px dashed rgba(255, 255, 255, .45); display: grid; place-items: center; color: rgba(255, 255, 255, .6);
  font-size: calc(var(--cw) * .45); cursor: default; }
.pc.slot[data-where=stock] { cursor: pointer; }
.pc-corner { position: absolute; left: 6%; top: 3%; font-weight: 800; font-size: calc(var(--cw) * .3); line-height: 1; letter-spacing: -.04em;
  font-family: system-ui, sans-serif; white-space: nowrap; }
.pc-mid { position: absolute; inset: 30% 0 0; display: grid; place-items: center; font-size: calc(var(--cw) * .55); line-height: 1; }
.pc.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* Snake: the score glows once you're past your best */
.game-stats.hot { color: #d97706; }

/* Tap a profile picture to see it big */
img.avatar { cursor: zoom-in; }
.who-btn img.avatar, .me-chip img.avatar, .four-pick img.avatar, .start-btn img.avatar, .splash img.avatar { cursor: inherit; }
.pic-viewer { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px;
  background: rgba(15, 23, 42, .82); backdrop-filter: blur(4px); animation: pv-in .18s ease-out; cursor: zoom-out; }
.pic-viewer figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pic-viewer img { width: min(82vw, 70vh, 520px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  border: 5px solid var(--c, #fff); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); background: #fff; animation: pv-pop .25s ease-out; }
.pic-viewer figcaption { color: #fff; font-size: calc(22px * var(--ts, 1)); font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.pic-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .18); color: #fff; font-size: calc(20px * var(--ts, 1)); cursor: pointer; }
@keyframes pv-in { from { opacity: 0; } }
@keyframes pv-pop { from { transform: scale(.6); opacity: 0; } }
.calm .pic-viewer, .calm .pic-viewer img { animation: none; }

/* Games list: Four in a Row wants you */
.your-turn { color: #dc2626 !important; font-weight: 700; }
.gc-words .game-icon { background: color-mix(in srgb, #22c55e 18%, var(--panel)); }
.gc-four .game-icon { background: color-mix(in srgb, #eab308 20%, var(--panel)); }
.gc-bricks .game-icon { background: color-mix(in srgb, #3b82f6 18%, var(--panel)); }
.gc-hopper .game-icon { background: color-mix(in srgb, #38bdf8 20%, var(--panel)); }

/* Word of the Day */
.wd { display: flex; flex-direction: column; align-items: center; margin: 4px 0 18px; }
.wd-grid { display: grid; gap: 5px; margin: 2px 0; }
.wd-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.wd-tile { width: min(14vw, 56px, 6.4svh); height: min(14vw, 56px, 6.4svh); display: grid; place-items: center; border: 2px solid var(--line);
  border-radius: 8px; font-size: min(7.5vw, 28px, 3.4svh); font-weight: 800; text-transform: uppercase; background: var(--panel); color: var(--ink); }
.wd-tile.typed { border-color: var(--muted); animation: wd-pop .1s ease-out; }
.wd-tile.m-g, .wd-key.m-g, .wd-mini .m-g { background: #16a34a; border-color: #16a34a; color: #fff; }
.wd-tile.m-y, .wd-key.m-y, .wd-mini .m-y { background: #eab308; border-color: #eab308; color: #fff; }
.wd-tile.m-x, .wd-key.m-x, .wd-mini .m-x { background: #94a3b8; border-color: #94a3b8; color: #fff; }
.wd-tile.flip { animation: wd-flip .5s ease-in-out backwards; }
.wd-row.shake { animation: wd-shake .4s; }
.wd-row.win .wd-tile { animation: wd-jump .5s ease-in-out; }
.wd-row.win .wd-tile:nth-child(2) { animation-delay: .08s; } .wd-row.win .wd-tile:nth-child(3) { animation-delay: .16s; }
.wd-row.win .wd-tile:nth-child(4) { animation-delay: .24s; } .wd-row.win .wd-tile:nth-child(5) { animation-delay: .32s; }
@keyframes wd-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); background: var(--panel); color: var(--ink); border-color: var(--line); } 100% { transform: rotateX(0); } }
@keyframes wd-pop { 50% { transform: scale(1.1); } }
@keyframes wd-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes wd-jump { 40% { transform: translateY(-14px); } }
.wd-msg { min-height: 1.4em; margin: 2px 0; font-weight: 700; text-align: center; }
.wd-done { text-align: center; margin: 4px 0 10px; max-width: 420px; }
.wd-done p:first-child { font-size: calc(18px * var(--ts, 1)); font-weight: 700; }
.wd-keys { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 500px; margin-top: 4px; touch-action: manipulation; }
.wd-keys[hidden] { display: none; }
.wd-krow { display: flex; gap: 5px; justify-content: center; }
.wd-key { flex: 1 1 0; min-width: 0; max-width: 44px; height: min(52px, 6svh); border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); font: inherit; font-weight: 700; text-transform: uppercase; font-size: calc(17px * var(--ts, 1)); cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent; }
.wd-key.wide { max-width: 68px; flex-grow: 1.6; font-size: calc(13px * var(--ts, 1)); }
.wd-key:active { transform: scale(.95); }
.wd-key-help { margin-top: 10px; text-align: center; }
.wd-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.wd-stats b { display: block; font-size: calc(26px * var(--ts, 1)); }
.wd-stats small { color: var(--muted); }
.wd-spread { margin-top: 14px; display: grid; gap: 4px; }
.wd-bar { display: grid; grid-template-columns: 1.2em 1fr; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.wd-bar i { font-style: normal; display: block; width: max(1.8em, var(--w)); background: var(--accent); color: #fff; text-align: right;
  padding: 1px 8px; border-radius: 6px; font-weight: 700; font-size: calc(14px * var(--ts, 1)); box-sizing: border-box; }
.wd-family { list-style: none; padding: 0; margin: 8px 0 0; }
.wd-family li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.wd-family li:last-child { border-bottom: 0; }
.wd-family li.me .wd-fname { font-weight: 800; }
.wd-fname { flex: 1; min-width: 0; }
.wd-fres { font-weight: 700; font-variant-numeric: tabular-nums; }
.wd-streak { margin-left: 6px; color: #ea580c; }
.wd-mini { display: flex; flex-direction: column; gap: 2px; flex-basis: 100%; padding-left: 20px; }
.wd-mini span { display: flex; gap: 2px; }
.wd-mini i { width: 10px; height: 10px; border-radius: 2px; display: block; }

/* Four in a Row */
.four-list { list-style: none; padding: 0; margin: 6px 0 0; }
.four-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; }
.four-list li:last-child a { border-bottom: 0; }
.four-list a.mine .four-state { color: #dc2626; font-weight: 800; }
.four-state { color: var(--muted); font-size: calc(15px * var(--ts, 1)); text-align: right; }
.four-new { display: flex; flex-wrap: wrap; gap: 8px; }
.four-pick { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.four-pick:hover { border-color: var(--c, var(--accent)); }
.four-pick .avatar { width: 34px; height: 34px; font-size: calc(16px * var(--ts, 1)); }
.avatar.bot { background: color-mix(in srgb, var(--muted) 25%, var(--panel)); font-size: calc(18px * var(--ts, 1)); }
.avatar.tiny.bot { font-size: calc(12px * var(--ts, 1)); }
.four-board { width: 100%; border-collapse: collapse; margin-top: 8px; }
.four-board th { text-align: right; color: var(--muted); font-weight: 600; font-size: calc(14px * var(--ts, 1)); }
.four-board td { padding: 6px 0; border-top: 1px solid var(--line); }
.four-board td + td { text-align: right; }
.four-board tr.me td:first-child { font-weight: 800; }
.four-vs { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 2px; font-weight: 700; flex-wrap: wrap; }
.four-side { display: inline-flex; align-items: center; gap: 6px; }
.disc { display: inline-block; width: 18px; height: 18px; border-radius: 50%; }
.disc.d-a, .hole.d-a { background: radial-gradient(circle at 35% 35%, #f87171, #dc2626 60%, #991b1b); }
.disc.d-b, .hole.d-b { background: radial-gradient(circle at 35% 35%, #fde047, #eab308 60%, #a16207); }
.four-msg { text-align: center; font-weight: 700; min-height: 1.5em; margin: 6px 0 10px; }
.four { display: flex; justify-content: center; }
.four-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px; border-radius: 16px;
  background: linear-gradient(#2563eb, #1d4ed8); box-shadow: 0 8px 20px rgba(29, 78, 216, .3); width: min(100%, 460px); touch-action: manipulation; }
.four-col { display: grid; gap: 4px; border: 0; padding: 2px; background: transparent; border-radius: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.four-grid.my-turn .four-col:hover, .four-grid.my-turn .four-col:focus-visible { background: rgba(255, 255, 255, .16); outline: none; }
.four-grid:not(.my-turn) .four-col { cursor: default; }
.hole { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--bg); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .25); }
.hole.drop { animation: four-drop calc(.12s + var(--fall) * .06s) cubic-bezier(.5, 0, 1, .6); }
.hole.last { outline: 3px solid rgba(255, 255, 255, .8); outline-offset: -3px; }
.hole.win { animation: four-glow .9s ease-in-out infinite alternate; outline: 3px solid #fff; outline-offset: -3px; }
@keyframes four-drop { from { transform: translateY(calc(var(--fall) * -112%)); } }
@keyframes four-glow { to { transform: scale(.86); } }
.calm .hole.win { animation: none; }
.four-after { display: flex; justify-content: center; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.four-after form[hidden] { display: none; }
.wd-intro { margin: 0 0 4px; }
.wd-sw { display: inline-block; width: .9em; height: .9em; border-radius: 3px; vertical-align: -1px; }
.wd-sw.m-g { background: #16a34a; } .wd-sw.m-y { background: #eab308; } .wd-sw.m-x { background: #94a3b8; }

/* seasonal decorations: a strip under the top bar (birthday bunting, Halloween, fireworks, Christmas lights) */
.deco { position: relative; z-index: 9; display: flex; justify-content: space-around; align-items: flex-start; height: 26px;
  overflow: hidden; pointer-events: none; margin-bottom: -10px; }
.deco-birthday { height: 22px; }
.deco-birthday i { flex: 1; max-width: 46px; height: 18px; background: hsl(var(--h) 85% 60%);
  clip-path: polygon(8% 0, 92% 0, 50% 100%); transform-origin: top center; animation: swing 3s ease-in-out infinite alternate; }
.deco-birthday::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: color-mix(in srgb, var(--ink) 30%, transparent); }
.deco-halloween i { font-style: normal; font-size: 18px; line-height: 26px; animation: bob 2.6s ease-in-out calc(var(--i) * -.3s) infinite alternate; }
.deco-halloween i:nth-child(3n+2) { animation-name: flap; }
.deco-fireworks { height: 32px; margin-bottom: -8px; display: block; }
.deco-fireworks i { position: absolute; top: 2px; left: calc(var(--x) * 1%); width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--h) 95% 65%) 0 2px, transparent 3px),
    repeating-conic-gradient(hsl(var(--h) 95% 62%) 0 6deg, transparent 6deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 0 5px, #000 6px 12px, transparent 14px);
  mask: radial-gradient(circle, transparent 0 5px, #000 6px 12px, transparent 14px);
  opacity: 0; animation: burst 3s ease-out var(--d) infinite; }
.deco-christmas { height: 18px; }
.deco-christmas::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 22px; border-radius: 0 0 50% 50%;
  border-bottom: 2px solid color-mix(in srgb, var(--ink) 35%, transparent); }
.deco-christmas i { width: 8px; height: 12px; margin-top: 6px; border-radius: 50% 50% 45% 45%; background: hsl(var(--h) 90% 55%);
  box-shadow: 0 0 8px hsl(var(--h) 90% 60%); animation: twinkle 1.8s ease-in-out calc(var(--i) * -.37s) infinite alternate; }
.deco-snow { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.deco-snow i { position: absolute; top: -10px; left: calc(var(--x) * 1%); width: var(--s); height: var(--s); border-radius: 50%;
  background: #fff; opacity: .75; box-shadow: 0 0 3px rgba(80, 110, 160, .5); animation: deco-fall var(--d) linear var(--w) infinite; }
@keyframes swing { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes bob { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes flap { from { transform: translateY(2px) scaleX(1); } to { transform: translateY(-4px) scaleX(.7); } }
@keyframes burst { 0% { opacity: 0; transform: scale(.2); } 15% { opacity: 1; } 60% { opacity: .9; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.3); } }
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }
@keyframes deco-fall { to { transform: translate(30px, 105vh); } }
@media (prefers-reduced-motion: reduce) { .deco i { animation: none; } .deco-fireworks i { opacity: .8; } .deco-snow { display: none; } }
.calm .deco-fireworks i { opacity: .8; }
.calm .deco-snow { display: none; }
@media print { .deco, .deco-snow { display: none; } }

/* readability: text on the accent colour stays clear in every look (checked automatically, light and dark) */
:root[data-theme="dark"] :is(body.look-classic, body.look-sky) { --accent-btn: #2563eb; }
:root[data-theme="dark"] body.look-reading { --accent-btn: #be185d; }
:root[data-theme="dark"] :is(body.look-candyfloss, body.look-flamingo, body.look-rose-gold, body.look-night-race, body.look-christmas, body.look-frost) { --on-accent: #1a0b14; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(body.look-classic, body.look-sky) { --accent-btn: #2563eb; }
  :root:not([data-theme="light"]) body.look-reading { --accent-btn: #be185d; }
  :root:not([data-theme="light"]) :is(body.look-candyfloss, body.look-flamingo, body.look-rose-gold, body.look-night-race, body.look-christmas, body.look-frost) { --on-accent: #1a0b14; }
}
/* "My colour" looks tint the page, so grey text needs to be a touch stronger */
body.mycolour { --muted: #4f5d70; }
:root[data-theme="dark"] body.mycolour { --muted: #a3b0c2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.mycolour { --muted: #a3b0c2; } }

/* letters to Santa: a parent's questions about a wish and the answers */
.wish-talk { flex: 1 1 100%; display: grid; gap: 6px; margin: 2px 0 0; }
.wish-note { margin: 0; padding: 7px 11px; border-radius: 12px; font-size: calc(14px * var(--ts, 1)); overflow-wrap: anywhere; justify-self: start; max-width: 92%;
  background: color-mix(in srgb, #16a34a 12%, var(--panel)); border: 1px solid color-mix(in srgb, #16a34a 30%, var(--line)); }
.wish-note.answer { justify-self: end; background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--c, var(--accent)) 30%, var(--line)); }
.wish-wait { margin: 0; font-size: calc(13px * var(--ts, 1)); font-weight: 600; color: color-mix(in srgb, #b45309 70%, var(--ink)); }
.wish-waiting { background: color-mix(in srgb, #f59e0b 8%, transparent); border-radius: 10px; padding-left: 6px !important; padding-right: 6px !important; }
.wish-ask { display: flex; gap: 8px; align-items: center; margin: 4px 0 0; }
.wish-ask input { flex: 1; min-width: 0; }
.wish-ask-open > summary { list-style: none; display: inline-flex; cursor: pointer; }
.wish-ask-open > summary::-webkit-details-marker { display: none; }
.xmas-links { display: flex; flex-wrap: wrap; gap: 8px; }
.xmas-btn .badge, .xmas-links .badge { position: static; margin-left: 4px; }
/* Home banner: "Write to Santa" and "View letters" side by side, even on small phones */
.xmas-actions .xmas-btn { flex: 1 1 0; min-width: 0; justify-content: center; text-align: center; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.xmas-actions .xmas-count { flex: 1 1 100%; }
@media (max-width: 380px) { .xmas-actions .xmas-btn { font-size: calc(14px * var(--ts, 1)); padding-left: 6px; padding-right: 6px; } }

/* two-player games (duels.js): side "a" goes first */
.duel { --pa: #e11d48; --pb: #2563eb; display: flex; justify-content: center; }
.duel-board { width: min(100%, 440px); transition: opacity .15s; }
.duel-board.waiting { opacity: .75; }
.duel-score { font-size: calc(15px * var(--ts, 1)); margin-left: 2px; min-width: 1ch; }
.duel-mark { display: inline-block; width: 16px; height: 16px; border-radius: 50%; }
.dm-noughts-a::before { content: "\2715"; color: var(--pa, #e11d48); font-style: normal; font-weight: 900; }
.dm-noughts-b::before { content: "\25EF"; color: var(--pb, #2563eb); font-style: normal; font-weight: 900; }
.dm-noughts-a, .dm-noughts-b { width: auto; height: auto; }
.dm-dots-a { background: #e11d48; } .dm-dots-b { background: #2563eb; }
.dm-reversi-a { background: #111827; box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .15), 0 0 0 2px #94a3b8; }
.dm-reversi-b { background: #f8fafc; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15), 0 0 0 1px #94a3b8; }
.dm-ships-a, .dm-ships-b { display: none; }
.duel-how { margin-top: 8px; } .duel-how summary { cursor: pointer; font-weight: 700; } .duel-how p { margin: 8px 0 0; }
.four-after [data-shuffle][hidden] { display: none; }

/* Noughts and Crosses */
.nc-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; width: min(100%, 330px); margin: 0 auto; aspect-ratio: 1; }
.nc-cell { border: 0; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); font-size: clamp(40px, 15vw, 64px);
  font-weight: 900; line-height: 1; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nc-cell:disabled { cursor: default; color: var(--ink); opacity: 1; }
.my-turn .nc-cell:not(:disabled):hover { box-shadow: inset 0 0 0 3px var(--accent); }
.nc-cell.p-a { color: var(--pa); } .nc-cell.p-b { color: var(--pb); }
.nc-cell.last { animation: duel-pop .25s ease-out; }
.nc-cell.win { background: color-mix(in srgb, #facc15 35%, var(--panel)); animation: four-glow .9s ease-in-out infinite alternate; }

/* Dots and Boxes */
.db-grid { display: grid; grid-template-columns: repeat(var(--n), 12px 1fr) 12px; grid-template-rows: repeat(var(--n), 12px 1fr) 12px;
  width: min(100%, 380px); aspect-ratio: 1; margin: 0 auto; padding: 10px; border-radius: 16px; background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line); }
.db-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); z-index: 1; }
.db-box { display: grid; place-items: center; font-size: calc(20px * var(--ts, 1)); color: #fff; border-radius: 4px; margin: 2px; }
.db-box.p-a { background: color-mix(in srgb, var(--pa) 75%, transparent); } .db-box.p-b { background: color-mix(in srgb, var(--pb) 75%, transparent); }
.db-edge { position: relative; border: 0; padding: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.db-edge::before { content: ""; position: absolute; border-radius: 4px; background: color-mix(in srgb, var(--muted) 25%, transparent); }
.db-edge.h { margin: -10px 0; } .db-edge.h::before { left: 2px; right: 2px; top: calc(50% - 3px); height: 6px; }
.db-edge.v { margin: 0 -10px; } .db-edge.v::before { top: 2px; bottom: 2px; left: calc(50% - 3px); width: 6px; }
.my-turn .db-edge:not(:disabled):hover::before { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.db-edge:disabled { cursor: default; }
.db-edge.on.p-a::before { background: var(--pa); } .db-edge.on.p-b::before { background: var(--pb); }
.db-edge.last::before { box-shadow: 0 0 0 3px color-mix(in srgb, #facc15 70%, transparent); }

/* Reversi */
.rv-grid { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); gap: 2px; width: min(100%, 420px); aspect-ratio: 1; margin: 0 auto;
  padding: 6px; border-radius: 12px; background: #14532d; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.rv-cell { position: relative; border: 0; padding: 0; background: #15803d; border-radius: 3px; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent; }
.rv-cell:disabled { cursor: default; }
.rv-cell.can { cursor: pointer; } .rv-cell.can::after { content: ""; width: 26%; height: 26%; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.rv-cell.can:hover::after { background: rgba(255, 255, 255, .8); }
.rv-cell.last { box-shadow: inset 0 0 0 2px #facc15; }
.rv-disc { width: 82%; height: 82%; border-radius: 50%; display: block; }
.rv-disc.p-a { background: radial-gradient(circle at 35% 30%, #4b5563, #030712 70%); }
.rv-disc.p-b { background: radial-gradient(circle at 35% 30%, #fff, #d1d5db 75%); }
.rv-disc.flip { animation: rv-flip .35s ease-in-out; }
@keyframes rv-flip { 50% { transform: scaleX(.05); } }

/* Sea Battle */
.sb-wrap { display: grid; gap: 6px; justify-items: center; }
.sb-title { margin: 6px 0 0; font-size: calc(16px * var(--ts, 1)); }
.sb-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); gap: 2px; padding: 4px; border-radius: 10px; aspect-ratio: 1;
  background: #0c4a6e; }
.sb-grid.target { width: min(100%, 380px); }
.sb-grid.mine { width: min(62%, 240px); }
.sb-cell { border: 0; padding: 0; border-radius: 3px; background: #0ea5e9; display: grid; place-items: center; font-size: clamp(12px, 3.6vw, 18px);
  line-height: 1; color: #fff; -webkit-tap-highlight-color: transparent; }
.sb-grid.mine .sb-cell { font-size: clamp(9px, 2.6vw, 13px); }
button.sb-cell { cursor: pointer; } button.sb-cell:disabled { cursor: default; }
.my-turn button.sb-cell:not(:disabled):hover { background: #38bdf8; box-shadow: inset 0 0 0 2px #fff; }
.sb-cell.miss { background: #0369a1; color: #bae6fd; font-size: calc(22px * var(--ts, 1)); }
.sb-cell.ship { background: #64748b; }
.sb-cell.hit { background: #f97316; }
.sb-cell.sunk { background: #b91c1c; }
.sb-cell.last { box-shadow: inset 0 0 0 2px #facc15; }
@keyframes duel-pop { from { transform: scale(.6); } }
.calm .rv-disc.flip, .calm .nc-cell.last, .calm .nc-cell.win { animation: none; }

/* ---- chats: search, polls, effects, starred ---- */
.chat-search { position: sticky; top: 0; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 10px; margin: 6px 0 10px; box-shadow: 0 6px 18px rgba(15, 23, 42, .12); }
.chat-search-top { display: flex; gap: 8px; align-items: center; }
.chat-search-top input { flex: 1; min-width: 0; }
.chat-search-results { display: flex; flex-direction: column; gap: 6px; max-height: min(420px, 55vh); overflow-y: auto; margin-top: 6px; }
.search-hit { display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; padding: 8px 10px; }
.search-hit:hover, .search-hit:focus-visible { border-color: var(--accent); border-left-color: var(--c); }
.search-top { display: flex; gap: 8px; align-items: baseline; }
.search-top small { color: var(--muted); }
.search-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.search-hit.open .search-text { display: block; -webkit-line-clamp: none; }
.search-text mark { background: #fde047; color: #0f172a; border-radius: 3px; padding: 0 1px; }
.search-old { color: var(--muted); }

.msg.has-poll { min-width: min(80%, 300px); }
.msg-poll { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.poll-q { font-size: calc(17px * var(--ts, 1)); line-height: 1.3; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 8px 12px;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.poll-opt:hover:not(:disabled) { border-color: var(--accent); }
.poll-opt:disabled { cursor: default; }
.poll-opt.mine { border: 2px solid var(--accent); }
.poll-opt.top { font-weight: 700; }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 22%, transparent); transition: width .4s ease; }
.poll-label { position: relative; display: flex; gap: 6px; flex: 1; min-width: 0; }
.poll-tick { width: 1em; color: var(--accent); font-weight: 700; }
.poll-text { word-break: break-word; }
.poll-n { position: relative; font-weight: 700; }
.poll-who { color: var(--muted); margin: -3px 2px 2px 30px; font-size: calc(13px * var(--ts, 1)); }
.poll-foot { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: space-between; color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.chat-poll-new, .chat-effects { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); padding: 10px; }
.poll-new-top { display: flex; justify-content: space-between; align-items: center; }
.poll-new-opts { display: flex; flex-direction: column; gap: 6px; }
.poll-new-btns { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.chat-effects .help { margin: 0; }
.effect-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.effect-choice { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; cursor: pointer; }
.effect-choice:hover, .effect-choice:focus-visible { border-color: var(--accent); }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 900; overflow: hidden; }
.fx-balloon { position: absolute; bottom: -120px; width: 46px; height: 58px; border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7) 0 8%, transparent 9%), var(--bc);
  animation: fx-rise 4s ease-in forwards; }
.fx-balloon::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 46px; background: rgba(100, 116, 139, .8); }
@keyframes fx-rise { 0% { transform: translate(0, 0); } 50% { transform: translate(var(--sway), -60vh); }
  100% { transform: translate(0, calc(-100vh - 200px)); } }
.fx-bit { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fx-fall 3s linear forwards; }
@keyframes fx-fall { to { transform: translate(var(--drift), calc(100vh + 40px)) rotate(var(--spin)); } }
.fx-burst { position: absolute; width: 0; height: 0; }
.fx-spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; opacity: 0; animation: fx-spark 1.8s ease-out forwards;
  box-shadow: 0 0 8px currentColor; }
@keyframes fx-spark { 0% { opacity: 1; transform: translate(0, 0) scale(1.2); }
  70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 30px)) scale(.4); } }
.msg.slam { animation: fx-slam .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes fx-slam { 0% { transform: scale(2.6); opacity: 0; } 60% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1); } }
body.slam-shake .chat { animation: fx-shake .45s .25s; }
@keyframes fx-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); } }
.fx-flake { position: absolute; top: -30px; line-height: 1; color: #bfdbfe; text-shadow: 0 0 3px rgba(30, 64, 175, .55);
  animation: fx-snow 4s linear forwards; }
@keyframes fx-snow { 0% { transform: translate(0, 0); } 25% { transform: translate(var(--drift), 25vh); }
  50% { transform: translate(calc(var(--drift) * -1), 50vh); } 75% { transform: translate(var(--drift), 75vh); }
  100% { transform: translate(0, calc(100vh + 40px)); opacity: .6; } }
.fx-heart { position: absolute; bottom: -60px; line-height: 1; animation: fx-heart 3.6s ease-in forwards; }
@keyframes fx-heart { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 10% { opacity: 1; }
  50% { transform: translate(var(--sway), -55vh) scale(1.1); } 80% { opacity: 1; }
  100% { transform: translate(0, calc(-100vh - 80px)) scale(.9); opacity: 0; } }
.fx-santa { position: absolute; top: 9%; left: 100%; display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  animation: fx-sleigh 4.6s ease-in-out forwards; white-space: nowrap; }
.fx-santa-team { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25)); }
.fx-santa-say { font-weight: 800; font-size: 15px; color: #fff; background: #dc2626; border-radius: 999px; padding: 2px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
@keyframes fx-sleigh { 0% { transform: translate(0, 30px); } 25% { transform: translate(-35vw, -10px); }
  50% { transform: translate(-70vw, 20px); } 75% { transform: translate(-105vw, -5px); }
  100% { transform: translate(calc(-100vw - 260px), 10px); } }
.fx-twinkle { position: absolute; font-size: 16px; opacity: 0; animation: fx-twinkle 1.4s ease-out forwards; }
@keyframes fx-twinkle { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: translateY(26px) scale(.5); } }

/* Invisible ink: hidden words under a sparkly shimmer until tapped */
.msg-text.ink { position: relative; cursor: pointer; user-select: none; -webkit-user-select: none; border-radius: 6px;
  color: transparent; text-shadow: 0 0 10px color-mix(in srgb, var(--ink) 75%, transparent); }
.msg-text.ink * { color: transparent !important; background: none !important; text-decoration-color: transparent; pointer-events: none; }
.msg-text.ink::after { content: ""; position: absolute; inset: -2px; border-radius: 6px; pointer-events: none;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--ink) 70%, transparent) 0 1px, transparent 1.6px),
    radial-gradient(circle, color-mix(in srgb, var(--accent) 80%, transparent) 0 1px, transparent 1.6px);
  background-size: 9px 9px, 13px 13px; background-position: 0 0, 4px 6px; animation: fx-ink 2.4s linear infinite; }
@keyframes fx-ink { to { background-position: 9px -9px, -9px 7px; } }
.msg-text.ink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .fx { display: none; } .msg.slam, body.slam-shake .chat, .msg-text.ink::after { animation: none; } }
body.calm .msg-text.ink::after { animation: none; }
body.calm .fx { display: none; }

.chats-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.star-list { display: flex; flex-direction: column; gap: 8px; }
.star-item { display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--c); border-radius: 12px; padding: 8px 10px; }
.star-go { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: var(--ink); text-decoration: none; }
.star-top small { color: var(--muted); }
.star-text { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.chat-search input::-webkit-search-cancel-button { display: none; }

/* jobs for pocket money */
.jobs-block h2 { margin-top: 0; }
.job-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0 10px 12px; border-left: 4px solid var(--c);
  border-bottom: 1px solid var(--line); }
.job-row:last-of-type { border-bottom: 0; }
.job-main { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.job-main small { color: var(--muted); }
.job-money { font-weight: 800; font-size: calc(18px * var(--ts, 1)); white-space: nowrap; }
.job-money.big { font-size: calc(22px * var(--ts, 1)); }
.job-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.job-btns form { margin: 0; }
.job-accept input { width: 5.5em; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--panel); color: var(--ink); }
.job-hist { padding: 4px 0; font-size: calc(14px * var(--ts, 1)); }
.job-idea { margin: 4px 0; color: var(--muted); }
.job-for .check { margin-top: 6px; }
.jobs-owed { text-align: center; }
.jobs-owed-label { margin: 0; color: var(--muted); font-weight: 600; }
.jobs-owed-sum { margin: 2px 0 6px; font-size: calc(44px * var(--ts, 1)); font-weight: 800; color: color-mix(in srgb, var(--me, var(--accent)) 70%, var(--ink)); }
.jobs-goal p { margin: 6px 0; }
.jobs-bar { height: 14px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.jobs-bar span { display: block; height: 100%; border-radius: inherit; background: var(--me, var(--accent)); transition: width .4s; }
.job-proof { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; flex: none; }
.pic-viewer img.whole { aspect-ratio: auto; object-fit: contain; border-radius: 14px; width: min(92vw, 720px); height: auto; max-height: 78vh; }
.job-photo-btn { position: relative; overflow: hidden; }
.job-photo-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.job-edit { flex-basis: 100%; }
.job-edit > summary { list-style: none; display: inline-flex; cursor: pointer; }
.job-edit > summary::-webkit-details-marker { display: none; }
.job-edit[open] > summary { margin-bottom: 4px; }
.job-edit .form { margin: 0; padding: 4px 0 6px; }
a.countdown { color: inherit; text-decoration: none; }
/* Voice calls between parents (beta) */
.call { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 24px 8px 40px; }
.call-beta { margin: 0; color: var(--muted); font-weight: 600; font-size: calc(14px * var(--ts, 1)); }
.beta-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent); font-size: calc(12px * var(--ts, 1)); vertical-align: 1px; }
.call-who { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call-who h1 { margin: 6px 0 0; font-size: calc(30px * var(--ts, 1)); }
.call-pic, .call .call-pic { width: 128px; height: 128px; font-size: calc(48px * var(--ts, 1)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 35%, transparent); }
.call-status { margin: 0; color: var(--muted); font-size: calc(17px * var(--ts, 1)); min-height: 1.4em; }
.call-time { margin: 0; font-variant-numeric: tabular-nums; font-size: calc(20px * var(--ts, 1)); font-weight: 700; }
.call-btns { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.call-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 84px; height: 84px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 30px; cursor: pointer; }
.call-btn span { font-size: calc(12px * var(--ts, 1)); font-weight: 600; }
.call-btn.go { background: #16a34a; border-color: #16a34a; color: #fff; }
.call-btn.stop { background: #dc2626; border-color: #dc2626; color: #fff; }
.call-btn.on { background: var(--ink); color: var(--bg); }
.call-btn:disabled { opacity: .6; }
.call-btn[hidden] { display: none; }
.call-help { max-width: 34ch; }
.call-ringing { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 60; padding: 14px 16px; border-radius: 16px;
  background: #16a34a; color: #fff; font-weight: 700; text-align: center; text-decoration: none; box-shadow: 0 8px 24px rgb(0 0 0 / .25);
  font-size: calc(16px * var(--ts, 1)); animation: call-pulse 1.4s ease-in-out infinite; }
.call-ringing[hidden] { display: none; }
@keyframes call-pulse { 50% { transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) { .call-ringing { animation: none; } }
/* Video calls: the other person fills the screen, you're in the corner, the buttons float over the picture. */
.call-videos[hidden] { display: none; }
.call.video-on { position: fixed; inset: 0; z-index: 70; margin: 0; padding: calc(16px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom));
  background: #000; color: #fff; justify-content: space-between; gap: 10px; overflow: hidden; }
.call.video-on .call-videos { position: absolute; inset: 0; z-index: 0; }
.call-remote { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-self { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 12px; width: 28vw; max-width: 150px; aspect-ratio: 3 / 4;
  object-fit: cover; border-radius: 14px; border: 2px solid rgb(255 255 255 / .75); background: #1f2937; box-shadow: 0 6px 18px rgb(0 0 0 / .4); }
.call-self.mirror { transform: scaleX(-1); }
.call-self.off { opacity: .25; }
.call.video-on > :not(.call-videos) { position: relative; z-index: 1; }
.call.video-on .call-beta, .call.video-on .call-help, .call.video-on .call-back { display: none; }
.call.video-on .call-who { align-self: flex-start; align-items: flex-start; text-align: left; padding-right: 32vw; }
.call.video-on .call-who h1, .call.video-on .call-status, .call.video-on .call-time { color: #fff; text-shadow: 0 1px 6px rgb(0 0 0 / .7); }
.call.video-on .call-who h1 { font-size: calc(24px * var(--ts, 1)); margin: 0; }
.call.video-on.has-remote .call-pic { display: none; }
.call.video-on .call-pic { width: 72px; height: 72px; font-size: calc(30px * var(--ts, 1)); }
.call.video-on .call-btns { margin-top: auto; gap: 8px; flex-wrap: nowrap; }
.call.video-on .call-btn { width: 60px; height: 60px; flex: 0 0 auto; font-size: 22px; background: rgb(255 255 255 / .18); border-color: transparent; color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.call.video-on .call-btn.on { background: #fff; color: #111; }
.call.video-on .call-btn.stop { background: #dc2626; }
.call.video-on .call-btn span { font-size: calc(10px * var(--ts, 1)); }
.call-btn .hi-video { --ic: currentColor; --duo: color-mix(in srgb, currentColor 22%, transparent); }
.call-beta .hi-video { --icb: #2563eb; font-size: 1.2em; }

/* ---- Settings menu: short groups of rows, each opening its own page ---- */
.set-cols { display: grid; gap: 4px 24px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.set-group { font-size: calc(12px * var(--ts, 1)); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 18px 6px 8px; }
.set-group small { text-transform: none; letter-spacing: 0; font-weight: 600; background: var(--line); color: var(--ink); padding: 1px 8px; border-radius: 999px; margin-left: 4px; }
.set-menu { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.set-menu form { margin: 0; }
.set-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 12px 14px;
  border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.set-menu > :first-child, .set-menu > form:first-child .set-row { border-top: 0; }
.set-row:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.set-row:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.set-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; background: var(--ic, var(--bg)); }
.ic-look { --ic: #ede9fe; } .ic-notify { --ic: #fef3c7; } .ic-reading { --ic: #dcfce7; } .ic-pin { --ic: #e0f2fe; }
.ic-hub { --ic: #fee2e2; } .ic-calendar { --ic: #dbeafe; } .ic-tea { --ic: #ffedd5; } .ic-security { --ic: #f1f5f9; }
.ic-chat { --ic: #fae8ff; } .ic-backup { --ic: #e0f2fe; } .ic-new { --ic: #fef9c3; } .ic-lock { --ic: #f1f5f9; }
[data-theme="dark"] .set-ic { background: color-mix(in srgb, var(--ic, #334155) 22%, var(--bg)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .set-ic { background: color-mix(in srgb, var(--ic, #334155) 22%, var(--bg)); } }
.set-text b { display: block; font-size: calc(16px * var(--ts, 1)); }
.set-text small { display: block; color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.set-go { color: var(--muted); font-size: 22px; display: flex; align-items: center; gap: 8px; }
.set-warn { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.saved-note { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; margin: 0;
  background: var(--head); color: #fff; padding: 7px 16px; border-radius: 999px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; }
.saved-note.show { opacity: 1; }
.saved-note.bad { background: var(--danger); }
.saved-note:empty { display: none; }
body.calm .saved-note { transition: none; }

/* Chat: tap one of your messages to see who has read it */
.msg-reads { display: grid; gap: 4px; margin-top: 4px; padding: 6px 9px; border-radius: 12px; justify-self: end; max-width: 92%;
  font-size: calc(12px * var(--ts, 1)); color: var(--ink); background: color-mix(in srgb, var(--panel) 92%, var(--accent));
  border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.msg.mine .msg-reads { margin-left: auto; width: fit-content; }
.reads-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-weight: 600; }
.reads-row.waiting { color: var(--muted); font-weight: 500; }
.reads-who { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.reads-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 5px; border-radius: 999px; font-weight: 600;
  background: color-mix(in srgb, var(--c) 14%, var(--panel)); color: var(--ink); }
.reads-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.reads-row.waiting .reads-chip { opacity: .75; font-weight: 500; }
.msg.open .msg-seen { display: none; }

/* Settings, Chat extras: a list of on/off switches */
.form label.extra-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; margin: 0;
  font-weight: 400; }
.extras .help + .extra-row { border-top: 0; }
.extra-row > span { flex: 1; min-width: 0; }
.extra-row b { display: block; font-size: calc(16px * var(--ts, 1)); }
.extra-row small { display: block; color: var(--muted); font-weight: 400; font-size: calc(13px * var(--ts, 1)); }
input.switch-box { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; margin: 0; padding: 0;
  border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background .15s; }
input.switch-box::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
input.switch-box:checked { background: var(--ok); }
input.switch-box:checked::after { left: 23px; }
input.switch-box:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Calls in a private chat: how each one went, with a button to ring back */
.msg-call { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 2px 0; }
.msg-call .call-label { font-weight: 600; }
.msg-call.missed .call-label { color: var(--danger); }
.msg-call .call-back { padding: 4px 12px; }


/* Chat extras: bedtime quiet hours */
.quiet-times { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.quiet-times label { flex: 1 1 120px; }

/* Send later: choosing a time, and the messages waiting to go */
.chat-later .help { margin: 0; }
.later-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.later-quick .effect-choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); font-weight: 700; }
.later-at { display: flex; flex-direction: column; gap: 4px; font-size: calc(14px * var(--ts, 1)); color: var(--muted); }
.later-at input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.chat-later-list { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 6px 10px; }
.chat-later-list summary { cursor: pointer; font-weight: 600; font-size: calc(14px * var(--ts, 1)); }
.chat-later-list ul { margin: 6px 0 2px; display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.later-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.later-words { display: flex; flex-direction: column; min-width: 0; }
.later-words b { font-size: calc(13px * var(--ts, 1)); color: var(--muted); }
.later-words span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Settings, Permissions */
.perm-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; }
.perm-head h1 { margin: 0; }
.perm-head p { margin: 2px 0 0; }
.perm-form h2 { margin-top: 18px; }
.perm-form h2:first-of-type { margin-top: 4px; }
.perm-usual { margin: 14px 0 6px; }
.perm-people .set-ic .avatar { width: 30px; height: 30px; font-size: calc(14px * var(--ts, 1)); object-fit: cover; }

/* Photo albums */
.page-head { margin-bottom: 10px; }
.page-head p { margin: 0; }
.album-new summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 10px; list-style: none; }
.album-new summary::-webkit-details-marker { display: none; }
.album-new[open] summary { margin-bottom: 12px; }
.album-new-plus { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 20px; line-height: 1; }
.album-ideas { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.album-idea { font: inherit; font-size: calc(14px * var(--ts, 1)); padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer; }
.album-idea:hover { border-color: var(--accent); }
.album-group h2 { margin-top: 22px; }
.album-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.album-card { display: flex; flex-direction: column; text-decoration: none; background: var(--panel); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow, 0 1px 3px rgba(15,23,42,.08)); transition: transform .15s ease, box-shadow .15s ease; }
.album-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-up, 0 8px 24px rgba(15,23,42,.12)); }
.album-cover { aspect-ratio: 1; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); display: grid; place-items: center; overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover b { font-size: 48px; }
.album-card-text { padding: 10px 12px 12px; min-width: 0; }
.album-card-text b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.25; margin-bottom: 2px; }
.album-card-text small { color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.album-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.album-pick { position: relative; overflow: hidden; cursor: pointer; }
.album-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.album-upload .help { flex: 1 1 200px; margin: 0; }
.album-progress { flex-basis: 100%; }
.album-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.album-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s ease; }
.album-progress p { margin: 6px 0 0; font-size: calc(14px * var(--ts, 1)); }
.album-photos { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; margin-top: 14px; }
.album-photos a { border-radius: 6px; }
@media (min-width: 700px) { .album-photos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; } }
.album-photos a[data-cover]::after { content: "\2B50"; position: absolute; top: 4px; right: 6px; font-size: 14px; }
.album-settings { margin-top: 20px; }
.album-settings summary { cursor: pointer; font-weight: 600; }
.album-delete { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.btn.danger.ghost { background: transparent; color: var(--danger); }
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.viewer[open] { display: grid; grid-template-rows: auto 1fr auto; }
.viewer::backdrop { background: #000; }
.viewer img { grid-row: 2; width: 100%; height: 100%; object-fit: contain; min-height: 0; user-select: none; -webkit-user-select: none; }
.viewer-top { grid-row: 1; display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.viewer-count { flex: 1; text-align: center; font-size: 14px; opacity: .8; }
.viewer-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14);
  color: #fff; font-size: 18px; text-decoration: none; cursor: pointer; }
.viewer-btn.on { background: rgba(250,204,21,.4); }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12);
  color: #fff; font-size: 34px; cursor: pointer; }
.viewer-nav.prev { left: 10px; } .viewer-nav.next { right: 10px; }
@media (hover: none) { .viewer-nav { display: none; } }
.viewer-foot { grid-row: 3; padding: 10px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.viewer-foot p { margin: 0; font-size: 14px; opacity: .85; }
.viewer-caption { font-size: 16px !important; opacity: 1 !important; margin-top: 4px !important; }
.viewer-foot form { display: flex; gap: 8px; margin-top: 8px; }
.viewer-foot input { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; font: inherit; }


/* Modern Classic look: a light frosted-glass header with the page showing softly through it. */
/* The glass is a layer behind the header, not the header itself: a blur on the header would pin the phone tab bar
   (which lives inside it) to the header instead of the bottom of the screen. */
.look-classic .top { background: transparent; color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.look-classic .top::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--glass);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); }
.look-classic .brand span { font-weight: 800; letter-spacing: -.01em; }
.look-classic .brand img { box-shadow: var(--shadow); }
.look-classic .main a { color: var(--muted); font-weight: 600; border-radius: 999px; }
.look-classic .main a.on, .look-classic .main a:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.look-classic .me-chip { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.look-classic .me-chip:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); }
.look-classic .top .link-btn { color: var(--ink); }
@media (max-width: 640px) {
  .look-classic nav.main a { color: color-mix(in srgb, var(--ink) 62%, var(--muted)); border-radius: 12px; }
  .look-classic nav.main a.on, .look-classic nav.main a:hover { background: none; color: color-mix(in srgb, var(--accent) 52%, var(--ink)); }
}
.look-classic .tile:nth-child(6n+1) .tile-icon { background: color-mix(in srgb, #2563eb 12%, var(--panel)); }
.look-classic .tile:nth-child(6n+2) .tile-icon { background: color-mix(in srgb, #f59e0b 16%, var(--panel)); }
.look-classic .tile:nth-child(6n+3) .tile-icon { background: color-mix(in srgb, #16a34a 13%, var(--panel)); }
.look-classic .tile:nth-child(6n+4) .tile-icon { background: color-mix(in srgb, #db2777 12%, var(--panel)); }
.look-classic .tile:nth-child(6n+5) .tile-icon { background: color-mix(in srgb, #7c3aed 13%, var(--panel)); }
.look-classic .tile:nth-child(6n+6) .tile-icon { background: color-mix(in srgb, #0891b2 13%, var(--panel)); }

/* The boxes in the chat's Start a poll and Send later panels. At least 16px writing: anything smaller and an iPhone
   zooms the whole page in when you tap the box, pushing the chat off the side of the screen. */
.chat-poll-new input { display: block; width: 100%; min-width: 0; margin: 0; padding: 10px 12px; font: inherit;
  font-size: max(16px, calc(16px * var(--ts, 1))); color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; -webkit-appearance: none; appearance: none; }
.chat-poll-new input[type=datetime-local] { min-height: 44px; }
.chat-poll-new input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
/* The chat's search box and the album form's month box: 16px too, so an iPhone doesn't zoom in on them. */
.chat-search-top input { padding: 9px 12px; font: inherit; font-size: max(16px, calc(16px * var(--ts, 1))); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; -webkit-appearance: none; appearance: none; }
.form input[type=month] { display: block; width: 100%; margin-top: 6px; padding: 11px 14px; font: inherit; font-size: calc(16px * var(--ts, 1));
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; min-height: 46px; }
/* Album cover: pick one from the album's photos */
.album-cover-pick summary { cursor: pointer; font-weight: 600; }
.album-cover-pick .help { margin: 10px 0; }
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.cover-grid label { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; cursor: pointer; margin: 0;
  background: var(--line); outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .12s, transform .12s; }
.cover-grid input { position: absolute; opacity: 0; pointer-events: none; }
.cover-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-grid label:has(input:checked) { outline-color: var(--accent); transform: scale(.96); }
.cover-grid label:has(input:checked)::after { content: "\2713"; position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.cover-grid label:has(input:focus-visible) { outline-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.cover-auto span { display: grid; place-items: center; align-content: center; gap: 2px; height: 100%; padding: 6px; text-align: center; font-size: 22px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.cover-auto small { font-size: calc(11px * var(--ts, 1)); color: var(--muted); line-height: 1.2; }
.cover-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cover-upload .help { margin: 0; }

/* The chat's "new messages" line, above the first message they haven't read yet */
.chat-unread-line { display: flex; align-items: center; gap: 10px; margin: 14px 4px 10px; color: var(--accent); font-weight: 700;
  font-size: calc(13px * var(--ts, 1)); text-transform: uppercase; letter-spacing: .04em; }
.chat-unread-line::before, .chat-unread-line::after { content: ""; flex: 1; height: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 45%, transparent); }
/* My menu bar: a preview of the bar */
.menu-preview { display: flex; justify-content: space-around; gap: 2px; margin: 14px 0 6px; padding: 8px 4px; border-radius: 18px;
  background: var(--panel); box-shadow: var(--shadow); }
.menu-preview span { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 600;
  color: color-mix(in srgb, var(--ink) 62%, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-preview i { font-style: normal; font-size: 22px; line-height: 1.2; }
.menu-preview .empty-slot { opacity: .35; }

/* Calendar quick add: one line, then the Add form opens filled in */
.quick-add { display: flex; gap: 8px; margin: 10px 0 4px; max-width: 560px; }
.quick-add input { flex: 1; min-width: 0; font-size: 16px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.quick-add input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.quick-said { background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 8px 12px; border-radius: 12px; }

/* Games: this week in the games room */
.games-week { margin-top: 18px; }
.games-week h2 { margin: 0 0 10px; font-size: calc(17px * var(--ts, 1)); }
.gw-played { display: flex; flex-wrap: wrap; gap: 8px; }
.gw-person { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg);
  font-size: calc(14px * var(--ts, 1)); }
.gw-person.me { outline: 2px solid var(--accent); }
.gw-person small { color: var(--muted); }
.gw-news { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.gw-news a { display: block; padding: 8px 12px; border-radius: 12px; background: var(--bg); color: var(--ink); text-decoration: none;
  font-size: calc(14px * var(--ts, 1)); line-height: 1.4; }

/* Write to Santa: a screenshot or photo of the wish */
.wish-pic-btn { cursor: pointer; }
.wish-pic { display: block; margin: 8px 0 4px; }
.wish-pic img { display: block; max-width: min(220px, 100%); max-height: 220px; border-radius: 12px; box-shadow: var(--shadow);
  background: #fff; object-fit: contain; }
.wishes li .wish-pic { flex: 0 0 100%; order: 1; }
.wishes li .wish-pic ~ * { order: 2; }

/* ---- Review tidy-up (Nov 2026) ---- */
/* Nothing smaller than 12px */
.msg-time { font-size: calc(12px * var(--ts, 1)); }
.set-group small, .games-week small, .gw-person small, .cover-now small { font-size: calc(12px * var(--ts, 1)); }
/* Messages across the top follow dark mode */
:root[data-theme="dark"] .flash { background: #1e3a5f; color: #dbeafe; }
:root[data-theme="dark"] .flash.ok { background: #14532d; color: #dcfce7; }
:root[data-theme="dark"] .flash.error { background: #7f1d1d; color: #fee2e2; }
:root[data-theme="dark"] .flash a, :root[data-theme="dark"] .flash .link-btn { color: inherit; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .flash { background: #1e3a5f; color: #dbeafe; }
  :root:not([data-theme="light"]) .flash.ok { background: #14532d; color: #dcfce7; }
  :root:not([data-theme="light"]) .flash.error { background: #7f1d1d; color: #fee2e2; }
  :root:not([data-theme="light"]) .flash a, :root:not([data-theme="light"]) .flash .link-btn { color: inherit; }
}
/* Home: What's new as short titles; Today at a glance */
.news-u { margin: 6px 0; }
.news-u summary { cursor: pointer; font-weight: 700; font-size: calc(15px * var(--ts, 1)); padding: 6px 0; }
.today-strip h2 { margin: 0 0 6px; font-size: calc(18px * var(--ts, 1)); }
.today-strip ul { list-style: none; margin: 0; padding: 0; }
.today-strip li + li { border-top: 1px solid var(--line); }
.today-strip a { display: flex; gap: 12px; align-items: baseline; padding: 9px 2px; text-decoration: none; color: var(--ink); }
.today-strip .ts-when { flex: 0 0 4.2em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); font-size: calc(14px * var(--ts, 1)); }
.today-strip .ts-what { flex: 1; min-width: 0; }
.today-strip .ts-none { padding: 9px 2px; color: var(--muted); }
/* A tick box and its words stay on one line together */
.form label.check:not(:has(input[type=date], input[type=number], select)) { flex-wrap: nowrap; align-items: flex-start; }
.form label.check input[type=checkbox] { flex: none; margin-top: 3px; }
/* A card that folds away (Add a job) */
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary::after { content: "\203A"; font-size: 22px; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-90deg); }
/* Month on a phone: the tapped day's entries under the grid */
.month-day { display: none; }
@media (max-width: 700px) {
  .month-day { display: block; margin-top: 12px; }
  .mday h2 { margin: 0 0 6px; font-size: calc(16px * var(--ts, 1)); }
  .mday h2 a { text-decoration: none; }
  .mday .chip { display: flex; margin: 4px 0; padding: 8px 10px; font-size: calc(15px * var(--ts, 1)); }
  .mday .chip .t { white-space: normal; }
  .cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
}
/* Computers: the week fills the screen and entries stack so titles have room; Home gets more width */
@media (min-width: 900px) {
  .wday { min-height: calc(100vh - 260px); }
  .week .chip { flex-wrap: wrap; row-gap: 2px; }
  .week .chip .t { flex: 1 1 100%; }
}
.now-line span { color: color-mix(in srgb, var(--danger) 70%, var(--ink)); }
.cover-grid small { font-size: calc(12px * var(--ts, 1)); }
.avatar.tiny, .who .avatar.tiny, .chip-faces .avatar.tiny { font-size: calc(12px * var(--ts, 1)); }

/* Undo, on the message after deleting something */
.undo-form { display: inline-block; margin-left: 10px; }
.undo-form .btn { background: var(--panel); color: var(--ink); }

/* Search: the magnifying glass in the top bar, and the results page */
.top-search { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; text-decoration: none; font-size: 17px; margin-left: auto; }
.top-search:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.top-search + .me-chip { margin-left: 0; }
@media (max-width: 640px) { .top-search { order: -1; } .top-search + .me-chip { margin-left: 0; } }
.hub-search { max-width: none; margin-bottom: 14px; }
.search-group h2 { margin: 0 0 4px; font-size: calc(17px * var(--ts, 1)); }
.search-group ul { list-style: none; margin: 0; padding: 0; }
.search-group li + li { border-top: 1px solid var(--line); }
.search-group a { display: flex; gap: 12px; align-items: center; padding: 10px 2px; text-decoration: none; color: var(--ink); }
.search-group a.past { opacity: .7; }
.search-group .sr-icon { flex: none; width: 36px; text-align: center; font-size: 20px; }
.search-group img { flex: none; width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.search-group .sr-text { min-width: 0; display: flex; flex-direction: column; }
.search-group .sr-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-group .sr-text small { color: var(--muted); font-size: calc(13px * var(--ts, 1)); }

/* ---- Home on a computer or wide screen: the tiles are a banner across the screen under the welcome, and the
   cards (Today, What's new, Christmas...) sit side by side below, instead of one long list down the middle ---- */
@media (min-width: 1000px) {
  main.page:has(> .tiles) { max-width: min(96vw, 2300px); display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
  main.page:has(> .tiles) > * { margin-top: 0; margin-bottom: 0; }
  main.page:has(> .tiles) > .hero { grid-column: 1 / -1; order: -3; padding: 20px 16px 16px; }
  main.page:has(> .tiles) > .tiles { grid-column: 1 / -1; order: -2; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
  main.page:has(> .tiles) > .tiles .tile { grid-template-columns: 1fr; grid-template-rows: auto 1fr; justify-items: center; align-content: start; text-align: center;
    row-gap: 8px; padding: 14px 6px 12px; min-height: 0; }
  main.page:has(> .tiles) > .tiles .tile-icon { grid-row: auto; }
  main.page:has(> .tiles) > .tiles .tile-name { font-size: clamp(13px, 1vw, 16px); line-height: 1.25; overflow-wrap: break-word; }
  main.page:has(> .tiles) > .tiles .tile-name .badge { display: block; width: fit-content; margin: 4px auto 0; }
  main.page:has(> .tiles) > .tiles .tile-sub { display: none; }
}

/* Shopping list and routines: big tick rows */
.shop-add { max-width: none; }
.shop-list h2 { margin: 0 0 4px; font-size: calc(17px * var(--ts, 1)); }
.count { font-size: calc(13px * var(--ts, 1)); font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 2px 9px; margin-left: 4px; }
.shop-row { display: flex; align-items: center; gap: 8px; }
.shop-row + .shop-row, .routine-steps li + li { border-top: 1px solid var(--line); }
.shop-row > form:first-child { flex: 1; min-width: 0; }
.shop-tick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 2px; background: none; border: 0; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; }
.shop-tick.still { cursor: default; min-height: 40px; }
.shop-box { flex: none; width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--muted); display: grid; place-items: center; font-weight: 800; color: #fff; }
.shop-box.on { background: #16a34a; border-color: #16a34a; }
.shop-text { min-width: 0; display: flex; flex-direction: column; }
.shop-text small { color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.shop-got .shop-text b, .routine-steps li.on .shop-text b { text-decoration: line-through; color: var(--muted); font-weight: 600; }
.routine h2, .routine-peek summary { font-size: calc(18px * var(--ts, 1)); margin: 0 0 4px; }
.routine.complete { border: 2px solid #16a34a; }
.routine-steps { list-style: none; margin: 0; padding: 0; }
.routine-done { margin: 8px 0 0; font-weight: 700; color: #15803d; }
.routine-peek, .routine-edit { padding: 6px 0; }
.routine-peek + .routine-peek, .routine-edit + .routine-edit { border-top: 1px solid var(--line); }
.routine-peek summary, .routine-edit summary { cursor: pointer; padding: 6px 0; }
.routine-edit summary small { display: block; color: var(--muted); font-size: calc(13px * var(--ts, 1)); font-weight: 400; }
@media (min-width: 1000px) { main.page:has(> .tiles) > .tiles .tile { align-items: center; } }

/* Calendars from elsewhere (Settings, Calendar) */
.feed-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.feed-row > div { flex: 1; min-width: 0; }
.feed-row small { display: block; color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.feed-row .feed-bad { color: var(--danger); }
#feeds details.fold { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
#feeds details.fold h3 { margin: 0; font-size: calc(16px * var(--ts, 1)); }
.ic-callink { --ic: #dbeafe; }
.chip.virtual.cat-school, .chip.virtual.cat-activity, .chip.virtual.cat-event, .chip.virtual.cat-work, .chip.virtual.cat-appointment { font-style: normal; }

/* Drawn icons (2026-11-17): one set of drawings (templates/_icons.html) instead of emoji, so they look the same on every
   phone. Each section keeps its own colour (--icb), nudged towards the text colour so it reads in light, dark and every look. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hi { width: 1em; height: 1em; flex: none; vertical-align: -.15em; overflow: visible; fill: none; stroke: var(--ic); stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; color: var(--ic);
  --ic: color-mix(in srgb, var(--icb, var(--accent)) 82%, var(--ink)); --duo: color-mix(in srgb, var(--ic) 20%, transparent); }
.hi-home, .tile:has(.hi-home) { --icb: #2563eb; }
.hi-calendar, .tile:has(.hi-calendar) { --icb: #2563eb; }
.hi-chat, .tile:has(.hi-chat) { --icb: #0d9488; }
.hi-dms, .tile:has(.hi-dms) { --icb: #4f46e5; }
.hi-albums, .tile:has(.hi-albums) { --icb: #db2777; }
.hi-shopping, .tile:has(.hi-shopping) { --icb: #16a34a; }
.hi-routines, .tile:has(.hi-routines) { --icb: #d97706; }
.hi-parents, .tile:has(.hi-parents) { --icb: #475569; }
.hi-people, .tile:has(.hi-people) { --icb: #7c3aed; }
.hi-games, .tile:has(.hi-games) { --icb: #dc2626; }
.hi-jobs, .tile:has(.hi-jobs) { --icb: #ca8a04; }
.hi-ideas, .tile:has(.hi-ideas) { --icb: #ca8a04; }
.hi-tea, .tile:has(.hi-tea) { --icb: #ea580c; }
.hi-christmas, .tile:has(.hi-christmas) { --icb: #b91c1c; }
.hi-advent, .tile:has(.hi-advent) { --icb: #15803d; }
.hi-settings, .tile:has(.hi-settings) { --icb: #64748b; }
.hi-search, .tile:has(.hi-search) { --icb: #2563eb; }
/* Home's tiles: the square behind the icon takes the icon's colour. */
body .tiles .tile:has(.hi) { --tc: var(--icb); }
body .tiles .tile:has(.hi) .tile-icon { background: color-mix(in srgb, var(--icb) 12%, var(--panel)); }
.zaz .tiles .tile:has(.hi) .tile-icon { background: color-mix(in srgb, var(--icb) 20%, var(--panel)); }
.tile-icon .hi { width: .95em; height: .95em; }
/* Living sky and My colour: bright colour tiles with white drawings, like app icons. */
body.sky .tiles .tile:has(.hi) .tile-icon, body.mycolour .tiles .tile:has(.hi) .tile-icon {
  background: linear-gradient(150deg, color-mix(in srgb, var(--icb) 70%, #fff), var(--icb) 70%);
  box-shadow: 0 1px 0 rgb(255 255 255 / 35%) inset, 0 6px 14px -8px var(--icb); }
body.sky .tile-icon .hi, body.mycolour .tile-icon .hi { --ic: #fff; --duo: rgb(255 255 255 / 28%); stroke-width: 2.1; width: .95em; height: .95em; }
/* The menu bar: in the header on a computer the icons take the header's text colour; on a phone they keep their colours. */
nav.main .ni { display: inline-flex; align-items: center; }
nav.main .ni .hi { width: 1.15em; height: 1.15em; }
@media (min-width: 641px) { nav.main .hi { --ic: currentColor; --duo: color-mix(in srgb, currentColor 18%, transparent); } }
@media (max-width: 640px) { nav.main .ni .hi { width: 1.05em; height: 1.05em; } }
.top-search .hi { --ic: currentColor; --duo: color-mix(in srgb, currentColor 16%, transparent); width: 20px; height: 20px; }
.menu-preview i .hi, .tile-row-icon .hi { width: .95em; height: .95em; }
/* Dark mode: a little more of the text colour in each icon, so the greys (Parent Chat, Settings) stay clear. */
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .hi { --ic: color-mix(in srgb, var(--icb, var(--accent)) 66%, var(--ink)); } }
:where(:root[data-theme="dark"]) .hi { --ic: color-mix(in srgb, var(--icb, var(--accent)) 66%, var(--ink)); }

/* Wide screens (2026-11-17): every page uses the same width as Home, not a narrow column down the middle.
   The sign-in and message pages stay narrow. */
@media (min-width: 1000px) {
  main.page:not(.narrow) { max-width: min(96vw, 2300px); }
}
/* Cards flow into two columns, like Home's cards; headings, help text and anything else stay full width. A card
   with no card next to it takes the whole width, and a form on its own stays a comfortable width to fill in.
   Not the calendar, People, Home, the chats or the games (they have their own wide layouts). */
@media (min-width: 1000px) {
  main.page:not(.wide):not(.narrow):not(:has(> .tiles)):not(:has(.chat-send)):not(:has(.game-wrap, .wd, .v2-play)) {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; align-items: start; align-content: start; }
  main.page:not(.wide):not(.narrow):not(:has(> .tiles)):not(:has(.chat-send)):not(:has(.game-wrap, .wd, .v2-play)) > * { grid-column: 1 / -1; min-width: 0; }
  main.page:not(.wide):not(.narrow):not(:has(> .tiles)):not(:has(.chat-send)):not(:has(.game-wrap, .wd, .v2-play)) > .card { grid-column: auto; }
  main.page:not(.wide):not(.narrow):not(:has(> .tiles)):not(:has(.chat-send)):not(:has(.game-wrap, .wd, .v2-play)) > .card:not(.card + .card):not(:has(+ .card)) { grid-column: 1 / -1; }
  main.page:not(.wide):not(.narrow):not(:has(> .tiles)):not(:has(.chat-send)):not(:has(.game-wrap, .wd, .v2-play)) > form.card:not(.card + .card):not(:has(+ .card)) { max-width: 900px; }
  .quick-add { max-width: 720px; }
}
@media (min-width: 1000px) { main.page > form.card.album-upload { max-width: none; } }
/* Home on a big screen, option 3 (2026-11-17): the tiles in two rows of bigger tiles, the cards three across,
   and on very wide screens (an ultrawide at 100%) the whole of Home scales up instead of sitting in the middle. */
@media (min-width: 1000px) {
  body main.page:has(> .tiles) { grid-template-columns: repeat(auto-fit, minmax(max(340px, 28%), 1fr)); }
  body main.page:has(> .tiles) > .tiles { --cols: 4; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 12px; }
  body main.page:has(> .tiles) > .tiles:has(> .tile:nth-child(9)) { --cols: 5; }
  body main.page:has(> .tiles) > .tiles:has(> .tile:nth-child(11)) { --cols: 6; }
  body main.page:has(> .tiles) > .tiles:has(> .tile:nth-child(13)) { --cols: 7; }
  body main.page:has(> .tiles) > .tiles:has(> .tile:nth-child(15)) { --cols: 8; }
  body main.page:has(> .tiles) > .tiles:has(> .tile:nth-child(17)) { --cols: 9; }
  body main.page:has(> .tiles) > .tiles:has(> .tile:nth-child(19)) { --cols: 10; }
  body main.page:has(> .tiles) > .tiles .tile { min-height: 112px; padding: 16px 10px 14px; }
  body main.page:has(> .tiles) > .tiles .tile-icon { width: 54px; height: 54px; font-size: 30px; }
  body main.page:has(> .tiles) > .tiles .tile-name { font-size: 15px; }
}
@media (min-width: 1700px) {
  body main.page:has(> .tiles) > .tiles { gap: 14px; }
  body main.page:has(> .tiles) > .tiles .tile { display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
    text-align: left; gap: 16px; padding: 18px 20px; min-height: 116px; }
  body main.page:has(> .tiles) > .tiles .tile-icon { flex: none; width: 64px; height: 64px; font-size: 36px; border-radius: 18px; }
  body main.page:has(> .tiles) > .tiles .tile-name { font-size: 17px; text-align: left; }
  body main.page:has(> .tiles) > .tiles .tile-name .badge { margin: 4px 0 0; }
}
@media (min-width: 2400px) { body main.page:has(> .tiles) { max-width: 96%; zoom: 1.25; } }
@media (min-width: 3200px) { body main.page:has(> .tiles) { zoom: 1.5; } }
@media (min-width: 4000px) { body main.page:has(> .tiles) { zoom: 1.9; } }
/* Our Sports (2026-11-17): Man Utd red for the tile and icon; fixtures, results, race sessions and headlines */
.hi-sports, .tile:has(.hi-sports) { --icb: #da291c; }
.hi-tv, .tile:has(.hi-tv) { --icb: #0284c7; }
.hi-camera, .tile:has(.hi-camera) { --icb: #0f766e; }
.hi-remote, .tile:has(.hi-remote) { --icb: #4f46e5; }
.hi-quiz { --icb: #c026d3; }
.sp-next { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin: 6px 0 10px; border-radius: 14px;
  background: color-mix(in srgb, var(--icb, #da291c) 9%, var(--panel)); border-left: 4px solid #da291c; }
.sp-f1 .sp-next { border-left-color: #e10600; background: color-mix(in srgb, #e10600 8%, var(--panel)); }
.sp-next small { color: var(--muted); font-size: calc(13px * var(--ts, 1)); font-weight: 600; }
.sp-next b { font-size: calc(19px * var(--ts, 1)); line-height: 1.25; }
.sp-next span { color: var(--muted); font-size: calc(14px * var(--ts, 1)); }
.sp-card h2 { margin: 0 0 4px; font-size: calc(19px * var(--ts, 1)); }
.sp-card h3 { margin: 14px 0 4px; font-size: calc(15px * var(--ts, 1)); color: var(--muted); }
.sp-list { list-style: none; margin: 0; padding: 0; }
.sp-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.sp-list li + li { border-top: 1px solid var(--line); }
.sp-when { flex: none; width: 8.6em; color: var(--muted); font-size: calc(14px * var(--ts, 1)); font-variant-numeric: tabular-nums; }
.sp-teams { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-teams small { color: var(--muted); font-size: calc(13px * var(--ts, 1)); }
.sp-ha { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--bg); color: var(--muted); }
.sp-ha.home { background: #da291c; color: #fff; }
.sp-wdl { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px; }
.sp-w { background: #15803d; } .sp-d { background: #64748b; } .sp-l { background: #b91c1c; }
.sp-race b { color: #e10600; }
.sp-story { align-items: baseline !important; flex-wrap: wrap; row-gap: 2px !important; }
.sp-story a, .sp-story b { flex: 1 1 260px; min-width: 0; font-weight: 600; color: var(--ink); }
.sp-story small { flex: none; color: var(--muted); font-size: calc(12px * var(--ts, 1)); }
.sp-tag { flex: none; font-size: calc(12px * var(--ts, 1)); font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; background: #da291c; }
.sp-tag.sp-mufc_women { background: #9d174d; } .sp-tag.sp-f1 { background: #111827; }
:root[data-theme="dark"] .sp-tag.sp-f1 { background: #475569; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sp-tag.sp-f1 { background: #475569; } }
.sp-add summary { list-style: none; cursor: pointer; }
.sp-add summary::-webkit-details-marker { display: none; }
.sp-add[open] { flex-basis: 100%; }
#calendar .feed-row { flex-wrap: wrap; }
/* Spoiler snooze (Our Sports): a full-width card above the teams */
main.page > .sp-spoil { grid-column: 1 / -1 !important; }
.sp-spoil > summary span { display: flex; flex-direction: column; gap: 2px; }
.sp-spoil > summary small { color: var(--muted); font-size: calc(14px * var(--ts, 1)); font-weight: 400; }
.sp-spoil fieldset { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.sp-spoil legend { font-weight: 700; margin-bottom: 6px; }
.sp-for { display: flex; flex-wrap: wrap; gap: 8px; }
section.sp-spoil { border: 2px solid #9d174d; background: color-mix(in srgb, #9d174d 7%, var(--panel)); }
section.sp-spoil p { margin: 6px 0 12px; }

/* Home's TV Hub tile is a button (it puts the hub on the TV), dressed like the other tiles */
.tile-form { display: contents; }
button.tile { font: inherit; text-align: left; width: 100%; cursor: pointer; }

/* Home: quiz night is on the TV */
.quiz-home { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border-radius: 16px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #c026d3); box-shadow: 0 6px 18px rgba(124, 58, 237, .3); }
.quiz-home b { display: block; font-size: 1.05rem; }
.quiz-home small { opacity: .9; }
.quiz-home-i svg { width: 34px; height: 34px; --duo: rgba(255, 255, 255, .25); stroke: #fff; }

/* the phone as a TV remote */
.remote { display: grid; justify-items: center; gap: 22px; padding: 10px 0 30px; user-select: none; -webkit-user-select: none; }
.remote-pad { display: grid; grid-template-columns: repeat(3, 78px); grid-template-rows: repeat(3, 78px); gap: 8px; }
.rk { font: 700 1.6rem/1 system-ui, sans-serif; border: 0; border-radius: 20px; background: var(--panel); color: var(--ink);
  box-shadow: 0 2px 0 var(--line, #ddd), 0 4px 14px rgba(0, 0, 0, .08); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.rk:active, .rk.hit { transform: scale(.94); background: color-mix(in srgb, #4f46e5 18%, var(--panel)); }
.rk.ok { border-radius: 50%; background: #4f46e5; color: #fff; font-size: 1.2rem; }
.rk.up { grid-area: 1 / 2; } .rk.left { grid-area: 2 / 1; } .rk.ok { grid-area: 2 / 2; } .rk.right { grid-area: 2 / 3; } .rk.down { grid-area: 3 / 2; }
.rk.back { width: 150px; height: 56px; font-size: 1.05rem; border-radius: 99px; }
.remote-note { color: var(--muted, #666); font-size: .92rem; text-align: center; max-width: 34ch; min-height: 1.4em; }
.remote-note.bad { color: #dc2626; }

/* quiz night on a phone */
.quiz-phone { display: grid; gap: 14px; max-width: 520px; margin: 0 auto; }
.quiz-phone .qp-head { text-align: center; display: grid; gap: 4px; }
.quiz-phone .qp-cat { font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #a21caf; }
.quiz-phone .qp-q { font-size: 1.25rem; font-weight: 700; line-height: 1.3; margin: 0; }
.qp-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qp-ans { font: 800 1.05rem/1.25 system-ui, sans-serif; color: #fff; border: 0; border-radius: 16px; padding: 16px 12px; min-height: 96px; background: var(--qc);
  display: grid; justify-items: center; align-content: center; gap: 6px; cursor: pointer; touch-action: manipulation; transition: opacity .2s, transform .2s; }
.qp-ans .qp-shape { font-size: 1.3rem; opacity: .85; }
.qp-ans[disabled] { cursor: default; }
.qp-answers.locked .qp-ans:not(.mine) { opacity: .3; }
.qp-ans.mine { box-shadow: 0 0 0 4px var(--ink, #111); }
.qp-ans.right { box-shadow: 0 0 0 4px #16a34a; }
.qp-msg { text-align: center; font-size: 1.1rem; font-weight: 700; padding: 18px 14px; border-radius: 16px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); }
.qp-msg small { display: block; font-weight: 400; color: var(--muted); margin-top: 6px; font-size: .92rem; }
.qp-msg.good { border-color: #16a34a; background: color-mix(in srgb, #16a34a 14%, var(--panel)); }
.qp-msg.bad { border-color: #dc2626; background: color-mix(in srgb, #dc2626 12%, var(--panel)); }
.qp-msg.win { border: 0; color: #422006; background: linear-gradient(135deg, #fde68a, #f59e0b); font-size: 1.3rem; }
.qp-msg.win small { color: #713f12; }
.qp-timer { height: 8px; border-radius: 99px; background: var(--line, #ddd); overflow: hidden; }
.qp-timer i { display: block; height: 100%; background: #c026d3; transition: width .25s linear; }

/* the home camera (parents only) */
.cam-view { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center;
  width: min(100%, calc((100vh - 260px) * 16 / 9)); width: min(100%, calc((100dvh - 260px) * 16 / 9)); min-width: min(100%, 320px); margin-inline: auto; }
/* the picture is pinned to the box (not sized by the grid), so it fits the same way in every browser, full screen too */
.cam-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-view:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; max-width: none; margin: 0; }
.cam-view:-webkit-full-screen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; max-width: none; margin: 0; }
.cam-view.cam-max { position: fixed; inset: 0; z-index: 1000; border-radius: 0; aspect-ratio: auto; max-width: none; width: auto; height: auto; margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
html.cam-maxed, html.cam-maxed body { overflow: hidden; }
.cam-view.cam-max img { top: env(safe-area-inset-top, 0px); left: env(safe-area-inset-left, 0px);
  width: calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  height: calc(100% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
.cam-close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px));
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 1.2rem; cursor: pointer; }
.cam-max .cam-state { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); }
.cam-state { position: absolute; left: 10px; bottom: 10px; font-size: .82rem; padding: 4px 10px; border-radius: 99px; background: rgba(0, 0, 0, .6); color: #fff; }
.cam-state.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-right: 6px; vertical-align: 1px; }
.cam-state.bad { background: rgba(185, 28, 28, .85); }
.cam-wait { color: #cbd5e1; font-size: .95rem; }

/* who can see an album (parents) */
.album-see { display: grid; gap: 10px; }
.album-see-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.album-see-group .eyebrow { width: 100%; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.album-see-all { justify-self: start; }
.album-see-all.on { background: var(--accent, #2563eb); color: #fff; border-color: transparent; }
.form-error { color: #b91c1c; font-weight: 600; margin: 0; }

/* the Call list on Chat & Calling */
.call-row { cursor: default; }
.call-row .call-btns { display: flex; gap: 6px; margin-left: auto; margin-top: 0; justify-content: flex-end; flex-wrap: nowrap; }
.call-row .call-btns .btn { min-width: 44px; min-height: 44px; padding: 6px 10px; }
.call-row .call-btns .hi-video, .chat-title-btns .hi-video { --icb: #2563eb; font-size: 1.25em; }

/* album videos, look-alike photos, and choosing several photos */
.album-photos > a { position: relative; }
.video-badge { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .78rem;
  font-weight: 600; padding: 2px 8px; border-radius: 99px; pointer-events: none; }
.pick-mark { display: none; position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .35); color: transparent; font-weight: 700; place-items: center; pointer-events: none; }
.selecting .pick-mark { display: grid; }
.selecting [data-photo].picked .pick-mark { background: var(--accent); color: #fff; }
.selecting [data-photo].picked img { outline: 4px solid var(--accent); outline-offset: -4px; opacity: .85; }
.album-tools { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.select-bar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 30; margin-top: 10px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px;
  background: var(--panel, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 16px; box-shadow: 0 8px 24px rgba(15, 23, 42, .15); }
@media (min-width: 900px) { .select-bar { bottom: 16px; } }
.select-count { font-weight: 600; }
.select-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.send-dialog { max-width: min(440px, calc(100vw - 32px)); border: 0; padding: 20px; }
.send-dialog::backdrop { background: rgba(15, 23, 42, .5); }
.send-to { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.send-choice { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px; font-weight: 500 !important; margin: 0 !important; }
.album-dupes { margin-top: 12px; display: grid; gap: 10px; }
.album-dupes h3 { margin: 0; }
.dupe-list { display: grid; gap: 8px; }
.dupe-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px; border: 1px solid var(--line, #e2e8f0); border-radius: 12px; }
.dupe-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.dupe-row .dupe-text { flex: 1; min-width: 140px; font-size: .9rem; }
.dupe-row .dupe-text small { display: block; color: var(--muted); }
.viewer video { grid-row: 2; width: 100%; height: 100%; min-height: 0; object-fit: contain; background: #000; }
