/* The editor around the board. System fonts only; the one outside script is
   Google sign-in (docs/spec.md, "The editor and its gate"). */
:root {
  --bg: #f3f1ee; --fg: #22201d; --muted: #6c6760; --line: #ddd8d1; --card: #ffffff;
  --accent: #2f6f5e; --accent-fg: #ffffff; --warn: #a2541a; --ok: #2f6f5e;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171a19; --fg: #ece8e2; --muted: #a19b93; --line: #33302c; --card: #22211f;
    --accent: #6fc2a8; --accent-fg: #0e1a16; --warn: #e3a066; --ok: #6fc2a8; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--ui); font-size: 18px; line-height: 1.45;
  padding: 20px max(16px, env(safe-area-inset-right)) 140px max(16px, env(safe-area-inset-left)); }
.wrap { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 1.7rem; margin: 0; }
h2 { font-size: 1.25rem; margin: 18px 0 0; }
.lede { margin: 0; font-size: 1.1rem; }
.small { margin: 0; font-size: 15px; color: var(--muted); }
.boardlink { margin: -4px 0 12px; font-size: 17px; }
.boardlink[hidden] { display: none; }
.boardlink a { color: var(--accent); display: inline-block; padding: 10px 0; min-height: 44px; }
.boardlink a::after { content: " \2197"; }
.who { margin: 0; color: var(--muted); font-size: 15px; }
.link { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 8px 4px; min-height: 44px; min-width: 44px; }
/* Google's sign-in button. Google draws it in an iframe over a fallback copy,
   and styles the fallback with an inline <style> that our CSP (no
   'unsafe-inline') refuses. When the iframe can't load (an unregistered origin,
   a blocked network), the bare fallback showed a card-sized "G" and its label
   twice. These rules keep the fallback a plain, tidy button either way. */
#gsiButton { position: relative; min-height: 44px; max-width: 400px; overflow: hidden; }
#gsiButton iframe { max-width: 100%; }
#gsiButton svg { width: 20px !important; height: 20px !important; flex: none; }
#gsiButton [role="button"] { display: inline-flex; align-items: center; gap: 12px; height: 44px; padding: 0 20px;
  border-radius: 999px; background: #1a73e8; color: #fff; font: 600 16px/1 var(--ui); cursor: pointer; white-space: nowrap; }
#gsiButton [role="button"] > div:first-child:empty { display: none; }
#gsiButton [role="button"] div { display: flex; align-items: center; }
#gsiButton [role="button"] svg { background: #fff; border-radius: 50%; padding: 3px; box-sizing: content-box; margin-right: 4px; }
#gsiButton #button-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
#editor { display: flex; flex-direction: column; gap: 14px; }
#editor[hidden] { display: none; }
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.days button { flex: none; }
.days button, .chips button { font: inherit; padding: 10px 16px; min-height: 48px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--card); color: var(--fg); cursor: pointer; }
.chips button { border-radius: 10px; background: var(--bg); }
.days button[aria-pressed="true"], .chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.viewing { margin: 0; color: var(--muted); font-size: 15px; }
.screen { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #0b0d10;
  box-shadow: 0 0 0 10px #1d1d1d, 0 12px 30px rgba(0,0,0,.25); }
.screen iframe { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; }
/* "See it bigger" (#21): on a phone the preview's lines are 6-10 px. Fill
   the screen with it, turned sideways when the phone is upright. */
.bigbtn { display: none; }
@media (max-width: 700px) { .bigbtn { display: block; } }
.screen.big { position: fixed; left: 50%; top: 50%; z-index: 25; border-radius: 0; aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.94); }
.bigdone { position: fixed; z-index: 26; left: 50%; transform: translateX(-50%); min-width: 160px;
  bottom: calc(12px + env(safe-area-inset-bottom)); }
body.isbig { overflow: hidden; }
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #a9a49a; font-size: 18px; }
.loading[hidden] { display: none; }
.bigbuttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { font: inherit; font-weight: 700; padding: 14px 22px; border-radius: 12px; border: 0; cursor: pointer; min-height: 54px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.primary { background: var(--accent); color: var(--accent-fg); }
.ghost { background: transparent; color: var(--fg); border: 2px solid var(--line); }
.danger { background: transparent; color: var(--warn); border: 2px solid var(--warn); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.list li:hover, .list li:focus-visible { border-color: var(--accent); }
.list .when { color: var(--muted); font-size: 15px; grid-column: 1; }
.list .what { font-size: 19px; grid-column: 1; overflow-wrap: anywhere; }
.list .tag { grid-column: 2; grid-row: 1 / span 2; font-size: 14px; color: var(--muted); text-align: right; }
.list .tag.on { color: var(--ok); font-weight: 700; }
.list .tag.problem { color: var(--warn); font-weight: 700; }
.list .empty { cursor: default; color: var(--muted); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0,0,0,.18); border-radius: 16px 16px 0 0; max-height: 88%; overflow: auto; z-index: 20;
  padding: 18px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.sheet[hidden] { display: none; }
.sheet .in { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden] { display: none; }
.l { font-weight: 700; font-size: 15px; }
input[type=text], input[type=date], textarea { font: inherit; font-size: 20px; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--line);
  background: var(--bg); color: var(--fg); width: 100%; }
textarea { resize: none; display: block; line-height: 1.3; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.over { color: var(--warn); font-weight: 700; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips[hidden] { display: none; }
.warnmsg { margin: 0; font-size: 16px; color: var(--warn); font-weight: 700; }
.actions { display: flex; gap: 10px; justify-content: flex-end; }
.actions .primary { flex: 1 1 auto; max-width: 320px; }
/* Save and Cancel stay on screen however long the panel is (#20). */
.sheet .actions { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--card);
  margin: 0 -4px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 4px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--fg); color: var(--bg); padding: 14px 20px; border-radius: 12px; font-weight: 700; max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.good::before { content: ""; display: inline-block; width: 10px; height: 18px; margin-right: 12px; vertical-align: -2px;
  border: solid currentColor; border-width: 0 4px 4px 0; transform: rotate(45deg); }
.toast[hidden] { display: none; }
/* On a phone the bottom is where the buttons are: say it at the top (#20). */
@media (max-width: 600px) { .toast { bottom: auto; top: calc(12px + env(safe-area-inset-top)); } }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(30px); opacity: .6; } } }
