:root { color-scheme: light dark; --ink: #1f2933; --paper: #fbfaf7; --line: #d9d5cc; --accent: #2f6f5e;
  --card: #fff; --muted: #6b7280; --notice: #fff4d6; --error: #b91c1c; --link: #1d4ed8;
  --have: #2f6f5e; --low: #a85d00; --out: #b91c1c; --on-mark: #fff; }
/* Dark mode follows the phone or computer's own setting. */
@media (prefers-color-scheme: dark) {
  :root { --ink: #e5e7eb; --paper: #14181c; --line: #343b43; --accent: #3f9a80;
    --card: #1e242a; --muted: #9ca3af; --notice: #3a3220; --error: #f87171; --link: #8ab4f8;
    --have: #4fb394; --low: #f0a43a; --out: #f87171; --on-mark: #14181c; }
}
a { color: var(--link); }
input, select, textarea { background: var(--card); color: var(--ink); }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; color: var(--ink); background: var(--paper); }
header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
header form { margin: 0; }
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 12px; color: inherit; text-decoration: none; }
.tabs a[aria-current="page"] { border-bottom: 3px solid var(--accent); font-weight: 600; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
button { font: inherit; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
input, select { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
input.link { width: 100%; }
.people { list-style: none; padding: 0; }
.people li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.people form { margin: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; }
.role { color: var(--muted); }
.add-person { display: grid; gap: 10px; }
.notice { background: var(--notice); padding: 8px 12px; border-radius: 8px; }

/* Calendar */
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.legend .dot { display: inline-block; vertical-align: middle; }
.week { display: grid; gap: 10px; }
.day { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--card); }
.day.today { border-color: var(--accent); border-width: 2px; }
.day h2 { margin: 0 0 4px; font-size: 1.05rem; }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item.allday .what { font-weight: 600; }
.item .dot { display: inline-block; flex: none; }
.item .when, .item .where { color: var(--muted); font-size: 0.9rem; }
.empty { margin: 0; }
.add { display: inline-block; margin-top: 4px; color: var(--accent); text-decoration: none; font-weight: 600; }
@media (min-width: 900px) {
  main:has(.week) { max-width: 1200px; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; }
  .week:has(> .day:only-child) { grid-template-columns: minmax(0, 640px); }
}

/* Grocery list: big targets, used one-handed in a store */
.add-item { display: flex; gap: 8px; margin: 8px 0 16px; }
.add-item input { flex: 1; min-width: 0; font: inherit; font-size: 1.15rem; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.add-item button { min-height: 48px; padding: 0 20px; font-size: 1.1rem; }
.grocery, .chores { list-style: none; margin: 0 0 16px; padding: 0; }
.grocery-item, .chore-item { border-bottom: 1px solid var(--line); }
.grocery-item form, .chore-item form { margin: 0; }
.tick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.big-check { display: flex; align-items: center; gap: 14px; flex: 1; min-height: 56px; font-size: 1.2rem; cursor: pointer; }
.big-check input { width: 32px; height: 32px; flex: none; }
.grocery-item.is-done .text, .chore-item.is-done .text { text-decoration: line-through; color: var(--muted); }
.grocery .trip, .grocery .by { color: var(--muted); font-size: 0.85rem; }
.tick-submit { min-height: 48px; min-width: 96px; }

/* Chore tiles: the whole tile is the button. Outlined with the kid's color on the left edge until done, then filled. */
.chores:has(.chore-tile) { display: grid; gap: 10px; }
.chore-item:has(.chore-tile) { border-bottom: 0; }
.chore-tile { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 10px 16px; font: inherit; font-size: 1.3rem; text-align: left;
  color: var(--ink); background: var(--card); border: 2px solid var(--line); border-left: 12px solid var(--kid, var(--accent)); border-radius: 14px; cursor: pointer; }
.chore-tile .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chore-tile .tile-mark { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 3px solid var(--muted); border-radius: 50%; }
.chore-tile .tile-mark svg { visibility: hidden; }
.chore-tile .tile-note { flex: none; font-size: 0.9rem; opacity: 0.85; }
.chore-tile:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
.chore-tile:active { transform: scale(0.99); }
.chore-tile[aria-busy="true"] { opacity: 0.7; }
.chore-tile.is-done { background: var(--kid, var(--accent)); color: var(--on, #fff); border-color: var(--kid, var(--accent)); }
.chore-tile.is-done .tile-mark { border-color: var(--on, #fff); }
.chore-tile.is-done .tile-mark svg { visibility: visible; }
.chore-tile.is-done .text { text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.85; }
.chore-tile.is-locked { cursor: default; }
.chore-tile.is-locked:active { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.list-switch { display: flex; gap: 8px; margin: 0 0 12px; }
.list-switch a { flex: 1; text-align: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; background: var(--card); }
.list-switch a[aria-current="page"] { border-color: var(--accent); font-weight: 700; }
.kid-chores .chores:has(.chore-tile) { padding: 12px; }
body.kiosk .chore-tile { font-size: 1.5rem; min-height: 76px; }
.more { padding: 0 0 8px 46px; }
.more summary { cursor: pointer; padding: 8px 0; color: var(--muted); }
.more form { display: flex; gap: 8px; margin-top: 6px; }
.more .edit input { flex: 1; min-width: 0; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.chore-person h2 { display: flex; align-items: center; gap: 8px; }
.chore-person h2 small { color: var(--muted); font-weight: normal; font-size: 0.9rem; }
.approval-list { list-style: none; padding: 0; margin: 0; }
.approval-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.approval-item > div { flex: 1 1 14rem; }
.approval-item form { margin: 0; }
.grid-scroll { overflow-x: auto; max-width: 100%; }
.chore-grid { border-collapse: collapse; width: 100%; }
.chore-grid th, .chore-grid td { padding: 2px; text-align: center; font-size: 0.85rem; }
.chore-grid th[scope="row"] { text-align: left; font-weight: normal; font-size: 0.95rem; min-width: 7rem; overflow-wrap: anywhere; }
.chore-grid .cell { display: flex; align-items: center; justify-content: center; min-width: 40px; min-height: 44px; }
.chore-grid input[type="checkbox"] { width: 22px; height: 22px; }
.chore-list { list-style: none; margin: 0 0 12px; padding: 0; }
.chore-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.chore-list form { margin: 0; }
.error { color: var(--error); }

/* Trips */
.trips { list-style: none; margin: 0 0 16px; padding: 0; }
.trips li { border-bottom: 1px solid var(--line); }
.trip-link { display: block; padding: 16px 0; font-size: 1.2rem; min-height: 56px; }
.when { color: var(--muted); font-size: 0.95rem; }
.trip-items { list-style: none; margin: 0 0 16px; padding: 0; }
.trip-item { border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.trip-item form { margin: 0; }
.trip-item .tick { flex: 1; }
.trip-item button { min-height: 48px; }
.trip-item.is-done .text { text-decoration: line-through; color: var(--muted); }
.trip-group h2 { display: flex; align-items: center; gap: 8px; }
.trip-group h2 small { color: var(--muted); font-weight: normal; font-size: 0.9rem; }
.sent { color: var(--muted); }
.stack input, .add-item select { font: inherit; font-size: 1.15rem; padding: 12px; border: 1px solid var(--line); border-radius: 8px; max-width: 100%; }
.stack button { min-height: 48px; padding: 0 20px; font-size: 1.1rem; }

/* Kitchen wall tablet (about 1280x800 landscape): bigger type, wider page, color per person. */
body.kiosk { font-size: 20px; }
body.kiosk header { padding: 6px 20px; }
body.kiosk main { max-width: none; padding: 12px 20px; }
body.kiosk h1 { margin: 0 0 6px; font-size: 1.7rem; }
body.kiosk .week { grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; gap: 8px; }
body.kiosk .day h2 { font-size: 1.1rem; }
body.kiosk .item .when, body.kiosk .item .where { font-size: 0.85rem; }
body.kiosk .item { font-size: 0.95rem; }
body.kiosk .item .dot, body.kiosk .legend .dot { width: 16px; height: 16px; }
.chores-title { margin: 14px 0 6px; font-size: 1.4rem; }
.kid-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.kid-chores { border: 3px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.kid-name { margin: 0; padding: 12px 16px; font-size: 2rem; color: #fff; }
.kid-name small { font-size: 1rem; font-weight: 400; }
.kid-chores .chores { list-style: none; margin: 0; padding: 0 12px; }
.kid-chores .empty { padding: 0 16px; }

/* Color picker on People: swatches as radio buttons, plus "Pick your own" */
.colors { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.colors legend { padding: 0; margin-bottom: 6px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span:not(.sr) { display: block; width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; outline: 1px solid var(--line); }
.swatch input:checked + span { border-color: var(--paper); outline: 3px solid var(--ink); }
.swatch input:focus-visible + span { outline: 3px solid var(--link); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.colors .custom { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 4px; }
.colors .custom input[type="color"] { width: 56px; height: 40px; padding: 2px; }
.edit-person { width: 100%; }
.edit-person summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.edit-person form { margin: 8px 0 12px; }

/* Forms: each label on its own line with its box full width under it (phones squeezed them side by side). */
form label:not(.swatch):not(.custom):not(.big-check) { display: block; margin: 8px 0; }
form label:not(.swatch):not(.custom):not(.big-check) > input:not([type="checkbox"]):not([type="radio"]),
form label:not(.swatch):not(.custom):not(.big-check) > select,
form label:not(.swatch):not(.custom):not(.big-check) > textarea { display: block; width: 100%; margin-top: 4px; min-height: 48px; }
.stack input { width: 100%; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
form label:not(.swatch):not(.custom):not(.big-check) > textarea { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; min-height: 96px; }
form fieldset:not(.colors) { border: 1px solid var(--line); border-radius: 10px; }
form label > input[type="checkbox"] { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
input.link { max-width: 100%; min-width: 0; }

/* Heroes: the builder */
.hero-now { text-align: center; }
.pick-group { margin: 12px 0; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.picks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.picks-grid small { text-align: center; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pick small { color: var(--muted); font-size: 0.8rem; }
.pick-face { display: flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 2px; border: 3px solid transparent; border-radius: 12px; outline: 1px solid var(--line); background: var(--card); }
.pick input:checked + .pick-face { border-color: var(--paper); outline: 3px solid var(--ink); }
.pick input:focus-visible + .pick-face { outline: 3px solid var(--link); }
.dot-face { display: block; width: 40px; height: 40px; border-radius: 50%; }
.step-title { margin: 20px 0 4px; font-size: 1.15rem; }
.hero-tabs[hidden], .hero-surprise[hidden], .hero-step[hidden] { display: none; }
/* Save and Cancel stay in reach at the bottom of a phone screen. */
.hero-save { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 12px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
.hero-save button { min-height: 48px; padding: 0 20px; }
.hero-save .primary { font-size: 1.1rem; font-weight: 600; }
.hero-save a { margin-left: auto; padding: 12px 4px; }
/* With the script: the preview stays at the top while picking, with the three tabs beside it. */
.hero-builder.live .hero-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 6px 0; background: var(--paper); border-bottom: 1px solid var(--line); }
.hero-builder.live .hero-now { flex: none; line-height: 0; }
.hero-builder.live .hero-now svg { width: 118px; height: 118px; }
.hero-builder.live .step-title { display: none; }
.hero-tabs { flex: 1; display: flex; flex-direction: column; gap: 5px; max-width: 240px; }
.hero-tabs button { min-height: 38px; padding: 4px 14px; font-weight: 600; text-align: left; }
.hero-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 800px) {
  main:has(.hero-builder.live) { max-width: 1000px; }
  .hero-builder.live { display: grid; grid-template-columns: 260px minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .hero-builder.live .hero-top { grid-column: 1; grid-row: 1 / span 2; flex-direction: column; align-items: stretch;
    top: 16px; border-bottom: 0; }
  .hero-builder.live .hero-now { text-align: center; }
  .hero-builder.live .hero-now svg { width: 240px; height: 240px; }
  .hero-builder.live .hero-tabs { max-width: none; }
  .hero-builder.live .hero-steps, .hero-builder.live .hero-save { grid-column: 2; }
}

/* Chore Quest board: dark parchment and gold in both themes; the words around it follow the theme. */
.quest { margin: 12px 0 20px; }
.quest-title { margin: 0 0 8px; font-family: Georgia, 'Times New Roman', serif; }
.quest-title small { color: var(--muted); font-weight: normal; font-size: 0.9rem; margin-left: 6px; }
.quest-frame { max-width: 480px; margin: 0 auto; border: 3px solid #d4a94a; border-radius: 14px; overflow: hidden; background: #15110c;
  box-shadow: 0 0 0 4px #2a2016, 0 6px 18px rgba(0, 0, 0, .45); }
.quest-map, .quest-day { display: block; height: auto; }
/* Week / Today: quest-view.js shows the switch and one map at a time. Without it both maps show. */
.quest-switch { display: flex; justify-content: center; margin: 0 0 10px; }
.quest-switch[hidden], .quest-frame[hidden] { display: none; }
.quest-switch button { min-width: 96px; border: 2px solid #d4a94a; border-radius: 0; font-family: Georgia, 'Times New Roman', serif; }
.quest-switch button:first-child { border-radius: 10px 0 0 10px; }
.quest-switch button:last-child { border-radius: 0 10px 10px 0; margin-left: -2px; }
.quest-switch button[aria-pressed="true"] { background: #d4a94a; color: #1a130b; font-weight: 700; }
.quest-frame + .quest-frame { margin-top: 14px; }
/* Each map comes in two shapes; exactly one shows. Tall by default, wide on landscape screens. */
.quest-map--wide { display: none; }
.quest-day--wide { display: none; }
@media (min-width: 900px) and (orientation: landscape) {
  .quest-map--tall { display: none; }
  .quest-day--tall { display: none; }
  .quest-map--wide { display: block; }
  .quest-day--wide { display: block; }
  /* The wide board breaks out of the narrow page column so its words stay readable. */
  .quest-frame { width: min(1240px, calc(100vw - 40px)); max-width: none; margin-left: 50%; transform: translateX(-50%); }
  .quest-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); column-gap: 24px; }
}
.quest-key { font-size: 0.85rem; color: var(--muted); text-align: center; margin: 8px 0; }
.quest-roster { list-style: none; padding: 0; margin: 8px 0 0; }
.quest-roster li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quest-roster li > div { flex: 1; min-width: 0; }
.quest-roster .hero { flex: none; }
.quest-balance { font-weight: 700; white-space: nowrap; }
.quest-today { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 2px 0; font-size: 0.9rem; }
.quest-today-n { margin-right: 4px; font-weight: 600; }
.quest-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--dot); box-sizing: border-box; }
.quest-dot.is-done { background: var(--dot); }
.quest-today.is-approved .quest-dot { box-shadow: 0 0 0 2px #d4a94a; }
@media (prefers-reduced-motion: no-preference) {
  .qb-spark { animation: qb-twinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .qb-glow { animation: qb-pulse 2s ease-in-out infinite; }
  @keyframes qb-twinkle { 0%, 100% { opacity: .25; scale: .6; } 50% { opacity: 1; scale: 1.15; } }
  @keyframes qb-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
}
/* A big portrait screen in the kitchen: the tall board on the left, the kids beside it. A landscape
   kitchen tablet gets the wide board with the kids under it instead. */
@media (min-width: 900px) and (orientation: portrait) {
  body.kiosk .quest { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 4px 24px; align-items: start; }
  body.kiosk .quest-title { grid-column: 1 / -1; }
  body.kiosk .quest-maps { grid-column: 1; grid-row: 2; }
  body.kiosk .quest-frame { width: 100%; margin: 0; }
  body.kiosk .quest-frame + .quest-frame { margin-top: 14px; }
  body.kiosk .quest-key { grid-column: 1; grid-row: 3; }
  body.kiosk .quest-roster { grid-column: 2; grid-row: 2 / span 2; margin: 0; }
}
.quest-week { display: block; margin-top: 4px; }
/* Bosses: a card per boss under the board, and the parents' post form. */
.bosses { margin: 12px 0; }
.boss-card { border: 2px solid #d4a94a; border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; background: var(--card); }
.boss-card.is-beaten { border-color: var(--line); opacity: .85; }
.boss-kicker { margin: 0; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: .04em; }
.boss-name { margin: 2px 0; font-family: Georgia, 'Times New Roman', serif; }
.boss-job { margin: 0 0 4px; }
.boss-bonus { margin: 0; font-weight: 700; }
.boss-state { margin: 6px 0 0; font-weight: 600; }
.boss-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.boss-act { margin: 0; }
.boss-act button { min-height: 44px; }
.boss-post { margin: 8px 0; }
.boss-post summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.boss-post label { display: block; margin: 8px 0; }
.boss-post input, .boss-post select { display: block; width: 100%; max-width: 28rem; margin-top: 4px; }
@media (min-width: 900px) and (orientation: portrait) { body.kiosk .bosses { grid-column: 1 / -1; } }

/* Month view: seven columns that always fit; titles show only when there is room */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: 8px; }
.mhead { text-align: center; font-size: 0.8rem; color: var(--muted); padding: 2px 0; }
.mcell { position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--card); padding: 2px 3px; min-width: 0; min-height: 92px; overflow: hidden; }
.mnum::after { content: ''; position: absolute; inset: 0; }
.mcell.out { opacity: 0.55; background: transparent; }
.mcell.today { border-color: var(--accent); border-width: 2px; }
.mcell.today .mnum { background: var(--accent); color: #fff; border-radius: 50%; }
.mnum { display: inline-block; min-width: 1.6em; text-align: center; font-size: 0.85rem; font-weight: 600; text-decoration: none; color: var(--ink); line-height: 1.6em; }
.mitems { list-style: none; margin: 0; padding: 0; }
.mi { display: flex; align-items: center; gap: 2px; min-width: 0; font-size: 10.5px; line-height: 1.3; margin-top: 2px; }
.mi .dot { flex: none; width: 6px; height: 6px; }
.mi .dot + .dot { display: none; }
.mi .mw { display: none; color: var(--muted); flex: none; }
.mi .mt { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmore { font-size: 0.7rem; color: var(--muted); }
@media (min-width: 700px) {
  main:has(.month) { max-width: 1200px; }
  .mcell { min-height: 100px; padding: 3px 5px; }
  .mi { font-size: 0.75rem; gap: 3px; }
  .mi .dot { width: 8px; height: 8px; }
  .mi .dot + .dot { display: inline-block; }
  .mi .mw { display: block; }
  .mmore { margin-top: 2px; }
}
body.kiosk .chore-tile .tile-note { display: none; }

/* Kitchen tablet: one big button to the Lists page, and a big way back from it. */
.kitchen-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.kitchen-lists, .kitchen-back { display: inline-flex; align-items: center; min-height: 56px; padding: 0 22px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.kitchen-back { margin: 0 0 4px; }
.kitchen-lists:focus-visible, .kitchen-back:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }

/* Lists page: grocery list grouped by store section, then On hand. */
.list-switch a { font-weight: 600; }
.add-grocery, .edit-grocery, .add-pantry form, .edit-pantry { margin: 0 0 12px; }
.add-grocery input, .add-grocery select, .add-pantry input, .add-pantry select { font-size: 1.1rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.add-grocery button.primary, .add-pantry button.primary { width: 100%; min-height: 52px; font-size: 1.15rem; }
.grocery + h3, h3.section, h3.place { margin: 18px 0 2px; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.grocery .qty { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 0.95rem; white-space: nowrap; }
.edit-grocery button, .edit-pantry button, .more form button { min-height: 44px; }
.more .edit-grocery, .more .edit-pantry { display: block; }
.bought-before { margin: 4px 0 8px; }
.bought-before h3 { margin: 0 0 6px; font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips form { margin: 0; }
.chip { min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); font-size: 1rem; }
.chip small { color: var(--muted); }
.chip:active { transform: scale(0.97); }
#on-hand { margin-top: 32px; padding-top: 16px; border-top: 2px solid var(--line); }
.hint { color: var(--muted); margin: 0 0 4px; }
.pantry { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.pantry-item { background: var(--card); border: 2px solid var(--line); border-left: 10px solid var(--have); border-radius: 14px; padding: 10px 12px; }
.pantry-item.is-low { border-left-color: var(--low); }
.pantry-item.is-out { border-left-color: var(--out); }
.pantry-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pantry-line .name { flex: 1 1 140px; min-width: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.pantry-line .name small { display: block; color: var(--muted); font-size: 0.9rem; }
.status-pick { display: flex; gap: 6px; margin: 0; flex: 1 1 220px; }
.status-pick button { flex: 1; min-height: 52px; font-size: 1.05rem; font-weight: 600; border: 2px solid var(--line); border-radius: 12px; }
.status-pick button:active { transform: scale(0.97); }
.status-pick button[aria-pressed="true"].mark-have { background: var(--have); border-color: var(--have); color: var(--on-mark); }
.status-pick button[aria-pressed="true"].mark-low { background: var(--low); border-color: var(--low); color: var(--on-mark); }
.status-pick button[aria-pressed="true"].mark-out { background: var(--out); border-color: var(--out); color: var(--on-mark); }
.status-badge { padding: 6px 14px; border-radius: 999px; font-weight: 600; border: 2px solid currentColor; }
.status-badge.mark-have { color: var(--have); }
.status-badge.mark-low { color: var(--low); }
.status-badge.mark-out { color: var(--out); }
.pantry-item .more { padding: 4px 0 0; }
.add-pantry { margin: 16px 0; }
.add-pantry summary, .pantry-item .more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.add-pantry summary { font-weight: 600; color: var(--link); }
.setting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0 24px; }
.setting span { flex: 1 1 200px; }
.setting button { min-height: 44px; }

/* Tablet view: header buttons, the parent unlock link and page, the unlock code form on People. */
.who { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; }
.who form { margin: 0; }
.who button { min-height: 44px; }
header { gap: 8px; }
.unlock-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 0.95rem; color: var(--muted); }
.unlock-form input { display: block; width: 100%; max-width: 320px; min-height: 64px; margin: 4px 0 12px; font-size: 2rem; letter-spacing: 0.3em; text-align: center; }
.unlock-form button.primary { width: 100%; max-width: 320px; min-height: 56px; font-size: 1.2rem; }
.tablet-setup { margin-top: 32px; padding-top: 16px; border-top: 2px solid var(--line); }
.tablet-setup input { display: block; width: 100%; min-height: 48px; font-size: 1.3rem; letter-spacing: 0.2em; }
.tablet-setup button { min-height: 48px; }
.code-state { margin: 0 0 4px; }
.tablet-go { margin-top: 16px; }
.tablet-go button { width: 100%; min-height: 52px; }

/* Device timer: big countdowns, red at Time's up, big Start/Pause and quick Ask buttons. */
.timer-card { background: var(--card); border: 2px solid var(--line); border-left: 12px solid var(--kid, var(--accent)); border-radius: 14px; padding: 12px 16px; margin: 0 0 12px; }
.timer-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1.3rem; }
.timer-card h2 small { color: var(--muted); font-weight: normal; font-size: 0.9rem; margin-left: auto; }
.timer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.timer-clock { font-size: 2.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.timer-clock.big { font-size: 4.5rem; text-align: center; margin: 8px 0 0; }
.timer-clock.small { font-size: 1.3rem; }
.timer-clock.is-up { color: var(--error); }
.timer-clock.big.is-up { font-size: 3.4rem; }
.timer-status { color: var(--muted); margin: 2px 0 8px; }
.timer-mine .timer-status { text-align: center; font-size: 1.1rem; }
.timer-go { margin: 0; }
.timer-go button { min-height: 56px; min-width: 132px; font-size: 1.25rem; font-weight: 700; border-radius: 12px; }
.timer-go button:disabled { opacity: 0.45; cursor: default; }
.timer-mine .timer-go button { width: 100%; min-height: 64px; font-size: 1.4rem; }
.timer-row .timer-go { margin-left: auto; }
.timer-ask { margin-top: 4px; }
.timer-ask summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--link); font-weight: 600; }
.timer-ask-own { margin: 20px 0; }
.timer-ask-own h2 { margin: 0 0 4px; }
.ask-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.ask-quick button { min-height: 64px; font-size: 1.15rem; font-weight: 700; border: 2px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.ask-quick button small { font-weight: normal; font-size: 0.85rem; color: var(--muted); }
.ask-quick button:disabled { opacity: 0.4; cursor: default; }
.ask-quick button:not(:disabled):active { transform: scale(0.97); }
.ask-number { margin: 4px 0 8px; }
.ask-number .ask-buys { display: block; min-height: 1.5em; color: var(--muted); margin: 0 0 6px; }
.ask-number button { min-height: 48px; padding: 0 24px; }
.timer-others ul { list-style: none; margin: 0; padding: 0; }
.timer-others li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timer-others .name { flex: 1 1 6rem; }
.timer-others .timer-status { margin: 0; flex-basis: 100%; padding-left: 24px; font-size: 0.9rem; }
.timer-others .dot, .timer-strip .dot { display: inline-block; flex: none; }
.timer-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 4px 0 10px; padding: 8px 14px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; }
.timer-strip .strip-link { font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.timer-strip .strip-item { display: inline-flex; align-items: center; gap: 8px; }
.timer-strip .hint { margin: 0; }
.timer-grid { display: grid; gap: 12px; }
.timer-grid .timer-card { margin: 0; }
@media (min-width: 900px) {
  main:has(.timer-grid) { max-width: 1100px; }
  .timer-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
}
.timer-rate { margin: 12px 0 10px; }
.timer-card .timer-clock.is-up:not(.big) { font-size: 2rem; }
.ask-number button.primary { width: 100%; min-height: 52px; font-size: 1.15rem; }
