:root {
  color-scheme: dark;
  --ink: #fff4df;
  --muted: #b8c8de;
  --deep: #101c34;
  --surface: #1a2c49;
  --edge: #3d5373;
  --glow: #ffca64;
  --danger: #ffb1a5;
  --radius: 12px;
  --safe-bottom: var(--aw-safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  background: #091426;
  color: var(--ink);
}
* { box-sizing: border-box }
body { margin: 0; min-width: 0; overscroll-behavior: none }
button, a { -webkit-tap-highlight-color: transparent }
button { font: inherit; color: inherit; cursor: pointer; min-height: 44px }
button:disabled { opacity: .53; cursor: default }
button:focus-visible, a:focus-visible { outline: 3px solid #9ed9ff; outline-offset: -3px }
h1,h2,h3,p { margin: 0 }
h1 { font-size: 27px; line-height: 1.12; letter-spacing: -.025em }
h2 { font-size: 21px; line-height: 1.2 }
h3 { font-size: 16px; line-height: 1.25 }
p { line-height: 1.42 }
small { font-size: 13px }
.shell {
  width: min(100%, 480px); margin: auto; height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto minmax(0,1fr) auto;
  background: var(--deep); padding-top: var(--aw-safe-area-inset-top, 0px);
  padding-inline: var(--aw-safe-area-inset-left, 0px) var(--aw-safe-area-inset-right, 0px);
}
.loading { grid-row: 1 / -1; align-self: center; justify-self: center; display:grid; gap:16px; place-items:center; padding: 24px; text-align:center; }
.loading-light { width: 21px; height: 21px; border-radius: 50%; border: 3px solid var(--edge); border-top-color: var(--glow); animation: spin 1s linear infinite }
@keyframes spin { to { transform: rotate(1turn) } }
.hud {
  min-height: 55px; display:flex; justify-content: space-between; gap:8px; align-items: center;
  padding: 5px 12px; border-bottom: 1px solid var(--edge); background: #13223e; z-index: 1;
}
.resources { display:flex; align-items:center; min-width:0; gap:6px }
.pill { min-height: 44px; background:#0e1a30; border:1px solid #344966; border-radius:10px; padding:5px 8px; font-weight:750; display:inline-flex; gap:6px; align-items:center; white-space:nowrap; font-variant-numeric: tabular-nums }
.pill i { display:inline-block; flex:none }
.coin { width:16px; height:16px; border-radius:50%; background:#ffc250; border:2px solid #ffe3a1; box-shadow:inset 0 0 0 2px #b87222 }
.gem { width:14px; height:16px; background:#8bdffc; clip-path:polygon(50% 0,100% 34%,80% 100%,20% 100%,0 34%); box-shadow:inset 4px 0 #429bd6 }
.part { color:#b4c9e7; font-style:normal; line-height:1 }
.icon-button { width:44px; flex:none; border:0; border-radius:10px; background:transparent; font-size:20px; color:var(--muted) }
#content { min-height:0; display:grid }
.base { display:grid; grid-template-rows:minmax(0,1fr) auto; min-height:0; }
.scene {
  position:relative; isolation:isolate; min-height:0; overflow:hidden; container-type:size;
  --reserve: 61px; --ground: 12px;
  background: #12365d url("/art/land.webp") center 83% / cover no-repeat;
  border-bottom:1px solid var(--edge); 
}
.scene.has-officer { --reserve: 96px; --ground: 46px }
.scene::before { content:""; position:absolute; z-index:-1; inset:0; background:linear-gradient(180deg,#10233c22 0%,transparent 42%,#14284822 74%,#294d7d8c 100%) }
.scene-snow { position:absolute; inset:0; overflow:hidden; pointer-events:none }
.scene-snow i, .window-snow i {
  position:absolute; inset:calc(-1 * var(--snow-fall)) -8px 0;
  animation:ambient-snow var(--snow-time) linear infinite;
}
.scene-snow i {
  --snow-fall:144px; --snow-time:16s;
  background-image:radial-gradient(circle at 15% 18%,#f0f8ffe0 0 1px,transparent 1.65px),
    radial-gradient(circle at 63% 42%,#dceeffaa 0 .7px,transparent 1.35px),
    radial-gradient(circle at 36% 81%,#dceeffa6 0 1px,transparent 1.65px),
    radial-gradient(circle at 89% 65%,#dceeffb3 0 .6px,transparent 1.2px);
  background-size:172px var(--snow-fall);
  opacity:.6;
}
.scene-snow i:nth-child(2) { --snow-time:24s; background-position:62px 55px; animation-delay:-9s; opacity:.33 }
@keyframes ambient-snow { to { transform:translate3d(4px,var(--snow-fall),0) } }
.scene-head { position:absolute; inset:12px 12px auto; display:flex; align-items:flex-start; justify-content:space-between; gap:6px; z-index:1; pointer-events:none }
.scene-head button { pointer-events:auto }
.scene-title { text-shadow:0 2px 4px #0b1326,0 1px 15px #0b1326; font-size:clamp(20px,5.6vw,27px); align-self:center }
.scene-chip { border:1px solid #8ba3be; border-radius:10px; padding:0 9px; font-weight:700; background:#122540ee; white-space:nowrap }
.scene-floor {
  position:absolute; inset:42px 0 var(--ground); display:grid; justify-items:center; align-items:end;
  padding:0 5px;
}
.station {
  display:flow-root; position:relative; isolation:isolate; container-type:inline-size;
  width:min(96%, 440px, calc(max(95px,100cqh - var(--reserve)) * var(--fit)));
  padding-top:0; margin-bottom:2px;
}
.station::before { content:""; position:absolute; z-index:-1; inset:auto -2% 0; height:18%; border-radius:50%; background:#0b214974; filter:blur(5px); }
.station-roof, .station-footing { position:absolute; pointer-events:none; z-index:4; width:105%; left:-2.5%; display:block; object-fit:fill }
.station-roof { top:0; height:auto; aspect-ratio:3.8; }
.station-footing { bottom:0; height:auto; aspect-ratio:6.2; }
.station-rooms {
  display:grid; grid-template-columns:repeat(var(--columns),minmax(0,1fr)); gap:0;
  margin-block:25% 12%; padding:0 2.1%;
  border-inline:clamp(3px,1.1vw,7px) solid #506481;
  background:repeating-linear-gradient(90deg,#223450 0 4px,#455b7c 4px 6px,#273c5c 6px 11px);
  box-shadow:inset 2px 0 #9aacc3,inset -2px 0 #253b5b, 0 3px 6px #08162d80;
}
.room {
  position:relative; display:grid; align-items:end; overflow:hidden; aspect-ratio:1.6; min-width:0;
  border:0; border-inline:clamp(1px,.55vw,3px) solid #607594;
  border-block:clamp(2px,.8vw,5px) solid #405778;
  border-radius:4px 4px 0 0; padding:0; background:#172641;
}
.room-new { animation: room-light .65s ease-out }
@keyframes room-light { from { filter: brightness(.4) } to { filter:brightness(1) } }
.room-art { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:0 }
.room::after { content:""; z-index:1; position:absolute; inset:0; background:linear-gradient(0deg,#08152bec,transparent 41%) }
.window-snow { position:absolute; z-index:1; inset:21% auto auto 59.5%; width:20%; height:35%; border-radius:50%; overflow:hidden; pointer-events:none }
.window-snow i {
  --snow-fall:32px; --snow-time:8s;
  background-image:radial-gradient(circle at 22% 29%,#eaf5ffe0 0 .65px,transparent 1.1px),
    radial-gradient(circle at 73% 72%,#eaf5ffa8 0 .75px,transparent 1.2px);
  background-size:25px var(--snow-fall); opacity:.72;
}
.radio-lights { position:absolute; z-index:2; left:30.3%; top:62%; width:10%; height:0; display:flex; justify-content:space-between; pointer-events:none }
.radio-lights i {
  width:clamp(1px,.9cqw,3px); aspect-ratio:1; border-radius:50%; translate:-50% -50%;
  color:#ffd77a; background:currentColor; box-shadow:0 0 3px currentColor;
  animation:radio-indicator 3.9s linear infinite;
}
.radio-lights i:nth-child(2) { color:#ffad63; animation-duration:5.7s; animation-delay:-1.1s }
.radio-lights i:nth-child(3) { color:#ccedaa; animation-duration:4.7s; animation-delay:-2.6s }
@keyframes radio-indicator { 0%,62%,100% { opacity:.26 } 67%,85% { opacity:.95 } 92% { opacity:.26 } }
.room-name { position:relative; z-index:3; padding:4px 3px; font-size:clamp(10px,3vw,13px); line-height:1.12; font-weight:760; text-shadow:0 1px 3px #000,0 1px 6px #101729; text-align:left }
.room-name small { font-size:inherit; white-space:nowrap }
.room-ground .room-name { padding-bottom:calc(4px + 4.4cqw) }
@container (max-width:215px) {
  .room-name { padding-inline:2px; letter-spacing:-.025em; overflow-wrap:anywhere }
  .room-name small { display:none }
}
@container (max-width:160px) { .room-name { font-size:9px } }
.room-resident {
  position:absolute; z-index:2; pointer-events:none;
  left:var(--resident-x,68%); bottom:var(--resident-floor,17%);
  width:37%; height:43%; max-width:68px; max-height:52px;
  translate:-50% 0;
}
.room-ground .room-resident { --resident-floor:21% }
.room[data-target="home"] .room-resident { --resident-x:70% }
.room[data-target="green"] .room-resident { --resident-x:59% }
.room[data-target="work"] .room-resident { --resident-x:66%; --resident-floor:19% }
.room[data-target="radio"] .room-resident { --resident-x:74%; --resident-floor:20% }
.room[data-target="garage"] .room-resident { --resident-x:77% }
.room-resident::before {
  content:""; position:absolute; inset:auto 19% 0; height:12%;
  background:#221b17a8; border-radius:50%; filter:blur(1.5px);
}
.room-resident img { position:relative; width:100%; height:100%; display:block; object-fit:contain; object-position:50% 100%; filter:saturate(.82) brightness(.88) contrast(.94); transform-origin:50% 100%; animation:resident-breath 4.8s ease-in-out infinite }
.room-resident[data-action="nap"] img { animation-duration:5.9s }
.room-resident[data-action="cook"] img, .room-resident[data-action="water"] img,
.room-resident[data-action="spark"] img, .room-resident[data-action="work"] img { animation-name:resident-lean; animation-duration:3.9s }
@keyframes resident-breath { 50% { transform:scaleY(1.024) } }
@keyframes resident-lean { 50% { transform:rotate(.85deg) scaleY(1.013) } }
.soup-steam { position:absolute; inset:auto auto 42% 68%; width:25%; height:56%; pointer-events:none }
.soup-steam i {
  position:absolute; bottom:0; left:8%; width:52%; height:74%; border-radius:60% 37% 55% 30%;
  background:radial-gradient(ellipse at 50% 50%,#fff5dfbf,transparent 71%); opacity:0;
  filter:blur(.65px); animation:steam-rise 3.1s ease-out infinite;
}
.soup-steam i:nth-child(2) { left:32%; animation-delay:-1.45s }
@keyframes steam-rise {
  0% { opacity:0; transform:translateY(5%) scale(.55) }
  28% { opacity:.6 }
  100% { opacity:0; transform:translate(33%,-75%) scale(1.32) }
}
[data-ambience-paused] [data-ambience] { animation-play-state:paused }
.crew-look img { width:100%; height:100%; object-fit:contain; object-position:50% 100%; display:block }
.crew-look { position:relative; display:block }
.crew-gear { position:absolute; display:block; pointer-events:none; background:var(--gear-color); border:1px solid #17243b35; box-shadow:0 1px 1px #14263b60 }
.crew-gear[data-gear="scarf"] { width:26%; height:9%; inset:auto auto 36% 32%; border-radius:48% 30% 38% 48%; rotate:-7deg }
.crew-gear[data-gear="scarf"]::after { content:""; position:absolute; left:20%; bottom:-79%; width:30%; height:114%; border-radius:0 0 40% 40%; rotate:13deg; background:inherit }
.crew-gear[data-gear="pack"] { inset:auto auto 23% 17%; width:15%; height:23%; border-radius:45% 30% 25% 35%; rotate:-12deg; background:linear-gradient(#fce9cf3d 24%,transparent 25% 34%,#17243b54 35% 39%,transparent 40%),var(--gear-color); box-shadow:inset 1px 0 #fce9cf5c,1px 2px 2px #14263b65 }
.crew-gear[data-gear="patch"] { inset:auto auto 30% 47%; width:12%; height:12%; border-radius:33%; rotate:-15deg }
.crew-gear[data-gear="cap"] { inset:auto auto 76% 39%; width:23%; height:8%; border-radius:70% 70% 18% 18%; rotate:-9deg }
.crew-gear[data-gear="trim"] { inset:auto auto 25% 50%; width:14%; height:8%; border-radius:30%; rotate:-12deg }
.crew-look[data-action="nap"] .crew-gear { display:none }
.trait-mark { position:absolute; right:6%; top:7%; border-radius:50%; background:#0e1a30; width:16px; height:16px; line-height:16px; text-align:center; font-size:11px; font-style:normal }
.outfit { position:absolute; left:42%; top:62%; width:13%; height:16%; background:#31b4cd; border:1px solid #bff4ff; border-radius:4px 4px 6px 6px; transform:rotate(-12deg) }
.outfit.chief { background:#ffca64; border-color:#fff4df }
.room-event { position:absolute; z-index:3; inset:4px 4px auto auto; display:grid; place-items:center; width:22px; height:22px; background:#fff4df; color:#203c5c; border-radius:50%; font-size:14px; font-weight:800 }
.room-empty {
  border:clamp(2px,.8vw,5px) solid #405778; border-radius:4px 4px 0 0; display:grid; place-items:center;
  color:var(--ink); background:repeating-linear-gradient(0deg,#344660 0 6px,#293c55 6px 8px,#526380 8px 9px);
  box-shadow:inset 0 1px 9px #07162b; font-size:23px; font-weight:600;
}
.room-empty span { width:29px; height:28px; line-height:26px; border-radius:5px; background:#152642; border:1px solid #7485a0 }
.officer {
  position:absolute; bottom:4px; left:12px; right:12px; display:flex; justify-content:center;
}
.officer button { min-height:44px; border:0; border-radius:9px; background:#10233fec; padding:5px 9px; line-height:1.18; color:var(--ink); font-size:12px }
.officer strong { color: var(--glow) }
.base-controls { padding:8px 12px; background:#132340; display:grid; gap:6px }
.goal, .offer-bar {
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:8px; text-align:left;
  border:1px solid var(--edge); border-radius:var(--radius); padding:7px 10px; background:var(--surface);
}
.goal span,.offer-bar span { min-width:0; line-height:1.28; overflow-wrap:anywhere }
.goal small, .offer-bar small { color:var(--muted) }
.goal b, .offer-bar b { display:block; font-size:14px }
.goal i,.offer-bar i { font-size:22px; font-style:normal; line-height:1; color:var(--glow) }
.primary, .secondary, .quiet {
  border-radius:var(--radius); display:inline-flex; justify-content:center; align-items:center; text-align:center;
  padding:8px 12px; font-weight:750; gap:6px; text-decoration:none;
}
.primary { background:linear-gradient(#ffdc8a,#f8b74c); color:#332009; border:1px solid #ffe1a3; box-shadow:inset 0 -2px 0 #b87426 }
.secondary { background:#263d5c; color:var(--ink); border:1px solid #526b8c }
.quiet { color:var(--muted); background:transparent; border:1px solid var(--edge) }
.primary:active,.secondary:active,.quiet:active { transform:translateY(1px) }
.collect { min-height:52px; font-size:17px; justify-content:space-between; padding-inline:12px }
.collect small { font-size:12px; opacity:.83 }
nav {
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px;
  padding:5px 6px calc(5px + var(--safe-bottom)); background:#0e1c35; border-top:1px solid var(--edge);
}
nav button {
  display:grid; place-content:center; justify-items:center; gap:1px;
  position:relative; color:#c5d3e8; padding:1px 2px; min-width:0; min-height:50px;
  background:transparent; border:1px solid transparent; border-radius:9px; font-size:clamp(10px,3.25vw,13px); font-weight:650;
}
nav button[aria-current="page"] { color:var(--glow); border-color:#72634b; background:#2b2d3d }
.nav-icon { font-size:19px; height:22px; line-height:22px; font-weight:800 }
.nav-dot { width:7px; height:7px; border-radius:50%; position:absolute; right:17%; top:7px; background:var(--glow) }
.compact-dot { display:none }
.scroll { min-height:0; overflow:auto; overscroll-behavior:contain; padding:14px 12px 18px; scrollbar-width:thin; }
.page-head { display:grid; gap:5px; margin-bottom:13px; }
.muted, .meta { color:var(--muted); font-size:13px }
.stack { display:grid; gap:8px }
.list-card, .week, .box-card, .status-card {
  border:1px solid var(--edge); background:var(--surface); border-radius:var(--radius);
  padding:12px; display:grid; gap:7px;
}
.route { grid-template-columns:87px minmax(0,1fr); align-items:center; }
.route-art { width:100%; border-radius:8px; aspect-ratio:1; object-fit:cover }
.route-info { display:grid; gap:5px; min-width:0 }
.route .secondary,.route .primary { grid-column:1/-1 }
.route-lock { grid-column:1/-1; margin-top:2px }
.status-card { background:linear-gradient(145deg,#20395d,#182a46); border-color:#647d9b; margin-bottom:9px }
.status-card .row,.box-card .row,.week .row { display:flex; justify-content:space-between; gap:8px; align-items:center }
.progress { width:100%; height:8px; accent-color:var(--glow) }
.week { margin-top:10px }
.week .row + .row { border-top:1px solid #354e6e; padding-top:7px }
.done { color:#b8eed1 }
.boxes { display:grid; gap:8px; margin-bottom:13px }
.box-card { grid-template-columns:46px minmax(0,1fr) auto; align-items:center; text-align:left; width:100%; color:var(--ink) }
.crate { display:block; width:40px; height:32px; border:2px solid #99bad6; border-radius:5px; background:repeating-linear-gradient(0deg,#2b5372 0px,#407493 5px,#274863 6px,#315372 11px); box-shadow:0 2px 4px #0b182b; position:relative }
.crate::after { content:""; width:9px; height:12px; border:2px solid #abcae0; border-radius:3px; position:absolute; inset:8px auto auto 13px; background:#254965 }
.crate.premium { background:repeating-linear-gradient(0deg,#a27436 0px,#f3cb86 5px,#d59649 6px,#ebcea0 11px); border-color:#ffe8b6 }
.crate.premium::after { border-color:#ffe8b6; background:#95662e }
.gallery { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.avatar { min-width:0; border:1px solid var(--edge); border-radius:var(--radius); background:#1b2d4c; padding:3px 3px 7px; display:grid; justify-items:center; align-content:start; gap:3px; text-align:center }
.tile-portrait { width:100%; aspect-ratio:1.16; }
.avatar img { width:100%; height:100%; object-fit:contain }
.avatar.locked .tile-portrait { filter:brightness(.5) saturate(.65) }
.avatar strong { font-size:clamp(10px,3.2vw,13px); line-height:1.14; overflow-wrap:anywhere; max-width:100% }
.avatar small { color:var(--muted); font-size:10px }
.avatar.active { border-color:var(--glow) }
.group-0 { color:var(--danger) }
.group-1 { color:#bee1fc }
.group-2 { color:var(--glow) }
.group-0 .portrait { transform:rotate(-5deg) }
.group-2 .portrait { filter:drop-shadow(0 0 14px #ffbc5e65) }
.portrait { width:132px; height:132px; object-fit:contain; display:block; margin-inline:auto }
.portrait-frame { position:relative; width:132px; margin-inline:auto }
.offer { grid-template-columns:minmax(0,1fr) auto; align-items:center }
.offer h3 { overflow-wrap:anywhere }
.offer p { margin-top:3px }
.offer .primary { min-width:66px }
.shop-note { padding-bottom:3px }
details { border:1px solid var(--edge); padding:8px 9px; border-radius:var(--radius); }
summary { min-height:44px; display:flex; align-items:center; cursor:pointer; font-weight:650 }
summary::after { content:"+"; margin-left:auto; color:var(--glow) }
details[open] summary::after { content:"−" }
.odds { margin-top:4px; border-collapse:collapse; width:100%; font-size:13px; text-align:left }
.odds th,.odds td { border-bottom:1px solid #394f6d; padding:7px 3px; }
.odds th:last-child,.odds td:last-child { text-align:right }
dialog {
  width:min(100%, 480px); max-width:100%; max-height:calc(100dvh - var(--aw-safe-area-inset-top,0px) - 12px);
  padding:0; margin:auto auto 0; border:1px solid var(--edge); border-radius:16px 16px 0 0;
  color:var(--ink); background:#192c49; box-shadow:0 -14px 48px #081424b5;
}
dialog::backdrop { background:#030c1db5 }
.sheet-head { position:sticky; top:0; z-index:1; background:#192c49; padding:6px 10px 6px 13px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--edge); gap:6px }
.sheet-head h2 { font-size:20px; min-width:0; overflow-wrap:anywhere }
.sheet-body { padding:12px 13px calc(14px + var(--safe-bottom)); display:grid; gap:9px; }
.sheet-body .primary,.sheet-body .secondary,.sheet-body .quiet { width:100% }
.sheet-art { width:100%; max-height:175px; object-fit:cover; border-radius:var(--radius) }
.stat-line { display:flex; gap:10px; flex-wrap:wrap; justify-content:space-between; border-bottom:1px solid var(--edge); padding-bottom:6px }
#toast { position:fixed; z-index:5; pointer-events:none; width:min(calc(100% - 28px),452px); top:calc(62px + var(--aw-safe-area-inset-top, 0px)); left:50%; transform:translateX(-50%); filter:drop-shadow(0 3px 12px #0b1527ac); }
#toast:not(:empty), .inline-message { background:#17243b; border:1px solid #849ab7; padding:9px 11px; border-radius:var(--radius); color:var(--ink); font-size:14px; }
#toast + * { margin:0 }
dialog .inline-message { display:none }
dialog[open] .inline-message:not(:empty) { display:block; margin:0 12px 10px }
@media (max-width:350px) { .hud { padding-inline:7px } .pill { padding-inline:5px; gap:4px } .collect small { font-size:11px } .box-card { padding:8px; grid-template-columns:43px minmax(0,1fr) auto } }
@media (max-height:545px) { .hud { min-height:46px; padding-block:1px } .scene { --reserve:49px; --ground:9px } .scene.has-officer { --reserve:78px; --ground:43px } .scene-floor { inset-block-start:32px } .scene-head { inset-block-start:3px } .officer { bottom:1px } .base-controls { padding-block:5px } .offer-bar .extra { display:none } nav button { min-height:44px } }
@media (max-width:350px), (max-height:545px) { .base-controls .offer-bar { display:none } .compact-dot { display:block } }
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation-duration:.001ms !important; transition-duration:.001ms !important; } }
@media (prefers-reduced-motion:reduce) { [data-ambience] { animation:none !important } .soup-steam i:first-child { opacity:.25 } }
.offer-link { background:transparent; border:0; padding:4px 0; text-align:left; min-width:0; flex:1 }
.offer-bar { padding-block:1px }
#trip-action button { width:100% }
