/* Hadley Howler play client. Portrait phone first; light and dark follow the system. */
:root {
  color-scheme: light;
  --page: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece8de;
  --surface-3: #e0dbcf;
  --ink: #1c1a17;
  --ink-2: #4a463f;
  --muted: #7a756b;
  --border: rgba(0, 0, 0, 0.12);
  --accent: #a8641a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(168, 100, 26, 0.12);
  --you: #24578f;
  --you-soft: rgba(36, 87, 143, 0.10);
  --good: #2f7d32;
  --warn: #9a6a00;
  --warn-soft: rgba(201, 141, 0, 0.14);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, 0.10);
  --shadow: 0 -6px 24px rgba(0, 0, 0, 0.10);
  --map-bg: #f8f5ee; --link: #b9b2a3;
  --area-town: #8a6d3b; --area-core: #4f6d8f; --area-residential: #7a5a8c; --area-grounds: #4f7d4a; --area-lake: #2f7f96;
  --lvl-ok: #cfe8cf; --lvl-warn: #f7dd94; --lvl-bad: #f2b3ac; --lvl-grave: #a8403a; --lvl-closed: #c9c6bf; --lvl-none: #fffdf8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --tap: 48px;
  --radius: 12px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #141318;
    --surface: #1d1c22;
    --surface-2: #26252c;
    --surface-3: #313038;
    --ink: #ece9e2;
    --ink-2: #c4c0b6;
    --muted: #8f8a80;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #e09a45;
    --accent-ink: #1a1206;
    --accent-soft: rgba(224, 154, 69, 0.14);
    --you: #8db8ec;
    --you-soft: rgba(141, 184, 236, 0.10);
    --good: #7cc47f;
    --warn: #f0c050;
    --warn-soft: rgba(240, 192, 80, 0.12);
    --bad: #f08a80;
    --bad-soft: rgba(240, 138, 128, 0.12);
    --shadow: 0 -6px 24px rgba(0, 0, 0, 0.45);
    --map-bg: #18171c; --link: #4a4852;
    --area-town: #d2a964; --area-core: #8fb3dc; --area-residential: #c3a0d6; --area-grounds: #8cc486; --area-lake: #6cc3da;
    --lvl-ok: #2d4f30; --lvl-warn: #6b5420; --lvl-bad: #6e2f2a; --lvl-grave: #b4473f; --lvl-closed: #45434a; --lvl-none: #26252c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--page); color: var(--ink); }
body {
  font: 17px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { font-size: 16px; }   /* no iOS zoom on focus */
code { font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ buttons */
.btn {
  min-height: var(--tap); padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  font-weight: 600; cursor: pointer; text-align: center; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); filter: brightness(0.96); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent;
  color: var(--ink); border-radius: 10px; cursor: pointer; flex: none;
}
.icon-btn:active { background: var(--surface-2); }

/* ------------------------------------------------------------------ start screen */
#start { overflow-y: auto; padding: calc(16px + var(--st)) calc(16px + var(--sr)) calc(24px + var(--sb)) calc(16px + var(--sl)); }
.start-inner { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.brand { text-align: center; padding: 18px 0 4px; }
.brand-icon { border-radius: 16px; }
.brand h1 { font: 600 1.9rem/1.15 var(--serif); margin: 8px 0 2px; letter-spacing: 0.01em; }
.brand .tag { margin: 0; color: var(--muted); font-family: var(--serif); font-style: italic; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card p { margin: 6px 0; }
.msg { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--ink); }
.msg.bad { background: var(--bad-soft); }
.row { display: flex; gap: 8px; }
.row > input { flex: 1; min-width: 0; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=password], input:not([type]), input[type=time], textarea, select {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--page); color: var(--ink);
}
textarea { resize: none; line-height: 1.4; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-width: 64px; min-height: var(--tap); border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); font-weight: 600; cursor: pointer;
}
.seg button[aria-checked=true] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.preset {
  text-align: left; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; min-height: var(--tap);
}
.preset[aria-checked=true] { outline: 2px solid var(--accent); background: var(--accent-soft); }
.preset b { display: block; text-transform: capitalize; margin-bottom: 4px; }
.bars { display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; align-items: center; font-size: 0.72rem; color: var(--muted); }
.bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.cont-title { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 4px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
details summary { cursor: pointer; font-weight: 600; min-height: 32px; }

/* ------------------------------------------------------------------ top bar */
#topbar {
  flex: none; display: flex; align-items: center; gap: 4px;
  padding: calc(4px + var(--st)) calc(8px + var(--sr)) 4px calc(4px + var(--sl));
  background: var(--surface); border-bottom: 1px solid var(--border); min-height: 52px;
}
.tb-main { flex: 1; min-width: 0; line-height: 1.25; }
.tb-line1 { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-line2 { font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { margin-left: 8px; font-size: 0.72rem; font-weight: 600; color: var(--warn); }
.tb-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.stat { font-size: 0.74rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.stat.warn { background: var(--warn-soft); color: var(--warn); }
.stat.bad { background: var(--bad-soft); color: var(--bad); }

/* ------------------------------------------------------------------ Next line (D322) */
.next-bar {
  flex: none; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  padding: 6px calc(12px + var(--sr)) 6px calc(12px + var(--sl)); min-height: 44px;
  background: var(--surface-2); border: 0; border-bottom: 1px solid var(--border); color: var(--ink);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.nb-ico { flex: none; display: grid; place-items: center; color: var(--muted); }
.nb-body { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 6px; line-height: 1.25; }
.nb-lbl { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; color: var(--muted); align-self: center; }
.nb-text { font-size: 0.88rem; font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nb-sub { grid-column: 1 / -1; font-size: 0.76rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-when { flex: none; font-size: 0.78rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--surface); font-variant-numeric: tabular-nums; }
.nb-when:empty { display: none; }
.next-bar.lvl-none .nb-text { font-weight: 500; color: var(--muted); }
.next-bar.lvl-soon { background: var(--warn-soft); }
.next-bar.lvl-soon .nb-ico, .next-bar.lvl-soon .nb-lbl, .next-bar.lvl-soon .nb-when { color: var(--warn); }
.next-bar.lvl-urgent, .next-bar.lvl-late { background: var(--bad-soft); }
.next-bar.lvl-urgent .nb-ico, .next-bar.lvl-urgent .nb-lbl, .next-bar.lvl-urgent .nb-when,
.next-bar.lvl-late .nb-ico, .next-bar.lvl-late .nb-lbl, .next-bar.lvl-late .nb-when { color: var(--bad); }
.next-bar.lvl-here .nb-ico, .next-bar.lvl-here .nb-lbl { color: var(--good); }
.next-bar.summons { box-shadow: inset 4px 0 0 var(--accent); }
.next-bar.summons .nb-lbl { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .next-bar.lvl-urgent .nb-when { animation: pulse 1.6s ease-in-out infinite; }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.next-list li { display: block; }
.nl-top { display: flex; justify-content: space-between; gap: 10px; }
.nl-when { flex: none; font-size: 0.82rem; font-weight: 700; color: var(--ink-2); }
.nl-sub { font-size: 0.82rem; color: var(--muted); }
.next-list li.lvl-soon .nl-when { color: var(--warn); }
.next-list li.lvl-urgent .nl-when, .next-list li.lvl-late .nl-when { color: var(--bad); }
.next-list li.lvl-here .nl-when { color: var(--good); }
.next-list li.lvl-done { opacity: 0.6; }

/* ------------------------------------------------------------------ story log */
#log {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: 12px calc(16px + var(--sr)) 18px calc(16px + var(--sl));
  overflow-wrap: anywhere;
}
.e { margin: 0 0 10px; max-width: 100%; }
.e.narration { font-family: var(--serif); font-size: 1.04rem; line-height: 1.55; }
.e.seen { color: var(--ink-2); font-size: 0.95rem; padding-left: 10px; border-left: 2px solid var(--surface-3); }
.e.say { font-family: var(--serif); font-size: 1.04rem; }
.e.say .who { display: block; font-family: var(--sans); font-size: 0.78rem; font-weight: 700; color: var(--accent); letter-spacing: 0.02em; margin-bottom: 1px; }
.e.say.you { margin-left: 18%; text-align: right; }
.e.say.you .bubble { display: inline-block; text-align: left; background: var(--you-soft); padding: 6px 10px; border-radius: 12px 12px 2px 12px; }
.e.say.you .who { color: var(--you); }
.e.action { font-style: italic; color: var(--ink-2); font-family: var(--serif); }
.e.action.you { text-align: right; }
.e.me { text-align: right; color: var(--you); font-size: 0.86rem; font-weight: 600; }
.e.me::before { content: "\203A  "; }
.e.notice { font-size: 0.86rem; font-weight: 700; padding: 7px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); }
.e.system { font-size: 0.86rem; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); }
.e.divider { height: 1px; background: var(--border); margin: 14px 20%; }
.e.ending { font: 600 1.4rem/1.25 var(--serif); text-align: center; margin: 22px 0 8px; color: var(--accent); }
.e.ending_line { font-family: var(--serif); text-align: center; font-size: 1rem; }
/* D320: curtain cards at scene boundaries */
.e.curtain {
  margin: 22px 0 16px; padding: 16px 16px 14px; border-radius: 14px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent);
}
.e.curtain .c-when { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }
.e.curtain .c-title { font: 600 1.32rem/1.2 var(--serif); margin: 4px 0 2px; color: var(--ink); }
.e.curtain .c-place { font-size: 0.86rem; font-weight: 600; color: var(--accent); }
.e.curtain .c-line { font: italic 1rem/1.5 var(--serif); color: var(--ink-2); margin: 8px 0 0; }
.e.curtain.forced { border-top-color: var(--bad); }
.e.curtain.forced .c-place { color: var(--bad); }
.e.curtain.day { border-top-color: var(--you); }
.e.curtain.day .c-place { color: var(--you); }
.e.curtain.slot {
  text-align: left; padding: 8px 12px; margin: 16px 0 12px; border-top: 1px solid var(--border); border-left: 3px solid var(--muted);
  background: transparent;
}
.e.curtain.slot .c-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.e.curtain.slot .c-title { font: 700 0.92rem/1.3 var(--sans); margin: 0; }
.e.curtain.slot .c-meta { font-size: 0.76rem; color: var(--muted); }
.e.curtain.slot .c-line { font-size: 0.9rem; margin-top: 2px; }
.e.reminder, .e.missed { font-size: 0.88rem; padding: 7px 10px; border-radius: 10px; display: flex; gap: 8px; align-items: baseline; }
.e.reminder { background: var(--warn-soft); border-left: 3px solid var(--warn); }
.e.missed { background: var(--bad-soft); border-left: 3px solid var(--bad); }
.e .flag { flex: none; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; }
.e.reminder .flag { color: var(--warn); }
.e.missed .flag { color: var(--bad); }
.stamp { display: block; text-align: center; font-size: 0.7rem; color: var(--muted); margin: 14px 0 8px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ------------------------------------------------------------------ action area */
#actions {
  flex: none; max-height: 58dvh; overflow-y: auto; overflow-x: hidden;
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 10px calc(12px + var(--sr)) calc(10px + var(--sb)) calc(12px + var(--sl));
}
.a-prompt { font-family: var(--serif); font-weight: 600; margin: 0 0 8px; font-size: 1.02rem; }
/* D323: the player's move */
.ym { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; min-width: 0; }
.ym-pill {
  flex: none; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em; padding: 2px 9px; border-radius: 999px;
  background: var(--you); color: var(--surface);
}
.ym.k-free .ym-pill { background: var(--you-soft); color: var(--you); }
.ym-instr { font: italic 0.92rem/1.35 var(--serif); color: var(--ink-2); min-width: 0; }
.ym.has-instr { padding: 8px 10px; border-radius: 12px; background: var(--you-soft); border-left: 3px solid var(--you); }
.a-note { font-size: 0.85rem; color: var(--ink-2); margin: 0 0 8px; }
.a-note.warn { color: var(--warn); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  width: 100%; min-height: var(--tap); text-align: left; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; line-height: 1.35;
  font-size: 0.98rem; touch-action: manipulation;
}
.opt.special { border-color: var(--accent); background: var(--accent-soft); }
.opt .tag { font-size: 0.72rem; font-weight: 700; color: var(--accent); display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  min-height: 40px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 0.9rem; cursor: pointer; white-space: nowrap; flex: none;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; touch-action: manipulation;
}
.chips:not(.scroll) .chip { white-space: normal; text-align: left; flex: 0 1 auto; border-radius: 14px; }
.chip.special { border-color: var(--accent); background: var(--accent-soft); }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.ctx-row { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; min-width: 0; }
.ctx-row > .lbl { flex: none; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; width: 52px; }
.ctx-row > .chips { flex: 1; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.act {
  min-height: 56px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 0.74rem; font-weight: 600; cursor: pointer; padding: 4px 2px; touch-action: manipulation;
}
.act svg { width: 22px; height: 22px; }
.act.hot { border-color: var(--accent); background: var(--accent-soft); }
.more { margin-top: 6px; }
.say-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.say-row textarea { flex: 1; min-width: 0; min-height: var(--tap); max-height: 140px; }
.say-row .btn { flex: none; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
.counter { font-size: 0.7rem; color: var(--muted); text-align: right; margin-top: 2px; }
.approach { border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--warn-soft); font-weight: 600; }
.approach.late { background: var(--bad-soft); }
.thinking { display: flex; align-items: center; gap: 10px; min-height: 56px; color: var(--ink-2); font-size: 0.95rem; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.3; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.8; } }
.convo-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.convo-head b { font-size: 0.95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-opts { max-height: 26dvh; overflow-y: auto; }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--sb)); z-index: 30;
  background: var(--bad); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 0.9rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

/* ------------------------------------------------------------------ sheet */
#sheet-wrap { position: fixed; inset: 0; z-index: 20; }
#sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); }
#sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  padding-bottom: var(--sb); animation: up 0.18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 16px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 1.05rem; }
#sheet-body { overflow-y: auto; overflow-x: hidden; padding: 4px calc(16px + var(--sr)) 16px calc(16px + var(--sl)); overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 10px; position: sticky; top: 0; background: var(--surface); padding: 4px 0; z-index: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.tab[aria-selected=true] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.list li:last-child { border-bottom: 0; }
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick button { text-align: left; }
pre.block { white-space: pre-wrap; font: 0.85rem/1.45 var(--sans); margin: 0; background: var(--surface-2); padding: 10px; border-radius: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
table.roles { width: 100%; border-collapse: collapse; font-size: 0.82rem; font-variant-numeric: tabular-nums; margin-top: 10px; }
table.roles th, table.roles td { text-align: right; padding: 4px 4px; border-bottom: 1px solid var(--border); }
table.roles th:first-child, table.roles td:first-child { text-align: left; }
.sec { margin: 14px 0 6px; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 0.95rem; }
.toggle input { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ map */
.mapframe { background: var(--map-bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.mapsvg { width: 100%; height: auto; display: block; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.m-area { font: 700 11px var(--sans); letter-spacing: 0.12em; fill: var(--muted); text-anchor: middle; }
.m-link { stroke: var(--link); stroke-width: 2.5; stroke-linecap: round; }
.m-link.inside { stroke-dasharray: 2 4; stroke-width: 2; }
.m-link.exit { stroke: var(--accent); stroke-width: 4; }
.m-node { cursor: pointer; outline: none; }
.m-dot { fill: var(--lvl-none); stroke-width: 3; stroke: var(--muted); }
.m-node.a-town .m-dot { stroke: var(--area-town); }
.m-node.a-core .m-dot { stroke: var(--area-core); }
.m-node.a-residential .m-dot { stroke: var(--area-residential); }
.m-node.a-grounds .m-dot { stroke: var(--area-grounds); }
.m-node.a-lake .m-dot { stroke: var(--area-lake); }
.m-dot.lvl-ok { fill: var(--lvl-ok); }
.m-dot.lvl-warn { fill: var(--lvl-warn); }
.m-dot.lvl-bad { fill: var(--lvl-bad); }
.m-dot.lvl-grave { fill: var(--lvl-grave); }
.m-dot.lvl-closed { fill: var(--lvl-closed); }
.m-here-ring { fill: none; stroke: var(--accent); stroke-width: 4; }
.m-exit-ring { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }
.m-label { font: 600 11px var(--sans); fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: var(--map-bg); stroke-width: 3.5px; stroke-linejoin: round; }
.m-label.sub { font-size: 9.5px; font-weight: 500; fill: var(--ink-2); }
.m-label.here { font-weight: 800; }
.m-you { font: 800 9px var(--sans); fill: var(--accent); text-anchor: middle; letter-spacing: 0.1em; paint-order: stroke; stroke: var(--map-bg); stroke-width: 3px; }
.m-hit { fill: transparent; }
.m-node:focus-visible .m-dot { stroke: var(--accent); stroke-width: 4; }
.m-badge.appt { fill: var(--warn); }
.m-badge-glyph { fill: none; stroke: var(--surface); stroke-width: 1.6; stroke-linecap: round; }
.m-badge.obj { fill: var(--accent); stroke: var(--surface); stroke-width: 1; }
.m-badge.people { fill: var(--you); }
.m-badge-num { font: 800 10px var(--sans); fill: var(--surface); text-anchor: middle; }
.map-banner { margin-bottom: 6px; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; font-size: 0.8rem; color: var(--ink-2); }
.lg { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.lg-sw { flex: none; }
.ashby { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.ashby p { margin: 4px 0; }
