/* The Hummel Hive — one stylesheet for the visitor village and the Hall.
   Look: the doodle style of art/STYLE.md carried into the interface — paper, thick uneven ink outlines, flat pastels.
   Type: Gaegu (hand-lettered) for names, titles and places; Atkinson Hyperlegible Next for reading and numbers. */

@font-face { font-family: "Gaegu"; src: url("/fonts/gaegu-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gaegu"; src: url("/fonts/gaegu-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #fffdf7;
  --paper-2: #fbf4e3;
  --paper-3: #f4ead2;
  --ink: #231c17;
  --ink-2: #5d4f45;
  --ink-3: #8a7b6f;
  --line: #e4d8c2;
  --meadow: #cfe6b3;
  --meadow-2: #b8d998;
  --leaf: #5f9a4c;
  --honey: #f4c95d;
  --honey-2: #e3a92e;
  --sky: #c8dcf2;
  --blush: #f2a0b5;
  --rose: #f5c6e0;
  --berry: #a8405c;
  --berry-soft: #f7d9e0;
  --moss: #3e7a43;
  --moss-soft: #dcefd2;
  --lilac: #d9cdef;
  --night: #1f2a4d;
  --wob: 18px 24px 16px 26px / 24px 16px 26px 18px;
  --wob-sm: 10px 14px 9px 15px / 14px 9px 15px 10px;
  --shadow: 3px 4px 0 var(--ink);
  --hand: "Gaegu", "Comic Sans MS", "Chalkboard SE", cursive;
  --read: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;
  --topbar: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--meadow);
  color: var(--ink);
  font-family: var(--read);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--honey-2); }
:focus-visible { outline: 3px solid var(--honey-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── type ── */
.hand { font-family: var(--hand); font-weight: 700; letter-spacing: 0.01em; }
h1, h2, h3, h4 { font-family: var(--hand); font-weight: 700; margin: 0; line-height: 1.1; }
h1 { font-size: 40px; }
h2 { font-size: 30px; }
h3 { font-size: 23px; }
h4 { font-size: 19px; }
p { margin: 0 0 0.6em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote { font-style: italic; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch; }
.mono-file { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--wob-sm); padding: 12px 14px; max-height: 420px; overflow: auto; margin: 8px 0; }

/* ── paper, buttons, chips ── */
.paper { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border: 2.5px solid var(--ink); border-radius: 14px 18px 13px 19px / 18px 13px 19px 14px;
  background: var(--paper); color: var(--ink);
  font-family: var(--hand); font-weight: 700; font-size: 20px; line-height: 1;
  box-shadow: 2px 3px 0 var(--ink); cursor: pointer; text-decoration: none;
  transition: transform 80ms ease, box-shadow 80ms ease, background 120ms;
}
.btn:hover { background: #fff8e4; }
.btn:active { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 2px 3px 0 var(--ink); }
.btn.primary { background: var(--honey); }
.btn.primary:hover { background: #f8d57a; }
.btn.approve { background: var(--moss-soft); }
.btn.approve:hover { background: #cbe7bd; }
.btn.deny { background: var(--berry-soft); }
.btn.deny:hover { background: #f3c7d2; }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: 18px; box-shadow: 1.5px 2px 0 var(--ink); }
.btn.ghost { box-shadow: none; border-color: transparent; background: transparent; text-decoration: underline; text-decoration-color: var(--honey-2); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.btn.ghost:hover { background: var(--paper-2); }
.btn img, .navlink img { width: 26px; height: 26px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); font-size: 13.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.chip.alive { background: var(--moss-soft); }
.chip.grace { background: #ffe7a8; }
.chip.dormant { background: #e4e0ea; }
.chip.unborn { background: var(--rose); }
.chip.p0 { background: var(--berry); color: #fff; }
.chip.p1 { background: var(--honey); }
.chip.p2 { background: var(--paper-3); }
.chip.trust { background: var(--sky); }
.chip.soft { border-color: var(--line); color: var(--ink-2); font-weight: 600; }
/* v1.2.4: a job sent back to the villager who did it, held for it a day */
.chip.returned { background: var(--lilac); }
.chip.reserved { background: var(--sky); }
.return-line { color: var(--ink-2); border-left: 3px solid var(--lilac); padding: 1px 0 1px 9px; margin: 6px 0 0; overflow-wrap: anywhere; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 2px solid var(--ink); }

/* ── forms ── */
label.field { display: grid; gap: 4px; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
label.field .hint { font-weight: 400; color: var(--ink-3); font-size: 13px; }
input[type=text], input[type=number], input[type=email], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 2px solid var(--ink); border-radius: 10px 13px 9px 14px / 13px 9px 14px 10px;
  background: #fff; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--honey); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--moss); }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .formgrid { grid-template-columns: 1fr; } }

/* ── lists, tables, stats ── */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { padding: 12px 2px; border-bottom: 2px dashed var(--line); }
.rows > li:last-child { border-bottom: 0; }
table.ledger { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.ledger th { text-align: left; font-family: var(--hand); font-size: 18px; font-weight: 700; padding: 6px 8px; border-bottom: 2.5px solid var(--ink); white-space: nowrap; }
table.ledger td { padding: 7px 8px; border-bottom: 1.5px dashed var(--line); vertical-align: top; }
table.ledger td.r, table.ledger th.r { text-align: right; }
table.ledger tr:last-child td { border-bottom: 0; }
table.ledger tfoot td { border-top: 2.5px solid var(--ink); font-weight: 700; }
.pos { color: var(--moss); }
.neg { color: var(--berry); }
.tablewrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 10px 0 14px; }
.stat .label { font-size: 13.5px; color: var(--ink-2); }
.stat .value { font-family: var(--hand); font-weight: 700; font-size: 30px; line-height: 1.05; }
.stat .value.unknown { color: var(--ink-3); font-size: 24px; }
.stat .sub { font-size: 12.5px; color: var(--ink-3); }
.bar { height: 14px; border: 2px solid var(--ink); border-radius: 9px; background: var(--paper-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--honey); border-right: 2px solid var(--ink); }
.bar.ok > span { background: var(--meadow-2); }
.bar.warn > span { background: #ffd27a; }
.bar.bad > span { background: var(--blush); }
.section { margin: 20px 0 8px; }
.section > h3 { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 6px; }
.section > h3 .small { font-family: var(--read); font-weight: 400; }
.note { background: var(--paper-2); border-left: 5px solid var(--honey); padding: 10px 12px; border-radius: 4px 12px 12px 4px; font-size: 14.5px; margin: 8px 0; }
.note.calm { border-left-color: var(--sky); }
.note.warn { border-left-color: var(--berry); }
.empty { text-align: center; padding: 22px 12px; color: var(--ink-2); }
.empty img { width: 92px; height: 92px; display: block; margin: 0 auto 6px; }
.empty .hand { font-size: 22px; color: var(--ink); display: block; }

/* ── the villager portrait ── */
.portrait { width: 72px; height: 72px; flex: none; border-radius: 50%; background: var(--paper-2); border: 2.5px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: contain; }
.portrait.big { width: 132px; height: 132px; background: #fff; }
.portrait.small { width: 44px; height: 44px; border-width: 2px; }
.portrait.dormant img { filter: grayscale(0.6); opacity: 0.8; }
.who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.who .name { font-family: var(--hand); font-weight: 700; font-size: 22px; line-height: 1; }
.who .line { color: var(--ink-2); font-size: 14px; }

/* ── dialogs and toasts ── */
dialog.sheetdlg { border: 2.5px solid var(--ink); border-radius: var(--wob); padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--paper); box-shadow: var(--shadow); color: var(--ink); }
dialog.sheetdlg::backdrop { background: rgba(31, 42, 77, 0.35); }
dialog .dlg-body { padding: 20px 22px 18px; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow: auto; overscroll-behavior: contain; }
dialog .dlg-body h3 { margin-bottom: 8px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; position: sticky; bottom: -18px; padding: 10px 0 18px; margin-bottom: -18px; background: var(--paper); box-shadow: 0 -14px 12px -6px var(--paper); z-index: 1; }
dialog .dlg-actions .btn { white-space: nowrap; }
dialog .dlg-body h3:focus { outline: none; }
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob-sm); box-shadow: var(--shadow); padding: 10px 14px; font-weight: 600; pointer-events: auto; animation: toast-in 180ms ease-out; }
.toast.bad { background: var(--berry-soft); }
.toast.good { background: var(--moss-soft); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ── the map frame (both pages) ── */
.map { position: relative; overflow: hidden; background: var(--meadow); touch-action: none; }
.map canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.map-chip { position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 8px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 12px 4px 6px; font-weight: 600; font-size: 14px; box-shadow: 2px 3px 0 var(--ink); }
.map-chip .sun { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--honey); flex: none; }
.map[data-phase="night"] .map-chip .sun { background: #f3efd8; box-shadow: inset -7px -3px 0 0 #c9c4a8; }
.map[data-phase="dusk"] .map-chip .sun, .map[data-phase="dawn"] .map-chip .sun { background: #f7a96b; }
.tooltip { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, -100%); background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob-sm); padding: 6px 12px 8px; width: max-content; max-width: min(280px, calc(100% - 16px)); box-shadow: 2px 3px 0 var(--ink); font-size: 14px; }
.tooltip .hand { font-size: 22px; display: block; line-height: 1.05; }
.iconbtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--paper); box-shadow: 2px 3px 0 var(--ink); cursor: pointer; padding: 0; position: relative; }
.iconbtn img { width: 28px; height: 28px; }
.iconbtn[aria-pressed="true"] { background: var(--honey); }
.iconbtn .count { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--berry); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--ink); }

/* ── the Hall ── */
body.hall { overflow: hidden; }
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--paper); border-bottom: 2.5px solid var(--ink); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand img { width: 40px; height: 40px; }
.brand .hand { font-size: 28px; line-height: 0.9; }
.brand small { display: block; font-family: var(--read); font-size: 12px; color: var(--ink-3); font-weight: 600; }
.places { display: flex; gap: 2px; align-items: center; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.navlink { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 44px; border-radius: 12px 15px 11px 16px / 15px 11px 16px 12px; text-decoration: none; font-family: var(--hand); font-weight: 700; font-size: 20px; white-space: nowrap; border: 2.5px solid transparent; position: relative; }
.navlink:hover { background: var(--paper-2); }
.navlink[aria-current="page"] { border-color: var(--ink); background: var(--honey); box-shadow: 2px 3px 0 var(--ink); }
.navlink .count { min-width: 22px; height: 22px; border-radius: 11px; background: var(--berry); color: #fff; font-family: var(--read); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; border: 2px solid var(--ink); }
.topbar .right { display: flex; gap: 10px; align-items: center; flex: none; }
.usermenu { font-family: var(--hand); font-weight: 700; font-size: 20px; }

.hall-main { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w, 470px); height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); transition: grid-template-columns 220ms ease; }
.hall-main[data-width="wide"] { --panel-w: min(860px, 62vw); }
.hall-main[data-width="full"] { --panel-w: min(1180px, 82vw); }
.mapcol { position: relative; min-width: 0; display: grid; grid-template-rows: 1fr auto; }
.mapcol .map { min-height: 0; }
.strip { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; background: var(--paper); border-top: 2.5px solid var(--ink); scrollbar-width: thin; }
.strip button { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px 3px 3px; background: var(--paper); cursor: pointer; min-height: 44px; white-space: nowrap; }
.strip button[aria-pressed="true"] { background: var(--honey); }
.strip button img { width: 36px; height: 36px; border-radius: 50%; background: var(--paper-2); }
.strip .nm { font-family: var(--hand); font-weight: 700; font-size: 19px; line-height: 1; }
.strip .cr { font-size: 12.5px; color: var(--ink-2); display: block; line-height: 1.2; text-align: left; }
.panel { background: var(--paper); border-left: 2.5px solid var(--ink); overflow-y: auto; overscroll-behavior: contain; min-width: 0; }
.panel-inner { padding: 18px 22px 40px; }
.panel-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 4px; flex-wrap: wrap; }
.panel-head h2 { display: flex; align-items: center; gap: 10px; }
.panel-head h2 img { width: 40px; height: 40px; }
.panel-sub { color: var(--ink-2); margin-bottom: 12px; font-size: 15px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.tabs button { min-height: 40px; border: 2px solid var(--ink); background: var(--paper); border-radius: 999px; padding: 4px 14px; font-family: var(--hand); font-weight: 700; font-size: 18px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.loading { padding: 30px 0; text-align: center; color: var(--ink-3); font-family: var(--hand); font-size: 22px; }
.err { background: var(--berry-soft); border: 2px solid var(--berry); border-radius: var(--wob-sm); padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.notexposed { background: repeating-linear-gradient(-45deg, var(--paper-2), var(--paper-2) 8px, var(--paper) 8px, var(--paper) 16px); border: 2px dashed var(--ink-3); border-radius: var(--wob-sm); padding: 12px 14px; color: var(--ink-2); font-size: 14.5px; margin: 8px 0; }

/* approvals */
.req { border: 2.5px solid var(--ink); border-radius: var(--wob); padding: 14px 16px; margin: 0 0 14px; background: var(--paper); }
.req.p0 { box-shadow: 4px 5px 0 var(--berry); }
.req.p1 { box-shadow: 3px 4px 0 var(--honey-2); }
.req-top { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.req-title { font-weight: 700; font-size: 17px; margin: 4px 0; overflow-wrap: anywhere; }
.req-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.record { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 12px; background: var(--paper-2); border-radius: var(--wob-sm); padding: 10px 12px; margin: 10px 0; font-size: 13px; }
.record b { display: block; font-family: var(--hand); font-size: 21px; line-height: 1.05; }
.req .detail { margin: 6px 0; }
.req details summary { cursor: pointer; font-weight: 600; min-height: 32px; }

/* villager card */
.card-head { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.card-head .nm { font-family: var(--hand); font-weight: 700; font-size: 40px; line-height: 0.95; }
.card-head .kind { color: var(--ink-2); font-size: 15px; }
.honors { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.honor { display: inline-flex; gap: 6px; align-items: center; background: var(--rose); border: 2px solid var(--ink); border-radius: 12px 14px 11px 15px; padding: 2px 10px; font-family: var(--hand); font-weight: 700; font-size: 18px; }
.honor small { font-family: var(--read); font-weight: 400; font-size: 12px; color: var(--ink-2); }
.doing { font-size: 17px; background: var(--paper-2); border-radius: var(--wob-sm); padding: 10px 14px; margin: 8px 0 12px; }
.pantry { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; }
@media (max-width: 420px) { .pantry { grid-template-columns: repeat(2, 1fr); } }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.family { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.family button { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); background: var(--paper); border-radius: 999px; padding: 2px 12px 2px 2px; cursor: pointer; font-family: var(--hand); font-weight: 700; font-size: 18px; min-height: 40px; }
.family img { width: 32px; height: 32px; }
.tree { font-family: var(--hand); font-size: 19px; }
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 2.5px solid var(--ink-3); }
.tree li { margin: 6px 0; position: relative; }
.tree li::before { content: ""; position: absolute; left: -22px; top: 16px; width: 16px; border-top: 2.5px solid var(--ink-3); }

/* jobs */
.job { padding: 12px 0; border-bottom: 2px dashed var(--line); }
.job-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.job-title { font-weight: 700; font-size: 17px; }
.pay { font-family: var(--hand); font-weight: 700; font-size: 24px; white-space: nowrap; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.filebtn { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 8px 10px 7px 11px; background: #fff; padding: 3px 10px; cursor: pointer; font-size: 13.5px; min-height: 36px; }
.dropzone { border: 2.5px dashed var(--ink-3); border-radius: var(--wob-sm); padding: 14px; text-align: center; color: var(--ink-2); background: var(--paper-2); }
.dropzone.over { background: #fff3c9; border-color: var(--ink); }

/* notifications */
.notif { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 2px dashed var(--line); }
.notif.unread .subj { font-weight: 700; }
.notif .subj { overflow-wrap: anywhere; }
.notif .body { white-space: pre-wrap; font-size: 13.5px; color: var(--ink-2); max-height: 0; overflow: hidden; }
.notif.open .body { max-height: none; margin-top: 6px; }

/* login */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 20; }
.gate .map { position: absolute; inset: 0; }
.gate-card { position: relative; z-index: 2; width: min(440px, 100%); padding: 26px 26px 22px; box-shadow: 5px 6px 0 var(--ink); text-align: center; }
.gate-card img.mascot { width: 120px; height: 120px; margin: -70px auto 2px; display: block; }
.gate-card h1 { font-size: 46px; }
.gate-card p { color: var(--ink-2); }

/* ── phone ── */
.tabbar { display: none; }
@media (max-width: 900px) {
  body.hall { overflow: auto; }
  .topbar { height: 56px; padding: 0 12px; }
  .topbar .places { display: none; }
  .brand .hand { font-size: 24px; }
  .hall-main, .hall-main[data-width] { display: block; height: auto; --panel-w: 100%; }
  /* the map fits the width (the whole meadow, 2048×1280), stays at the top; the panel is a sheet that slides over it */
  /* v1.2.2: a band above the meadow for the clock (it no longer covers the cottages), never taller than the screen allows */
  .hall-main { --hall-map-h: min(calc(62.5vw + 74px), calc(100vh - 56px - 132px)); }
  @supports (height: 100svh) { .hall-main { --hall-map-h: min(calc(62.5vw + 74px), calc(100svh - 56px - 132px)); } }
  .mapcol { display: block; aspect-ratio: auto; height: var(--hall-map-h); position: sticky; top: 56px; z-index: 1; }
  .mapcol .map { position: absolute; inset: 0; }
  .mapcol .strip { display: none; }
  .topbar { position: sticky; top: 0; }
  .panel { border-left: 0; border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0; margin-top: -18px; position: relative; z-index: 2; min-height: calc(100svh - 56px - var(--hall-map-h, 62.5vw) + 18px); overflow: visible; padding-bottom: 84px; box-shadow: 0 -4px 0 rgba(35, 28, 23, 0.08); }
  .panel::before { content: ""; display: block; width: 46px; height: 5px; border-radius: 3px; background: var(--ink-3); margin: 8px auto 0; opacity: 0.6; }
  .panel-inner { padding: 16px 16px 30px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--paper); border-top: 2.5px solid var(--ink); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 0; min-height: 52px; padding: 4px 0; text-decoration: none; font-family: var(--hand); font-weight: 700; font-size: 15px; border-radius: 12px; position: relative; }
  .tabbar a img { width: 28px; height: 28px; }
  .tabbar a[aria-current="page"] { background: var(--honey); }
  .tabbar .count { position: absolute; top: 0; right: 18%; min-width: 20px; height: 20px; border-radius: 10px; background: var(--berry); color: #fff; font-family: var(--read); font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--ink); }
  h2 { font-size: 27px; }
  .card-head .nm { font-size: 34px; }
  .portrait.big { width: 104px; height: 104px; }
  .toasts { bottom: 86px; }
}

/* ── the visitor village ── */
body.visitor { overflow: hidden; }
.vis { display: grid; grid-template-columns: minmax(0, 1fr) 410px; height: 100vh; height: 100dvh; }
.vis .map { height: 100%; }
.plaque { position: absolute; z-index: 3; top: 16px; left: 16px; padding: 10px 18px 12px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.plaque h1 { font-size: 38px; line-height: 0.95; }
.plaque p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.plaque p.byline { margin-top: 0; font-size: 13px; font-style: italic; }
.plaque p.byline a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.vis .drawer { background: var(--paper); border-left: 2.5px solid var(--ink); display: flex; flex-direction: column; min-height: 0; }
.vis .drawer-inner { padding: 14px 20px 24px; }
.ai-note { font-size: 13.5px; color: var(--ink-2); padding: 12px 20px 16px; border-top: 2px dashed var(--line); display: flex; gap: 10px; align-items: center; }
.ai-note img { width: 34px; height: 34px; flex: none; }
.vlist { list-style: none; margin: 0; padding: 0; }
.vlist button { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: none; border: 0; border-bottom: 2px dashed var(--line); padding: 10px 2px; cursor: pointer; min-height: 64px; }
@media (hover: hover) { .vlist button:hover { background: var(--paper-2); } }
.vlist .who .line { font-size: 13.5px; }
.post { padding: 10px 0; border-bottom: 2px dashed var(--line); }
.post .by { font-family: var(--hand); font-weight: 700; font-size: 20px; }
.post .by small { font-family: var(--read); font-weight: 400; color: var(--ink-3); font-size: 12.5px; margin-left: 6px; }
.post.notice .by { color: var(--leaf); }
.post .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.back { margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.map .clockchip { left: 16px; bottom: 16px; }
.map-tools { position: absolute; right: 16px; bottom: 16px; z-index: 3; display: flex; gap: 10px; }
.hall-link { position: absolute; top: 16px; right: 16px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px 4px 8px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 2px 3px 0 var(--ink); color: var(--ink); text-decoration: none; font-size: 18px; }
.hall-link img { width: 22px; height: 22px; }
.hall-link:hover { background: var(--honey); }

/* venture plans, key/value tables, belongings, exports */
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th { text-align: left; vertical-align: top; width: 9.5em; padding: 5px 10px 5px 0; color: var(--ink-2); font-weight: 600; }
table.kv td { padding: 5px 0; overflow-wrap: anywhere; }
table.kv tr + tr th, table.kv tr + tr td { border-top: 1.5px dashed var(--line); }
.plan { background: var(--paper-2); border-radius: var(--wob-sm); padding: 8px 12px; margin: 8px 0; }
.belongings { list-style: none; padding: 0; margin: 4px 0; }
.belongings li { padding: 6px 0; border-bottom: 1.5px dashed var(--line); }
.formrow { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 8px; }
.field.inline { margin: 0; }
.exports .btn { text-decoration: none; }
.post.owner .by { color: var(--berry); }
@media (max-width: 900px) {
  .topbar .right { gap: 8px; }
  .topbar .usermenu, .topbar .iconbtn.preview, .topbar .iconbtn.studiobtn, .topbar .iconbtn.brainbtn { display: none; }
  .brand small { font-size: 11px; }
  .hall-main { max-width: 100vw; overflow-x: clip; }
  /* dialogs become bottom sheets */
  dialog.sheetdlg { margin: auto 0 0 0; max-width: 100vw; width: 100vw; border-radius: 22px 22px 0 0; border-bottom: 0; max-height: 88vh; max-height: 92dvh; }
  dialog.sheetdlg .dlg-body { max-height: 88vh; max-height: 92dvh; padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); }
  dialog .dlg-actions .btn { min-height: 44px; flex: 1 1 auto; }
  dialog .dlg-actions .btn.ghost { flex: 0 0 auto; }
  dialog.sheetdlg .dlg-actions { bottom: calc(-14px - env(safe-area-inset-bottom)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); margin-bottom: calc(-14px - env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) { .brand .hand { font-size: 21px; } .brand img { width: 34px; height: 34px; } }
/* touch: every target at least 44 px on coarse pointers */
@media (pointer: coarse), (max-width: 900px) {
  .btn.small, .tabs button, .filebtn, .family button, .req details summary, details summary { min-height: 44px; }
  .req details summary, details summary { display: flex; align-items: center; }
  /* v1.2.4: a job's title opens it (the Job Board is now in the UI matrix) */
  .job-title { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ── v1.1: memory, journals with consent, Studio, cards, tips ── */
.cardtabs { margin: 12px 0 4px; }
.offline { margin: 14px 0 6px; padding: 12px 16px; border: 2.5px dashed var(--ink-3); border-radius: var(--wob-sm); background: var(--paper-2); font-family: var(--hand); font-size: 22px; font-weight: 700; color: var(--ink-2); }
.beside { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; margin: 8px 0; }
.beside > .plan, .beside > .record { margin: 0; }
@media (max-width: 760px) { .beside { grid-template-columns: 1fr; } }
.consent { border: 2.5px solid var(--ink); border-radius: var(--wob-sm); background: var(--lilac); padding: 10px 14px; margin: 8px 0 14px; box-shadow: 2px 3px 0 var(--ink); }
.consent b { font-size: 16px; }
.brainlink { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0 12px; }
.brainlink .btn img { width: 24px; height: 24px; }
.memories .prose { margin-top: 2px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media { margin: 0; border: 2.5px solid var(--ink); border-radius: var(--wob-sm); background: var(--paper); box-shadow: 2px 3px 0 var(--ink); overflow: hidden; display: flex; flex-direction: column; }
.media img, .media video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--paper-2); border-bottom: 2.5px solid var(--ink); }
.media figcaption { padding: 8px 10px 10px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.media figcaption .btn { justify-self: start; }
.section.sub { margin-top: 14px; }
.section.sub > h3 { font-size: 22px; }
.switches .chip { min-width: 46px; text-align: center; }
.support { background: var(--berry-soft); border: 2.5px solid var(--ink); border-radius: var(--wob-sm); padding: 10px 14px 12px; box-shadow: 2px 3px 0 var(--ink); }
.support .btn img { width: 26px; height: 26px; }
body.tippage { min-height: 100vh; background: var(--meadow); }
body.tippage .gate { position: static; min-height: 100vh; padding-top: 90px; }
body.tippage .gate-card .btn { display: inline-flex; margin-top: 4px; }
table.banks code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; user-select: all; }
.memsearch { align-items: end; margin: 6px 0 2px; }
.memsearch input { min-width: 220px; }

/* ── v1.2: the open village (SPEC-phase4): server-rendered pages, guests, errands, gifts, the fun ── */
body.visitor { overflow: auto; }
.vis { min-height: 100vh; min-height: 100dvh; height: auto; }
.vis .map { height: 100vh; height: 100dvh; }
.vis .drawer { height: 100vh; height: 100dvh; position: sticky; top: 0; }
.plaque .plaque-weather { margin-top: 4px; color: var(--ink-2); font-style: italic; }
.plaque .plaque-weather:empty { display: none; }

.site-head { background: var(--paper); border-bottom: 2.5px solid var(--ink); }
.site-head-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-brand { text-decoration: none; display: grid; line-height: 1; }
.site-brand .hand { font-size: 32px; color: inherit; text-decoration: none; }
.site-brand .byline { font-size: 12.5px; color: var(--ink-2); font-style: italic; margin-top: 2px; }
.site-brand .byline a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; flex: 1; min-width: 0; }
.site-nav a { font-family: var(--hand); font-weight: 700; font-size: 19px; text-decoration: none; padding: 4px 9px; border-radius: 12px 15px 11px 16px / 15px 11px 16px 12px; border: 2px solid transparent; white-space: nowrap; }
.site-nav a:hover { background: var(--paper-2); }
.site-nav a[aria-current="page"] { border-color: var(--ink); background: var(--honey); }
.site-nav a.me { margin-left: auto; background: var(--moss-soft); border-color: var(--ink); }
.site-sub { max-width: 1100px; margin: 0 auto; padding: 0 16px 10px; color: var(--ink-2); }
main.page { padding: 18px 16px 48px; }
main.page .page-inner { max-width: 760px; margin: 0 auto; }
main.page.wide .page-inner { max-width: 1100px; }
main.page.home { background: var(--paper-2); border-top: 2.5px solid var(--ink); }
main.page h1 { font-size: 42px; margin: 6px 0 10px; }
main.page h2 { font-size: 28px; margin: 26px 0 8px; }
main.page h3 { margin: 10px 0 4px; }
main.page h4 { margin: 14px 0 6px; }
main.page section { margin: 0 0 10px; }
main.page .lead { font-size: 18px; color: var(--ink-2); }
main.page ul.rows li { overflow-wrap: anywhere; }
.noscript { background: var(--paper); border-bottom: 2.5px solid var(--ink); padding: 10px 16px; margin: 0; font-size: 14px; }
.site-foot { background: var(--paper); border-top: 2.5px solid var(--ink); padding: 18px 16px 28px; text-align: center; font-size: 14px; color: var(--ink-2); }
.site-foot p { max-width: 760px; margin: 0 auto 8px; }
.foot-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; }
.foot-nav a { color: var(--ink-2); }
.ico { width: 26px; height: 26px; vertical-align: middle; flex: none; }
.ico.lvl { width: 18px; height: 18px; margin-left: -4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px 2px 4px; background: var(--sky); font-family: var(--hand); font-weight: 700; font-size: 17px; line-height: 1.2; margin: 2px 0 4px; }
.badge .ico { width: 24px; height: 24px; }
.chip.calling { background: var(--sky); gap: 4px; }
.badge-ico { width: 20px; height: 20px; vertical-align: middle; }
.calling-small { font-family: var(--read); font-weight: 400; font-size: 12.5px; color: var(--ink-2); }
.village-lines { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 4px; }
.village-lines li { display: flex; gap: 8px; align-items: center; }
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 10px 0 18px; }
.vcard { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob-sm); padding: 12px; box-shadow: 2px 3px 0 var(--ink); min-width: 0; }
.vcard.resting { opacity: 0.8; }
.vcard .portrait.big { width: 92px; height: 92px; }
.vcard-body { min-width: 0; }
.vcard-body h3 { font-size: 24px; margin: 0 0 2px; }
.vcard-body h3 a { text-decoration: none; }
.vcard .kind { color: var(--ink-2); font-size: 14px; margin: 0; }
.vcard .line { font-size: 13.5px; margin: 2px 0 0; }
.portrait.huge { width: 170px; height: 170px; background: #fff; }
.profile-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.profile-head h1 { margin: 0 0 4px; }
.profile-head > div { min-width: 0; flex: 1; }
.profile-actions .btn img { width: 24px; height: 24px; }
blockquote.quote { margin: 10px 0; padding: 8px 14px; border-left: 5px solid var(--honey); background: var(--paper-2); border-radius: 4px 12px 12px 4px; font-style: italic; }
blockquote.quote cite { display: block; font-style: normal; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.prose-md p { margin: 0 0 0.7em; overflow-wrap: anywhere; }
.prose-md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 4px solid var(--line); color: var(--ink-2); }
.prose-md ul, .prose-md ol { margin: 0 0 0.7em; padding-left: 22px; }
.piece-text { font-size: 17.5px; line-height: 1.6; max-width: 62ch; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.family .fam, .tree .fam, .piece .who { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-family: var(--hand); font-weight: 700; font-size: 18px; }
.family .fam .ico, .tree .fam .ico, .piece .who .ico { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper-2); }
.wearing { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prop { width: 34px; height: 34px; vertical-align: middle; }
.prop.small { width: 24px; height: 24px; }
.wishes { list-style: none; padding: 0; margin: 4px 0; }
.wishes li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1.5px dashed var(--line); flex-wrap: wrap; }
.wishes li.granted .wish-text { text-decoration: line-through; color: var(--ink-3); }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.gift { display: grid; justify-items: center; gap: 2px; padding: 10px 8px 12px; text-align: center; cursor: pointer; font: inherit; color: inherit; border-radius: var(--wob-sm); box-shadow: 2px 3px 0 var(--ink); }
button.gift:hover { background: #fff8e4; }
button.gift:disabled { opacity: 0.5; cursor: not-allowed; }
.gift .prop { width: 56px; height: 56px; }
.gift b { font-family: var(--hand); font-size: 18px; line-height: 1.1; }
.gift .price { font-weight: 700; color: var(--moss); }
.errand-form { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob); padding: 16px 18px 12px; box-shadow: 3px 4px 0 var(--ink); margin: 10px 0; }
.errand-form fieldset { border: 2px dashed var(--line); border-radius: var(--wob-sm); padding: 8px 12px 10px; margin: 0 0 12px; }
.errand-form legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.tip-choices { gap: 6px; }
/* v1.2.3: the villager's price for the kind (the forms, the dialog) and Herbert's on the Apothecary */
.price-line, .price-note { font-weight: 600; border-left: 4px solid var(--honey); padding: 2px 0 2px 10px; margin: 6px 0 12px; }
.price-note { font-size: 15px; }
.chipbtn { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; background: var(--paper); cursor: pointer; font-weight: 600; min-height: 40px; }
.chipbtn:has(input:checked) { background: var(--honey); }
.chipbtn input { width: 18px; height: 18px; accent-color: var(--moss); }
.project { padding: 14px 18px 16px; margin: 14px 0; box-shadow: 3px 4px 0 var(--ink); }
.project h2 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.project.done { background: var(--moss-soft); }
.bar > span.w0 { width: 0; } .bar > span.w5 { width: 5%; } .bar > span.w10 { width: 10%; } .bar > span.w15 { width: 15%; } .bar > span.w20 { width: 20%; } .bar > span.w25 { width: 25%; } .bar > span.w30 { width: 30%; } .bar > span.w35 { width: 35%; } .bar > span.w40 { width: 40%; } .bar > span.w45 { width: 45%; } .bar > span.w50 { width: 50%; }
.bar > span.w55 { width: 55%; } .bar > span.w60 { width: 60%; } .bar > span.w65 { width: 65%; } .bar > span.w70 { width: 70%; } .bar > span.w75 { width: 75%; } .bar > span.w80 { width: 80%; } .bar > span.w85 { width: 85%; } .bar > span.w90 { width: 90%; } .bar > span.w95 { width: 95%; } .bar > span.w100 { width: 100%; }
.ways-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.way { display: grid; gap: 4px; padding: 14px 16px; text-decoration: none; box-shadow: 2px 3px 0 var(--ink); border-radius: var(--wob-sm); }
.way b { font-family: var(--hand); font-size: 22px; }
.way span { font-size: 14px; color: var(--ink-2); }
.way .ico { width: 34px; height: 34px; }
.meet h2 { margin-top: 20px; }
.festival-line { background: var(--honey); border: 2px solid var(--ink); border-radius: var(--wob-sm); padding: 6px 12px; display: flex; gap: 6px; align-items: center; }
.faq dt { font-family: var(--hand); font-weight: 700; font-size: 22px; margin-top: 12px; }
.faq dd { margin: 2px 0 0; }
.shelf { list-style: none; padding: 0; margin: 6px 0; }
.shelf li { padding: 8px 0; border-bottom: 1.5px dashed var(--line); }
.disclaimer { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob-sm); padding: 10px 14px; margin: 18px 0; font-weight: 600; }
.answer { font-size: 17px; line-height: 1.6; }
.piece-list { list-style: none; padding: 0; margin: 4px 0; }
.piece-list li { padding: 6px 0; border-bottom: 1.5px dashed var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.filters a { border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; text-decoration: none; font-weight: 600; font-size: 14px; background: var(--paper); }
.filters a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.piece { padding: 12px 14px 14px; box-shadow: 2px 3px 0 var(--ink); border-radius: var(--wob-sm); min-width: 0; }
.piece h3 { font-size: 22px; margin: 6px 0 2px; }
.piece p { overflow-wrap: anywhere; }
.chron { list-style: none; padding: 0; margin: 6px 0 10px; display: grid; gap: 6px; }
.chron li { display: flex; gap: 10px; align-items: flex-start; }
.chron .ico { width: 30px; height: 30px; }
.chron-day { padding: 12px 0; border-bottom: 2px dashed var(--line); }
.chron-day h2 { margin: 0 0 4px; }
.chron-day h2 a { text-decoration: none; }
.pager { display: flex; justify-content: space-between; margin: 16px 0; }
.timeline { list-style: none; padding: 0 0 0 10px; margin: 10px 0; border-left: 3px solid var(--ink-3); display: grid; gap: 14px; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -17px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--honey); border: 2px solid var(--ink); }
.timeline .ico { width: 30px; height: 30px; }
.tree-family { padding: 12px 16px; margin: 12px 0; box-shadow: 2px 3px 0 var(--ink); border-radius: var(--wob-sm); }
.tree-family h2 { margin: 0 0 6px; font-size: 24px; }
.tree-node .small { margin-left: 8px; }
.tree-node.resting > .fam { opacity: 0.7; }
.avatar { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper-2); overflow: hidden; }
.avatar .ico { width: 100%; height: 100%; }
.avatar.standing-sprout { border-color: var(--leaf); }
.avatar.standing-friend { border-color: var(--honey-2); box-shadow: 0 0 0 3px var(--honey); }
.avatar.standing-elder { border-color: var(--berry); box-shadow: 0 0 0 3px var(--rose); }
.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.avatar-pick { display: grid; justify-items: center; gap: 2px; padding: 6px; border: 2px dashed var(--line); border-radius: var(--wob-sm); cursor: pointer; font-size: 13px; }
.avatar-pick:has(input:checked) { border: 2.5px solid var(--ink); background: var(--honey); }
.avatar-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.me-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.me-avatar { width: 96px; height: 96px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper-2); }
.me-signin { padding: 14px 18px; box-shadow: 3px 4px 0 var(--ink); }
.errand-card { padding: 12px 14px; margin: 0 0 12px; box-shadow: 2px 3px 0 var(--ink); border-radius: var(--wob-sm); }
.errand-card details { margin: 6px 0; }
/* v1.2.3: a long state ("Herbert is on it; he owes you an answer within a week") wraps inside the card */
.errand-card .req-top > .chip { white-space: normal; max-width: 100%; border-radius: 16px; line-height: 1.35; padding: 4px 10px; }
.delivery { background: var(--paper-2); border-radius: var(--wob-sm); padding: 10px 14px; margin: 8px 0; }
.delivery h4 { margin: 0 0 6px; }
.delivery-text { font-size: 16.5px; line-height: 1.55; }
.guest-line { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.guest-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper-2); flex: none; }
.wave-row { margin: 6px 0 10px; }
.wave-row .btn img { width: 22px; height: 22px; }
.links { font-size: 15px; }
.thanks { max-width: 520px; margin: 40px auto; padding: 26px 26px 22px; text-align: center; box-shadow: 5px 6px 0 var(--ink); }
.thanks img.mascot { width: 120px; height: 120px; margin: -70px auto 2px; display: block; }
.thanks .btn { display: inline-flex; }
body.tippage main.page { background: var(--meadow); }
@media (max-width: 900px) {
  .site-head-inner { padding: 8px 12px; gap: 8px; }
  .site-brand .hand { font-size: 26px; }
  .site-nav { gap: 0 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; width: 100%; }
  .site-nav a { font-size: 17px; padding: 4px 8px; }
  .site-nav a.me { margin-left: 4px; }
  main.page h1 { font-size: 34px; }
  .portrait.huge { width: 120px; height: 120px; }
  .cardgrid { grid-template-columns: 1fr; }
}

/* v1.2.1: a skip link to the main content (visible when focused), a text chip where a gift has no picture, the board's note */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1000; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
.gift .prop-chip { align-self: center; margin: 18px auto; }
.board-note { margin-top: 14px; }

/* ── v1.2.2: the panel as a bottom sheet on a phone; its head (handle, title, tabs) and body on every screen ── */
.sheet-handle { display: none; }
.vis .phone-title { display: none; }
.vis .sheet-head { flex: none; padding: 16px 20px 12px; border-bottom: 2px dashed var(--line); }
.vis .sheet-head .tabs { margin: 0; }
.vis .sheet-head .tabs button { min-height: 44px; }
.vis .sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sheet-more:empty { display: none; }
.safe-probe { position: fixed; left: 0; bottom: 0; width: 1px; height: env(safe-area-inset-bottom, 0px); visibility: hidden; pointer-events: none; }
.tooltip.below { transform: translate(-50%, 0); }
.preview-line { margin: 8px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (pointer: coarse) { .hall-link { min-height: 44px; } }

@media (max-width: 900px) {
  html.sheet-mode, html.sheet-mode body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .vis { position: fixed; inset: 0; display: block; height: auto; min-height: 0; overflow: hidden; background: var(--meadow); }
  .vis .map { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--vh, 100dvh) - var(--sheet-peek, 22dvh) + 24px); }
  .vis .map .plaque { display: none; }
  .vis .drawer { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; top: auto; height: var(--sheet-h, 88dvh); min-height: 0;
    transform: translate3d(0, calc(var(--sheet-h, 88dvh) - var(--sheet-y, 22dvh)), 0);
    border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0;
    box-shadow: 0 -2px 0 rgba(35, 28, 23, 0.06), 0 -10px 28px rgba(31, 42, 77, 0.2);
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1); will-change: transform; }
  .vis .drawer.dragging { transition: none; }
  .vis .sheet-head { position: relative; padding: 24px 16px 12px; border-bottom: 2px dashed var(--line); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .vis .drawer.dragging .sheet-head { cursor: grabbing; }
  .sheet-handle { display: block; position: absolute; z-index: 1; top: 0; left: 50%; transform: translateX(-50%); width: 112px; height: 44px; padding: 0; border: 0; border-radius: 14px; background: none; cursor: grab; }
  .sheet-handle .grip { position: absolute; top: 9px; left: 50%; width: 46px; height: 5px; margin-left: -23px; border-radius: 3px; background: var(--ink-3); opacity: 0.7; transition: opacity 120ms, width 120ms; }
  .sheet-handle:hover .grip, .vis .drawer.dragging .grip { opacity: 1; }
  .sheet-handle:focus-visible { outline-offset: -6px; }
  .vis .phone-title { display: block; margin: 0 0 10px; min-width: 0; }
  .phone-title h1 { font-size: 27px; line-height: 1; white-space: nowrap; }
  .phone-title .tagline { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.3; }
  .vis .sheet-head .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .vis .sheet-head .tabs button { padding: 4px 2px; font-size: 18px; white-space: nowrap; }
  .vis .sheet-body { padding-bottom: calc(var(--sheet-pad, 0px) + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .vis .drawer:not([data-state="full"]) .sheet-body { touch-action: none; }
  .vis .drawer-inner { padding: 12px 16px 16px; }
  .vis .ai-note { padding: 12px 16px 18px; }
  /* the rest of the front page scrolls on inside the sheet */
  .sheet-more { border-top: 2.5px solid var(--ink); }
  .sheet-more .site-head { border-bottom: 2px dashed var(--line); background: var(--paper); }
  .sheet-more .site-head-inner { padding: 12px 16px; }
  .sheet-more .site-brand { display: none; }
  .sheet-more .site-nav { flex-wrap: wrap; overflow: visible; gap: 6px; width: 100%; }
  .sheet-more .site-nav a, .sheet-more .site-nav a.me { margin: 0; min-height: 44px; display: inline-flex; align-items: center; border: 2px solid var(--ink); border-radius: 999px; padding: 4px 13px; background: var(--paper); font-size: 18px; }
  .sheet-more .site-nav a[aria-current="page"] { display: none; }
  .sheet-more .site-nav a.me { background: var(--moss-soft); }
  .sheet-more main.page.home { border-top: 0; padding-top: 6px; }
  .sheet-more main.page.home .lead, .sheet-more main.page.home .village-lines, .sheet-more main.page.home .meet { display: none; }
  /* the overlays on the meadow: sound top left, the clock top right, the Hall's door under it */
  .map .clockchip { top: 10px; right: 10px; left: auto; bottom: auto; font-size: 13.5px; min-height: 44px; padding: 3px 12px 3px 5px; box-shadow: 1.5px 2px 0 var(--ink); }
  .map .clockchip .sun { width: 22px; height: 22px; }
  .map-tools { top: 10px; left: 10px; right: auto; bottom: auto; }
  /* the Hall's door stands beside the clock (one row of overlays: more meadow shows over a raised sheet) */
  .hall-link { top: 10px; right: calc(20px + var(--chip-w, 150px)); min-height: 44px; font-size: 16px; padding: 4px 13px 4px 9px; box-shadow: 1.5px 2px 0 var(--ink); }
  .hall-link img { width: 20px; height: 20px; }
}
@media (max-width: 359px) { .hall-link { top: 64px; right: 10px; } }
/* a wide sheet (a phone on its side, a tablet): the title and the tabs share one row, so the meadow keeps the height */
@media (max-width: 900px) and (min-width: 600px) {
  .vis .sheet-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; padding-top: 22px; padding-bottom: 10px; }
  .vis .phone-title { margin: 0; }
  .vis .sheet-head .tabs { grid-template-columns: repeat(4, auto); }
  .vis .sheet-head .tabs button { padding: 4px 14px; }
}

/* v1.2.2: every tap target at least 44 × 44 px on a touch screen (links inside a sentence excepted) */
@media (pointer: coarse), (max-width: 900px) {
  .site-nav a { min-height: 44px; display: inline-flex; align-items: center; }
  .site-brand > a.hand { display: inline-flex; align-items: center; min-height: 44px; }
  .foot-nav { gap: 0 2px; }
  .foot-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 9px; }
  .chipbtn { min-height: 44px; }
  .filters a { display: inline-flex; align-items: center; min-height: 44px; }
  .vcard-body h2 a, .vcard-body h3 a, .piece h3 a, .chron-day h2 a { display: inline-flex; align-items: center; min-height: 44px; }
  .piece .who, .family .fam, .tree .fam { min-height: 44px; }
  a.go { display: inline-flex; align-items: center; min-height: 44px; }
  table.ledger td > a { display: inline-flex; align-items: center; min-height: 44px; }
  .vcard-body h2 a, .vcard-body h3 a, table.ledger td > a, a.go, .foot-nav a { min-width: 44px; }
  .brand { min-height: 44px; }
}

/* v1.2.2: a villager's page on a phone: the portrait beside the name, then what it is doing and the buttons in a grid */
@media (max-width: 560px) {
  .profile .profile-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 14px; row-gap: 2px; align-items: start; }
  .profile .profile-head > div { display: contents; }
  .profile .profile-head > .portrait { grid-row: 1 / span 3; width: 96px; height: 96px; }
  .profile .profile-head h1, .profile .profile-head .badge, .profile .profile-head .kind { grid-column: 2; justify-self: start; }
  .profile .profile-head h1 { margin-top: 6px; }
  .profile .profile-head > div > :not(h1):not(.badge):not(.kind) { grid-column: 1 / -1; }
  .profile-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
  .profile-actions .btn { flex: 1 1 auto; white-space: nowrap; font-size: 19px; padding: 8px 14px; }
  .profile .doing { margin-top: 10px; }
}
/* a tick box beside a long line sits by its first line */
.check { align-items: flex-start; padding: 10px 0; }
.check input { margin: 1px 0 0; flex: none; }

/* v1.2.2: on a phone the page links are their own row under the name, scrolled sideways, fading at the right edge */
@media (max-width: 900px) {
  .site-nav { flex: 1 1 calc(100% + 24px); margin: 0 -12px; padding: 0 28px 0 12px; width: auto; -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 30px), transparent); }
  .sheet-more .site-nav { margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 400px) { .vis .sheet-head .tabs button { font-size: 17px; } }

/* v1.2.2: the Hall's places on a laptop or a tablet held sideways: the doodle icons alone (each names itself on
   hover and to a screen reader), so no place is cut at the edge of the bar; the names come back on a wide screen */
@media (min-width: 901px) and (max-width: 1599px) {
  .navlink .nl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .navlink { padding: 6px 9px; min-width: 48px; justify-content: center; }
  .navlink img { width: 30px; height: 30px; }
  .navlink .count { position: absolute; top: -4px; right: -6px; }
  .topbar .usermenu { display: none; }
}
.places { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); padding-right: 24px; }
/* v1.2.2: the Apothecary's head on a phone: the portrait sits in the text, which flows around it */
@media (max-width: 560px) {
  .profile-head.apoth { display: block; }
  .profile-head.apoth > .portrait { float: left; width: 96px; height: 96px; margin: 4px 14px 6px 0; shape-outside: circle(50%); }
  .profile-head.apoth::after { content: ""; display: block; clear: both; }
}
/* v1.2.2: a phone on its side or a tablet: a dialog is a centred sheet, not the full width of the screen */
@media (max-width: 900px) and (min-width: 600px) {
  dialog.sheetdlg { width: min(620px, 100vw); max-width: min(620px, 100vw); margin: auto auto 0; }
  dialog .dlg-actions .btn { flex: 0 0 auto; min-width: 140px; }
}
/* v1.2.2: a wide screen gives the panel a little more room */
@media (min-width: 1800px) { .vis { grid-template-columns: minmax(0, 1fr) 480px; } }
