/* Olam Chai UX v0.10 — 3D-first interaction polish, no font/asset downloads. */
:root{--ux-ink:#071d23;--ux-white:#f3fff7;--ux-glass:rgba(12,40,48,.89);--ux-border:rgba(144,199,180,.35)}
html{scroll-behavior:smooth;scroll-padding-top:18px}
#region3d{position:relative;background:radial-gradient(ellipse at 4% 0%,rgba(65,118,112,.37),transparent 42%),linear-gradient(150deg,#132f37,#101f2d 82%);border-color:#59847e}
#region3d .region-header h2{font-size:clamp(22px,2.2vw,30px);letter-spacing:-.4px;color:#fff}
#region3d .region-header p{max-width:620px;line-height:1.55;margin-bottom:5px}
#region3d .region-header .region-pop{background:#23584e;border:1px solid #6b9b88;color:#e8fff2}
#region3d .region-canvas-wrap{box-shadow:0 19px 46px rgba(1,13,23,.52),inset 0 0 40px #07231b20;border-color:#86ad9e}
#region3d .region-canvas-wrap::after{content:'';position:absolute;inset:0;z-index:1;pointer-events:none;background:linear-gradient(180deg,rgba(8,29,39,.19),transparent 28%,transparent 80%,rgba(7,25,36,.38))}
#region3d .region-floating-label{z-index:3;background:var(--ux-glass);border:1px solid var(--ux-border);box-shadow:0 5px 15px rgba(5,15,25,.28)}
#region3d .region-viewtools button{min-width:42px;min-height:42px;padding:9px 11px;background:rgba(9,30,40,.84);border:1px solid #9fc1b080;color:#f1fff8;backdrop-filter:blur(7px)}
#region3d button[data-camera][aria-pressed="true"]{background:#bfe6cf;color:#14332b;border-color:#ecfff2;font-weight:700}
#region3d button[data-move]{min-height:44px;min-width:44px}
#region3d :is(button,summary,a,input,select):focus-visible,.ux-game-nav button:focus-visible{outline:3px solid #ffe9a5;outline-offset:3px}
#region3d :is(.region-rail,.region-form,.ux-first-step,.ux-game-nav,.ux-rail-details){min-width:0}
#region3d .region-onboarding{background:linear-gradient(120deg,#20534c,#1d3846);border-color:#6d9f8c;box-shadow:0 8px 24px #001b242d}
#region3d .region-onboarding .region-form input:focus,#region3d .region-onboarding .region-form select:focus{border-color:#b6ebc8}
#region3d .region-onboarding .btn[data-region="register"]{background:linear-gradient(110deg,#bcebcf,#92dbb4);box-shadow:0 5px 14px #041f2440}
#region3d .region-card{border-color:#557a77;box-shadow:0 7px 24px rgba(2,22,30,.24)}
#region3d .npc-card{border-color:#6f978b;background:linear-gradient(145deg,#24534b,#1b4048)}
#region3d .npc-card header b{letter-spacing:0}
#region3d .region-message:not([hidden]){border-right:4px solid #98deab;padding:12px 14px;font-weight:600;box-shadow:0 8px 22px #00161f26}
#region3d .region-message.error:not([hidden]){border-right-color:#f0a491}
.ux-game-nav{display:flex;gap:6px;align-items:center;justify-content:space-between;padding:6px;margin:3px 0 11px;background:#122f39;border:1px solid #527e78;border-radius:13px}
.ux-game-nav button{border:0;border-radius:9px;background:transparent;color:#c5dfd7;padding:9px 12px;font-size:12px;min-height:42px;font-weight:700}
.ux-game-nav button:hover,.ux-game-nav button[aria-current="page"]{background:#2c594e;color:#f7fff7}
.ux-first-step{display:flex;gap:12px;align-items:center;padding:13px 14px;margin:10px 0 13px;background:linear-gradient(105deg,#245448,#183a42 82%);border:1px solid #86ba99;border-radius:13px;box-shadow:0 8px 24px rgba(4,29,32,.35)}
.ux-step-icon{background:rgba(195,242,205,.11);border:1px solid #b6e8b458;color:#e4fff2;display:grid;place-items:center;flex:none;width:47px;height:47px;font-size:29px;border-radius:11px}
.ux-step-copy{min-width:0;flex:1}
.ux-eyebrow{display:block;font-size:10px;font-weight:700;color:#b5edcc;letter-spacing:.5px;margin-bottom:2px}
.ux-step-copy strong{font-size:16px;color:#fff;display:block}
.ux-step-copy p{font-size:12px;color:#daebe2;line-height:1.55;margin:2px 0 0}
.ux-primary{border:0;background:linear-gradient(105deg,#f2e2ad,#f7c878);color:#1f2b27;font-size:13px;font-weight:800;padding:12px 17px;border-radius:10px;min-height:47px;box-shadow:0 6px 16px #061d2433;flex:none}
.ux-primary:hover{filter:brightness(1.07)}.ux-primary:focus-visible{outline:3px solid #fff}
.ux-game-hud{position:absolute;left:13px;top:65px;display:flex;flex-wrap:wrap;gap:5px;z-index:4;pointer-events:none}
.ux-game-hud span{display:inline-flex;align-items:center;gap:4px;background:rgba(8,32,42,.82);color:#f5fff5;border:1px solid #c0dacf73;border-radius:99px;font-size:11px;padding:5px 9px;backdrop-filter:blur(7px)}
.ux-game-hud strong{color:#fff1bf}
.ux-rail-details{border:1px solid #466e72;border-radius:12px;background:#142f39;overflow:hidden}
.ux-rail-details[open]{border-color:#80aa96}
.ux-rail-details>summary{cursor:pointer;display:flex;align-items:center;min-height:44px;padding:10px 12px;font-size:12px;font-weight:700;color:#e7f8ec;background:#21424a}
.ux-rail-details>summary::marker{color:#b7d7c7}
.ux-rail-details .region-card{border:0!important;box-shadow:none!important;border-radius:0!important}
.ux-npc-more{display:none;width:100%;min-height:44px;border:1px solid #79a58d;background:#225047;color:#e3f7e9;border-radius:10px;font-size:12px;font-weight:700;margin:10px 0}
#region3d .npc-disclaimer{color:#bfcfc9}
@media(min-width:1160px){#region3d .region-rail{max-height:550px;overflow:auto}#region3d .region-rail:has(.ux-rail-details){gap:9px}}
@media(max-width:760px){
 body{padding-bottom:82px}
 main>header{margin-bottom:10px}
 main>header .brand{gap:9px}main>header .brandmark{width:43px;height:43px;font-size:25px}
 main>header h1{font-size:22px}
 main>header .sub{font-size:11px}
 main>header .topactions{display:none}
 #region3d{padding:10px}
 #region3d .region-header{margin-bottom:4px}
 #region3d .region-header h2{font-size:20px;margin:3px 0}
 #region3d .region-header p{display:none}
 #region3d .region-header .region-pop{font-size:10px;padding:5px 9px}
 #region3d .region-climate{margin:7px 0;padding:7px;gap:5px}
 #region3d .region-onboarding{padding:10px;margin:9px 0;gap:7px}
 #region3d .region-onboarding h3{font-size:14px;margin:0 0 5px}
 #region3d .region-onboarding p{font-size:11px;line-height:1.45;margin:0 0 8px}
 #region3d .region-onboarding .region-onboarding-icon{display:none}
 #region3d .region-onboarding .region-form{display:grid;grid-template-columns:minmax(0,1fr);gap:7px}
 #region3d .region-onboarding .region-form label{font-size:11px;width:100%}
 #region3d .region-onboarding .region-form input,#region3d .region-onboarding .region-form select{width:100%;height:45px;font-size:16px}
 #region3d .region-onboarding button[data-region="register"]{min-height:46px}
 #region3d .region-stage{display:block}
 #region3d .region-canvas-wrap{height:clamp(365px,56svh,530px);min-height:365px}
 #region3d .region-canvas-top{top:8px;right:8px;left:8px;display:flex;flex-wrap:wrap;align-items:flex-start;gap:5px}
 #region3d .region-canvas-top .region-floating-label{font-size:10px;max-width:100%;padding:6px 9px}
 #region3d .region-viewtools{display:flex;flex-wrap:nowrap;overflow-x:auto;width:100%;gap:4px;scrollbar-width:none}
 #region3d .region-viewtools::-webkit-scrollbar{display:none}
 #region3d .region-viewtools button{font-size:11px;min-width:0;min-height:40px;padding:7px 10px;white-space:nowrap;flex:1}
 #region3d .region-canvas-bottom>.region-floating-label{display:none}
 #region3d .region-movement{display:none}
 #region3d.ux-in-walk .region-movement{display:grid}
 #region3d .region-rail{display:grid;grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible;gap:7px;margin-top:9px}
 #region3d .region-rail .region-card{font-size:12px}
 #region3d .region-stat strong{font-size:16px}
 .ux-game-nav{position:fixed;z-index:100;left:9px;right:9px;bottom:max(7px,env(safe-area-inset-bottom));margin:0;padding:5px;display:flex;gap:1px;background:rgba(12,39,47,.96);border:1px solid #8dbba6;box-shadow:0 5px 35px #0008;backdrop-filter:blur(16px);border-radius:14px}
 .ux-game-nav button{flex:1;min-width:0;display:flex;align-items:center;justify-content:center;flex-direction:column;font-size:20px;line-height:1.05;gap:4px;padding:7px 3px;min-height:52px}
 .ux-game-nav button span{font-size:10px}
 .ux-first-step{padding:9px;gap:8px;margin:8px 0 9px;flex-wrap:wrap}
 .ux-step-icon{width:39px;height:39px;font-size:25px}
 .ux-eyebrow{font-size:9px}.ux-step-copy strong{font-size:14px}.ux-step-copy p{font-size:11px;margin-top:3px}
 .ux-primary{min-height:43px;flex-basis:100%;font-size:12px;padding:9px 12px}
 .ux-game-hud{left:8px;top:95px;gap:4px}
 .ux-game-hud span{font-size:10px;padding:5px 7px}
 .ux-rail-details>summary{min-height:46px}
 .ux-npc-more{display:block}
 #region3d .npc-world:not(.ux-expanded) .npc-card:nth-child(n+3){display:none}
}
@media(max-width:360px){.ux-game-nav button{font-size:17px}.ux-game-nav button span{font-size:9px}#region3d .region-viewtools button{font-size:10px;padding:6px 8px}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}#region3d *{animation-duration:.01ms!important;transition-duration:.01ms!important}}

.ux-skip{position:absolute;top:-80px;right:12px;z-index:999;background:#f9dfa5;color:#14282a;padding:10px 15px;border-radius:8px;font-weight:700;text-decoration:none}
.ux-skip:focus{top:8px}
#region3d [data-ux-section]:focus-visible{outline:3px solid #ffe9a5;outline-offset:2px}

/* First-time players see one clear start action rather than two competing buttons. */
#region3d #regionSteps.ux-onboarding-compact:not(.ux-form-open){display:none}
#region3d #regionSteps.ux-form-open{animation:ux-enter .22s ease-out}
@keyframes ux-enter{from{opacity:.6;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){#region3d #regionSteps.ux-form-open{animation:none}}

/* Live screenshot audit 2026-11-22: 5 big stats cards buried the 3D scene below the fold. */
#region3d .ux-stats-details{margin:11px 0;border:1px solid #54776e;border-radius:11px;overflow:hidden;background:#14343c}
#region3d .ux-stats-details>summary{padding:10px 13px;cursor:pointer;color:#e4f7e9;font-weight:700;font-size:12px}
#region3d .ux-stats-details .region-stats{padding:0 10px;margin:0}
@media(min-width:761px){#region3d .ux-stats-details{border:0;background:transparent}#region3d .ux-stats-details>summary{display:none}}
@media(max-width:760px){#region3d .ux-stats-details{margin:8px 0}#region3d .ux-stats-details:not([open])>summary{background:#20494a}#region3d .ux-stats-details[open] #regionStats{margin:7px 8px}}

/* v0.11: real NPC contracts — short, touch-friendly and distinct from simulated dialogue. */
.npc-contract-board{margin:14px 0 18px;padding:13px;border:1px solid #8eac8a;background:linear-gradient(135deg,#24463f,#1d3844);border-radius:13px}
.npc-contract-header{display:flex;gap:10px;align-items:baseline;justify-content:space-between;flex-wrap:wrap}
.npc-contract-header strong{font-size:15px;color:#f6fff4}.npc-contract-header small{font-size:10px;color:#c8edcd}
.npc-contract-board>p{font-size:11px;line-height:1.7;color:#d1e4d7;margin:6px 0 12px}
.npc-contract-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.npc-contract{display:flex;flex-direction:column;gap:7px;min-width:0;padding:11px;background:rgba(5,36,39,.59);border:1px solid #628d7d;border-radius:11px}
.npc-contract header{display:flex;align-items:center;gap:6px}.npc-contract header>span{font-size:23px}.npc-contract header strong{font-size:12px;flex:1}
.npc-contract header small{font-size:12px;color:#f4e4ad;font-weight:800;white-space:nowrap}
.npc-contract p{font-size:11px;line-height:1.55;margin:0;color:#cae4db}
.npc-contract-metrics{display:flex;gap:4px;flex-wrap:wrap;font-size:10px;color:#c9e9d3}
.npc-contract-metrics>span{padding:4px 6px;background:#2c5a4e;border-radius:6px}
.npc-contract-buttons{display:flex;gap:5px;flex-wrap:wrap;margin-top:auto}
.npc-contract-buttons button{flex:1;min-width:120px;white-space:normal;line-height:1.5;min-height:43px}
.npc-contract-buttons button:disabled{opacity:.5;cursor:not-allowed}
.npc-contract-reason{color:#c4d7cb;font-size:10px;min-height:15px}
@media(max-width:640px){.npc-contract-board{padding:9px}.npc-contract-grid{grid-template-columns:1fr}.npc-contract-buttons button{min-width:115px}}

/* v0.12: cooperative construction — concise mobile drawer below the living 3D world */
.community-hub{margin:13px 0 18px;background:linear-gradient(135deg,#1f4649,#152f3c);border:1px solid #5e9787;border-radius:15px;color:#edf8ec;box-shadow:0 9px 25px #08192235;overflow:hidden}
.community-hub details>summary{list-style:none;cursor:pointer;min-height:57px;padding:12px 15px;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:5px;background:linear-gradient(110deg,#2b5a4f,#21464b)}
.community-hub details>summary::-webkit-details-marker{display:none}
.community-hub details>summary:after{content:'⌄';font-weight:900;color:#f5d8a6;transition:transform .17s}
.community-hub details[open]>summary:after{transform:rotate(180deg)}
.community-summary>span{font-weight:800;font-size:16px;color:#eaffec}
.community-summary>small{font-size:11px;color:#cfdfd5;font-weight:600}
.community-body{padding:13px}
.community-intro p{font-size:12px;line-height:1.65;color:#d4e7da;margin:1px 0 13px}
.community-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.community-project{min-width:0;border:1px solid #547f74;background:#1b3f46;border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:10px;transition:border-color .18s}
.community-project.community-selected{border-color:#f9d9a0;box-shadow:0 0 0 1px #f9d9a040}
.community-project header{display:flex;align-items:center;gap:8px}
.community-project header>span{font-size:24px}
.community-project header>div{flex:1;min-width:0}
.community-project header strong{font-size:13px;display:block;color:#fff}
.community-project header small{font-size:10px;line-height:1.5;display:block;color:#c1dbd0}
.community-project header>b{background:#406953;border-radius:9px;color:#e5fae3;padding:5px 7px;font-size:10px;white-space:nowrap}
.community-progress{height:9px;border:1px solid #507569;border-radius:99px;overflow:hidden;background:#0a2b32}
.community-progress>span{display:block;height:100%;background:linear-gradient(90deg,#bfe7aa,#d9c587);border-radius:99px;transition:width .35s}
.community-figures{display:flex;align-items:center;gap:8px;flex-wrap:wrap;color:#d2ded7;font-size:10px}
.community-figures span{background:#254e4c;border-radius:7px;padding:4px 7px}
.community-benefit{font-size:11px;line-height:1.6;color:#dbeada;margin:0;flex:1}
.community-benefit strong{color:#fff0bc}
.community-actions{display:flex;gap:5px;flex-wrap:wrap}
.community-actions button{min-height:43px;white-space:normal;font-size:11px;flex:1;min-width:109px}
.community-actions button:disabled{opacity:.55;cursor:not-allowed}
.community-hint{font-size:10px;color:#bed7ca}
.community-feed{margin-top:13px;padding:11px;background:#112f3a;border:1px solid #466f71;border-radius:10px}
.community-feed>strong{display:block;font-size:12px;margin-bottom:7px}
.community-update{display:flex;align-items:center;gap:8px;font-size:11px;padding:5px 0;border-bottom:1px solid #4c6965}
.community-update small{flex:1;color:#d6e8dc}.community-update time{color:#b7d1c5;font-size:10px}
.community-start{font-size:11px;color:#c6dacf;margin:3px 0}
.community-guardrail{margin:10px 0 2px;font-size:10px;line-height:1.6;color:#adc7b7}
@media(max-width:980px){.community-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.community-hub{margin:8px 0 11px}.community-hub details>summary{padding:10px 12px;min-height:55px}.community-summary>span{font-size:14px}.community-summary>small{font-size:10px}.community-body{padding:9px}.community-grid{grid-template-columns:1fr}.community-project{padding:10px}.community-actions button{min-height:45px}}

/* Three.js renderer quality toggle — explicit tradeoff, no empty control. */
#region3d .ux-graphics-button{min-height:42px;background:rgba(25,60,61,.88);border:1px solid #84b8a2;color:#eaffed;font-weight:700;border-radius:9px;padding:8px 11px;white-space:nowrap;font-size:11px}
#region3d .ux-graphics-button[data-ux-graphics="economy"]{background:#355a4a;color:#e8ffdc}
#region3d .ux-graphics-button[data-ux-graphics="sharp"]{background:#364f68;color:#dceeff}
#region3d .ux-graphics-button:focus-visible{outline:3px solid #ffe9a5;outline-offset:2px}
@media(max-width:760px){#region3d .ux-graphics-button{font-size:10px;padding:6px 8px;min-height:40px}}

/* v0.13 — opt-in multiplayer, no player chat. */
.human-presence{margin:13px 0;padding:12px 15px;border:1px solid #75a8a0;background:linear-gradient(110deg,#17444e,#183442);color:#edf7f2;border-radius:14px}
.human-presence-lead{display:flex;gap:14px;justify-content:space-between;align-items:center}
.human-presence-lead strong{font-size:15px}.human-presence-lead p{font-size:11px;color:#cde7e1;line-height:1.6;margin:3px 0}
#humanPresenceToggle{background:#cef2d7;color:#14352d;border:1px solid #e6fff1;border-radius:10px;padding:10px 13px;min-height:45px;font-weight:800;white-space:nowrap}
#humanPresenceToggle[aria-pressed="true"]{background:#314f55;color:#f0f8f6;border-color:#8cc0ad}
#humanPresenceToggle:disabled{opacity:.55}
.human-presence-details{display:flex;flex-direction:column;gap:5px;margin-top:8px;padding-top:9px;border-top:1px solid #638b86;font-size:11px}
.human-presence-details small{color:#c1d7d1;font-size:10px}
.human-presence-avatars{display:flex;flex-wrap:wrap;gap:5px;padding:6px 0}
.human-presence-chip{padding:5px 8px;border:1px solid #719f92;border-radius:99px;background:#235752;color:#f3fcf7;font-size:10px}
@media(max-width:760px){.human-presence{margin:8px 0;padding:10px}.human-presence-lead{gap:8px;flex-wrap:wrap}.human-presence-lead strong{font-size:13px}#humanPresenceToggle{min-width:100%;font-size:12px}.human-presence-details{font-size:10px}}

/* World 0.14 — third-person play controls: touch-first, compact and accessible. */
.region-movement [data-move],.region-movement [data-sprint]{touch-action:none;user-select:none;-webkit-user-select:none;min-width:43px;min-height:43px}
.region-movement [data-move]:active,.region-movement [data-sprint]:active{transform:scale(.96);background:#d8ebd5!important;color:#0b3535!important}
.region-movement [data-sprint]{background:rgba(60,100,76,.92);border:1px solid #abdabc;color:#fff;border-radius:10px;font-size:17px}
.walk-hud{z-index:4;position:absolute;right:12px;top:72px;max-width:min(370px,calc(100% - 24px));padding:9px 12px;border:1px solid #9bcdb6;border-radius:12px;background:rgba(11,39,43,.88);backdrop-filter:blur(10px);box-shadow:0 9px 26px #001d2340;display:flex;align-items:stretch;flex-direction:column;gap:5px;color:#e9fff2}
.walk-hud[hidden]{display:none!important}
.walk-hud>span{font-size:11px;font-weight:800}
.walk-hud>small{font-size:10px;color:#d4e9d8;line-height:1.45}
.walk-hud>button{min-height:37px;border:1px solid #7da891;border-radius:8px;background:#276455;color:#fff;padding:6px 9px;font-weight:700;font-size:11px}
.walk-hud>button:disabled{opacity:.6;color:#c9dfd4;cursor:default;background:#30504d}
.walk-hud>button:focus-visible{outline:3px solid #f8e5a7;outline-offset:2px}
@media(max-width:650px){.walk-hud{top:60px;right:6px;max-width:min(240px,calc(100% - 12px));padding:7px 8px;gap:3px}.walk-hud>span{font-size:10px}.walk-hud>small{font-size:9px}.walk-hud>button{font-size:10px;min-height:38px}}

/* v0.14 — recovery controls: explicit secret-only-on-request, never shown in read-only game HUD. */
.citizen-recovery{margin:9px 0 14px;border:1px solid #708c8b;border-radius:12px;background:linear-gradient(115deg,#203943,#243f47);color:#e9faf0;overflow:hidden}
.citizen-recovery>summary{cursor:pointer;font-weight:800;padding:11px 14px;font-size:13px;list-style-position:inside}
.citizen-recovery-body{padding:11px 14px 15px;display:flex;flex-direction:column;gap:9px;max-width:720px}
.citizen-recovery-body p{font-size:11px;line-height:1.7;margin:0}
.citizen-recovery-body label{font-size:12px;font-weight:700}
.citizen-recovery-warning{color:#f4d9aa;border-right:3px solid #dfb784;padding:6px 10px;background:rgba(100,78,50,.25)}
.citizen-recovery-actions{display:flex;flex-wrap:wrap;gap:8px}
.citizen-recovery button{background:#376858;border:1px solid #a4d9c4;color:#fff;border-radius:9px;min-height:43px;padding:9px 11px;font-weight:700;cursor:pointer}
.citizen-recovery button:disabled{opacity:.45;cursor:default}
.citizen-recovery input{width:100%;max-width:600px;padding:10px;border-radius:8px;border:1px solid #7ea9a3;color:#16333b;background:#ecfcf5;font-family:monospace;letter-spacing:.035em;direction:ltr;text-align:left}
.citizen-recovery [hidden]{display:none}
#recoveryFeedback[data-error="true"]{color:#ffc0ae}
#recoveryFeedback:not([data-error="true"]){color:#c8f7da}
