/* OTHERLIFE — visual language borrowed from Viennese enamel street signs:
   white on deep enamel blue, thin white inner border, tram-red for the one primary action,
   window-gold for money and night light. DIN-like wayfinding type from the system. */
:root {
  --enamel: #1d3a6e;
  --enamel-2: #284d8c;
  --sign: #f7f6f2;
  --tram: #c8102e;
  --asphalt: #262a31;
  --stone: #d9cdb4;
  --gold: #f2b544;
  --green: #4caf7d;
  --plate-radius: 7px;
  --display: "Bahnschrift", "DIN Alternate", "DIN Next", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e1726; color: var(--sign); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Enamel plate: the one recurring device */
.plate, .hud-tl, .hud-tr, .hud-job, .panel, .creator, .prompt {
  background: var(--enamel);
  border-radius: var(--plate-radius);
  box-shadow: inset 0 0 0 2px var(--enamel), inset 0 0 0 3.5px var(--sign), 0 6px 18px rgba(4, 10, 24, .35);
}

/* Buttons */
.btn { border: 0; border-radius: 6px; padding: 12px 18px; background: var(--sign); color: var(--enamel); font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.btn:hover { background: #fff; }
.btn.ghost { background: transparent; color: var(--sign); box-shadow: inset 0 0 0 1.5px rgba(247, 246, 242, .55); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--sign); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.cta { background: var(--tram); color: var(--sign); font-size: 20px; padding: 16px 28px; letter-spacing: .06em; }
.btn.cta:hover { background: #dc1834; }
.link { background: none; border: 0; color: var(--stone); text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; text-align: left; }
.field { width: 100%; padding: 11px 12px; border-radius: 6px; border: 1.5px solid rgba(247, 246, 242, .35); background: rgba(8, 18, 38, .45); color: var(--sign); font-size: 16px; }
.field:focus { border-color: var(--sign); outline: none; }
.error { color: #ffb4b4; min-height: 1.2em; margin: 6px 0; }
.muted { color: var(--stone); opacity: .85; }
.hint, .fineprint { font-size: 12px; color: var(--stone); opacity: .75; }

/* Splash & menu */
.splash { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 14px; background: radial-gradient(ellipse at 50% 60%, #1d3a6e 0%, #0e1726 70%); }
.logo { font-family: var(--display); font-weight: 700; font-size: 44px; letter-spacing: .14em; padding: 10px 26px 8px; display: inline-block; justify-self: center;
  background: var(--enamel); border-radius: 8px; box-shadow: inset 0 0 0 3px var(--enamel), inset 0 0 0 5px var(--sign); }
.logo.big { font-size: clamp(44px, 8vw, 96px); }
.splash-sub { font-family: var(--display); letter-spacing: .3em; font-size: 12px; color: var(--stone); }
.splash-status { color: var(--stone); font-size: 14px; }
.loader { width: 220px; height: 3px; background: rgba(247, 246, 242, .15); border-radius: 2px; overflow: hidden; justify-self: center; }
.loader .bar { width: 40%; height: 100%; background: var(--sign); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.menu { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: clamp(20px, 6vw, 72px);
  background: linear-gradient(180deg, rgba(8, 14, 28, 0) 35%, rgba(8, 14, 28, .72) 100%); }
.menu-inner { display: grid; gap: 14px; max-width: 560px; justify-items: start; }
.tagline { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 3vw, 34px); letter-spacing: .08em; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.subline { font-size: 18px; color: var(--stone); margin-bottom: 10px; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.login-box { display: grid; gap: 8px; width: min(340px, 90vw); }
.attribution { font-size: 11px; color: rgba(247, 246, 242, .75); text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.attribution.corner { position: absolute; right: 12px; bottom: 8px; }
.attribution.inline { position: static; margin-top: 8px; color: var(--stone); text-shadow: none; }

/* Character creator */
.creator { position: absolute; right: clamp(10px, 3vw, 40px); top: 50%; transform: translateY(-50%); width: min(380px, calc(100vw - 20px)); max-height: calc(100vh - 24px); overflow: auto; padding: 22px 22px 18px; display: grid; gap: 12px; }
.creator h2 { font-family: var(--display); margin: 0 0 4px; font-size: 24px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row.col { flex-direction: column; align-items: stretch; gap: 6px; }
.lbl { font-size: 14px; color: var(--stone); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .val { min-width: 2ch; text-align: center; font-family: var(--display); font-size: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); padding: 0; }
.swatch.on { border-color: var(--sign); box-shadow: 0 0 0 2px var(--enamel), 0 0 0 4px var(--sign); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-btn { border: 1.5px solid rgba(247, 246, 242, .4); background: transparent; border-radius: 6px; padding: 8px 4px; font-size: 14px; }
.seg-btn.on { background: var(--sign); color: var(--enamel); border-color: var(--sign); font-weight: 600; }
@media (max-width: 720px) { .creator { top: auto; bottom: 10px; transform: none; max-height: 58vh; } }

/* Welcome: the one orchestrated moment */
.welcome { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: rgba(8, 14, 28, .78); }
.welcome-small { font-family: var(--display); letter-spacing: .4em; color: var(--stone); animation: rise .7s ease-out both; }
.welcome-city { font-family: var(--display); font-weight: 700; font-size: clamp(56px, 12vw, 150px); letter-spacing: .06em; line-height: 1; margin: 10px 0; animation: rise .9s .15s ease-out both; }
.welcome-district { color: var(--stone); animation: rise .9s .35s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; font-size: 15px; }
.hud > * { pointer-events: auto; }
.hud-tl { position: absolute; left: 14px; top: calc(14px + env(safe-area-inset-top)); display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; }
.avatar-dot { width: 36px; height: 36px; border-radius: 50%; background: var(--sign); color: var(--enamel); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; }
.hud-name { font-family: var(--display); font-weight: 700; font-size: 17px; }
.hud-sub { font-size: 13px; color: var(--stone); }
.hud-tr { position: absolute; right: 14px; top: calc(14px + env(safe-area-inset-top)); padding: 8px 14px; text-align: right; }
.hud-clock { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: .04em; }
.hud-balance { color: var(--gold); font-family: var(--display); font-size: 17px; font-weight: 700; }
.hud-online { font-size: 12px; color: var(--stone); }
.hud-job { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 8px 16px 8px 10px; }
.job-arrow { font-size: 22px; color: var(--gold); width: 26px; text-align: center; transition: transform .1s linear; }
.job-title { font-weight: 600; }
.job-meta { font-size: 13px; color: var(--stone); }
.prompt { position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%); padding: 10px 18px; font-family: var(--display); font-size: 18px; font-weight: 700; }
.hud-bl { position: absolute; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: min(380px, 60vw); }
.chat-log { max-height: 26vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; scrollbar-width: thin; }
.chat-line { font-size: 14px; background: rgba(14, 23, 38, .62); padding: 4px 9px; border-radius: 5px; width: fit-content; max-width: 100%; overflow-wrap: anywhere; }
.chat-name { background: none; border: 0; padding: 0; color: var(--gold); font-weight: 700; }
.chat-row { display: flex; gap: 6px; }
.chat-input { flex: 1; padding: 9px 11px; border-radius: 6px; border: 1.5px solid rgba(247, 246, 242, .3); background: rgba(14, 23, 38, .7); color: var(--sign); font-size: 15px; }
.hud-br { position: absolute; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--enamel); box-shadow: inset 0 0 0 2px var(--enamel), inset 0 0 0 3.5px var(--sign); font-size: 22px; }
.round:hover { background: var(--enamel-2); }
.round.on { background: var(--tram); }
.round.big { width: 68px; height: 68px; font-family: var(--display); font-weight: 700; font-size: 26px; }
.toasts { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 9px 18px; border-radius: 6px; background: rgba(14, 23, 38, .85); font-family: var(--display); font-size: 18px; font-weight: 700; transition: opacity .5s, transform .5s; animation: rise .35s ease-out; }
.toast.money { color: var(--gold); font-size: 26px; }
.toast.ok { color: #9fe3bd; }
.toast.warn { color: #ffcf8a; }
.toast.out { opacity: 0; transform: translateY(-10px); }
.banner { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); background: var(--tram); padding: 10px 16px; border-radius: 6px; display: flex; gap: 12px; align-items: center; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.labels > * { position: absolute; left: 0; top: 0; will-change: transform; }
.nametag { display: grid; justify-items: center; gap: 4px; }
.nametag .tag { font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: rgba(29, 58, 110, .85); white-space: nowrap; }
.nametag.self .tag { display: none; }
.nametag .bubble { display: none; max-width: 240px; background: var(--sign); color: #1b2333; padding: 6px 10px; border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }
.nametag.has-bubble .bubble { display: block; }
.venue { font-family: var(--display); font-weight: 700; font-size: 15px; padding: 4px 10px; background: var(--enamel); border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--enamel), inset 0 0 0 2.5px var(--sign); white-space: nowrap; transform-origin: 50% 100%; }
.attribution:not(.corner):not(.inline) { position: absolute; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); }
.controls-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 12px; color: rgba(247, 246, 242, .7); text-shadow: 0 1px 3px #000; white-space: nowrap; transition: opacity 1s; }
.controls-hint.gone { opacity: 0; }
@media (max-width: 1180px) { .controls-hint { display: none; } }

/* Overlays: phone, map, menu */
.overlay { position: absolute; inset: 0; background: rgba(8, 14, 28, .45); display: grid; place-items: center; }
.panel { padding: 22px; display: grid; gap: 12px; min-width: min(320px, 92vw); }
.panel h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.brand { font-family: var(--display); letter-spacing: .14em; margin: 0 0 6px; text-align: center; }
.map-panel { width: min(760px, 96vw); }
.map-canvas { width: 100%; aspect-ratio: 1 / 1; max-height: 72vh; border-radius: 4px; background: #e9e5dc; }
.map-legend { font-size: 14px; color: var(--stone); }
.phone-wrap { position: absolute; inset: 0; display: grid; place-items: center; }
.phone { width: min(360px, 94vw); height: min(700px, 92vh); border-radius: 38px; background: #0c111b; padding: 12px; box-shadow: 0 0 0 2px #39404d, 0 24px 60px rgba(0, 0, 0, .55); display: flex; flex-direction: column; position: relative; animation: rise .25s ease-out; }
.phone-notch { width: 110px; height: 24px; border-radius: 0 0 14px 14px; background: #0c111b; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; }
.phone-status { display: flex; justify-content: space-between; padding: 8px 22px 6px; font-size: 13px; font-weight: 600; background: linear-gradient(180deg, #1d3a6e, #18315c); border-radius: 28px 28px 0 0; }
.phone-screen { flex: 1; overflow-y: auto; background: linear-gradient(180deg, #18315c 0%, #101c33 100%); border-radius: 0 0 28px 28px; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.phone-greet { font-family: var(--display); font-size: 26px; font-weight: 700; margin: 10px 4px 6px; }
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 10px; }
.app-icon { background: none; border: 0; display: grid; justify-items: center; gap: 6px; font-size: 13px; }
.app-icon .ico { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; }
.app-head { display: flex; align-items: center; gap: 8px; }
.app-head h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.app-back { background: none; border: 0; font-size: 30px; line-height: 1; padding: 0 8px 4px 0; }
.close-phone { margin-top: auto; align-self: center; }
.card { background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.card p { margin: 0; }
.card-title { font-weight: 700; font-size: 16px; }
.bank-balance .big { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--gold); }
.bank-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pos { color: #8fe0b0; font-weight: 600; }
.neg { color: #ffaaa0; font-weight: 600; }
.tx-list { display: grid; gap: 2px; }
.tx { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: 14px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.setting .field { width: auto; min-width: 150px; }
.menu-panel { width: min(320px, 92vw); }
.small-panel { width: min(300px, 92vw); }

/* Touch */
.joy { position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(247, 246, 242, .14); border: 2px solid rgba(247, 246, 242, .35); pointer-events: none; }
.knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(247, 246, 242, .6); }
.mobile-buttons { display: none; position: absolute; right: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); gap: 10px; align-items: flex-end; }
@media (pointer: coarse) {
  .mobile-buttons { display: flex; }
  .controls-hint { display: none; }
  .hud-bl { width: 52vw; }
  .chat-log { max-height: 18vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- milestone 3: minimap, needs, shops, places ---- */
.hud-tr { background: none; box-shadow: none; padding: 0; display: grid; gap: 10px; justify-items: end; }
.clock-plate { background: var(--enamel); border-radius: var(--plate-radius); box-shadow: inset 0 0 0 2px var(--enamel), inset 0 0 0 3.5px var(--sign), 0 6px 18px rgba(4, 10, 24, .35); padding: 8px 14px; text-align: right; }
.minimap { border-radius: 50%; cursor: crosshair; box-shadow: 0 6px 18px rgba(4, 10, 24, .45); display: block; }
.hud.indoor .minimap { opacity: .35; pointer-events: none; }
.needs { display: grid; gap: 3px; margin-top: 5px; min-width: 128px; }
.need { display: grid; grid-template-columns: 16px 1fr; align-items: center; gap: 5px; font-size: 11px; }
.need-track { height: 5px; border-radius: 3px; background: rgba(247, 246, 242, .2); overflow: hidden; }
.need-fill { height: 100%; background: var(--sign); border-radius: 3px; transition: width .6s; }
.need-fill.low { background: var(--gold); }
.needs.big { gap: 8px; }
.need-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.need-row .need-track { height: 8px; }
.hud-job { pointer-events: auto; }
.job-x { background: none; border: 0; color: var(--stone); font-size: 15px; padding: 2px 4px; margin-left: 4px; }
.venue.real { background: var(--asphalt); box-shadow: inset 0 0 0 1px rgba(247, 246, 242, .5); font-family: var(--body); font-weight: 600; font-size: 13px; }
.venue.home { background: var(--enamel); }
.shop-panel { width: min(560px, 94vw); max-height: 86vh; overflow: auto; }
.shop-grid, .bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.shop-item { background: rgba(255, 255, 255, .08); border-radius: 10px; padding: 12px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.shop-ico { font-size: 34px; line-height: 1; }
.shop-name { font-weight: 600; }
.shop-price { color: var(--gold); font-family: var(--display); font-weight: 700; }
.map-panel { width: min(1080px, 96vw); }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.map-col { display: grid; gap: 6px; }
.map-canvas { cursor: crosshair; max-height: 70vh; }
.places-col { display: grid; gap: 8px; grid-template-rows: auto auto auto 1fr; max-height: 72vh; min-height: 0; }
.places-col h4 { margin: 0; font-family: var(--display); font-size: 18px; }
.tabs { grid-template-columns: repeat(2, 1fr); }
.places { overflow-y: auto; display: grid; gap: 4px; align-content: start; min-height: 0; }
.place { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; text-align: left; background: rgba(255, 255, 255, .06); border: 0; border-radius: 6px; padding: 8px 10px; }
.place:hover { background: rgba(255, 255, 255, .14); }
.place-ico { font-size: 18px; }
.place-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-d { color: var(--stone); font-size: 12px; }
@media (max-width: 820px) { .map-layout { grid-template-columns: 1fr; } .places-col { max-height: 34vh; } .minimap { width: 120px !important; height: 120px !important; } }

/* ---- world picker ---- */
.picker-host { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 14, 28, .55); }
.picker { width: min(560px, 94vw); max-height: 90vh; overflow: hidden; display: grid; grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto; }
.picker-results { overflow-y: auto; max-height: 46vh; }
.picker-head { font-size: 12px; color: var(--stone); margin: 8px 2px 2px; }
.picker-status { background: rgba(255, 255, 255, .07); border-radius: 10px; padding: 14px; display: grid; gap: 10px; justify-items: start; }
.picker-status .loader { justify-self: stretch; width: auto; }
.picker-title { font-family: var(--display); font-size: 20px; font-weight: 700; }
.ok-text { color: #9fe3bd; }
.coord-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.field.bad { border-color: #ff8a8a; }
.place-pick { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: rgba(8, 18, 38, .45); border-radius: 6px; padding: 8px 10px; }
.place-current { font-weight: 600; }
