/* The Kingdom - Oahu shore observation board. House rules: r349 contrast (every panel its own
   tint + 2px darker border, white tiles with 1.5px border + 6px colour bar, 4.5:1 text),
   r343/r350 back button, keyboard-safe sheet (--vvh / --kb), rule 68 red pulsating critical. */
:root {
  --ink: #1b2a33;
  --ink-2: #44535c;
  --hint: #5c6b74;
  --sea: #1d8fc4;
  --sea-deep: #0f4f7a;
  --sand: #f1d38e;
  --sand-dark: #d9b15a;
  --leaf: #2e9b63;
  --sun: #ffc23d;
  --plumeria: #f7a8c4;
  --calm: #2e9b63;
  --busy: #d99a1b;
  --strained: #e0662a;
  --stuck: #c62828;
  --shore-bg: #dff1fb;  --shore-line: #7fb8d8;
  --map-bg: #e4f3e1;    --map-line: #7fb783;
  --alex-bg: #fdf1d5;   --alex-line: #d9b15a;
  --sheet-bg: #eee9fb;  --sheet-line: #9b8fd0;
  --staff-bg: #fbe9f0;  --staff-line: #c7708f;
  --office-bg: #f5ecdb; --office-line: #9c7a45;
  --tile-bg: #ffffff;   --tile-alt: #f1f7fb; --tile-line: #9db5c4;
  --ns-bg: #ffffff; --ns-ink: #1b2a33; --ns-line: #9db5c4;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #c9e6f5;
  color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
h1, h2 { margin: 0; font-weight: 700; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--sea-deep); color: #ffffff;
  border-bottom: 2px solid #072e49;
  padding: 8px 16px;
}
.topbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title { font-size: 20px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; color: #ffffff; }
.title-sun { width: 18px; height: 18px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 3px #ffe08a66; display: inline-block; }
.topbar-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.chip {
  background: #1b6a99; color: #ffffff; border: 1px solid #6fb3dc;
  border-radius: 999px; padding: 3px 10px; font-size: 13px; white-space: nowrap;
}
.chip.ok { background: #1f7a4d; border-color: #7fd3a6; color: #ffffff; }
.chip.warn { background: #a2461b; border-color: #f0a97f; color: #ffffff; }
.chip.bad { background: #a11a1a; border-color: #f29a9a; color: #ffffff; }
.menu-wrap { position: relative; margin-left: auto; }
.menu-btn {
  background: #1b6a99; color: #ffffff; border: 1px solid #6fb3dc; border-radius: 10px;
  width: 40px; height: 36px; font-size: 22px; line-height: 1;
}
.menu {
  position: absolute; right: 0; top: 42px; min-width: 160px;
  background: #ffffff; color: var(--ink); border: 2px solid var(--sea-deep); border-radius: 10px;
  box-shadow: 0 8px 24px #0f4f7a44; padding: 6px; z-index: 30;
}
.menu-item {
  display: block; width: 100%; text-align: left; background: #f1f4f7; color: var(--ink);
  border: 2px solid #8a94a6; border-radius: 8px; padding: 10px 12px; font-size: 15px;
}
.menu-item + .menu-item { margin-top: 4px; } /* r367 (Kevin 10/27/2026): every menu choice with words is a visible button */
.menu-item:hover, .menu-item:focus { background: #dff1fb; color: var(--ink); }
.notice { margin-top: 6px; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.notice-amber { background: #fff3cd; color: #6b4a00; border: 1.5px solid #e0b84a; }
.notice-red { background: #fde2e2; color: #7a1414; border: 1.5px solid #e08c8c; }
.notice-red a { color: #7a1414; font-weight: 700; }
.notice-grey { background: #e6eef3; color: #3b4a53; border: 1.5px solid #9db5c4; }

/* ---------- page + panels ---------- */
.page { padding: 12px 16px 40px; max-width: 1280px; margin: 0 auto; display: grid; gap: 14px; }
@media (min-width: 900px) {
  .page { grid-template-columns: 1fr 1fr; grid-template-areas: "alex map" "shore shore" "staff staff"; align-items: start; }
  .panel-staff { grid-area: staff; }
  .panel-alex { grid-area: alex; }
  .panel-map { grid-area: map; }
  .panel-shore { grid-area: shore; }
}
.panel { border-radius: var(--radius); padding: 12px; }
.panel-shore { background: var(--shore-bg); border: 2px solid var(--shore-line); }
.panel-map { background: var(--map-bg); border: 2px solid var(--map-line); }
.panel-alex { background: var(--alex-bg); border: 2px solid var(--alex-line); }
.panel-staff { background: var(--staff-bg); border: 2px solid var(--staff-line); }
.panel-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h2 { font-size: 17px; }
.panel-sub { font-size: 13px; color: var(--ink-2); }

/* ---------- Alex card ---------- */
.alex-row { display: flex; gap: 12px; align-items: flex-start; }
.alex-avatar { width: 72px; height: 72px; flex: 0 0 72px; border-radius: 50%; overflow: hidden; background: #ffffff; border: 2px solid var(--alex-line); }
.alex-avatar img, .alex-avatar svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.alex-name { font-weight: 700; font-size: 14px; color: #6b4a00; }
.alex-lines { margin: 4px 0 0; padding-left: 18px; }
.alex-lines li { margin: 2px 0; }

/* ---------- shore stage ---------- */
.verdict { border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-weight: 600; }
.verdict.flowing { background: #dcf5df; color: #1b5e20; border: 1.5px solid #7fcf8e; }
.verdict.stuck { background: #fde2e2; color: #7a1414; border: 1.5px solid #e08c8c; }
.stage {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1.5px solid #7fb8d8;
  /* bg_shore.jpg (1600x900 painted Oahu shore) with the drawn gradient underneath as the 404 fallback */
  background-image: url(art/kingdom/bg_shore.jpg), linear-gradient(180deg, #bfe6ff 0, #8fd0f5 50px, #2fa2d8 110px, #1d8fc4 150px, #f4dea2 154px, #f1d38e 100%);
  background-size: cover, auto;
  background-position: left top, 0 0;
  background-repeat: no-repeat;
  min-height: 420px;
}
.stage.has-bg .stage-scene { display: none; }
.stage-scene { position: absolute; inset: 0; pointer-events: none; }
.stage-scene svg { width: 100%; height: 100%; display: block; }
.stage-fish { position: absolute; left: 0; right: 0; top: 0; height: 150px; pointer-events: none; overflow: hidden; }
.fish {
  position: absolute; width: 24px; height: 24px; opacity: 0;
  animation: swim var(--dur, 9s) linear var(--delay, 0s) infinite;
}
.fish img, .fish svg { width: 100%; height: 100%; display: block; object-fit: contain; }
@keyframes swim {
  0% { transform: translate(-30px, var(--y0, 0px)) scaleX(1); opacity: 0; }
  8% { opacity: 1; }
  48% { transform: translate(var(--x1, 300px), var(--y1, 20px)) scaleX(1); opacity: 1; }
  50% { transform: translate(var(--x1, 300px), var(--y1, 20px)) scaleX(-1); }
  92% { opacity: 1; }
  100% { transform: translate(-30px, var(--y0, 0px)) scaleX(-1); opacity: 0; }
}
.huts {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  padding: 160px 10px 12px;
}
@media (min-width: 640px) { .huts { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 160px; } }
@media (min-width: 900px) { .huts { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 160px; } }
.unit-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.unit-layer .unit { position: absolute; left: 0; top: 0; transition: transform .9s cubic-bezier(.4,.1,.3,1); }
.stage.has-layer .slot .unit { visibility: hidden; }

/* hut tile: white, 1.5px border, 6px band bar on the left, alternating faint tint */
.hut {
  position: relative; background: var(--tile-bg); color: var(--ink);
  border: 1.5px solid var(--tile-line); border-left: 6px solid var(--band, #9db5c4);
  border-radius: 10px; padding: 8px 8px 8px 10px; min-height: 108px;
}
.hut:nth-child(even) { background: var(--tile-alt); }
.hut.band-calm { --band: var(--calm); }
.hut.band-busy { --band: var(--busy); }
.hut.band-strained { --band: var(--strained); }
.hut.band-stuck { --band: var(--stuck); }
.hut.stub { opacity: .72; }
.hut.stub .hut-name { color: var(--ink-2); }
.hut-top { display: flex; align-items: center; gap: 6px; }
.hut-roof { width: 26px; height: 22px; flex: 0 0 26px; }
.hut-name { font-weight: 700; font-size: 13px; line-height: 1.15; flex: 1; min-width: 0; }
.hut-face { width: 22px; height: 22px; flex: 0 0 22px; }
.hut-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.badge { border-radius: 999px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-age { background: #e6eef3; color: #2c3b45; border: 1px solid #9db5c4; }
.badge-age.warn { background: #ffe5cc; color: #6b2e00; border-color: #e0a06a; }
.badge-age.bad { background: #fde2e2; color: #7a1414; border-color: #e08c8c; }
.badge-alert { background: #fff3cd; color: #6b4a00; border: 1px solid #e0b84a; }
.badge-cleared { background: #dcf5df; color: #1b5e20; border: 1px solid #7fcf8e; }
.badge-thru { background: #dff1fb; color: #0f4f7a; border: 1px solid #7fb8d8; }
.badge-thru .juice { font-weight: 800; font-variant-numeric: tabular-nums; }
.hut-reason { font-size: 12px; color: var(--ink-2); font-style: italic; margin-top: 6px; }
.hut-count { font-weight: 800; font-size: 16px; color: var(--ink); }
.slots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; min-height: 24px; align-items: flex-end; }
.slot { width: 22px; height: 26px; position: relative; }
.unit { width: 22px; height: 26px; display: block; }
.unit img, .unit svg { width: 100%; height: 100%; display: block; object-fit: contain; object-position: center bottom; }
.more { font-size: 12px; font-weight: 700; color: var(--ink-2); align-self: center; }

/* rule 68: the bottleneck hut is red and pulsates */
.hut.bottleneck { border-color: var(--stuck); --band: var(--stuck); }
.hut.bottleneck .ring {
  position: absolute; inset: -5px; border-radius: 13px; pointer-events: none;
  border: 3px solid var(--stuck);
  animation: pulse-ring 1.2s ease-in-out infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 #c6282899; opacity: 1; }
  70% { box-shadow: 0 0 0 10px #c6282800; opacity: .75; }
  100% { box-shadow: 0 0 0 0 #c6282800; opacity: 1; }
}

/* warning-sign card for the bottleneck */
.bottleneck-card {
  margin-top: 10px; position: relative;
  background: #ffffff; color: var(--ink); border: 2px solid var(--stuck); border-radius: 12px;
  padding: 12px 12px 12px 56px;
}
.bottleneck-card .sign { position: absolute; left: 10px; top: 10px; width: 38px; height: 34px; }
.bottleneck-card h3 { margin: 0 0 4px; font-size: 16px; color: #7a1414; }
.bottleneck-card .kv { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.bottleneck-card .kv b { color: var(--ink); }
.bottleneck-card p { margin: 4px 0; }
.bottleneck-card .quote { font-style: italic; color: #3b4a53; border-left: 3px solid var(--alex-line); padding-left: 8px; margin-top: 6px; }

/* side huts: caseload hale + two stubs */
.side-huts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (min-width: 640px) { .side-huts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- map ---------- */
.map-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.map-btn {
  min-width: 44px; min-height: 40px; padding: 4px 10px; font-size: 15px; font-weight: 700;
  background: #ffffff; color: #1b2a33; border: 2px solid #4f8a55; border-radius: 10px;
}
.map-btn.on { background: #1f5f2a; color: #ffffff; border-color: #1f5f2a; }
.map-btn[disabled] { background: #e6eaed; color: #2b3840; border-color: #8d9aa3; cursor: default; }
.map-hint { font-size: 12.5px; color: var(--ink-2); flex: 1 1 160px; min-width: 0; }
.map-wrap { background: #ffffff; border: 1.5px solid var(--map-line); border-radius: 10px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.map-wrap.is-locked { touch-action: auto; border-style: solid; border-color: #1f5f2a; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.pin { cursor: pointer; }
/* Phase 3: each source is a small drawn hospital (no logo, nothing fetched). The circle is only
   its footprint / selection ring; the hit square is 44px. */
.pin > circle { fill: #ffffff; fill-opacity: 0; stroke: none; }
.pin.on > circle { fill-opacity: .55; stroke: #1b2a33; stroke-width: 2.5; }
.pin .hit { fill: #ffffff; fill-opacity: .01; }
.pin .bldg .wall { fill: #f7f1e3; stroke: #5a4632; }
.pin .bldg .roof { fill: #8a5a2b; }
.pin .bldg .win { fill: #6fb3dc; }
.pin .bldg .door { fill: #5a4632; }
.pin .bldg .plate { fill: #ffffff; stroke: #c62828; }
.pin .bldg .cross { fill: #c62828; }
.pin:focus-visible { outline: none; }
.pin:focus-visible > circle { fill-opacity: .55; stroke: #0f4f7a; stroke-width: 3; }
.pin text.n90 { font-weight: 800; fill: #1b2a33; text-anchor: middle; pointer-events: none; }
.pin .wk circle { fill: #56636d; stroke: #ffffff; stroke-width: 1.2; }
.pin .wk.unsure:not(.has) circle { fill: #8a5a00; }
.pin .wk.has circle { fill: #0f4f7a; }
.pin .wk text { font-weight: 800; fill: #ffffff; text-anchor: middle; pointer-events: none; }
.plbl { cursor: pointer; }
/* the hospital's name sign */
.plbl rect { fill: #fffdf3; stroke: #6b4a00; stroke-width: 1.4; }
.plbl text { fill: #1b2a33; font-weight: 700; }
.office { cursor: pointer; }
.office:focus-visible { outline: 3px solid #0f4f7a; }
.map-wrap.is-locked .office { cursor: default; }
.map-note rect { fill: #ffffff; stroke: #1d8fc4; stroke-width: 1.2; }
.map-note text { fill: #0f4f7a; font-weight: 700; }
.map-legend { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; display: flex; gap: 6px 12px; flex-wrap: wrap; }
.map-legend b { color: var(--ink); }
.map-legend .lg-src { color: var(--ink); }

/* ---------- staff speech bubble on the station cards ---------- */
.say { display: flex; gap: 6px; align-items: flex-start; margin-top: 7px; }
.say-face { width: 26px; height: 26px; flex: 0 0 26px; }
.say-face svg { width: 100%; height: 100%; display: block; }
.say-bubble {
  position: relative; margin: 0; min-width: 0; flex: 1 1 auto;
  background: #fff8dc; color: #3b2f00; border: 1.5px solid #d9b15a; border-radius: 10px;
  padding: 4px 7px; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere;
}
.say-bubble::before {
  content: ""; position: absolute; left: -6px; top: 8px; width: 9px; height: 9px;
  background: #fff8dc; border-left: 1.5px solid #d9b15a; border-bottom: 1.5px solid #d9b15a; transform: rotate(45deg);
}
.say-who { display: block; font-size: 11px; color: #6b4a00; }
.pop-say { background: #fff8dc; color: #3b2f00; border: 1.5px solid #d9b15a; border-radius: 10px; padding: 6px 9px; }
.pop-say b { color: #6b4a00; }
.fish-note {
  position: absolute; left: 50%; top: 56px; transform: translateX(-50%); white-space: nowrap;
  background: #ffffff; color: #0f4f7a; border: 1.5px solid #1d8fc4; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 700;
}

/* ---------- settings bottom sheet (keyboard-safe) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: #0f4f7a66; z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0;
  bottom: var(--kb, 0px);
  max-height: calc(var(--vvh, 100dvh) - 24px);
  display: flex; flex-direction: column;
  background: var(--sheet-bg); color: var(--ink);
  border: 2px solid var(--sheet-line); border-bottom: 0;
  border-radius: 16px 16px 0 0; z-index: 50;
  max-width: 720px; margin: 0 auto;
  box-shadow: 0 -8px 30px #0f4f7a44;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.sheet-head h2 { font-size: 18px; }
.sheet-x { background: #ffffff; color: var(--ink); border: 1.5px solid var(--sheet-line); border-radius: 10px; width: 38px; height: 36px; font-size: 16px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 12px; flex: 1 1 auto; min-height: 0; }
.trow {
  background: #ffffff; border: 1.5px solid #b8b0dc; border-left: 6px solid var(--sheet-line);
  border-radius: 10px; padding: 8px 10px; margin: 8px 0;
}
.trow:nth-child(even) { background: #f6f3fd; }
.trow-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.tfield { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 4px 0; }
/* numstep wraps the field in a flex .ns-wrap whose input is flex:1/width:0, so the wrap needs a real width inside the auto grid column */
.tfield .ns-wrap { width: 176px; max-width: 100%; }
.tfield label { font-size: 13px; color: var(--ink-2); }
.tfield .hint { grid-column: 1 / -1; font-size: 12px; color: var(--hint); }
.t-reset { margin-left: 6px; font: inherit; font-size: 12px; font-weight: 600; padding: 3px 8px; border: 1.5px solid #6d5bb0; border-radius: 8px; background: #ffffff; color: #3f2f86; }
.t-reset[disabled] { border-color: #8d9aa3; color: #2b3840; background: #e6eaed; }
.tfield input[type="number"] { width: 92px; font: inherit; padding: 6px 8px; border: 1.5px solid #9db5c4; border-radius: 8px; background: #ffffff; color: var(--ink); }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1.5px solid #b8b0dc; }
.sheet-msg { font-size: 13px; color: var(--ink-2); }
.btn-save { background: var(--sea-deep); color: #ffffff; border: 0; border-radius: 10px; padding: 10px 20px; font-weight: 700; }
.btn-save[disabled] { opacity: .6; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .fish, .hut.bottleneck .ring { animation-duration: 4s; }
  .unit-layer .unit { transition: none; }
}

/* ---------- unknown (feed down): grey, never green ---------- */
.verdict.unknown { background: #e6eaed; color: #2b3840; border: 1.5px solid #8d9aa3; }
.hut.band-unknown { --band: #6b7a85; }
.hut[role=button] { cursor: pointer; }
.hut[role=button]:focus-visible { outline: 3px solid var(--sea-deep); outline-offset: 2px; }

/* ---------- pop-up (warning / cleared / station card) ---------- */
.pop { z-index: 60; }
.pop-body { padding-bottom: 18px; }
.pop-item {
  position: relative; background: #ffffff; color: var(--ink);
  border: 1.5px solid var(--tile-line); border-left: 6px solid #6b7a85;
  border-radius: 10px; padding: 10px 12px; margin: 8px 0;
}
.pop-item:nth-child(even) { background: var(--tile-alt); }
.pop-item h3 { margin: 0 0 4px; font-size: 16px; }
.pop-item .kv { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.pop-item .kv b { color: var(--ink); }
.pop-item p { margin: 4px 0; }
.say-btn { float: right; margin: 0 0 6px 8px; min-height: 44px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 700;
  border: 1.5px solid #6d5bb0; border-radius: 18px; background: #ffffff; color: #3f2f86; cursor: pointer; }
.say-btn.on { background: #3f2f86; color: #ffffff; border-color: #3f2f86; }
.pop-warn { border-left-color: var(--stuck); padding-left: 58px; min-height: 52px; }
.pop-warn h3 { color: #7a1414; }
.pop-warn .sign { position: absolute; left: 10px; top: 10px; width: 38px; height: 34px; }
.pop-clear { border-left-color: var(--calm); }
.pop-clear h3 { color: #1b5e20; }
.pop-note { font-size: 12.5px; color: var(--ink-2); font-style: italic; }
.pop-next { font-weight: 600; }

/* ---------- Phase 2 B: "Who needs help next" (hiring triggers) - rose panel, white tile + level bar ---------- */
.panel-staff .panel-head h2 { color: #6e1f3d; }
.panel-staff .panel-sub { color: #5a3a46; }
.staff-tile {
  background: #ffffff; color: var(--ink);
  border: 1.5px solid #d9a3b7; border-left: 6px solid var(--lvl, #6b7a85);
  border-radius: 10px; padding: 10px 12px;
}
.staff-tile.staff-ok { --lvl: var(--calm); }
.staff-tile.staff-handoff { --lvl: var(--busy); }
.staff-tile.staff-full { --lvl: var(--strained); }
.staff-tile.staff-hire { --lvl: var(--stuck); }
.staff-tile.staff-unknown { --lvl: #6b7a85; }
.staff-head { font-weight: 800; font-size: 17px; color: var(--ink); }
.staff-bar { height: 10px; border-radius: 999px; background: #f3dde6; border: 1px solid #d9a3b7; margin: 8px 0 6px; overflow: hidden; }
.staff-bar span { display: block; height: 100%; background: var(--lvl, #6b7a85); }
.staff-kv { font-size: 13px; color: var(--ink-2); }
.staff-kv b { color: var(--ink); }
.staff-advice { margin: 6px 0 0; font-weight: 700; color: #6e1f3d; }
.src-note { margin-top: 6px; font-size: 12px; color: var(--ink-2); font-style: italic; }

/* ---------- Phase 2 C: Family Decision red flag ---------- */
.badge-flag { background: #fde2e2; color: #7a1414; border: 1.5px solid #c62828; white-space: normal; border-radius: 10px; max-width: 100%; }

/* ---------- Phase 2 A: "a referral just came in" toast (Back closes it) ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--kb, 0px) + 16px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; z-index: 70;
  display: flex; align-items: center; gap: 10px;
  background: #0f4f7a; color: #ffffff; border: 2px solid #072e49; border-radius: 12px;
  padding: 10px 10px 10px 14px; box-shadow: 0 8px 24px #0f4f7a55; font-weight: 600;
}
.toast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast-x { flex: 0 0 auto; min-width: 40px; min-height: 40px; background: #ffffff; color: #0f4f7a; border: 1.5px solid #bfe6ff; border-radius: 10px; font-size: 16px; font-weight: 700; }
.mfish.hl path { fill: #ffe14d; stroke: #c62828; stroke-width: 1.4; }
.pin.hl > circle { stroke: #ffc23d; stroke-width: 4; }

/* ---------- Phase 3: inside ACM Headquarters (full-screen layer, keyboard-safe height) ---------- */
body.office-open { overflow: hidden; }
.office-view {
  position: fixed; left: 0; right: 0; top: var(--vvt, 0px);
  height: var(--vvh, 100dvh);
  z-index: 55; display: flex; flex-direction: column;
  background: var(--office-bg); color: var(--ink);
  border: 2px solid var(--office-line);
}
.office-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: #5a3a1a; color: #ffffff; border-bottom: 2px solid #3a240e;
}
.office-head h2 { flex: 1 1 auto; min-width: 0; font-size: 17px; color: #ffffff; overflow-wrap: anywhere; }
.office-x, .office-back {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 4px 12px;
  background: #ffffff; color: #3a240e; border: 1.5px solid #d9b98a; border-radius: 10px; font-size: 15px; font-weight: 700;
}
.office-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 24px; }
.office-note {
  background: #ffffff; color: var(--ink); border: 1.5px solid var(--office-line); border-left: 6px solid #8a5a2b;
  border-radius: 10px; padding: 8px 10px; font-size: 13.5px; margin-bottom: 10px;
}
.office-note.unk, .room-note.unk { background: #fff3cd; color: #5a3a00; border: 1.5px solid #c99a2e; border-left: 6px solid #8a5a00; border-radius: 10px; padding: 6px 9px; font-style: italic; }
.flow-row { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.flow-arrow { align-self: center; font-size: 22px; line-height: 1; color: #6b4a00; transform: rotate(90deg); }
.flow-turn { text-align: center; font-size: 13px; font-weight: 700; color: #5a3a1a; margin: 6px 0; }
.side-head { font-weight: 800; font-size: 14px; color: #5a3a1a; margin: 14px 0 6px; }
.side-row { gap: 10px; }
@media (min-width: 900px) {
  .flow-row { flex-direction: row; align-items: stretch; }
  .flow-arrow { transform: none; align-self: center; }
  .flow-row > .room { flex: 1 1 0; }
}
.room {
  position: relative; min-width: 0; min-height: 44px; cursor: pointer;
  border: 2px solid var(--room-line); background: var(--room-bg); border-radius: 12px; padding: 8px 10px;
}
.room-t0 { --room-bg: #e3f2fd; --room-line: #4f86b3; }
.room-t1 { --room-bg: #e6f4e7; --room-line: #4f8a55; }
.room-t2 { --room-bg: #fdefdc; --room-line: #b7792f; }
.room-t3 { --room-bg: #f3e6f6; --room-line: #8f5ea0; }
.room:focus-visible { outline: 3px solid #0f4f7a; outline-offset: 2px; }
.room-head { display: flex; align-items: center; gap: 8px; }
.room-face { width: 30px; height: 30px; flex: 0 0 30px; }
.room-face svg { width: 100%; height: 100%; display: block; }
.room-name { flex: 1 1 auto; min-width: 0; font-weight: 800; font-size: 14px; color: var(--ink); }
.room-nick { display: block; font-weight: 600; font-size: 12px; color: #3b4a53; }
.room-count { flex: 0 0 auto; font-size: 22px; font-weight: 800; color: var(--ink); }
.room-say { margin: 6px 0 0; background: #fff8dc; color: #3b2f00; border: 1.5px solid #d9b15a; border-radius: 10px; padding: 4px 7px; font-size: 12px; line-height: 1.3; }
.room-say b { color: #6b4a00; }
.room-note { margin-top: 6px; font-size: 12.5px; color: #3b4a53; }
.room-sick { margin-top: 6px; }
.badge-sick { display: inline-block; background: #e3f5dc; color: #1f4d1a; border: 1.5px solid #4f8a55; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.figs { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-start; margin: 8px 0 0; }
.fig { display: inline-flex; align-items: flex-start; gap: 4px; max-width: 100%; }
.fig-body { display: inline-flex; flex-direction: column; align-items: center; min-width: 44px; }
.fig-svg { width: 26px; height: 32px; display: block; animation: fig-bob 1.6s ease-in-out infinite alternate; }
.fig-sick .fig-svg { animation-duration: 3.4s; }
.fig-unsure .fig-svg { animation: none; }
@keyframes fig-bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
.mcode { display: block; margin-top: 1px; background: #ffffff; color: #1b2a33; border: 1px solid #7d8f9b; border-radius: 6px; padding: 0 4px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.fig-sick .mcode { background: #e3f5dc; border-color: #4f8a55; color: #1b2a33; }
.fig-days { font-size: 11px; color: #3b4a53; white-space: nowrap; }
.fig-say {
  align-self: flex-start; max-width: 160px; background: #f0fae9; color: #1f3b14; border: 1.5px solid #4f8a55;
  border-radius: 10px; padding: 3px 7px; font-size: 11.5px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere;
}
.fig-more { align-self: center; font-size: 12.5px; font-weight: 700; color: #3b4a53; }
.room-detail { background: var(--room-bg); border: 2px solid var(--room-line); border-left: 6px solid var(--room-line); }
.room-detail.pop-item:nth-child(even) { background: var(--room-bg); }
.figs-detail { gap: 10px 12px; }
@media (prefers-reduced-motion: reduce) { .fig-svg { animation: none; } }
