/* Ivory glass (round 3, Oct 29 2026): the interface takes the city's own materials.
   Ivory stone and outline navy are the page, steel-blue glass means running fine,
   bronze is the warning, mummy red is the one accent and means "you, or what needs you".
   Loaded last so it restyles every surface without moving any. Remove the <link> to roll back.
   Spec: docs/0XCITY-UI.md. */

:root{
  --sans:Jost,system-ui,-apple-system,"Segoe UI",sans-serif;--deco:"Josefin Sans",Jost,system-ui,sans-serif;
  --mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,monospace;
  --ease-sheet:cubic-bezier(.32,.72,0,1);--ease-glide:cubic-bezier(.22,.61,.36,1);
}
:root[data-theme="light"],:root:not([data-theme]){
  --ivory:#f5f0e6;--stone:#eee5d5;--stone-2:#d8c7ab;
  --ink:#20394d;--ink-2:#54687a;--muted:var(--ink-2);
  --glass:rgba(245,240,230,.62);--glass-raised:rgba(245,240,230,.76);
  --edge:rgba(32,57,77,.18);--light:rgba(255,255,255,.65);
  --accent:#ec5436;--accent-fill:#c43b20;--accent-ink:#f5f0e6;
  --running:#637f9b;--good:#4f6b49;--warn:#7f6433;--bad:var(--warn);--linen:#ddd0b4;
  --navy:#233343;--bg:#f5f0e6;
  --panel:var(--glass);--panel-solid:var(--glass-raised);--soft:rgba(238,229,213,.55);--line:var(--edge);
  --shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);--r:14px;
}
:root[data-theme="dark"]{
  --ivory:#f5f0e6;--stone:#2b3f52;--stone-2:#334d68;
  --ink:#f5f0e6;--ink-2:#bfcbd3;--muted:var(--ink-2);
  --glass:rgba(35,51,67,.60);--glass-raised:rgba(35,51,67,.78);
  --edge:rgba(167,192,202,.22);--light:rgba(167,192,202,.30);
  --accent:#f7876f;--accent-fill:#f7876f;--accent-ink:#20394d;
  --running:#a7c0ca;--good:#9db894;--warn:#d4b37a;--bad:var(--warn);--linen:#b8ab90;
  --navy:#20394d;--bg:#1a2632;
  --panel:var(--glass);--panel-solid:var(--glass-raised);--soft:rgba(43,63,82,.55);--line:var(--edge);
  --shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);
}
/* the city map keeps its line-drawing paper, re-inked in the same materials */
:root[data-theme="light"] #city-ui{--paper:#f5f0e6;--panel:var(--glass-raised);--soft:rgba(238,229,213,.55);--ink:#20394d;--muted:#54687a;--line:var(--edge);--accent:#ec5436;--live:#637f9b;--planned:#7f6433;--shadow:var(--shadow)}
:root[data-theme="dark"] #city-ui{--paper:#1a2632;--panel:var(--glass-raised);--soft:rgba(43,63,82,.55);--ink:#f5f0e6;--muted:#bfcbd3;--line:var(--edge);--accent:#f7876f;--live:#a7c0ca;--planned:#d4b37a;--shadow:var(--shadow)}

html,body,.hw-ui{font-family:var(--sans);font-size:13.5px}
button,select,.hw-panel button,.design-menu,#journey-save-status,.c-tag.c-agent{font-family:var(--sans)}

/* ---- the surface recipe: one glass slab, depth by light not shadow ---- */
.topbar,.kpi,.inspector,.dock,#real-hud,#world-actions,.c-panel,.c-controls,.c-tabs,.hw-panel,.banner,.loading>div,.gl-lost,#world-designs[open]>div{
  background:var(--glass);
  backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);
  border:0;box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:var(--r)}
.kpi{position:relative}
.topbar::before,.kpi::before,.inspector::before,.dock::before,#real-hud::before,.c-panel::before,.hw-panel::before{
  content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;
  background:linear-gradient(135deg,rgba(255,255,255,.26) 0%,transparent 38%)}
:root[data-theme="dark"] :is(.topbar,.kpi,.inspector,.dock,#real-hud,.c-panel,.hw-panel)::before{background:linear-gradient(135deg,rgba(167,192,202,.12) 0%,transparent 38%)}
.inspector,.dock,#real-hud,.c-panel,.hw-panel{background:var(--glass-raised)}

/* ---- lettering: deco caps for places and labels, mono for every number ---- */
.brand b{font:700 14px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase}
.brand small{font-family:var(--sans)}
.brand small a{color:var(--ink)}
.section-t,.kpi span,th,#world-actions span,.tabs button,.c-kicker,.c-tabs,.c-hint,.rh-live,.stat span,.rh-stats span{font-family:var(--deco);letter-spacing:.1em;text-transform:uppercase;font-size:10.5px;font-weight:600}
.kpi span em{text-transform:none;letter-spacing:0;font-family:var(--sans)}
.kpi b,.stat b,.rh-stats b,.clock b,td.num,.invariant,.rh-log time,.c-rows li{font-family:var(--mono);font-weight:500}
.kpi b{font-size:19px;letter-spacing:0}
.insp-head h2,.rh-head h2,.c-panel h2{font-family:var(--sans);font-weight:600;letter-spacing:0}

/* ---- fewer pills: chips become flat tags, only true toggles stay rounded ---- */
.chip,.pill,.c-badge,.c-pill,.c-close,.rec-link,.c-tag.c-agent{border-radius:6px}
.chip{background:transparent;padding:4px 8px;box-shadow:inset 0 0 0 1px var(--edge)}
.chip.paper{background:transparent;color:var(--warn);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 45%,transparent);font-family:var(--deco);letter-spacing:.1em;text-transform:uppercase;font-size:10.5px}
.chip i{background:var(--running);box-shadow:none}
.chip.off i{background:var(--warn);box-shadow:none}
.chip.off{color:var(--warn)}
.pill{background:transparent;box-shadow:inset 0 0 0 1px var(--edge);color:var(--ink-2)}
.pill.work{background:transparent;color:var(--running);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--running) 50%,transparent)}
.pill.sleep,.pill.dormant,.pill.mummified{background:transparent;color:var(--ink-2)}
.pill.coffee,.pill.brew{background:transparent;color:var(--warn);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 45%,transparent)}
.pill.celebrate{background:transparent;color:var(--good)}

/* the phone layout shortens the paper chip to one word */
@media (max-width:820px){.chip.paper{font-size:0}.chip.paper::after{font-size:10.5px}}
@media (max-width:900px) and (orientation:landscape) and (max-height:500px){.chip.paper{font-size:0}.chip.paper::after{font-size:10.5px}}

/* toggles (Real/Preview, speed, segments) stay the only rounded groups */
.mode-switch,.speed,.seg{background:var(--soft);box-shadow:inset 0 0 0 1px var(--edge);border-radius:10px}
.mode-switch button[aria-pressed="true"],.speed button.on,.seg button.on{background:var(--ivory);color:#20394d;box-shadow:0 0 0 1px var(--edge)}
:root[data-theme="dark"] :is(.mode-switch button[aria-pressed="true"],.speed button.on,.seg button.on){background:var(--stone-2);color:var(--ink)}

/* ---- buttons: flat, one primary per surface in deep mummy red ---- */
.btn,.tour-btns button,#world-actions button,.hw-panel button,select{background:var(--soft);border:0;box-shadow:inset 0 0 0 1px var(--edge);border-radius:10px;color:var(--ink)}
.btn.primary,.tour-btns #tour-play,.rec-link,#world-actions #world-home{background:var(--accent-fill);color:var(--accent-ink);box-shadow:none}
.btn.long{color:var(--good)}.btn.short{color:var(--warn)}
.link{color:var(--ink);text-decoration:underline;text-decoration-color:var(--edge);text-underline-offset:3px}
:is(.btn,.tour-btns button,#world-actions button,.hw-panel button,.tabs button,.mode-switch button,.speed button,.seg button,.c-controls button):focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tabs button[aria-selected="true"]{background:var(--soft);box-shadow:inset 0 0 0 1px var(--edge)}

/* ---- tiles inside a surface: flat stone with a hairline ---- */
.stat,.rh-now,.rh-stats>div,.queue li,.invariant,.position{background:var(--soft);box-shadow:inset 0 0 0 1px var(--edge);border:0}
.bar{background:color-mix(in srgb,var(--ink-2) 18%,transparent)}.bar i{background:var(--running)}
.loading em{background:var(--accent)}
.rh-live{color:var(--running)}.rh-live i{background:var(--running);box-shadow:none}
.avatar,.rh-head .avatar{border-radius:50%}
tr.agent-row.sel td{background:color-mix(in srgb,var(--accent) 9%,transparent)}
.invariant b{color:var(--good)}.invariant b.bad{color:var(--warn)}

/* ---- world plates: name and activity, you in mummy red ---- */
.tag{background:var(--glass-raised);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border:0;box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:8px}
.tag .e i{background:var(--running)}
.tag.sel{box-shadow:0 0 0 1.5px var(--running),inset 0 1px 0 var(--light)}
.tag.you{box-shadow:0 0 0 1.5px var(--accent),inset 0 1px 0 var(--light)}
.c-tag{border-color:var(--ink);border-radius:6px}
.c-tag.c-hot{background:var(--accent-fill);border-color:var(--accent-fill);color:var(--accent-ink)}

/* ---- motion: calm glides, no bounce ---- */
.inspector,.c-panel,.hw-panel,#real-hud{animation:ig-rise .32s var(--ease-sheet) both}
@keyframes ig-rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.inspector,.c-panel,.hw-panel,#real-hud,#places{animation:ig-fade .2s both}@keyframes ig-fade{from{opacity:0}}}

/* no backdrop-filter support: fall back to solid stone so text stays legible */
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  :root[data-theme="light"]{--glass:rgba(245,240,230,.95);--glass-raised:#f5f0e6}
  :root[data-theme="dark"]{--glass:rgba(35,51,67,.95);--glass-raised:#233343}
}

/* ======== Real mode navigation (wayfinder.js): place line, city line, wayfinder, Places, the Agent sheet ======== */
#placeline[hidden],#cityline[hidden],#wayfinder[hidden],#places[hidden]{display:none!important}
[data-mode="real"] :is(.topbar,#world-actions){display:none!important}
#placeline,#cityline,#wayfinder,#places{position:absolute;z-index:12;color:var(--ink);background:var(--glass);
  backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);
  box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:var(--r)}
#placeline svg,#wayfinder svg,.ig-x svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:square}

/* place line: top left; each crumb goes up, the last one opens Places */
#placeline{top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));display:flex;align-items:center;gap:2px;height:44px;padding:0 8px 0 4px;max-width:min(62vw,640px,calc(100vw - 460px))}
#placeline .crumb{display:flex;align-items:center;gap:8px;height:36px;padding:0 9px;border:0;border-radius:10px;background:none;
  font:600 11.5px/1 var(--deco);letter-spacing:.11em;text-transform:uppercase;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
#placeline .crumb.root{color:var(--ink);padding-left:5px;flex:none}
#placeline .crumb.here{color:var(--ink)}
#placeline .crumb:hover{background:var(--soft);color:var(--ink)}
#placeline .crumb.here::after{content:"";width:6px;height:6px;margin-left:2px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg) translateY(-2px);opacity:.6}
#placeline .mark{display:grid;place-items:center;width:26px;height:26px;border-radius:7px;background:var(--navy);color:var(--ivory);font:500 10.5px/1 var(--mono);letter-spacing:0}
:root[data-theme="dark"] #placeline .mark{background:var(--ivory);color:#20394d}
#placeline .sep{color:var(--ink-2);opacity:.55;font-size:13px}
.ig-tag{margin-left:6px;padding:4px 7px;border-radius:6px;font:600 10px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--warn);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 45%,transparent);white-space:nowrap}

/* city line: top right; tap for the city map */
#cityline{top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));display:flex;align-items:center;gap:9px;height:44px;padding:0 15px;border:0;font:500 13px/1 var(--sans);white-space:nowrap;cursor:pointer}
#cityline:hover{background:var(--glass-raised)}
#cityline .num{font:500 14px/1 var(--mono)}
#cityline .utc{font:600 10px/1 var(--deco);letter-spacing:.12em;color:var(--ink-2)}
#cityline .sep{width:1px;height:18px;background:var(--edge)}
#cityline .dot{width:9px;height:9px;border-radius:50%;background:var(--running)}
#cityline .dot.out{background:var(--ink)}
#cityline .settle{color:var(--ink-2)}

/* wayfinder: bottom centre; the Agent tab carries the runway ring, the two numbers and the count */
#wayfinder{left:50%;bottom:max(12px,env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;align-items:stretch;padding:5px;gap:2px;max-width:calc(100vw - 24px)}
#wayfinder button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:74px;min-height:58px;padding:6px 10px;border:0;border-radius:10px;background:none;color:var(--ink-2);font:600 10px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase}
#wayfinder button:hover{background:var(--soft);color:var(--ink)}
#wayfinder button[aria-current="location"]{color:var(--ink)}
#wayfinder button[aria-current="location"]{background:var(--soft);box-shadow:inset 0 0 0 1px var(--edge)}
#wayfinder .way-agent{flex-direction:row;gap:14px;padding:6px 16px 6px 8px;margin-right:6px;color:var(--ink);text-transform:none;letter-spacing:0;font-family:var(--sans);border-right:1px solid var(--edge);border-radius:10px 4px 4px 10px}
#wayfinder .way-agent[aria-expanded="true"]{background:var(--soft)}
.way-ring{position:relative;width:46px;height:46px;flex:none}
.way-ring svg{position:absolute;inset:0;width:46px!important;height:46px!important;transform:rotate(-90deg)}
.way-ring circle{fill:none;stroke-width:3}
.way-ring .track{stroke:color-mix(in srgb,var(--ink) 22%,transparent)}
.way-ring .fill{stroke:var(--running);stroke-linecap:round;transition:stroke-dasharray .6s var(--ease-sheet)}
.way-agent[data-stage="d3"] .fill,.way-agent[data-stage="d1"] .fill,.way-agent[data-stage="h6"] .fill{stroke:var(--warn)}
.way-agent[data-stage="out"] .track{stroke:var(--linen);stroke-dasharray:3 3}
.way-face{position:absolute;inset:7px;border-radius:50%;background:var(--linen);display:flex;align-items:center;justify-content:center;gap:7px;
  background-image:repeating-linear-gradient(-14deg,transparent 0 5px,rgba(32,57,77,.13) 5px 6.5px)}
.way-face i{width:4px;height:4px;border-radius:50%;background:#20394d}
.way-agent[data-stage="out"] .way-face i{height:1.5px;border-radius:1px;width:6px}
/* Real mode: the face follows your citizen's starting look (office.js sets the three colors) */
.you-look .way-face{background:var(--you-skin);background-image:linear-gradient(var(--you-hair) 0 34%,transparent 34%)}
.you-look .way-face i{background:var(--you-eyes)}
.way-count{position:absolute;top:-3px;right:-4px;min-width:19px;height:19px;padding:0 5px;border-radius:10px;background:var(--accent-fill);color:var(--accent-ink);font:600 11px/19px var(--mono);text-align:center;box-shadow:0 0 0 2px var(--ivory)}
:root[data-theme="dark"] .way-count{box-shadow:0 0 0 2px #233343}
.way-who,.way-num{display:flex;flex-direction:column;align-items:flex-start;gap:4px}
.way-who b{font:600 15px/1 var(--sans)}
.way-who small,.way-num small{font:600 9.5px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2)}
.way-num b{font:500 17px/1 var(--mono)}
.way-num b[data-unit]::after{content:" " attr(data-unit);font:600 9.5px/1 var(--deco);letter-spacing:.1em;color:var(--ink-2)}
.way-agent[data-stage="d3"] [data-w="runway"],.way-agent[data-stage="d1"] [data-w="runway"],.way-agent[data-stage="h6"] [data-w="runway"]{color:var(--warn)}

/* Places sheet: opened from the last crumb */
#places{top:64px;left:max(12px,env(safe-area-inset-left));width:min(340px,calc(100vw - 24px));padding:8px;background:var(--glass-raised);animation:ig-rise .32s var(--ease-sheet) both}
#places header,#real-hud .rh-head{display:flex;align-items:center;gap:10px}
#places h2{flex:1;margin:4px 8px;font:600 11.5px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase}
#places ul{list-style:none;margin:4px 0 0;padding:0;display:grid;gap:2px}
#places [data-go]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;width:100%;padding:10px 12px;border:0;border-radius:10px;background:none;text-align:left;color:var(--ink)}
#places [data-go]:hover{background:var(--soft)}
#places [data-go] b{font:500 14.5px/1.2 var(--sans)}
#places [data-go] small{font-size:12px;color:var(--ink-2)}
#places [aria-current="location"]{box-shadow:inset 0 0 0 1px var(--edge);background:var(--soft)}
#places [aria-current="location"] small{color:var(--ink)}
.ig-x{display:grid;place-items:center;width:36px;height:36px;flex:none;border:0;border-radius:10px;background:none;color:var(--ink-2)}
.ig-x:hover{background:var(--soft);color:var(--ink)}
:is(#placeline .crumb,#cityline,#wayfinder button,#places [data-go],.ig-x):focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* the Agent sheet: today's #real-hud, summoned by the Agent tab, closed by ×, Esc or a tap on the city */
[data-mode="real"] body:not(.agent-open) #real-hud{display:none!important}
[data-mode="real"] body.agent-open #real-hud{display:block!important;left:max(12px,calc(50% - 210px))!important;right:auto!important;top:auto!important;bottom:calc(max(12px,env(safe-area-inset-bottom)) + 84px)!important;width:min(420px,calc(100vw - 24px))!important;max-height:calc(100% - 170px)!important;overflow:auto;overscroll-behavior:contain;z-index:11;padding:14px 16px 16px!important;scrollbar-width:thin}
#real-hud .rh-head .ig-x{margin:-4px -6px 0 0}
#real-hud .rh-live{margin-left:auto}

/* clear room for the place line and the wayfinder */
[data-mode="real"] body.city-level #city-ui .c-tabs{top:68px}
[data-mode="real"] body.city-level #city-ui .c-controls{top:68px}
[data-mode="real"] body.city-level #city-ui .c-panel{top:118px;max-height:calc(100% - 210px)}
[data-mode="real"] body.city-level #city-ui .c-hint{display:none}
[data-mode="real"] .inspector{top:68px;max-height:calc(100% - 170px)}
[data-mode="real"] body.home-work-active .hw-panel{top:68px;max-height:calc(100% - 170px)}
/* the room's own panel is a second navigation: in Real mode it opens only from Places › Room options */
[data-mode="real"] body.home-work-active:not(.room-panel-open) .hw-panel{display:none!important}
#places li:not(.minor)+li.minor{margin-top:6px;padding-top:6px;border-top:1px solid var(--edge)}
#places li.minor [data-go]{padding:8px 12px}#places li.minor b{font-size:13.5px}

/* ======== The Agent sheet's sections and the City sheet (build order 5): Today, Decisions, Diary, Limits; Power & clock, Numbers, Everyone ======== */
#city-sheet[hidden],[data-mode="preview"] #city-sheet{display:none!important}
#city-sheet{position:absolute;z-index:11;left:max(12px,calc(50% - 210px));bottom:calc(max(12px,env(safe-area-inset-bottom)) + 84px);width:min(420px,calc(100vw - 24px));max-height:calc(100% - 170px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:14px 16px 16px;color:var(--ink);
  background:var(--glass-raised);backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);
  box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:var(--r);animation:ig-rise .32s var(--ease-sheet) both}
@media (prefers-reduced-motion:reduce){#city-sheet{animation:ig-fade .2s both}}
.rh-h{margin:16px 0 6px;font:600 10.5px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2)}
#real-hud .rh-h:first-of-type{margin-top:12px}
.rh-tiles{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-top:8px}
.rh-tile{padding:9px 11px;border-radius:10px;background:var(--soft);box-shadow:inset 0 0 0 1px var(--edge);min-width:0}
.rh-tile.wide{grid-column:1/-1}
.rh-tile span{display:block;font:600 10px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rh-tile b{display:block;margin-top:6px;font:500 19px/1.1 var(--mono);letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}
.rh-tile b.good{color:var(--good)}.rh-tile b.warn{color:var(--warn)}
.rh-tile b small{margin-left:4px;font:600 10.5px/1 var(--deco);letter-spacing:.04em;color:var(--ink-2)}
.rh-tile .bar{margin-top:7px}
.rh-empty,.rh-note{margin:2px 0 0;font-size:13px;line-height:1.45;color:var(--ink-2)}
#real-hud .rh-log{margin-top:4px;font-size:13px}
#real-hud .rh-log li{align-items:baseline;gap:8px}
#real-hud .rh-log li span{flex:1;min-width:0}
#real-hud .rh-log li b{font:500 12px/1 var(--mono);flex:none;color:var(--ink-2)}
#real-hud .rh-log li b.good{color:var(--good)}
.rh-row{display:flex;align-items:center;gap:10px;padding:9px 0;border-top:1px solid var(--edge);font-size:14px;color:var(--ink);text-decoration:none}
.rh-row:first-of-type,.rh-h+.rh-row{border-top:0}
.rh-row .grow{flex:1;min-width:0}
.rh-row small{display:block;margin-top:2px;font-size:12.5px;color:var(--ink-2)}
.rh-row .num{font-family:var(--mono);font-weight:500}
.rh-row.quiet{color:var(--ink-2)}.rh-row.quiet b{font-weight:500}
.rh-job .btn{flex:none;white-space:nowrap}.rh-job .btn:disabled{opacity:.5;cursor:default}.rh-tag{flex:none;font-size:12.5px;font-weight:600;color:var(--good);padding:4px 10px;border-radius:999px;background:var(--soft)}
.rh-step{display:flex;gap:6px;flex:none}
/* the optional X tag: one field and Add; once linked, the handle beside the name in mono */
.rh-label{display:block;margin-top:4px;font-size:13px;font-weight:600;color:var(--ink)}
.rh-social .rh-row{border-top:0;padding-top:6px}
.rh-input{flex:1;min-width:0;height:44px;box-sizing:border-box;padding:0 12px;border-radius:10px;border:1px solid var(--edge);background:var(--ivory);color:var(--ink);font:500 16px/1 var(--sans)}
.rh-input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.rh-social .btn{min-height:44px}
.rh-social .rh-note.bad{color:var(--warn);font-weight:600}
.rh-handle{font:500 13px/1 var(--mono);color:var(--ink-2)}
[data-theme="dark"] .rh-input{background:rgba(32,57,77,.7)}
.rh-step .btn{width:44px;height:36px;padding:0;font-size:18px;line-height:1;border-radius:10px}
.rh-row.link-row{margin:4px -8px 0;padding:9px 8px;border-radius:10px;border-top:0}
.rh-row.link-row:hover{background:var(--soft)}
.rh-row .chev{color:var(--ink-2);font-size:20px;line-height:1}
#real-hud .rh-foot{margin-top:12px;padding-top:12px;border-top:1px solid var(--edge)}
#real-hud .hint{margin-top:14px}
.rh-row.link-row:focus-visible,.c-everyone button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* City sheet */
.cs-head{display:flex;align-items:center;gap:10px}
.cs-head h2{flex:1;margin:2px 0;font:600 11.5px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase}
.cs-stage{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;background:var(--soft);box-shadow:inset 0 0 0 1px var(--edge)}
.cs-stage .dot{width:10px;height:10px;border-radius:50%;background:var(--running);flex:none}
.cs-stage .dot.out{background:var(--ink)}
.cs-stage b{display:block;font:600 15px/1.2 var(--sans)}
.cs-clock{display:block;margin-top:3px;font-size:12.5px;color:var(--ink-2)}
.cs-clock .num{display:inline;margin:0;font:500 12.5px/1 var(--mono);letter-spacing:0}
.cs-clock small{font:600 9.5px/1 var(--deco);letter-spacing:.12em;margin-left:3px}
.c-everyone{list-style:none;margin:0;padding:0}
.c-everyone button{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:6px 8px;border:0;border-radius:10px;background:none;text-align:left;color:var(--ink)}
.c-everyone button:hover{background:var(--soft)}
.c-everyone .way-face{position:relative;inset:auto;width:30px;height:30px;flex:none;gap:5px}
.c-everyone .b-dot{width:10px;height:10px;border-radius:50%;flex:none;margin:0 10px}
.c-everyone .grow{flex:1;min-width:0}
.c-everyone b{display:block;font:500 14px/1.2 var(--sans);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.c-everyone small{display:block;font-size:12.5px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cs-you{flex:none;padding:4px 7px;border-radius:6px;font:600 9.5px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--ink);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 55%,transparent)}
.cs-foot{margin-top:12px;padding-top:10px;border-top:1px solid var(--edge)}
#wayfinder [data-way="city"][aria-expanded="true"]{background:var(--soft);color:var(--ink);box-shadow:inset 0 0 0 1px var(--edge)}

/* ======== Phone pass (docs item 12; DESIGN §3 sheet sizes, §7 tab bar): one tab bar, bottom sheets above it, safe areas, 44 px targets, 12 px text ======== */
:root{--tab-h:64px;--bar-gap:8px;--tab-bottom:max(8px,env(safe-area-inset-bottom));--sheet-bottom:calc(var(--tab-bottom) + var(--tab-h) + var(--bar-gap));--top-clear:56px}
.way-label{display:none}
/* the grip on a phone sheet: a swipe down from the header or the grip closes it (sheet-swipe.js); off the phone it is not drawn */
.sheet-grip{display:none}
@media (max-width:820px){
  #placeline{top:max(8px,env(safe-area-inset-top));left:max(8px,env(safe-area-inset-left));height:44px;padding:0 4px;gap:0;max-width:calc(100vw - 172px)}   /* the city line (clock, dot, power word) is about 150 px */
  #placeline .crumb{height:44px;padding:0 7px;font-size:12px;gap:7px}
  #placeline .crumb .lbl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
  #office:has(#cityline[hidden]) #placeline,body.arriving #placeline{max-width:calc(100vw - 24px)}   /* at the pier, with no city line yet, the quay's name has the width */
  #placeline .crumb.mid,#placeline .crumb.mid+.sep,#placeline .ig-tag{display:none}
  #cityline{top:max(8px,env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));height:44px;padding:0 11px;gap:7px;font-size:12px}
  #cityline .utc,#cityline .wide,#cityline .sep,#cityline .day{display:none}
  /* the tab bar: Agent (ring and count), Home, Work, City; the two numbers move to the Agent sheet's first row */
  #wayfinder{left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));bottom:var(--tab-bottom);transform:none;max-width:none;justify-content:space-between;padding:4px;gap:0;height:var(--tab-h)}
  #wayfinder button{min-width:0;flex:1;min-height:56px;padding:4px 2px 5px;gap:3px;font-size:12px;letter-spacing:.1em}
  #wayfinder .way-agent{flex:1;flex-direction:column;gap:3px;padding:3px 2px 5px;margin:0;border-right:0;border-radius:10px;color:var(--ink-2);font-family:var(--deco);text-transform:uppercase;letter-spacing:.1em}
  #wayfinder .way-agent[aria-expanded="true"]{color:var(--ink);box-shadow:inset 0 0 0 1px var(--edge)}
  #wayfinder .way-who,#wayfinder .way-num{display:none}
  #wayfinder .way-label{display:block}
  .way-ring{width:32px;height:32px}.way-ring svg{width:32px!important;height:32px!important}.way-face{inset:5px;gap:4px}.way-face i{width:3.5px;height:3.5px}
  .way-count{top:-6px;right:-9px;min-width:20px;height:20px;font-size:12px;line-height:20px}
  /* phone sheets: Agent, City and Places rise from the tab bar as bottom sheets (about two thirds of the visible
     viewport, never over the place line), scroll inside and swipe down to close; the tabs stay in reach */
  [data-mode="real"] body.agent-open #real-hud,#city-sheet,#places{left:max(8px,env(safe-area-inset-left))!important;right:max(8px,env(safe-area-inset-right))!important;top:auto!important;width:auto!important;bottom:var(--sheet-bottom)!important;
    max-height:min(68vh,calc(100% - var(--sheet-bottom) - var(--top-clear)))!important;max-height:min(68dvh,calc(100% - var(--sheet-bottom) - var(--top-clear)))!important;
    overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:20px 14px 14px!important;touch-action:pan-y}
  #real-hud .rh-head,#city-sheet .cs-head,#places header,.sheet-grip{touch-action:none}
  .sheet-grip{display:block;position:absolute;top:0;left:50%;translate:-50% 0;width:88px;height:20px;cursor:grab}
  .sheet-grip::before{content:"";position:absolute;top:7px;left:50%;translate:-50% 0;width:36px;height:4px;border-radius:2px;background:color-mix(in srgb,var(--ink) 28%,transparent)}
  :is(#real-hud,#city-sheet,#places).swiping{transition:none}
  :is(#real-hud,#city-sheet,#places){transition:transform .2s var(--ease-sheet)}
  #places{animation:ig-rise .32s var(--ease-sheet) both}
  #places h2{font-size:12px}#places header{min-height:44px}
  #places [data-go]{min-height:48px;padding:8px 12px}
  #places [data-go] b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  #places [data-go] small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  :is(#real-hud,#city-sheet,#places,#bubble) .ig-x{width:44px;height:44px}
  #real-hud .rh-head .ig-x{margin:-6px -8px 0 0}
  #real-hud .rh-head h2{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #real-hud .rh-head>div{min-width:0}
  .rh-step .btn{width:48px;height:44px}
  .rh-row{min-height:44px}
  .rh-row.link-row{min-height:44px}
  [data-mode="real"] body.agent-open #real-hud .rh-log li{display:flex}
  [data-mode="real"] body.agent-open #real-hud .hint{display:block}
  /* the city's own surfaces in Real mode clear the tab bar and the place line */
  [data-mode="real"] body.city-level #city-ui .c-tabs{top:auto;bottom:var(--sheet-bottom)}
  [data-mode="real"] body.city-level #city-ui .c-controls{top:var(--top-clear);bottom:auto;flex-direction:column}
  [data-mode="real"] body.city-level #city-ui .c-panel{top:auto;bottom:var(--sheet-bottom);max-height:min(52vh,calc(100% - var(--sheet-bottom) - var(--top-clear)));max-height:min(52dvh,calc(100% - var(--sheet-bottom) - var(--top-clear)));overscroll-behavior:contain}
  [data-mode="real"] .inspector{top:auto;bottom:var(--sheet-bottom);max-height:min(52vh,calc(100% - var(--sheet-bottom) - var(--top-clear)));max-height:min(52dvh,calc(100% - var(--sheet-bottom) - var(--top-clear)));overscroll-behavior:contain}
  [data-mode="real"] body.home-work-active .hw-panel{top:auto;bottom:var(--sheet-bottom);max-height:min(44vh,calc(100% - var(--sheet-bottom) - var(--top-clear)));max-height:min(44dvh,calc(100% - var(--sheet-bottom) - var(--top-clear)));overscroll-behavior:contain}
  /* notices sit under the place line, never over the tabs */
  [data-mode="real"] .banner{top:var(--top-clear);max-width:calc(100% - 16px)}
  /* no text under 12 px on a phone: the caps labels grow to 12 */
  .way-num b[data-unit]::after{content:none}
}
/* phones under 380 px wide (the 360 Android): the city line keeps the clock and the power dot, so the place line has room */
@media (max-width:380px){#cityline>span{display:none}#cityline{padding:0 10px}#placeline{max-width:calc(100vw - 112px)}}
/* a short phone (≤ 700 px tall, the SE): a waiting decision comes before the Today tiles, so it is seen without a scroll */
@media (max-width:820px) and (max-height:700px){
  [data-mode="real"] body.agent-open #real-hud.has-ask{display:flex!important;flex-direction:column}
  #real-hud.has-ask>*{flex:none}   /* a column flexbox under a max-height would shrink the ask card (overflow:hidden) to nothing */
  #real-hud.has-ask .rh-head{order:-3}
  #real-hud.has-ask .rh-h-decisions,#real-hud.has-ask .rh-ask{order:-2}
  #real-hud.has-ask .rh-h-decisions{margin-top:12px}
}
/* a tablet in portrait (600 to 820): the tab bar and the sheets are centred and no wider than a desktop sheet */
@media (min-width:600px) and (max-width:820px){
  #wayfinder{left:50%;right:auto;width:min(520px,calc(100vw - 16px));translate:-50% 0}
  [data-mode="real"] body.agent-open #real-hud,#city-sheet,#places,#card{left:50%!important;right:auto!important;width:min(480px,calc(100vw - 16px))!important;translate:-50% 0}
  [data-mode="real"] body.agent-open #real-hud,#city-sheet{max-height:min(60vh,calc(100% - var(--sheet-bottom) - var(--top-clear)))!important;max-height:min(60dvh,calc(100% - var(--sheet-bottom) - var(--top-clear)))!important}
  #placeline{max-width:calc(100vw - 260px)}
}
@media (max-width:960px){#placeline .crumb.mid,#placeline .crumb.mid+.sep,#placeline .ig-tag{display:none}#cityline .wide,#cityline .wide+*{display:none}}

/* the Agent sheet's head and the decision waiting in it */
#real-hud .rh-face{position:relative;inset:auto;width:40px;height:40px;flex:none}
#real-hud .rh-head h2{font-size:16px}
.rh-ask{margin-top:12px;border-radius:10px;overflow:hidden;box-shadow:inset 0 0 0 1px var(--edge);background:var(--soft)}
.rh-ask-band{display:block;padding:6px 11px;background:var(--accent-fill);color:var(--accent-ink);font:600 10px/1.2 var(--deco);letter-spacing:.12em;text-transform:uppercase}
.rh-ask p{margin:9px 11px 4px;font-size:13.5px}
.rh-ask .actions{padding:4px 11px 11px;display:grid;grid-template-columns:1fr 1fr;gap:6px}
.rh-ask .btn{min-height:38px}
[data-mode="real"] body.city-level #city-in{display:none}
[data-mode="real"] body.city-level #city-ui .c-controls .sep{display:none}

/* ======== Plates and bubbles (Real mode): activity only; tap for who it is and, for yours, what you can do ======== */
[data-mode="real"] #labels .tag{display:flex;flex-direction:row;align-items:center;gap:7px;white-space:nowrap;padding:5px 9px 5px 8px;border-radius:8px;transform:translate(-50%,calc(-100% - 7px))}
[data-mode="real"] #labels .tag .n{display:inline-flex;font:600 12px/1 var(--sans);gap:6px}
[data-mode="real"] #labels .tag .a{font:400 12px/1 var(--sans);color:var(--ink-2)}
[data-mode="real"] #labels .tag .a::before{content:"· ";opacity:.6}
[data-mode="real"] #labels .tag .e{display:none}
[data-mode="real"] #labels .tag .dot{width:7px;height:7px;margin:0}
[data-mode="real"] #labels .tag::after{content:"";position:absolute;left:50%;bottom:-5px;width:9px;height:9px;transform:translateX(-50%) rotate(45deg);background:inherit;box-shadow:1px 1px 0 var(--edge);border-radius:0 0 2px 0}
[data-mode="real"] #labels .tag.you{box-shadow:inset 0 1px 0 var(--light),0 0 0 1.5px var(--accent);z-index:3}
[data-mode="real"] #labels .tag.you .dot{background:var(--accent)!important}
[data-mode="real"] #labels .tag.sel{box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge)}
[data-mode="real"] #labels .tag.you.sel{box-shadow:inset 0 1px 0 var(--light),0 0 0 1.5px var(--accent)}
#bubble[hidden]{display:none!important}
#bubble{position:absolute;z-index:13;width:min(300px,calc(100vw - 24px));transform:translate(-50%,-100%);padding:10px 10px 12px;color:var(--ink);background:var(--glass-raised);
  backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:var(--r);animation:ig-pop .18s var(--ease-sheet) both}
#bubble::after{content:"";position:absolute;left:calc(50% + var(--tail,0px));bottom:-6px;width:12px;height:12px;transform:translateX(-50%) rotate(45deg);background:inherit;box-shadow:1px 1px 0 var(--edge);border-radius:0 0 3px 0}
#bubble.below{transform:translate(-50%,0)}
#bubble.below::after{bottom:auto;top:-6px;transform:translateX(-50%) rotate(225deg)}
#bubble.mine{box-shadow:inset 0 1px 0 var(--light),0 0 0 1.5px var(--accent)}
#bubble header{display:flex;align-items:center;gap:10px}
#bubble header>div{flex:1;min-width:0}
#bubble header b{display:block;font:600 15px/1.2 var(--sans);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#bubble header small{display:block;margin-top:2px;font-size:13.5px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#bubble .way-face{position:relative;inset:auto;width:34px;height:34px;flex:none}
#bubble .b-dot{width:10px;height:10px;border-radius:50%;flex:none;margin:0 4px}
#bubble p{margin:8px 4px 0;font-size:13.5px;color:var(--ink-2)}
#bubble .b-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:10px}
#bubble .b-actions .primary{grid-column:1/-1}
#bubble .btn{min-height:40px;font-size:13px}
@keyframes ig-pop{from{opacity:0;scale:.96}to{opacity:1;scale:1}}
@media (prefers-reduced-motion:reduce){#bubble{animation:ig-fade .2s both}}
/* one-line notices sit under the place line, not over the scene's middle */
[data-mode="real"] body.city-level .banner{display:block}
[data-mode="real"] .banner{top:68px;bottom:auto;padding:9px 14px;border:0;background:var(--glass-raised);box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);font-size:13px;z-index:14}
[data-mode="real"] #labels .tag.dormant{opacity:1}

/* ======== Decision and warning cards (decision-card.js, GAME-FEEL M7 and M16): one flat glass card above the wayfinder ======== */
#card[hidden]{display:none!important}
#card{position:absolute;z-index:13;left:max(12px,calc(50% - 210px));bottom:calc(max(12px,env(safe-area-inset-bottom)) + 84px);width:min(340px,calc(100vw - 24px));overflow:hidden;color:var(--ink);
  background:var(--glass-raised);backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);
  box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:var(--r);animation:ig-card-rise .24s var(--ease-sheet) both}
@keyframes ig-card-rise{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
#card.leaving{animation:ig-card-leave .2s ease both}
@keyframes ig-card-leave{to{opacity:0}}
#card .cd-band{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:32px;padding:0 44px 0 14px;background:var(--accent-fill);color:var(--accent-ink);font:600 10.5px/1.2 var(--deco);letter-spacing:.12em;text-transform:uppercase}
#card.warn .cd-band{background:var(--warn);color:var(--ivory)}
:root[data-theme="dark"] #card.warn .cd-band{color:#20394d}
#card .cd-band .num{font:500 11px/1 var(--mono);letter-spacing:0;text-transform:none;opacity:.9}
#card .cd-x{position:absolute;top:0;right:4px;width:32px;height:32px;color:var(--accent-ink)}   /* the band's own ink: ivory on red, navy in the dark theme */
#card.warn .cd-x{color:var(--ivory)}
:root[data-theme="dark"] #card.warn .cd-x{color:#20394d}
#card .cd-body{padding:12px 14px 14px}
#card p{margin:0;font-size:14.5px;line-height:1.45}
#card p b{font:500 14px/1 var(--mono);white-space:nowrap}
#card .cd-why{margin:6px 0 0;padding:2px 0;border:0;background:none;color:var(--ink-2);font:500 12.5px/1.2 var(--sans);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
#card .cd-why[aria-expanded="true"]{color:var(--ink)}
#card .cd-reason{margin-top:6px;font-size:13px;color:var(--ink-2)}
#card .cd-acts{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:12px}
#card .btn{min-height:42px;font-size:13px;border-radius:10px}
#card .btn:disabled{opacity:.7}
#card.warn :is(.btn,.ig-x,.cd-why):focus-visible{outline-color:var(--warn)}   /* even the focus ring stays bronze on a warning */
#card .cd-why:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
#card.warn .btn.primary{background:var(--warn);border-color:var(--warn);color:var(--ivory)}   /* a warning has no red in it */
:root[data-theme="dark"] #card.warn .btn.primary{color:#20394d}
/* the stamp: navy, lands at scale 1.6 → 1 and −4° → 0 in 220 ms (DESIGN §5) */
.ig-stamp{position:absolute;right:18px;bottom:22px;padding:5px 10px;border:2.5px solid var(--navy);color:var(--navy);border-radius:6px;background:rgba(245,240,230,.74);
  font:700 15px/1 var(--deco);letter-spacing:.14em;text-transform:uppercase;white-space:nowrap;transform:rotate(-4deg) scale(1.6);opacity:0;pointer-events:none}
:root[data-theme="dark"] .ig-stamp{border-color:var(--ivory);color:var(--ivory);background:rgba(35,51,67,.74)}
.ig-stamp.on{animation:ig-stamp .22s var(--ease-glide) forwards}
@keyframes ig-stamp{to{transform:none;opacity:1}}
#card .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@media (prefers-reduced-motion:reduce){
  #card{animation:ig-fade .2s both}
  #card.leaving{animation:ig-card-leave .2s ease both}
  .ig-stamp{transform:none}.ig-stamp.on{animation:ig-stamp-fade .2s ease forwards}@keyframes ig-stamp-fade{to{opacity:1}}
}
@media (max-width:820px){
  #card{left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));width:auto;bottom:var(--sheet-bottom);max-height:calc(100% - var(--sheet-bottom) - var(--top-clear));overflow:auto;overscroll-behavior:contain}
  #card .btn{min-height:44px}
  #card .cd-x{width:44px;height:44px;top:-6px;right:0}
  #card .cd-why{min-height:44px;padding:0;margin-top:0}
  #card .cd-band{min-height:36px}
}

/* your plate at a runway warning: the ring goes bronze (M16); the count on it is what needs you (M7) */
[data-mode="real"] #labels .tag.you:is([data-stage="d3"],[data-stage="d1"],[data-stage="h6"]){box-shadow:inset 0 1px 0 var(--light),0 0 0 1.5px var(--warn)}
[data-mode="real"] #labels .tag.you:is([data-stage="d3"],[data-stage="d1"],[data-stage="h6"]) .dot{background:var(--warn)!important}
[data-mode="real"] #labels .tag.you[data-stage="out"]{box-shadow:inset 0 1px 0 var(--light),0 0 0 1.5px var(--linen)}
[data-mode="real"] #labels .tag .cnt{display:inline-grid;place-items:center;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--accent-fill);color:var(--accent-ink);font:600 10.5px/1 var(--mono);cursor:pointer}
[data-mode="real"] #labels .tag .cnt[hidden]{display:none}

/* ======== First arrival (arrival-model.js, GAME-FEEL M1 and M2; docs item 7): no interface during the ferry ======== */
@keyframes ig-fade-in{from{opacity:0}}
body.arriving :is(#cityline,#wayfinder,#card,.banner,#real-hud,#city-sheet,#places,#world-actions,.rec-link){display:none!important}
body.arriving #city-ui>:not(.f-cine){visibility:hidden}
body.arrival-ferry :is(#placeline,#bubble){display:none!important}
body.arrival-pier #placeline{animation:ig-fade-in .6s ease both}
/* Skip stays: a flat glass word bottom-right, not a pill; the old caption strip is gone, and the strip leaves with the shot */
.f-cine[hidden]{display:none!important}
[data-mode="real"] body.arriving .f-cine{justify-content:flex-end;bottom:max(16px,env(safe-area-inset-bottom));padding:0 16px}
[data-mode="real"] body.arriving .f-cine p{display:none}
[data-mode="real"] body.arriving .f-cine .c-pill{height:40px;padding:0 16px;border:0;border-radius:10px;color:var(--ink);background:var(--glass);
  backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);
  font:600 11px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase}
[data-mode="real"] body.arriving .f-cine .c-pill:hover{background:var(--glass-raised)}
/* the arrival's bubbles: what the quay or your citizen says reads as speech, in ink */
#bubble.arrival .b-say{display:block;margin-top:10px;font-size:14.5px;line-height:1.4;color:var(--ink)}
#bubble.arrival p+p{margin-top:6px}
#bubble.arrival.housing{width:min(380px,calc(100vw - 24px))}
/* the name step: one field, Enter continues; a problem replaces the hint in bronze */
#bubble .b-form{margin:0}
#bubble .b-input{display:block;width:100%;box-sizing:border-box;margin-top:8px;height:44px;padding:0 12px;border-radius:10px;border:1px solid var(--edge);
  background:var(--ivory);color:var(--ink);font:500 16px/1 var(--sans)}
#bubble .b-input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
#bubble .b-hint{margin-top:6px;font-size:13px;color:var(--ink-2)}
/* register names: two search fields, each with a dropdown of up to 8 rows (44 px), over the bubble rather than in it */
#bubble.arrival.naming{width:min(360px,calc(100vw - 24px))}
#bubble .b-label{display:block;margin-top:10px;font:600 11px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2)}
#bubble .b-label+.b-combo .b-input{margin-top:6px}
#bubble .b-combo{position:relative}
#bubble .b-list{position:absolute;z-index:3;left:0;right:0;top:calc(100% + 4px);margin:0;padding:4px;list-style:none;max-height:198px;overflow-y:auto;overscroll-behavior:contain;
  border-radius:10px;background:var(--ivory);box-shadow:0 0 0 1px var(--edge),0 12px 28px rgba(16,28,40,.18)}
#bubble .b-list li{display:flex;align-items:center;min-height:44px;padding:0 10px;border-radius:8px;font:500 15px/1.2 var(--sans);color:var(--ink);cursor:pointer}
#bubble .b-list li[aria-selected="true"],#bubble .b-list li:hover{background:color-mix(in srgb,var(--accent) 14%,transparent)}
#bubble .b-list li.empty{cursor:default;color:var(--ink-2);font-size:13.5px}
[data-theme="dark"] #bubble .b-list{background:#1b3042}
#bubble .b-hint.bad{color:var(--warn);font-weight:600}
/* the Housing Office: starter studios as radio rows, the chosen one ringed in accent */
#bubble .b-opts{display:grid;gap:8px;margin-top:10px}
#bubble .b-opt{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:52px;padding:8px 12px;border-radius:10px;text-align:left;cursor:pointer;
  color:var(--ink);background:color-mix(in srgb,var(--ivory) 55%,transparent);border:1px solid var(--edge)}
#bubble .b-opt b{display:block;font:600 14px/1.25 var(--sans)}
#bubble .b-opt small{display:block;margin-top:2px;font-size:12.5px;color:var(--ink-2)}
#bubble .b-opt em{font:500 12.5px/1 var(--mono);font-style:normal;color:var(--good);white-space:nowrap}
#bubble .b-opt[aria-checked="true"]{background:var(--ivory);box-shadow:0 0 0 2px var(--accent);border-color:transparent}
[data-theme="dark"] #bubble .b-opt{background:rgba(32,57,77,.35)}
[data-theme="dark"] #bubble .b-input,[data-theme="dark"] #bubble .b-opt[aria-checked="true"]{background:rgba(32,57,77,.7)}
#bubble.arrival .b-actions{display:flex;gap:8px;margin-top:12px}
#bubble.arrival .b-actions .btn{flex:1}
/* the wayfinder rises last; the walkthrough's first coach mark follows it */
body.arrival-rise #wayfinder{animation:ig-rise .32s var(--ease-sheet) both}
@media (max-width:820px){[data-mode="real"] body.arriving .f-cine .c-pill{height:44px;padding:0 18px}#bubble.arrival .btn{min-height:44px}}
/* the walkthrough (walkthrough.js): one glass coach mark with a tail toward the control it names, a ring on that control */
#coach{position:absolute;z-index:14;width:min(320px,calc(100vw - 24px));translate:-50% 0;padding:12px 12px 12px;color:var(--ink);background:var(--glass-raised);
  backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);box-shadow:inset 0 1px 0 var(--light),0 0 0 1.5px var(--accent),0 14px 34px rgba(16,28,40,.22);
  border-radius:14px;animation:ig-rise .28s var(--ease-sheet) both}
#coach[hidden]{display:none}
#coach::after{content:"";position:absolute;left:calc(50% + var(--tail,0px));bottom:-6px;width:12px;height:12px;transform:translateX(-50%) rotate(45deg);background:inherit;box-shadow:1.5px 1.5px 0 var(--accent);border-radius:0 0 3px 0}
#coach.below::after{bottom:auto;top:-6px;transform:translateX(-50%) rotate(225deg)}
#coach.free::after{display:none}
#coach .coach-step{margin:0;font:600 11px/1 var(--deco);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2)}
#coach h2{margin:6px 0 0;font:600 16px/1.25 var(--sans);color:var(--ink)}
#coach .coach-body{margin:4px 0 0;font-size:14px;line-height:1.4;color:var(--ink)}
#coach .coach-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:12px}
#coach .coach-actions .btn{min-height:44px;min-width:96px}
#coach .coach-skip{min-height:44px;padding:0 6px;border:0;background:none;color:var(--ink-2);font:500 13.5px/1 var(--sans);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
#coach .coach-skip:hover{color:var(--ink)}
.coach-target{outline:2px solid var(--accent)!important;outline-offset:3px;border-radius:12px;animation:coach-pulse 1.6s ease-in-out infinite}
@keyframes coach-pulse{50%{outline-offset:6px}}
@media (prefers-reduced-motion:reduce){
  body.arrival-rise #wayfinder{animation:ig-fade-in .2s both}
  #coach{animation:ig-fade-in .2s both}.coach-target{animation:none}
  body.arrival-pier #placeline{animation:ig-fade-in .2s both}
}

/* last, so a short wide phone (both widths) takes the landscape layout over the portrait rules above */
/* a phone on its side (844×390): the tab bar is a compact slab bottom-right, the sheets are side sheets on the left */
@media (max-width:900px) and (orientation:landscape) and (max-height:500px){
  :root{--top-clear:56px;--side-w:min(380px,calc(100vw - 300px))}
  #placeline{height:44px;max-width:calc(100vw - 200px)}#placeline .crumb{height:44px;font-size:12px}
  #placeline .crumb .lbl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
  #cityline{height:44px}
  #wayfinder{left:auto;right:max(8px,env(safe-area-inset-right));bottom:max(8px,env(safe-area-inset-bottom));transform:none;translate:none;width:auto;height:auto;padding:4px;gap:0}
  #wayfinder button{min-height:52px;min-width:64px;flex:none;padding:4px 6px 5px;gap:3px;font-size:12px;letter-spacing:.1em}
  #wayfinder .way-agent{flex-direction:column;gap:3px;padding:3px 6px 5px;margin:0;border-right:0;border-radius:10px;color:var(--ink-2);font-family:var(--deco);text-transform:uppercase;letter-spacing:.1em}
  #wayfinder .way-who,#wayfinder .way-num{display:none}
  #wayfinder .way-label{display:block}
  .way-ring{width:32px;height:32px}.way-ring svg{width:32px!important;height:32px!important}.way-face{inset:5px;gap:4px}.way-face i{width:3.5px;height:3.5px}
  .way-count{top:-6px;right:-9px;min-width:20px;height:20px;font-size:12px;line-height:20px}
  [data-mode="real"] body.agent-open #real-hud,#city-sheet,#places{left:max(8px,env(safe-area-inset-left))!important;right:auto!important;top:var(--top-clear)!important;bottom:auto!important;translate:none;width:var(--side-w)!important;
    max-height:calc(100% - var(--top-clear) - 8px)!important;overflow:auto;overscroll-behavior:contain;padding:14px 14px 14px!important}
  .sheet-grip{display:none}
  #real-hud .rh-head,#city-sheet .cs-head,#places header{touch-action:auto}
  #card{left:max(8px,env(safe-area-inset-left));right:auto;bottom:max(8px,env(safe-area-inset-bottom));width:min(340px,var(--side-w));translate:none;max-height:calc(100% - var(--top-clear) - 8px);overflow:auto}
  [data-mode="real"] .banner{top:var(--top-clear);left:auto;right:max(8px,env(safe-area-inset-right));transform:none;max-width:calc(100vw - var(--side-w) - 32px)}
  [data-mode="real"] body.city-level #city-ui .c-tabs{top:var(--top-clear);right:auto;left:max(8px,env(safe-area-inset-left));bottom:auto;max-width:var(--side-w)}
  [data-mode="real"] body.city-level #city-ui .c-controls{top:auto;bottom:max(8px,env(safe-area-inset-bottom));left:auto;right:calc(max(8px,env(safe-area-inset-right)) + 290px);flex-direction:row}
  [data-mode="real"] body.city-level #city-ui .c-panel{top:calc(var(--top-clear) + 48px);left:max(8px,env(safe-area-inset-left));right:auto;bottom:auto;width:var(--side-w);max-height:calc(100% - var(--top-clear) - 56px);overscroll-behavior:contain}
  [data-mode="real"] .inspector{top:var(--top-clear);left:max(8px,env(safe-area-inset-left));right:auto;bottom:auto;width:var(--side-w);max-height:calc(100% - var(--top-clear) - 8px)}
  [data-mode="real"] body.home-work-active .hw-panel{top:var(--top-clear);left:max(8px,env(safe-area-inset-left));right:auto;bottom:auto;width:var(--side-w);max-height:calc(100% - var(--top-clear) - 8px)}
  .way-num b[data-unit]::after{content:none}
}

/* ======== Phone type and targets (docs item 12), last so they outrank every base rule above: no text under 12 px,
   every target 44 px, in the portrait layouts (≤ 820) and on a phone on its side ======== */
@media (max-width:820px), (max-width:900px) and (orientation:landscape) and (max-height:500px){
  .rh-h,.rh-tile span,.rh-tile b small,.cs-clock small,.ig-tag,.cs-you,.rh-ask-band,#card .cd-band,#card .cd-band .num,.cs-head h2,#places h2,#cityline .utc,
  #real-hud .rh-log li b,.rh-live,.rh-log,.rh-log time,.rh-now span,#card .cd-why,.way-who small,.way-num small,#placeline .crumb,.stat span,.rh-stats span{font-size:12px}
  [data-mode="real"] #labels .tag .cnt{position:relative;font-size:12px;min-width:19px;height:19px}
  [data-mode="real"] #labels .tag .cnt::before{content:"";position:absolute;inset:-13px}   /* a 44 px finger on a 19 px count */
  :is(#real-hud,#city-sheet,#places,#bubble) .ig-x{width:44px;height:44px}
  .rh-step .btn{width:48px;height:44px}.rh-row{min-height:44px}
  [data-mode="real"] #real-hud .btn,[data-mode="real"] #bubble .btn,[data-mode="real"] #card .btn,#real-hud .rh-ask .btn{min-height:44px}
  #card .cd-x{width:44px;height:44px;top:-6px;right:0}
  #card .cd-why{min-height:44px;padding:0;margin-top:0}
  #bubble .b-actions{gap:8px}
  /* the city map's own district tabs and zoom controls, in Real mode */
  [data-mode="real"] body.city-level #city-ui .c-tabs button{min-height:44px;padding:6px 10px;font-size:12px}
  [data-mode="real"] body.city-level #city-ui .c-controls button{width:44px;height:44px}
  [data-mode="real"] body.city-level #city-ui .c-panel .c-close,[data-mode="real"] body.city-level #city-ui .c-panel button{min-height:44px}
  [data-mode="real"] body.city-level #city-ui:has(.c-panel:not([hidden])) .c-tabs{visibility:hidden}   /* a building sheet takes the tabs' place above the tab bar */
  [data-mode="real"] .hw-panel button,[data-mode="real"] .hw-panel select{min-height:44px}   /* the room's options, opened from Places */
}

/* The map at rest (Nov 3): the city on full display. Real mode drops the district tabs and the
   line-drawing switch (City and Places get you anywhere); on a phone the map is pinch and drag only. */
:root[data-mode="real"] body #city-ui .c-tabs,
:root[data-mode="real"] body #city-ui #city-mode{display:none}
/* Watching a world: the same quiet map, and no hint line, bus ticker or Floor 40 shortcut. */
[data-watch] body #city-ui :is(.c-tabs,#city-mode,#city-in,.c-hint){display:none!important}
@media (max-width:700px),(pointer:coarse){
  :root[data-mode="real"] body #city-ui .c-controls,[data-watch] body #city-ui .c-controls{display:none}
}

/* ======== Watching a shared world (?world=): the city is the screen ========
   At rest: a place line, a clock line and two buttons (about 5% of a desktop screen). The showcase bar, money
   tiles and roster are gone from the map; Citizens and Numbers open one sheet, a tapped citizen opens a read-only
   sheet and the picture slides so they stay in the open part of the city. Spec: docs/0XCITY-UI.md. */
#watch-place[hidden],#watch-clock[hidden],#watch-bar[hidden]{display:none!important}
[data-watch] :is(.topbar,#world-actions){display:none!important}
[data-watch] body:not(.watch-dock) .dock{display:none!important}
#watch-place,#watch-clock,#watch-bar{position:absolute;z-index:12;color:var(--ink);background:var(--glass);
  backdrop-filter:blur(22px) saturate(1.35);-webkit-backdrop-filter:blur(22px) saturate(1.35);
  box-shadow:inset 0 1px 0 var(--light),0 0 0 1px var(--edge);border-radius:var(--r);font:500 13px/1 var(--sans)}
#watch-place{top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));display:flex;align-items:center;gap:8px;height:40px;padding:0 14px;white-space:nowrap}
#watch-place span:first-child{font-weight:600}#watch-place .sep{color:var(--ink-2)}
#watch-clock{top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));display:flex;align-items:center;gap:6px;height:40px;padding:0 14px;border:0;white-space:nowrap;cursor:pointer}
#watch-clock b{font-family:var(--mono);font-weight:500}
#watch-clock .power{width:8px;height:8px;border-radius:50%;background:var(--good);margin-right:2px}#watch-clock .power.off{background:var(--warn)}
#watch-bar{left:50%;bottom:max(14px,env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;gap:2px;padding:4px}
#watch-bar button{border:0;background:none;color:var(--ink);font:500 13.5px/1 var(--sans);padding:0 16px;height:36px;border-radius:10px;cursor:pointer;white-space:nowrap}
#watch-bar button[aria-expanded="true"]{background:var(--glass-raised);box-shadow:0 0 0 1px var(--edge)}
#watch-bar b{font-family:var(--mono);font-weight:500;margin-left:4px}
body.city-level #watch-bar{display:none}
/* one sheet at a time: the citizens/numbers sheet sits above the bar; the money tiles show under Numbers only */
[data-watch] .dock{left:50%;right:auto;bottom:64px;transform:translateX(-50%);width:min(760px,calc(100% - 24px));max-height:min(52vh,460px);overflow:auto;padding-top:10px}
[data-watch] .dock .kpis{position:static!important;display:grid!important;grid-template-columns:repeat(4,1fr);gap:8px;width:auto!important;margin:0 36px 10px 0;padding:0;overflow:visible}
[data-watch] .dock .kpi{min-width:0}
[data-watch] .dock:not([data-tab="ledger"]) :is(.kpis,.invariant),[data-watch] body:not(.watch-dock) .kpis{display:none!important}
[data-watch] #fund-treasury{display:none}
.watch-close{position:absolute;top:8px;right:10px;border:0;background:none;color:var(--ink-2);font-size:20px;line-height:1;width:32px;height:32px;cursor:pointer}
/* a citizen's sheet: read-only, right side, as tall as it needs */
[data-watch] .inspector{top:max(64px,env(safe-area-inset-top));right:12px;width:340px;max-height:calc(100% - 140px)}
.watch-rows{margin:12px 0 4px}.watch-rows div{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--edge)}
.watch-rows dt{color:var(--ink-2)}.watch-rows dd{margin:0;font-weight:500}.watch-rows dd.num{font-family:var(--mono)}
/* plates: names only, except the one you tapped */
[data-watch] .tag:not(.sel) :is(.a,.e){display:none}
[data-watch] .tag:not(.sel){padding:3px 8px;opacity:.9}
@media (max-width:819px){
  #watch-place{top:max(8px,env(safe-area-inset-top));left:max(8px,env(safe-area-inset-left));height:36px;padding:0 11px;font-size:12px;max-width:calc(100vw - 196px);overflow:hidden}
  #watch-place .mid{display:none}   /* phone: 0xCity › Floor 40 */
  #watch-clock{top:max(8px,env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));height:36px;padding:0 11px;font-size:12px}
  #watch-clock .more{display:none}
  #watch-bar{bottom:max(10px,env(safe-area-inset-bottom))}
  [data-watch] .dock{left:0!important;right:0!important;bottom:0!important;top:auto!important;transform:none;width:auto!important;max-height:56vh!important;border-radius:18px 18px 0 0}
  [data-watch] .dock .kpis{grid-template-columns:repeat(2,1fr)}
  [data-watch] .inspector{top:auto;left:0;right:0;bottom:0;width:auto;max-height:52vh;border-radius:18px 18px 0 0}
  [data-watch] body:has(.inspector:not(:empty)) #watch-bar,[data-watch] body.watch-dock #watch-bar{display:none}
}
