@font-face { font-family: Fell; src: url(/fonts/fell.ttf); font-display: swap; }
@font-face { font-family: Lora; src: url(/fonts/lora.ttf); font-weight: 400 700; font-display: swap; }
@font-face { font-family: Nunito; src: url(/fonts/nunito.ttf); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: Rajdhani; src: url(/fonts/rajdhani.ttf); font-display: swap; }
@font-face { font-family: ShareTech; src: url(/fonts/sharetech.ttf); font-display: swap; }

/* The same looks as the wall, chosen per person, each with a day and a night version. */
body[data-theme="storybook"] {
  --bg: #f7eedb; --card: #fffaee; --ink: #2e2418; --soft: #5e4e38; --line: #b7995f; --accent: #7a2e2a; --on: #fffaee; --tint: #efe0bf;
  --head: Fell, serif; --body: Lora, serif; --radius: 6px; --rule: 3px double #b7995f; --headweight: 400; --headcase: none;
}
body[data-theme="storybook-night"] {
  --bg: #1c1612; --card: #27201a; --ink: #f3e9d6; --soft: #c4b295; --line: #6e5a3c; --accent: #e9a093; --on: #2a120f; --tint: #3d3023;
  --head: Fell, serif; --body: Lora, serif; --radius: 6px; --rule: 3px double #6e5a3c; --headweight: 400; --headcase: none; color-scheme: dark;
}
body[data-theme="sunny"] {
  --bg: #fbf8f2; --card: #ffffff; --ink: #1f2933; --soft: #4b5766; --line: #e4dccb; --accent: #1c6477; --on: #ffffff; --tint: #fff0c9;
  --head: Nunito, sans-serif; --body: Nunito, sans-serif; --radius: 16px; --rule: 1px solid #e4dccb; --headweight: 800; --headcase: none;
}
body[data-theme="sunny-night"] {
  --bg: #121a1f; --card: #1a252c; --ink: #eaf2f5; --soft: #a9bcc6; --line: #31444f; --accent: #6cc7dd; --on: #06222a; --tint: #3a3320;
  --head: Nunito, sans-serif; --body: Nunito, sans-serif; --radius: 16px; --rule: 1px solid #31444f; --headweight: 800; --headcase: none; color-scheme: dark;
}
body[data-theme="ocean"] {
  --bg: #eaf3f8; --card: #ffffff; --ink: #12273a; --soft: #45607a; --line: #c3d9e8; --accent: #155a8a; --on: #ffffff; --tint: #d7ebf7;
  --head: Nunito, sans-serif; --body: Nunito, sans-serif; --radius: 14px; --rule: 1px solid #c3d9e8; --headweight: 800; --headcase: none;
}
body[data-theme="ocean-night"] {
  --bg: #0d1722; --card: #142232; --ink: #e6f0f8; --soft: #a3b9cc; --line: #2c445c; --accent: #7cc0f0; --on: #06233a; --tint: #1c3350;
  --head: Nunito, sans-serif; --body: Nunito, sans-serif; --radius: 14px; --rule: 1px solid #2c445c; --headweight: 800; --headcase: none; color-scheme: dark;
}
body[data-theme="forest"] {
  --bg: #eef1e6; --card: #fbfcf6; --ink: #1f2a1d; --soft: #4c5c46; --line: #b9c4a6; --accent: #2f5d3a; --on: #ffffff; --tint: #dde6cc;
  --head: Fell, serif; --body: Lora, serif; --radius: 8px; --rule: 3px double #b9c4a6; --headweight: 400; --headcase: none;
}
body[data-theme="forest-night"] {
  --bg: #121a12; --card: #1a241a; --ink: #e9f1e4; --soft: #aebfa7; --line: #3a4d36; --accent: #96cf8f; --on: #0d2210; --tint: #28371f;
  --head: Fell, serif; --body: Lora, serif; --radius: 8px; --rule: 3px double #3a4d36; --headweight: 400; --headcase: none; color-scheme: dark;
}
body[data-theme="blossom"] {
  --bg: #fbf0f2; --card: #fffafb; --ink: #33202a; --soft: #6b4d5c; --line: #e8c6d0; --accent: #93356a; --on: #ffffff; --tint: #f7dde5;
  --head: Nunito, sans-serif; --body: Nunito, sans-serif; --radius: 18px; --rule: 1px solid #e8c6d0; --headweight: 800; --headcase: none;
}
body[data-theme="blossom-night"] {
  --bg: #1d1319; --card: #291c24; --ink: #f6e8ee; --soft: #cbb0bd; --line: #57384a; --accent: #f0a0cc; --on: #34101f; --tint: #3d2533;
  --head: Nunito, sans-serif; --body: Nunito, sans-serif; --radius: 18px; --rule: 1px solid #57384a; --headweight: 800; --headcase: none; color-scheme: dark;
}
body[data-theme="steel"] {
  --bg: #e4e7ea; --card: #f6f7f8; --ink: #1b232b; --soft: #47535f; --line: #8c99a6; --accent: #1f4e79; --on: #ffffff; --tint: #cfd8e1;
  --head: Rajdhani, sans-serif; --body: Rajdhani, sans-serif; --radius: 3px; --rule: 1px solid #8c99a6; --headweight: 600; --headcase: uppercase;
}
body[data-theme="steel-night"] {
  --bg: #14171a; --card: #1e2327; --ink: #e8edf1; --soft: #a7b2bc; --line: #4a545d; --accent: #8fb8dc; --on: #0b1d2c; --tint: #2a333b;
  --head: Rajdhani, sans-serif; --body: Rajdhani, sans-serif; --radius: 3px; --rule: 1px solid #4a545d; --headweight: 600; --headcase: uppercase; color-scheme: dark;
}
body[data-theme="modern"] {
  --bg: #ffffff; --card: #f4f4f5; --ink: #09090b; --soft: #52525b; --line: #d4d4d8; --accent: #4338ca; --on: #ffffff; --tint: #e0e7ff;
  --head: system-ui, Roboto, sans-serif; --body: system-ui, Roboto, sans-serif; --radius: 12px; --rule: 1px solid #d4d4d8; --headweight: 800; --headcase: none;
}
body[data-theme="modern-night"] {
  --bg: #09090b; --card: #18181b; --ink: #fafafa; --soft: #a1a1aa; --line: #3f3f46; --accent: #a5b4fc; --on: #12123a; --tint: #27273f;
  --head: system-ui, Roboto, sans-serif; --body: system-ui, Roboto, sans-serif; --radius: 12px; --rule: 1px solid #3f3f46; --headweight: 800; --headcase: none; color-scheme: dark;
}
body[data-theme="robot"] {
  --bg: #eef2f1; --card: #fbfdfc; --ink: #0f1f1d; --soft: #3f5753; --line: #7fa8a1; --accent: #006b5f; --on: #ffffff; --tint: #d2ebe6;
  --head: ShareTech, monospace; --body: ShareTech, monospace; --radius: 0px; --rule: 1px solid #7fa8a1; --headweight: 400; --headcase: none;
}
body[data-theme="robot-night"] {
  --bg: #050b0a; --card: #0b1615; --ink: #d6fff5; --soft: #86bcb1; --line: #1f4a43; --accent: #3ef0c8; --on: #02201a; --tint: #0f2f29;
  --head: ShareTech, monospace; --body: ShareTech, monospace; --radius: 0px; --rule: 1px solid #1f4a43; --headweight: 400; --headcase: none; color-scheme: dark;
}
body[data-theme="digital"] {
  --bg: #b7c4a0; --card: #c6d2af; --ink: #14190f; --soft: #323c26; --line: #5d6b48; --accent: #14190f; --on: #d8e3c2; --tint: #a7b58e;
  --head: ShareTech, monospace; --body: ShareTech, monospace; --radius: 8px; --rule: 1px solid #5d6b48; --headweight: 400; --headcase: uppercase;
}
body[data-theme="digital-night"] {
  --bg: #06222a; --card: #0a3039; --ink: #bff6f2; --soft: #7cc6c6; --line: #1f5a64; --accent: #72f0e6; --on: #032a2c; --tint: #0f424c;
  --head: ShareTech, monospace; --body: ShareTech, monospace; --radius: 8px; --rule: 1px solid #1f5a64; --headweight: 400; --headcase: uppercase; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.4 var(--body); }
#view { max-width: 40rem; margin: 0 auto; padding: 16px 16px 96px; }
h1, h2, h3 { font-family: var(--head); font-weight: var(--headweight); line-height: 1.15; text-transform: var(--headcase); }
h1 { font-size: 2rem; color: var(--accent); margin: 8px 0 4px; text-align: center; }
h2 { font-size: 1.35rem; margin: 18px 0 8px; }
h3 { font-size: 1.2rem; margin: 12px 0 4px; }
button, input, select { font: inherit; min-height: 44px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--accent); }
button { background: var(--card); color: var(--accent); font-weight: 600; cursor: pointer; }
button.primary, button.approve { background: var(--accent); color: var(--on); }
button.primary { width: 100%; }
button.approve { background: #2e6b45; border-color: #2e6b45; }
button.quiet { border-color: var(--line); font-weight: 400; }
button + button { margin-top: 8px; }
input, select { width: 100%; margin: 4px 0 10px; background: var(--card); color: var(--ink); border-color: var(--line); }
/* The signed-in app: the name and a box for each section along the top, then two tidy columns. */
body.app #view { max-width: 80rem; padding: 0 0 32px; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px;
  background: var(--card); border-bottom: var(--rule); padding: 8px 16px; }
.brand { font-family: var(--head); font-weight: var(--headweight); font-size: 1.35rem; color: var(--accent); margin-right: auto;
  display: flex; align-items: center; line-height: 1.1; }
.brand small { display: block; font-family: var(--body); font-size: .75rem; }
.brand .house { width: 2rem; height: 2rem; margin-right: .5rem; }
h1.brand { justify-content: center; margin: 8px 0 16px; text-align: left; }
/* Sized with the name beside it. */
.house { width: 1.15em; height: 1.15em; border-radius: 22%; vertical-align: -.2em; margin-right: .4em; }
.topbar nav { display: flex; flex-basis: 100%; gap: 6px; overflow-x: auto; scrollbar-width: none; position: relative; }
.topbar nav button { flex: 1 0 auto; min-width: 4.8rem; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 8px 5px; font-size: .8rem; background: var(--bg); color: var(--soft); border: 1px solid var(--line); }
.topbar nav button.on { background: var(--accent); border-color: var(--accent); color: var(--on); }
.topbar nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 60rem) { .topbar nav { flex-basis: auto; } .topbar nav button { flex: 0 0 auto; } }
body.app header { padding: 14px 16px 10px; }
body.app header h1 { text-align: left; margin: 0 0 2px; }
header p { margin: 0; color: var(--soft); font-size: .85rem; }
/* One column on a phone, with what you add first; from 60rem the lists are left and wider, adding on the right. */
.panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; padding: 0 16px; }
.panels .card { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.stack, .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.col.side { order: -1; }
.col:empty { display: none; }
.wide { grid-column: 1 / -1; }
@media (min-width: 60rem) {
  .panels { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .col.side { order: 0; }
  .panels > .card, .panels > .stack { grid-column: span 1; }
}
/* Overview: today's numbers across the top, then three columns. */
.trio { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@media (min-width: 40rem) { .trio { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .trio { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats button { padding: 8px 12px; }
.trio .when { width: 4.2rem; }
/* Two dinner days, or two or three people, side by side where there is room. */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); column-gap: 20px; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 10px; align-items: start; margin-bottom: 8px; }
.people .person { margin: 0; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 8px; margin-bottom: 10px; }
.swatches button, .modes button { margin: 0; }
.modes { display: flex; gap: 8px; }
.modes button { flex: 1; }
/* Settings and Messages have no add column: even boxes. */
@media (min-width: 40rem) { .panels:not(:has(> .col)):not(:has(> .trio)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .panels:not(:has(> .col)):not(:has(> .trio)) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Add buttons under a page's heading, and the pop-ups they open. */
.tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; order: -2; }
.tools button, button.add { width: auto; margin: 0; }
button.add.primary { width: auto; }
dialog.popup { width: min(26rem, 94vw); max-height: 90vh; overflow-y: auto; margin: auto; }
dialog.popup h2 { margin-top: 0; }
dialog.popup button { width: 100%; margin-top: 8px; }
dialog.popup .toggles button, dialog.popup button.quiet.inline { width: auto; }
dialog.popup .error { min-height: 1.2em; margin: 8px 0 0; }
dialog::backdrop { background: rgba(46, 36, 24, .45); }
.picker .add { margin-left: auto; }
.picker { display: flex; flex-wrap: wrap; gap: 8px; order: -2; }
.picker button { margin: 0; min-width: 9rem; }
.picker button.on { background: var(--accent); color: var(--on); }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 8px 0; }
.item p { margin: 0; }
.item button { margin: 0; flex: none; }
/* A question with two answers: the words on their own line, the buttons under them. */
.item.verdict { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.item.verdict > div { flex: 1 0 100%; }
.item.verdict button.primary { width: auto; }
.ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); column-gap: 16px; }
.tickline input { accent-color: var(--accent); }
.kidgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 12px; }
.notices { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 12px; }
.notices p { margin: 0; }
.notices button { margin: 0; background: var(--tint); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; }
.stats button { margin: 0; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 12px 14px;
  border-color: var(--line); overflow-wrap: anywhere; }
.stat span { color: var(--soft); font-size: .88rem; font-weight: 400; }
.stat strong { font-weight: 600; font-size: 1.4rem; line-height: 1.25; font-variant-numeric: lining-nums; }
button.more { display: block; margin-top: 10px; border-color: var(--line); font-weight: 400; }
small.block { display: block; }
.person .actions { margin-bottom: 4px; }
.unread summary strong { color: var(--accent); }
.prayer summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
a.reply { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 600; }
.card, .person, dialog { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.card > h2 { margin-top: 0; }
.person { margin-bottom: 10px; }
.card .grid .card { background: var(--bg); }
.pinned { border: 2px solid var(--accent); }
.soft, small { color: var(--soft); font-size: .88rem; }
p.soft { margin: 8px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--tint); padding: 5px 10px; border-radius: var(--radius); font-size: .9rem; }
.row, .plan { display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 6px 0; }
.plan input { margin: 0; flex: 1; }
.tickline { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.tickline input { width: 22px; height: 22px; margin: 0; flex: none; }
.when { width: 5.2rem; flex: none; color: var(--soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 10px; margin-bottom: 12px; }
.grid .card { margin: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.grid .card button { margin: 8px 0 0; }
.gone { opacity: .6; }
.secret { word-break: break-all; user-select: all; font-family: ui-monospace, monospace; }
.shortcode { font: 600 1.3rem ui-monospace, monospace; letter-spacing: .08em; }
.device { border-top: 1px dashed var(--line); padding: 8px 0; }
.device small { display: block; }
.device button { margin: 6px 6px 0 0; }
.error, #message { color: #9b2c1f; }
#message { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(34rem, 92vw); margin: 0; z-index: 3;
  background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; text-align: center; }
#message:empty { display: none; }
dialog { width: min(24rem, 90vw); color: var(--ink); margin: auto; }
form { margin: 0; }
form + button { margin-top: 16px; }
#view a { color: var(--accent); font-weight: 600; }
.qr { display: block; width: 100%; max-width: 240px; height: auto; margin: 0 auto; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); font-size: 1.1rem; }
.check input, .toggle input { width: 26px; height: 26px; min-height: 0; margin: 0; flex: none; accent-color: var(--accent); }
.check.done span { text-decoration: line-through; color: var(--soft); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.toggle { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
textarea { width: 100%; font: inherit; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--ink); margin: 4px 0 10px; }
.prayer { border-top: 1px solid var(--line); padding: 10px 0; overflow-wrap: anywhere; }
.lines { white-space: pre-line; }
.request { margin: 0 0 2px; font-size: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.actions button { margin: 0; }
button.on { background: var(--tint); }
.goal { margin: 8px 0; }
.goal-line { display: flex; justify-content: space-between; gap: 8px; }
progress { width: 100%; height: 14px; accent-color: var(--accent); }
.reached { font-family: var(--head); font-weight: var(--headweight); font-size: 1.4rem; color: var(--accent); text-align: center; margin: 8px 0; }

body[data-theme$="-night"] .error, body[data-theme$="-night"] #message { color: #ff9c8c; }
body[data-theme$="-night"] button.approve { background: #2e6b45; color: #fff; }

/* Statistics. One colour per kid, in a fixed order; checked for colour blindness on the storybook day and night cards. */
body { --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600; --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #e0423f; }
body[data-theme$="-night"] { --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05; --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #e66767; }
.series-1 { background: var(--s1); }
.series-2 { background: var(--s2); }
.series-3 { background: var(--s3); }
.series-4 { background: var(--s4); }
.series-5 { background: var(--s5); }
.series-6 { background: var(--s6); }
.series-7 { background: var(--s7); }
.series-8 { background: var(--s8); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; }
.stat-tile { margin: 0; }
.stat-tile h3 { display: flex; align-items: center; gap: 6px; margin: 0; }
.stat-tile h3 i, .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.stat-tile p { margin: 4px 0 0; }
.stat-tile p.stat-hero { font-size: 2.6rem; font-weight: 700; line-height: 1.1; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.legend > span { display: flex; align-items: center; gap: 6px; }
.stat-block h3 { margin: 12px 0 4px; font-size: 1rem; }
.stat-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; gap: 8px; }
.stat-bar { display: grid; grid-template-columns: minmax(0, 1fr) 2.6rem; align-items: center; gap: 6px; padding: 3px 0; }
.stat-bar b { text-align: right; }
.stat-track { height: 14px; }
.stat-fill { height: 100%; border-radius: 0 4px 4px 0; }
.stat-chart { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.card button.stat-group { flex: 1 1 0; min-width: 1.6rem; margin: 0; padding: 0 1px; display: flex; flex-direction: column; border: 0;
                          background: none; color: var(--soft); font-weight: 400; }
.stat-columns { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 160px; }
.stat-columns i { flex: 1 1 0; max-width: 24px; border-radius: 4px 4px 0 0; }
.stat-group small { display: block; font-size: .7rem; padding: 2px 0; white-space: nowrap; }
.stat-scale, .readout { margin: 4px 0; font-size: .9rem; }
.stat-table { border-collapse: collapse; width: 100%; }
.stat-table th, .stat-table td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: right; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
.stat-chore { margin-bottom: 10px; }
.stat-chore-name { display: flex; justify-content: space-between; gap: 8px; }
.stat-stack { display: flex; gap: 2px; height: 100%; }
.stat-stack i { border-radius: 2px; min-width: 3px; }
.stat-stack i:last-child { border-radius: 2px 4px 4px 2px; }
.stat-range button { flex: 1; margin: 0; }
.panels > .stat-top { order: -2; } /* above the side column, which comes first on a phone */

/* Earned above the line, lost below it. Green and red keep their meaning in every look. */
.flow-chart { display: flex; gap: 4px; }
.flow-column { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; text-align: center; }
.flow-column > span { display: flex; flex-direction: column; align-items: center; height: 76px; }
.flow-column > span.up { justify-content: flex-end; border-bottom: 2px solid var(--line); }
.flow-column > span.down { flex-direction: column-reverse; justify-content: flex-end; }
.flow-column i { display: block; width: 70%; max-width: 34px; }
.flow-column .up i { background: #2e8b57; border-radius: 3px 3px 0 0; }
.flow-column .down i { background: #c0392b; border-radius: 0 0 3px 3px; }
.flow-column b { font-size: .75rem; line-height: 1.2; min-height: 1.2em; }
.flow-column small { white-space: nowrap; overflow: hidden; font-size: .7rem; }
.item.why b { flex: none; color: #fff; border-radius: var(--radius); padding: 2px 10px; }
.item.why b.up { background: #2e7d4f; }
.item.why b.down { background: #b3392c; }
.flow-column i.good, .flow-key i.good { background: #8fd0a5; }
.flow-key i.chores { background: #2e8b57; }
.flow-key i.bad { background: #c0392b; }
.flow-column .up i.good { border-radius: 3px 3px 0 0; }
.flow-column .up i.good + i { border-radius: 0; }
.flow-column .down b { order: -1; }
.stat-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stat-nav h2 { flex: 1 1 10rem; margin: 0; text-align: center; font-size: 1.3rem; }
.stat-nav button { margin: 0; }
.stat-nav button:disabled { opacity: .4; }

/* On paper: plain black on white, only the figures and charts. */
@media print {
  body[data-theme] { --bg: #fff; --card: #fff; --ink: #000; --soft: #333; --line: #999; --accent: #000; --on: #fff; --tint: #fff; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .stat-range, .stat-nav button, header p { display: none !important; }
  .panels, .col { display: block !important; }
  .card { break-inside: avoid-page; margin-bottom: 12px; }
  .stat-block { break-inside: avoid; }
}

/* ---- tidying: one toolbar row, rows that fill, nothing cut off ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; order: -2; }
.toolbar > * { order: 0; }
.toolbar button { margin: 0; }
.toolbar .tools { margin-left: auto; }
.toolbar .picker:only-child { flex: 1; }
.toolbar .stat-range button { flex: 0 0 auto; min-width: 7rem; }
.toolbar .stat-nav { margin-left: auto; }
.toolbar .stat-nav h2 { flex: 0 1 auto; min-width: 11rem; }
.panels > .card.wide { grid-column: 1 / -1; }
.panels > .stats { display: flex; flex-wrap: wrap; }
.panels > .stats > button { flex: 1 1 9rem; }
.modes button { white-space: nowrap; padding-left: 6px; padding-right: 6px; }
@media (max-width: 59.99rem) {
  /* Every section's button is on screen: two full rows rather than one that runs off the edge. It scrolls away with the page. */
  .topbar { position: static; }
  .topbar nav { flex-wrap: wrap; overflow: visible; }
  .topbar nav button { flex: 1 1 22%; min-width: 0; }
  .col.side.after { order: 0; }
  .toolbar > *, .toolbar .tools, .toolbar .stat-nav { width: 100%; margin-left: 0; }
  .toolbar .picker button, .toolbar .tools button, .toolbar .stat-range button { flex: 1 1 8rem; min-width: 0; width: auto; }
  .toolbar .picker .add { margin-left: 0; }
  .toolbar .stat-range button { flex-basis: 0; padding-left: 4px; padding-right: 4px; }
  .toolbar .stat-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .toolbar .stat-nav h2 { min-width: 0; font-size: 1.15rem; }
  .toolbar .stat-nav .stat-print { grid-column: 1 / -1; }
  .swatches button:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
body.app header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
body.app header .tools { margin-left: auto; order: 0; }
@media (max-width: 59.99rem) { body.app header > * { width: 100%; } body.app header .tools button { flex: 1 1 8rem; } }
@media print { body.app header .tools { display: none; } }

/* Countdowns dressed for a holiday or a birthday. */
.named { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fest { width: 32px; height: 32px; flex: none; }
.fest.end { margin-left: auto; }
.item .row-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 0; }
.item .row-buttons button { margin: 0; }
@media (max-width: 59.99rem) { .item .row-buttons { flex-direction: column; align-items: stretch; flex: none; } .item .row-buttons button { width: 5.5rem; } }

/* The next countdown fills its box with its picture; the words sit on a card at the top. */
.card.scene { min-height: 17rem; text-align: center; background: var(--card) center bottom / cover no-repeat; border: 2px solid var(--accent); }
.card.scene .words { display: inline-block; max-width: 100%; padding: 6px 22px 10px; background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); opacity: .95; }
.card.scene .words strong { display: block; font-size: 2rem; line-height: 1.15; color: var(--accent); }
.card.scene .words h2 { margin: 2px 0; }
@media (min-width: 60rem) { .col.side > .card.scene { min-height: 27rem; } }
.card .card.scene { min-height: 14rem; margin: 0 0 8px; }

/* Holiday decorations, on the same days as the wall: a picture strip under the header and a border on the boxes. */
.fest-bar { height: 64px; margin: 0 16px 8px; background: center / auto 64px repeat-x; }
body[data-fest="newyear"] .fest-bar { background-image: url(/festive/bar-newyear.svg); }
body[data-fest="mlk"] .fest-bar { background-image: url(/festive/bar-mlk.svg); }
body[data-fest="presidents"] .fest-bar { background-image: url(/festive/bar-presidents.svg); }
body[data-fest="valentine"] .fest-bar { background-image: url(/festive/bar-valentine.svg); }
body[data-fest="easter"] .fest-bar { background-image: url(/festive/bar-easter.svg); }
body[data-fest="christmas"] .fest-bar { background-image: url(/festive/bar-christmas.svg); }
body[data-fest="patrick"] .fest-bar { background-image: url(/festive/bar-patrick.svg); }
body[data-fest="mothers"] .fest-bar { background-image: url(/festive/bar-mothers.svg); }
body[data-fest="memorial"] .fest-bar { background-image: url(/festive/bar-memorial.svg); }
body[data-fest="juneteenth"] .fest-bar { background-image: url(/festive/bar-juneteenth.svg); }
body[data-fest="fathers"] .fest-bar { background-image: url(/festive/bar-fathers.svg); }
body[data-fest="independence"] .fest-bar { background-image: url(/festive/bar-independence.svg); }
body[data-fest="labor"] .fest-bar { background-image: url(/festive/bar-labor.svg); }
body[data-fest="columbus"] .fest-bar { background-image: url(/festive/bar-columbus.svg); }
body[data-fest="halloween"] .fest-bar { background-image: url(/festive/bar-halloween.svg); }
body[data-fest="veterans"] .fest-bar { background-image: url(/festive/bar-veterans.svg); }
body[data-fest="thanksgiving"] .fest-bar { background-image: url(/festive/bar-thanksgiving.svg); }
body.app[data-fest="newyear"] .card:not(.scene) { background-image: url(/festive/card-newyear.svg), url(/festive/card-newyear.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="valentine"] .card:not(.scene) { background-image: url(/festive/card-valentine.svg), url(/festive/card-valentine.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="christmas"] .card:not(.scene) { background-image: url(/festive/card-christmas.svg), url(/festive/card-christmas.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="mlk"] .card:not(.scene) { background-image: url(/festive/card-mlk.svg), url(/festive/card-mlk.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="presidents"] .card:not(.scene) { background-image: url(/festive/card-presidents.svg), url(/festive/card-presidents.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="patrick"] .card:not(.scene) { background-image: url(/festive/card-patrick.svg), url(/festive/card-patrick.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="easter"] .card:not(.scene) { background-image: url(/festive/card-easter.svg), url(/festive/card-easter.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="mothers"] .card:not(.scene) { background-image: url(/festive/card-mothers.svg), url(/festive/card-mothers.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="memorial"] .card:not(.scene) { background-image: url(/festive/card-memorial.svg), url(/festive/card-memorial.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="juneteenth"] .card:not(.scene) { background-image: url(/festive/card-juneteenth.svg), url(/festive/card-juneteenth.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="fathers"] .card:not(.scene) { background-image: url(/festive/card-fathers.svg), url(/festive/card-fathers.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="independence"] .card:not(.scene) { background-image: url(/festive/card-independence.svg), url(/festive/card-independence.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="labor"] .card:not(.scene) { background-image: url(/festive/card-labor.svg), url(/festive/card-labor.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="columbus"] .card:not(.scene) { background-image: url(/festive/card-columbus.svg), url(/festive/card-columbus.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="halloween"] .card:not(.scene) { background-image: url(/festive/card-halloween.svg), url(/festive/card-halloween.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="veterans"] .card:not(.scene) { background-image: url(/festive/card-veterans.svg), url(/festive/card-veterans.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
body.app[data-fest="thanksgiving"] .card:not(.scene) { background-image: url(/festive/card-thanksgiving.svg), url(/festive/card-thanksgiving.svg); background-repeat: repeat-x; background-position: left top, left bottom; background-origin: border-box; }
@media print { .fest-bar { display: none; } }

/* Statistics: two small drop-downs and small arrows, not a row of big buttons. */
.toolbar .stat-range { display: flex; flex-wrap: wrap; gap: 12px; }
.chooser { display: flex; align-items: center; gap: 6px; }
.chooser select { width: auto; min-width: 0; min-height: 36px; margin: 0; padding: 4px 8px; font-size: .95rem; }
.toolbar .stat-nav button { flex: 0 0 auto; width: auto; min-height: 36px; padding: 4px 12px; font-size: .95rem; }
.toolbar .stat-nav h2 { min-width: 9rem; font-size: 1.1rem; }
.stat-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 40px; }
.stat-summary .stat-lines { display: grid; grid-template-columns: repeat(2, minmax(9rem, auto)); column-gap: 28px; }
@media (max-width: 59.99rem) {
  .toolbar .stat-range .chooser { flex: 1 1 9rem; }
  .toolbar .stat-range .chooser select { flex: 1; }
  .toolbar .stat-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; }
  .toolbar .stat-nav h2 { flex: 1; min-width: 0; font-size: 1.05rem; }
  .toolbar .stat-nav .stat-print { grid-column: auto; }
  .stat-summary .stat-lines { grid-template-columns: repeat(2, minmax(0, auto)); column-gap: 18px; }
}
.flow-column i.learn, .flow-key i.learn { background: #3b82c4; }
.study-draft { border-top: 1px solid var(--line); padding: 8px 0; }
.study-draft summary { cursor: pointer; min-height: 36px; }
input.short { width: 5rem; margin: 0; }
.scroll-x { overflow-x: auto; }
.scroll-x th, .scroll-x td { overflow-wrap: normal; word-break: normal; }
.scroll-x th, .scroll-x td { padding-left: 4px; padding-right: 4px; }
.item.plan { flex-wrap: wrap; }
.item.plan > div { flex-basis: 100%; }
.item.plan select, .item.plan input { width: auto; margin: 0; }
.signin input, .signin button { display: block; width: 100%; margin: 6px 0 0; }
.own-question { border-top: 1px solid var(--line); padding: 4px 0 8px; }
.picture-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0; }
.picture-pick img { display: block; width: 100%; border-radius: 8px; }
.picture-pick button.pick { margin: 0; padding: 4px; width: 100%; min-height: 0; background: none; color: inherit; border: 2px solid var(--line); border-radius: 10px; font-size: 12px; text-align: center; }
.picture-pick button.chosen { border-color: currentColor; }
.row.wanted button { flex: none; width: auto; white-space: nowrap; }

/* ---- the study pages ---- */
#view { max-width: 44rem; }
.code { font-size: 2.6rem; letter-spacing: .15em; text-align: center; }
.who { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 10px; }
.who button { margin: 0; min-height: 64px; font-size: 1.2rem; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head h1 { text-align: left; }
button.small { width: auto; min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.studies { display: grid; gap: 10px; }
button.study { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; margin: 0; padding: 8px; text-align: left; border-color: var(--line); }
button.study img { width: 100%; border-radius: var(--radius); }
button.study span { display: flex; flex-direction: column; gap: 2px; }
button.study .state, p.state { color: var(--accent); font-weight: 700; }
img.picture { display: block; width: 100%; border-radius: var(--radius); }
blockquote { margin: 12px 0; padding: 4px 16px; background: var(--card); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.scripture { white-space: pre-line; font-size: 1.15rem; line-height: 1.6; }
.scripture.missing { font-style: italic; }
.cite { font-weight: 700; }
.question { margin: 14px 0 4px; font-weight: 700; }
textarea { width: 100%; font: inherit; padding: 8px 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }
footer { max-width: 44rem; margin: 0 auto; padding: 16px; font-size: .8rem; color: var(--soft); }
footer a { color: inherit; }
.choices { display: grid; gap: 6px; }
.choices button { width: 100%; margin: 0; text-align: left; font-weight: 400; border-color: var(--line); }
.choices button.on { background: var(--accent); color: var(--on); }
.quiz.again .question { color: var(--accent); }
.quiz.again .choices { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--radius); }
#view button.primary { margin-top: 16px; }
.about { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; }
.dots { display: flex; gap: 6px; margin: 0 0 8px; }
.dots i { width: 20px; height: 20px; border-radius: 50%; background: var(--tint); border: 1px solid var(--line); }
.dots i.on { background: #2e8b57; border-color: #2e8b57; }
button.study.big { grid-template-columns: 1fr; text-align: center; }
button.study.big span { align-items: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.two button { width: 100%; margin: 0; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 8px 0 16px; }
.badge { width: 6rem; text-align: center; font-size: .85rem; color: var(--soft); }
.badge b { display: block; width: 3.6rem; height: 3.6rem; margin: 0 auto 4px; border-radius: 50%; border: 2px solid var(--line); font-size: 1.8rem; line-height: 3.4rem; }
.badge.got { color: var(--ink); }
.badge.got b { background: #f0c94d; border-color: var(--ink); color: var(--ink); }
.recap { margin-top: 16px; }
#view button.wide-button { width: 100%; margin: 6px 0 0; }
.links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.links a { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px 10px; text-align: center; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--card); color: var(--accent); font-weight: 700; text-decoration: none; }
#view input:not([type=checkbox]) { width: 100%; margin: 8px 0 0; }
#view img.picture + input { margin-top: 14px; }
.week { margin: 12px 0 4px; }
.daysrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0; }
#view button.dayb { margin: 0; padding: 0; min-height: 48px; font-size: 1.2rem; }
#view button.dayb.done { background: #2e8b57; border-color: #2e8b57; color: #fff; }
#view button.dayb.locked { opacity: .4; }
.choices.pictures { grid-template-columns: repeat(3, 1fr); }
.choices.pictures button { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 8px 4px; }
.choices.pictures img { width: 100%; max-width: 7rem; border-radius: var(--radius); }
.find { position: relative; }
.find img { display: block; }
#view .find button.spot { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; height: auto; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; }
#view .find button.spot.found { border: 5px solid #fff; box-shadow: 0 0 0 4px #2e8b57; }
.placed { padding-left: 1.4rem; }
.placed li { margin: 4px 0; }
.placed button { margin: 0; }
.versline { font-size: 1.35rem; line-height: 1.7; text-align: center; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#view .bank button { width: auto; margin: 0; }
.quiz.again .placed { outline: 3px solid var(--accent); border-radius: var(--radius); }
.also, .make { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 10px; margin: 12px 0; }
.album { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.album .sticker, .album .slot { width: 100%; aspect-ratio: 1; border-radius: 50%; }
img.sticker { object-fit: cover; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--ink); border-radius: 50%; }
img.sticker.big { display: block; width: 70%; aspect-ratio: 1; margin: 10px auto; }
.album .slot { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); color: var(--soft); }
.colorpage svg { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); touch-action: manipulation; }
.crayons { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 12px 0; }
#view .crayons button { margin: 0; padding: 0; min-height: 0; width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink); color: #1d1712; }
#view .crayons button.on { border-width: 5px; transform: scale(1.12); }
.make .two { margin: 8px 0; }
#printarea { display: none; }
@media print {
  @page { margin: 10mm; }
  body > *:not(#printarea) { display: none !important; }
  body { background: #fff; }
  #printarea { display: block; }
  #printarea svg { display: block; width: 100%; height: auto; max-height: 98vh; }
}
.bar { height: 10px; background: var(--tint); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: #2e8b57; }
.map svg { display: block; width: 100%; height: auto; }
.stops li { margin: 3px 0; }
.stops li.got { font-weight: 700; color: #2e8b57; }
.stops li.here { font-weight: 700; color: var(--accent); }
.pickers { display: grid; grid-template-columns: 3fr 2fr; gap: 8px; margin: 10px 0 0; }
.pickers select { width: 100%; min-height: 44px; margin: 0; }
.lines { white-space: pre-line; }
.night { font-size: 1.15rem; }
#view select { width: 100%; min-height: 44px; margin: 8px 0 0; }
@media print { #printarea .dots i { -webkit-print-color-adjust: exact; print-color-adjust: exact; } #printarea { color: #000; font-family: serif; } }
.menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 20px; }
#view .menu button { margin: 0; width: 100%; min-height: 44px; padding: 4px; font-size: .9rem; }
