:root{color-scheme:dark;font-family:system-ui,sans-serif;color:#f1f3f6;background:#152833;--ink:#152732;--glass:rgba(15,29,39,.92);--line:rgba(255,255,255,.27);--blue:#2057c9}
*{box-sizing:border-box}
body{margin:0}
main{position:relative;min-height:100svh;overflow:hidden}
#world{position:absolute;inset:0;touch-action:none}
#world canvas{display:block;width:100%;height:100%}
[hidden]{display:none!important}
.hud{position:absolute;padding:.85rem 1rem;background:var(--glass);border:1px solid var(--line);border-radius:.65rem;box-shadow:0 12px 28px rgba(17,27,34,.18)}
h1,p{margin:0}
.top{top:1rem;left:1rem;right:1rem;display:flex;justify-content:space-between;align-items:center;gap:1rem}
.brand{color:#aaccff;letter-spacing:.055em;font-weight:750;font-size:.75rem}
h1{font-size:clamp(1.3rem,4vw,1.9rem);font-weight:680;line-height:1.15}
#connection{font-size:.82rem;text-align:right;color:#d0e4fc}
.session-tools{display:flex;align-items:center;justify-content:flex-end;gap:.5rem}
#transfer-open{white-space:nowrap;font-size:.77rem}
.wallet{top:6.4rem;left:1rem;min-width:10.7rem}
#cash{font-weight:760;font-size:1.52rem;line-height:1.12}
#clock{font-size:.76rem;color:#c7d6e2;margin:.25rem 0}
dl{margin:.62rem 0 0;font-size:.78rem}
dl div{display:flex;justify-content:space-between;gap:1rem;padding:.27rem 0;border-top:1px solid var(--line)}
dt{color:#d2dce5}dd{margin:0;font-weight:680}
.map{right:1rem;top:6.4rem;width:240px;padding:.55rem}
.map canvas{display:block;width:100%;height:auto;border-radius:.32rem}
.map label,.map p{font-size:.75rem;color:#d9e7f3}
.map label{display:block;margin:.35rem .1rem .2rem}
select,button{font:inherit;border:1px solid #88a3ba;border-radius:.40rem;background:#172e43;color:#fff;min-height:44px;padding:.45rem .65rem}
select{width:100%}button{cursor:pointer}
button:hover{filter:brightness(1.2)}
button:focus-visible,select:focus-visible{outline:3px solid #a2c5ff;outline-offset:2px}
#distance{margin:.34rem .15rem .1rem;min-height:1em}
.scene-actions{bottom:4.3rem;left:50%;transform:translateX(-50%);width:min(34rem,calc(100% - 2rem));text-align:center}
#nearby{font-size:.82rem;color:#aecdf5}
#shift-task{color:#fff0bf;font-weight:700;font-size:.85rem;margin:.26rem 0}
#interact{display:block;margin:.35rem auto;background:var(--blue);border-color:#88afff;font-weight:700}
#notice{font-size:.87rem}
.help{bottom:1rem;left:50%;transform:translateX(-50%);white-space:nowrap;font-size:.75rem;padding:.55rem .8rem}
.help span{margin-inline-start:1rem;color:#d9e7f3}
.touch{display:none;position:absolute;left:1rem;bottom:.7rem;touch-action:none;text-align:center}
.touch button{min-width:44px;touch-action:none}
.touch #touch-run{position:absolute;left:calc(50% + 1.65rem);top:0}
.touch #vehicle{position:fixed;right:1rem;bottom:.7rem}
.resume{top:50%;left:50%;transform:translateX(-50%);font-weight:750}
#housing, #mortgage, #resale, #family-plans, #workshop, #rental, #budget, #save-transfer {
    width: min(42rem, calc(100vw - 1.5rem));
    max-height: min(85svh, 46rem);
    padding: clamp(.85rem, 3vw, 1.4rem);
    border: 1px solid #7893ad;
    border-radius: .9rem;
    background: #142531;
    color: #f1f3f6;
}
#housing[open], #rental[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog::backdrop { background: rgb(5 12 20 / .68); }
#save-transfer{width:min(31rem,calc(100vw - 1.5rem));overflow:auto}
#save-transfer section,#save-transfer form{margin-top:.8rem;border-top:1px solid #536e82}
#save-transfer h3{font-size:1rem;margin:.8rem 0 .4rem}
#save-transfer p,#save-transfer label{font-size:.88rem;color:#d6e4f0}
#save-transfer label{display:block;margin-top:.65rem}
#save-transfer input{display:block;width:100%;min-height:44px;padding:.5rem;margin-top:.25rem;border:1px solid #88a3ba;border-radius:.4rem;background:#102030;color:#fff;font:inherit}
#save-transfer input:focus-visible{outline:3px solid #a2c5ff;outline-offset:2px}
#save-transfer :is(section,form) button{margin-top:.55rem}
#save-transfer button:disabled{opacity:.55;cursor:default}
#transfer-status{margin-top:.65rem;min-height:1em}
@media(max-width:480px){.top,.session-tools{gap:.3rem}#connection{max-width:5.6rem}}
@media(max-width:360px){.top h1{font-size:1.1rem;white-space:nowrap}#connection{max-width:4.25rem}}
.housing-head, .housing-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; }
.housing-head h2 { margin: .14rem 0; font-size: clamp(1.25rem, 5vw, 1.8rem); }
#housing-summary, #housing-lease-note, #rental-summary { margin: .75rem 0; color: #dce9f5; font-size: .88rem; }
.housing-scroll { min-width: 0; min-height: 0; overflow: auto; padding: .2rem; }
#housing-plan, #rental-plan { margin: 0 0 .75rem; padding: .5rem .65rem; border: 1px solid #536e82; border-radius: .5rem; background: #203747; }
#housing-plan-map, #rental-plan-map { display: block; width: min(100%, 340px); margin: auto; }
#housing-plan-caption { color: #ddeaf3; font-size: .82rem; }
#housing-units, #rental-units { min-width: 0; margin: .1rem 0 .75rem; padding: 0; border: 0; }
.housing-footer { flex: none; padding-top: .55rem; border-top: 1px solid #536e82; }
#housing-units legend, #rental-units legend { padding: 0; margin-bottom: .45rem; }
#housing-list, #rental-list { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fit,minmax(min(100%, 14rem),1fr)); }
.housing-unit { display: flex; align-items: start; gap: .48rem; padding: .55rem; background: #203747; border: 1px solid #536e82; border-radius: .5rem; cursor: pointer; }
.housing-unit:has(input:checked) { border-color: #a2c5ff; box-shadow: inset 0 0 0 1px #a2c5ff; }
.housing-unit:has(input:focus-visible) { outline: 2px solid #a2c5ff; outline-offset: 2px; }
.housing-unit:has(input:disabled) { background: #182a37; cursor: default; }
.housing-unit span span { display: block; margin-top: .12rem; color: #d6e4f0; font-size: .78rem; }
.housing-unit .housing-price { font-weight: 750; color: #aaccff; }
#housing-status, #rental-status { font-size: .85rem; }
#housing-buy:not(:disabled), #rental-pay:not(:disabled) { background: var(--blue); font-weight: 700; }
#housing-buy:disabled, #rental button:disabled { opacity: .55; cursor: default; }
#rental { width: min(34rem, calc(100vw - 1.5rem)); }
#rental-costs { width: 100%; margin: 0; }
#rental-costs div:first-child { border-top: 0; }
#rental-end-note { width: 100%; font-size: .8rem; color: #dce9f5; }
#rental-status:not(:empty) { width: 100%; }
#housing-method { min-width: 0; margin: .05rem 0 .9rem; padding: .5rem .7rem .7rem; border: 1px solid #536e82; border-radius: .5rem; }
#housing-method label { display: inline-flex; align-items: center; gap: .25rem; min-height: 44px; padding-right: .65rem; }
#housing-quote p { margin-top: .55rem; font-size: .84rem; color: #d6e4f0; }
#quote-payments { font-weight: 650; }
#budget-open, #mortgage-open, #sale-receipt-open { width: 100%; margin-top: .4rem; font-size: .75rem; }
#budget { width: min(32rem, calc(100vw - 1.5rem)); overflow: auto; }
#budget h3 { margin-top: .9rem; font-size: .96rem; }
#budget h3 + dl { margin-top: .35rem; }
#budget dl div:last-child { font-weight: 700; }
#budget p { margin-top: .65rem; color: #d6e4f0; font-size: .85rem; }
#mortgage, #resale { width: min(29rem, calc(100vw - 1.5rem)); overflow: auto; }
#mortgage-property, #mortgage-terms p { margin: .65rem 0; }
#mortgage-terms p { font-size: .87rem; color: #d6e4f0; }
#mortgage-status { font-size: .9rem; }
#mortgage-pay:not(:disabled) { background: var(--blue); font-weight: 700; }
#mortgage-pay:disabled { opacity: .55; cursor: default; }
#resale-form :is(p, dl), #resale-receipt :is(p, dl) { margin: .7rem 0; }
#resale-form label { display: block; margin: .7rem 0 .35rem; }
#resale-price { width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid #7893ad; border-radius: .5rem; background: #203747; color: inherit; font: inherit; }
#resale-proceeds, #resale-receipt dl { padding: .7rem; border: 1px solid #536e82; border-radius: .5rem; background: #203747; }
#resale-status { font-size: .88rem; }
#resale-submit:not(:disabled) { background: var(--blue); font-weight: 700; }
#resale-submit:disabled, #resale-withdraw:disabled { opacity: .55; cursor: default; }
#resale-open, #rental-open, #purchase-open { margin: .26rem .12rem .15rem; font-size: .86rem; }
#board-shuttle { margin: .28rem .12rem; border-color: #90b6ff; font-size: .87rem; }
#shuttle-stop-status { font-size: .80rem; color: #d5e7ff; margin-bottom: .25rem; }
#family-plans, #workshop { width: min(29rem, calc(100vw - 1.5rem)); overflow: auto; }
#family-plans > p, #workshop > p { margin: .75rem 0; color: #d6e4f0; font-size: .9rem; }
#family-plans .housing-footer, #workshop .housing-footer { justify-content: flex-end; }
#family-confirm:not(:disabled), #workshop-confirm:not(:disabled) { background: var(--blue); font-weight: 700; }
#family-confirm:disabled, #workshop-confirm:disabled { opacity: .55; cursor: default; }
@media(max-width:600px){
 .top{inset: .55rem .55rem auto;padding:.60rem .68rem}
 .wallet{top:4.8rem;left:.55rem;padding:.55rem .6rem;min-width:8.5rem}
 .map{top:4.8rem;right:.55rem;width:calc(50% - .62rem);padding:.3rem}
 #cash{font-size:1.15rem}
 dl{font-size:.67rem}dl div{gap:.38rem}
 .help{display:none}
 .touch{display:block}
 .scene-actions{bottom:7.5rem;padding:.50rem .65rem}
}
@media(pointer:coarse) and (min-width:601px){
 .touch{display:block}
 .help{display:none}
}
@media(pointer:coarse) and (orientation:landscape) and (max-height:500px) and (min-width:568px){
 main{--side-panel-width:clamp(8.5rem,25vw,11rem)}
 .top{inset:.5rem .55rem auto;padding:.5rem .65rem}
 .wallet,.map{top:4.4rem;width:var(--side-panel-width);padding:.45rem .6rem;overflow:auto}
 .wallet{left:.55rem;min-width:0;max-height:calc(100svh - 10.8rem);display:flex;flex-direction:column}
 .map{right:.55rem;max-height:calc(100svh - 8.3rem)}
 .wallet dl{order:1;font-size:.7rem;margin-top:.35rem}
 .wallet dl div{gap:.42rem;padding:.19rem 0}
 .wallet button{flex:none}
 #cash{font-size:1.2rem}
 .scene-actions{inset-inline:max(10.5rem,calc(var(--side-panel-width) + 1.1rem));bottom:.7rem;
   width:auto;max-height:calc(100svh - 5.3rem);overflow:auto;transform:none;padding:.5rem .65rem}
}
