/* V3: layout is designed around fingers; old laboratory component styles remain in style.css. */
:root{--gold:#e4c389;--ink:#0b2734;--soft:#aac7cf;--cyan:#8ce0e3;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;font-family:Inter,"Segoe UI",Arial,sans-serif;background:#092531;color:#e4f0f0}button,input,select,textarea{font:inherit}button{cursor:pointer;min-height:42px;border-radius:9px}button:disabled{opacity:.4;cursor:not-allowed}button:focus-visible{outline:2px solid #e7c68d;outline-offset:3px}button[hidden],[hidden]{display:none!important}input,select,textarea{font-size:16px!important}#world{position:fixed;inset:0;width:100%;height:100dvh;touch-action:none;outline:none}body{overflow:hidden}body.home-active #world,body.home-active #vignette{visibility:hidden}.glass{background:rgba(8,34,47,.92);border:1px solid #91bfc738;backdrop-filter:blur(8px)}
.homepage{position:fixed;inset:0;z-index:40;display:flex;flex-direction:column;background:linear-gradient(90deg,#071c26ef 0%,#08232fcc 46%,#082431ed 100%),url('./assets/ui/home-campus.webp') center/cover;color:#e8f1ef;touch-action:pan-y;overflow:hidden}.home-header{flex-shrink:0;display:flex;gap:24px;align-items:center;padding:22px clamp(18px,4vw,72px);border-bottom:1px solid #9bb6b027;background:#09212cbf}.home-brand{display:flex;gap:12px;align-items:center;white-space:nowrap;font-size:15px;font-weight:750;letter-spacing:2px}.home-brand small{display:block;font-size:8px;letter-spacing:2.6px;color:#95bcc6;margin-top:6px}.brand-shield{font-size:36px;line-height:40px;color:#e3c085;display:grid;place-items:center;width:38px}.home-nav{display:flex;gap:6px;margin-left:auto;flex-wrap:wrap}.home-nav button{background:transparent;color:#abc5cf;padding:8px 16px;border:1px solid transparent;font-size:13px;min-height:42px}.home-nav .selected{color:#f6dca6;background:#d1ba8710;border-color:#d2b57448}.home-install{border:1px solid #7097a04d;background:transparent;color:#b9d9df;padding:7px 12px;font-size:12px}.home-content{overflow:auto;flex:1;min-height:0;touch-action:pan-y;-webkit-overflow-scrolling:touch}.home-hero{min-height:calc(100dvh - 156px);display:grid;grid-template-columns:1.25fr 1fr;gap:clamp(24px,5vw,96px);align-items:center;max-width:1440px;margin:auto;padding:42px clamp(24px,6vw,96px) 34px}.hero-copy .eyebrow{font-size:10px;letter-spacing:2.7px;color:#96d5d8;display:flex;gap:9px;align-items:center}.status-dot{width:6px;height:6px;border-radius:50%;background:#95d9b5}.hero-copy h1{font-size:clamp(42px,4.8vw,76px);line-height:1.11;font-weight:500;letter-spacing:-2px;margin:24px 0;color:#f0f4ef}.hero-copy em{font-family:Georgia,serif;font-weight:400;color:var(--gold);font-style:italic}.hero-copy>p{color:#a6c3cd;font-size:15px;line-height:1.9}.hero-metrics{display:flex;gap:28px;border-top:1px solid #9cbcb628;padding-top:24px;margin-top:32px;flex-wrap:wrap}.hero-metrics span{font-size:10px;line-height:1.4;color:#a0c1cd}.hero-metrics b{font-size:25px;display:block;font-weight:550;color:#dceeea;margin-bottom:5px}.device-note{font-size:11px;line-height:1.8;color:#a2c7cc;margin-top:25px}.save-card{padding:28px 28px 20px;background:linear-gradient(150deg,#163748df,#0b2635f7);border:1px solid #acc9bc38;box-shadow:0 25px 70px #0005;border-radius:18px;max-width:450px;width:100%;justify-self:end;position:relative}.save-card:before{content:"";position:absolute;top:0;left:24px;right:24px;height:1px;background:linear-gradient(90deg,transparent,#dbbf87,transparent)}.save-card>.eyebrow{color:#b8cbbf;font-size:9px;letter-spacing:2.5px}.save-card h2{font-weight:500;font-size:24px;line-height:1.4;margin:14px 0 22px}.save-status{border:1px solid #91bbc22c;padding:13px 14px;border-radius:9px;display:flex;gap:6px;flex-direction:column}.save-status span{color:#90d2bd;font-size:10px;letter-spacing:1px}.save-status small{font-size:11px;color:#aecbd3}.save-stats{display:grid;grid-template-columns:repeat(3,1fr);margin:20px 0;gap:10px}.save-stats b{font-size:18px;font-weight:600;display:block}.save-stats small{font-size:10px;color:#94b6c0;display:block;margin-top:5px}.save-empty{font-size:12px;line-height:1.8;color:#a4c2cb;margin:18px 0}.home-primary,.home-secondary{width:100%;min-height:50px;padding:14px 18px;border:1px solid #e1c79066;border-radius:10px;text-align:left;display:flex;align-items:center;justify-content:space-between;font-weight:650;font-size:14px}.home-primary{background:#dcc28f;color:#152c33}.home-primary:hover{background:#efdbb2}.home-primary:disabled{background:#42616b;color:#93afb6;border-color:#77949b20}.home-secondary{background:#102d3d;color:#dfedee;border:1px solid #89adb545;margin-top:10px}.home-secondary:hover{background:#1b4051}.home-secondary small{font-size:10px;color:#94bbc7;font-weight:400}.home-link{display:block;text-align:center;width:100%;border:none;background:none;color:#9dd7df;font-size:12px;padding:10px}.save-tools{display:flex;justify-content:center;gap:15px;border-top:1px solid #98b6b423;margin-top:12px;padding-top:10px}.save-tools button{background:transparent;color:#a1c2cd;border:none;font-size:11px}.save-location{display:block;text-align:center;color:#799aa9;font-size:10px;margin-top:10px}.home-warning{font-size:12px;color:#f2d197}.home-bottom-strip{display:flex;max-width:1250px;gap:35px;margin:0 auto;padding:20px 25px;border-top:1px solid #adc5c422;color:#8fafb7;font-size:9px;letter-spacing:1.3px}.home-bottom-strip small{margin-left:auto}.home-page{max-width:1220px;margin:auto;padding:40px 36px 65px}.home-page>.eyebrow{color:#8eced2;font-size:10px}.home-page h1{font-size:clamp(30px,4vw,52px);font-weight:450;line-height:1.2;margin:18px 0 24px;letter-spacing:-1px}.home-page>p{font-size:14px;line-height:1.8;color:#a6c5ce}.guide-layout{display:grid;grid-template-columns:1fr 1fr;gap:36px;margin-top:32px}.guide-card{border:1px solid #829fa534;padding:25px;border-radius:14px;background:#102f3ec9}.guide-card p{font-size:14px;line-height:1.9;color:#adc8d0}.guide-card h2,.guide-layout h2{font-size:22px;color:#e2dbc5;font-weight:500}.guide-card h3{font-size:17px;color:#d8e8e7}.tip-row{display:grid;grid-template-columns:130px 1fr;gap:12px;border-bottom:1px solid #86b5bb26;padding:14px 0;align-items:start}.tip-row b{color:#e5cc97;font-size:13px}.tip-row span{font-size:13px;line-height:1.7;color:#afcbd2}.directory-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:28px}.directory-card{border:1px solid #86aab32e;background:#0d2b3be8;border-radius:12px;padding:22px}.phase-chip{display:inline-block;font-size:10px;letter-spacing:.7px;color:#dfc99c;background:#bca16a16;border:1px solid #ceb68837;padding:7px 9px;border-radius:5px}.directory-card h2{font-size:20px;line-height:1.45;font-weight:500}.directory-card p{font-size:12px;color:#93c2cb;line-height:1.7}.directory-card small{font-size:11px;color:#8eaeb7;line-height:1.7}.home-confirm{position:fixed;inset:0;background:#031521d9;z-index:45;display:grid;place-items:center;padding:24px;overflow:auto}.home-confirm>div{max-width:480px;padding:28px;background:#143342;border:1px solid #d5bc8066;border-radius:15px}.home-confirm p{font-size:14px;line-height:1.8;color:#b5cdd3}.home-confirm h2{font-size:25px;font-weight:550}.error-screen{z-index:70;padding:30px;overflow:auto}.error-screen pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;max-width:680px}.error-screen button{max-width:450px}
/* Gameplay HUD */
.hud{position:fixed;inset:0;pointer-events:none;z-index:5}.hud button,.hud input{pointer-events:auto;touch-action:manipulation}.player-card{left:12px!important;top:calc(12px + var(--safe-top))!important;width:190px!important;padding:9px!important;min-height:52px!important;gap:10px!important}.avatar{width:34px!important;height:34px!important}.player-info strong{font-size:12px!important}.player-info strong span{font-size:10px!important}.player-info small{font-size:10px!important}.resources{position:absolute;right:12px;top:calc(12px + var(--safe-top));display:flex;align-items:center;gap:13px;padding:12px 14px;border-radius:10px;height:52px;font-size:12px}.resources b{color:#e9cc90}.resources small{font-size:9px;color:#87c6b7}.quick-menu{position:absolute;right:12px;top:calc(73px + var(--safe-top));display:flex;gap:6px}.quick-menu button{min-width:63px;min-height:44px;background:#0e3043e8;border:1px solid #83b5c447;color:#e2efef;font-size:13px;padding:10px}.location-strip{position:absolute;top:20px;left:50%;transform:translateX(-50%);text-align:center;max-width:40vw;text-shadow:0 2px 5px #082331}.location-strip strong{font-size:12px;display:inline}.location-strip span{display:inline-block;margin-right:8px;color:#e3cd9e;font-size:11px}.location-strip small{display:block;color:#b6ced4;font-size:10px;margin-top:6px}.quests{left:12px!important;top:calc(81px + var(--safe-top))!important;width:225px!important}.quests header strong{font-size:10px}.quest-row{font-size:11px}.quest-row>span:first-child{color:#cbb57f}.quests button{min-height:32px}.toast-stack{top:auto!important;bottom:calc(165px + var(--safe-bottom));right:14px!important;width:280px!important;pointer-events:none}.toast{padding:12px!important}.toast strong{font-size:12px!important}.toast p{font-size:11px!important;margin:5px 0 0;line-height:1.6}.interaction{bottom:calc(86px + var(--safe-bottom))!important;left:50%!important;transform:translateX(-50%)!important;min-width:0!important;width:max-content;max-width:min(470px,70vw)!important;gap:10px;padding:11px 13px!important;text-align:left;cursor:pointer;color:#e4f0ef}.interaction:before{display:none!important}.action-badge{font-size:10px;border:1px solid #d4b47780;background:#183d4b;min-width:44px;border-radius:6px;align-self:center;padding:12px 7px;text-align:center;color:#f3d69e}.interaction strong{font-size:13px!important}.interaction small{font-size:10px!important;line-height:1.4}.crosshair{pointer-events:none!important;transform:translate(-50%,-50%)!important}.map-block{left:14px!important;bottom:20px!important;display:block;pointer-events:auto}.map-block button{background:#0b2d3cbf;padding:0;border:1px solid #96afb638;border-radius:10px;overflow:hidden}.map-block canvas{width:160px;height:120px;display:block}.keyboard-legend{position:absolute;bottom:15px;left:50%;right:auto;transform:translateX(-50%);font-size:10px;padding:12px;white-space:nowrap;width:auto!important}.tool-dock{position:absolute;right:12px;top:calc(127px + var(--safe-top));width:270px;max-height:calc(100dvh - 220px);overflow:auto;pointer-events:auto;touch-action:pan-y;scrollbar-width:thin}.tool-dock:has(>div:not([hidden])){padding:2px}.equipped,.instrument-controls{position:static!important;inset:auto!important;transform:none!important;width:100%!important;max-height:none!important;min-width:0!important;padding:10px!important;margin:0 0 7px;border-radius:9px!important}.equipped-name{display:flex;align-items:center;gap:10px;justify-content:space-between;font-size:12px}.equipped-name button{font-size:11px;background:none;color:#aacbd1;border:0;padding:4px;min-height:35px}.tool-modes{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;margin-top:5px}.tool-modes button{min-height:40px;font-size:12px;background:#224350;color:#c4dbe2;border:1px solid #6b99a140}.tool-modes .selected{background:#ceb482;color:#163241}.instrument-buttons{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible!important;gap:5px!important}.instrument-buttons button{min-width:0!important;min-height:43px!important;font-size:12px!important;padding:8px 4px!important;color:#e1ebed;border:1px solid #7599a44a;background:#1a3c4b;white-space:normal!important}.instrument-status{display:block!important;margin-bottom:9px}.instrument-status b{font-size:11px!important;white-space:normal!important;display:block;color:#8fcacb}.touch-controls{display:none!important}.touch-ui .touch-controls{display:flex!important;position:absolute;left:16px!important;right:16px!important;bottom:calc(10px + var(--safe-bottom))!important;align-items:flex-end;justify-content:space-between;pointer-events:none;z-index:6}.touch-ui .move-stick{display:flex!important;width:110px!important;height:120px!important;pointer-events:auto;touch-action:none}.stick-base{width:104px!important;height:104px!important}.move-stick>small{font-size:9px!important;color:#d1ecea!important}.touch-actions{display:flex!important;gap:8px!important;align-items:flex-end;max-width:none!important}.touch-actions button{width:54px!important;height:54px!important;min-height:54px!important;min-width:54px!important;background:#0b3043e8!important;border:1px solid #9bbec268!important;pointer-events:auto;touch-action:none!important}.touch-actions button b{font-size:24px!important}.touch-actions button small{font-size:8px!important;letter-spacing:.6px!important}.touch-actions #touch-interact{width:76px!important;height:76px!important}.touch-actions #touch-interact.ready{border-color:#f2d08b!important;box-shadow:0 0 14px #e6c37644}.touch-actions #touch-run[aria-pressed=true]{background:#615239e8!important}.touch-actions #touch-mode{display:none!important}.touch-ui .keyboard-legend,.touch-ui .free-mouse{display:none!important}.touch-ui .quests,.touch-ui .map-block{display:none!important}.touch-ui .interaction{bottom:calc(142px + var(--safe-bottom))!important}.touch-ui .resources{font-size:10px;gap:9px}.touch-ui .resources small{display:none}.touch-ui .player-card{width:158px!important}.touch-ui .location-strip{left:12px;top:calc(75px + var(--safe-top));transform:none;max-width:calc(100vw - 220px);text-align:left}.touch-ui .location-strip strong{font-size:10px}.touch-ui .location-strip small{font-size:9px;line-height:1.4}.touch-ui .tool-dock{top:calc(126px + var(--safe-top));width:248px;max-height:calc(100dvh - 266px)}.touch-ui .toast-stack{bottom:calc(228px + var(--safe-bottom));width:240px!important}
/* Panel layout: never restrict scroll based on touch devices. */
.panel{position:fixed!important;left:auto!important;right:12px!important;top:calc(12px + var(--safe-top))!important;bottom:calc(12px + var(--safe-bottom))!important;width:min(660px,calc(100vw - 24px))!important;max-height:none!important;display:flex;flex-direction:column;border-radius:13px;z-index:25;overflow:hidden;background:#0c2a39f7;pointer-events:auto}.panel-header{display:flex!important;align-items:flex-start!important;justify-content:space-between;padding:18px 20px!important;flex-shrink:0;border-bottom:1px solid #86b1b236}.panel-header h2{font-size:22px!important;line-height:1.35;margin:6px 0 0!important;color:#e4eddf}.panel-header .eyebrow{font-size:9px;color:#b8c5a6}.icon-button{min-width:44px;min-height:44px;color:#e4e9e9!important;background:#234653;border:1px solid #769ea140}.panel-body{overflow:auto!important;min-height:0!important;padding:20px!important;flex:1;touch-action:pan-y!important;-webkit-overflow-scrolling:touch;font-size:14px;line-height:1.8;overscroll-behavior:contain}.panel-body p{font-size:14px;line-height:1.85}.panel-footer{padding:10px 18px!important;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid #759b9e35}.panel-footer span{font-size:11px}.panel-footer button{min-height:44px;font-size:13px;color:#eddbb1;background:#173a49;padding:9px 14px;border:1px solid #adb99436}.panel-open .touch-controls,.panel-open .interaction,.panel-open .tool-dock{display:none!important}.panel input:not([type=checkbox]),.panel select,.panel textarea{width:100%;background:#183d4d;color:#e2ecec;border:1px solid #7da5af55;border-radius:7px;min-height:44px;padding:9px 10px;font-size:16px!important}.panel input[type=range]{padding:0;touch-action:pan-x;min-height:40px}.panel input[type=checkbox]{width:23px;height:23px;min-height:23px!important}.field-label{display:block;font-size:13px!important;margin:10px 0;color:#cbdcdf}.field-label select{display:block;margin-top:5px}.control{margin:8px 0}.control>span{font-size:12px!important;color:#cfdee1}.control output{font-size:12px!important;color:#e5cb9b}.control input[type=range]{height:40px}.primary{background:#d8bd88;color:#193440;border:1px solid #e4ca91;min-height:44px;padding:10px 15px}.secondary{background:#183b4c;color:#d9e7e8;border:1px solid #92b1ba48;padding:10px 13px;min-height:44px}.text-button{color:#a9d5da;background:none;border:none;min-height:40px}.full{display:block;width:100%;margin:10px 0}.formula{background:#183a45;border-left:3px solid #d9bd84;padding:14px;line-height:1.8!important;white-space:normal!important;overflow-wrap:anywhere;font-size:15px!important}.explain{padding:14px;background:#26484a73;border-radius:8px;font-size:13px}.list-card{display:flex;align-items:center;gap:14px;padding:14px!important;border:1px solid #8da9b328;border-radius:9px;margin:10px 0}.list-card>div{flex:1;min-width:0}.list-card strong{font-size:14px!important;line-height:1.5}.list-card small{font-size:12px!important;line-height:1.75;display:block;color:#a8c5cd;margin-top:4px}.list-card button{flex-shrink:0}.fineprint,.source-note{font-size:11px!important;line-height:1.7!important;color:#92b2bd;overflow-wrap:anywhere}.source-note{border-top:1px solid #99afb433;padding-top:14px;margin-top:22px}.wallet-card{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:16px;border:1px solid #c6ad7850;background:#5c543622;border-radius:10px}.wallet-card strong{font-size:19px;color:#efd6a5}.wallet-card span{font-size:12px;color:#a5cbca}.menu-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.big-map{display:block;width:100%;height:auto;aspect-ratio:640/470;max-height:440px;border-radius:8px}.map-number{width:38px;color:#eac889;font-size:19px;font-weight:700}.map-link{display:flex;gap:8px;margin-top:9px;flex-wrap:wrap}.map-link button{min-height:44px;background:#285362;color:#d1e7eb;border:1px solid #92b7c336;padding:8px 12px;font-size:12px}.live-plot svg{display:block;width:100%;height:auto;max-height:370px}.controls-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px 20px;margin:18px 0}.lab-topline{display:flex;justify-content:space-between;align-items:center;gap:9px}.challenge-box,.book-quiz{padding:18px;border:1px solid #d1b57745;background:#24474455;border-radius:10px;margin:20px 0}.challenge-box>.eyebrow{font-size:9px;color:#dcc698}.answer-row{display:flex;gap:9px}.answer-row input{min-width:0}.answer-row button{flex-shrink:0}.result-success,.result-error{padding:13px;border-radius:8px;line-height:1.7;font-size:13px;margin-top:12px}.result-success{color:#b8f0d2;background:#18523e80;border:1px solid #6eb59a55}.result-error{color:#ffd0c0;background:#793d3766;border:1px solid #c68c7c60}.book-card{display:block;text-align:left;width:100%;padding:18px;background:#143444;border:1px solid #7ba9b23d;border-radius:10px;margin:11px 0;color:#dfebea}.book-card strong{display:block;margin:9px 0 5px;font-size:17px;font-weight:550}.book-card small{color:#90b8c2}.book-nav{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.book-nav button{background:#1d4354;color:#ccdfe4;border:1px solid #759ba445;min-width:44px;min-height:44px;padding:8px 12px}.book-nav .selected{background:#d8bb83;color:#193841}.book-nav span{font-size:12px;color:#9dbfc8;margin-left:auto}.book-nav.bottom{justify-content:space-between}.book-reading h3{font-family:Georgia,serif;font-weight:500;font-size:25px;color:#e8d6b2;margin:24px 0 20px}.book-reading p{font-size:16px;line-height:1.95}.quiz-option{display:block;text-align:left;width:100%;padding:12px 14px;background:#103242;color:#dbeaec;border:1px solid #8baeb745;margin:8px 0;min-height:48px;font-size:14px}.dialogue-avatar{color:#e0c68d;padding:18px;background:#244752;border-radius:50%;width:76px;height:76px;margin:8px 0}.speech{border-left:3px solid #e2be7e;padding:6px 18px;margin:16px 0 26px;background:#2747505c}.speech p{font-size:17px;line-height:1.9}.dialogue-choices{display:flex;flex-direction:column;gap:9px}.dialogue-choices button{text-align:left;white-space:normal}.shop-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:18px 0}.shop-item{border:1px solid #89b3b637;background:#173c493b;border-radius:12px;padding:16px;display:flex;gap:9px;flex-direction:column}.snack-icon{font-size:32px;color:#edc889}.shop-item strong{font-size:16px}.shop-item small{font-size:12px;color:#9fc1c8}.shop-message{padding:13px;background:#35564588;border-radius:8px;color:#dae8bf}
@media(max-width:1000px){.home-header{gap:12px;padding:14px 22px}.home-nav button{padding:8px 11px}.home-hero{gap:28px;padding:30px 32px}.hero-copy h1{font-size:52px}.save-card{padding:23px}.home-install{display:none}.directory-grid{grid-template-columns:repeat(2,1fr)}.location-strip{top:132px;left:15px;transform:none;max-width:240px}.quests{top:180px!important}.resources{font-size:11px}}
@media(max-width:620px){.home-header{padding:12px 17px;flex-wrap:wrap;gap:10px}.home-brand{font-size:12px}.home-brand small{font-size:7px}.brand-shield{font-size:28px;width:25px;line-height:30px}.home-nav{margin:0;width:100%;justify-content:space-between;gap:0}.home-nav button{font-size:12px;padding:8px 9px;flex:1}.home-hero{display:flex;flex-direction:column;align-items:stretch;padding:25px 20px;gap:22px;min-height:0}.hero-copy h1{font-size:40px;letter-spacing:-1px;margin:18px 0}.hero-copy h1 br:nth-child(2){display:none}.hero-copy>p{font-size:13px;line-height:1.75}.hero-metrics{gap:23px;margin-top:20px;padding-top:15px}.hero-metrics b{font-size:23px}.device-note{margin-top:14px;font-size:11px}.save-card{max-width:none;padding:23px 20px}.save-card h2{font-size:23px}.home-bottom-strip{flex-wrap:wrap;font-size:8px;gap:12px;line-height:1.8;margin:0 20px;padding:18px 0}.home-page{padding:26px 20px 40px}.guide-layout{grid-template-columns:1fr;gap:25px}.guide-card{padding:20px}.directory-grid{grid-template-columns:1fr}.home-page h1{font-size:34px}.tip-row{grid-template-columns:95px 1fr}.tip-row b,.tip-row span{font-size:12px}.resources{height:50px;padding:10px;font-size:10px;right:9px;gap:7px}.resources small{display:none}.player-card{left:9px!important;width:150px!important}.quick-menu{right:9px;gap:5px}.quick-menu button{min-width:59px;font-size:12px;padding:9px}.touch-ui .tool-dock{width:207px;right:9px;top:127px}.tool-modes button,.instrument-buttons button{font-size:11px!important}.touch-ui .location-strip{max-width:135px;top:76px;left:10px}.touch-ui .location-strip small{max-height:44px;overflow:hidden}.touch-ui .interaction{max-width:88vw!important;bottom:145px!important}.interaction strong{font-size:12px!important}.interaction small{font-size:10px!important}.touch-actions{gap:6px!important}.touch-actions button{min-width:50px!important;width:50px!important;height:50px!important;min-height:50px!important}.touch-actions #touch-interact{width:68px!important;height:68px!important}.touch-ui .touch-controls{left:10px!important;right:10px!important}.touch-ui .move-stick{width:96px!important;height:107px!important}.stick-base{width:94px!important;height:94px!important}.panel{inset:calc(5px + var(--safe-top)) 5px calc(5px + var(--safe-bottom))!important;width:auto!important}.panel-header{padding:12px 14px!important}.panel-header h2{font-size:19px!important}.panel-body{padding:16px!important}.panel-footer{padding:7px 12px!important}.panel-footer span{display:none}.panel-footer button{width:100%}.controls-grid{grid-template-columns:1fr;gap:4px}.book-reading h3{font-size:24px}.answer-row{flex-direction:column}.shop-grid{gap:10px}.shop-item{padding:12px}.toast-stack{bottom:300px!important;width:210px!important}.toast strong{font-size:11px!important}.toast p{font-size:10px!important}.lab-topline{flex-wrap:wrap}}
@media(orientation:landscape) and (max-height:560px){.home-header{padding:9px 24px}.home-brand{font-size:12px}.home-hero{padding:22px 28px;grid-template-columns:1.1fr 1fr;gap:28px;align-items:start;min-height:0}.hero-copy h1{font-size:36px;margin:14px 0;letter-spacing:-1px}.hero-copy p{font-size:12px;margin:8px 0}.hero-metrics{padding-top:12px;margin-top:15px;gap:24px}.hero-metrics b{font-size:22px}.device-note{font-size:10px;margin-top:12px}.save-card{padding:17px 20px}.save-card h2{font-size:19px;margin:10px 0}.save-status{padding:10px}.save-empty{font-size:11px;margin:10px 0}.home-primary,.home-secondary{min-height:44px;padding:11px 14px}.home-page{padding:24px 30px}.touch-ui .player-card{top:8px!important;left:10px!important;width:156px!important}.touch-ui .resources{top:8px;right:215px;height:44px}.quick-menu{top:8px!important;right:10px}.quick-menu button{min-width:60px}.touch-ui .location-strip{left:177px!important;top:15px!important;max-width:210px}.touch-ui .tool-dock{top:61px!important;width:244px;max-height:calc(100dvh - 148px)}.equipped,.instrument-controls{padding:7px!important}.equipped-name{font-size:11px}.equipped-name button{min-height:29px}.tool-modes button{min-height:37px;font-size:11px}.instrument-buttons button{min-height:39px!important;font-size:11px!important}.instrument-status{margin-bottom:5px}.instrument-status b{font-size:10px!important}.touch-ui .interaction{left:42%!important;bottom:82px!important;max-width:335px!important}.interaction strong{font-size:11px!important}.interaction small{font-size:9px!important}.action-badge{padding:9px 5px;font-size:9px}.touch-ui .move-stick{height:103px!important;width:100px!important}.stick-base{width:90px!important;height:90px!important}.touch-actions button{width:50px!important;height:50px!important;min-width:50px!important;min-height:50px!important}.touch-actions #touch-interact{width:65px!important;height:65px!important}.touch-ui .toast-stack{bottom:82px!important;right:auto!important;left:130px;width:270px!important}.panel{inset:5px 5px 5px auto!important;width:calc(100vw - 10px)!important}.panel-header{padding:10px 16px!important}.panel-header h2{font-size:19px!important}.panel-body{padding:15px 24px!important}.panel-footer{padding:5px 16px!important}.panel-footer button{min-height:38px}.live-plot svg{max-height:255px}.controls-grid{grid-template-columns:1fr 1fr}.directory-grid{grid-template-columns:repeat(2,1fr)}}

/* Compact first visit: the New Game choice appears sooner on portrait phones. */
@media(max-width:620px){
.home-hero{padding-top:20px;gap:20px}.hero-copy h1{font-size:32px;line-height:1.1;margin:14px 0}.hero-copy em br{display:none}.hero-copy>p{font-size:12px;line-height:1.6;margin:10px 0}.hero-metrics{margin-top:13px;padding-top:12px;gap:21px}.hero-metrics b{font-size:20px}.device-note{margin-top:11px;font-size:10px}.save-card{padding:20px}.save-card h2{font-size:21px;margin:10px 0 13px}.save-empty{display:none}.save-status{padding:10px;margin-bottom:12px}.home-primary,.home-secondary{min-height:47px;padding:12px 14px}.save-tools{margin-top:7px;padding-top:6px}
}
.tool-dock .instrument-status b{font-size:13px!important;color:#b5e0db;line-height:1.5}

/* Keep all three tool mode buttons inside narrow phone screens. */
.equipped:not([hidden]){display:block!important}.equipped-name{width:100%;min-width:0}.equipped-name b{min-width:0;overflow-wrap:anywhere}.equipped-name button{min-width:48px!important}.tool-modes{width:100%;min-width:0;grid-template-columns:repeat(3,minmax(0,1fr))!important}.tool-modes button{min-width:0!important;min-height:44px!important;padding:8px 3px!important;white-space:normal}

/* V3.1 startup hardening: homepage is never visually blank while modules/cache recover. */
.home-boot-fallback{min-height:100%;display:grid;place-items:center;padding:28px 20px 42px;background:linear-gradient(180deg,rgba(6,26,36,.08),rgba(6,26,36,.38))}
.home-boot-fallback section{width:min(620px,100%);padding:30px;border:1px solid #91bfc738;border-radius:18px;background:linear-gradient(150deg,#143747e8,#0a2634f5);box-shadow:0 24px 70px #0007}
.home-boot-fallback h1{font-size:clamp(32px,7vw,54px);line-height:1.08;font-weight:500;margin:18px 0;color:#f1f3eb;letter-spacing:-1.5px}.home-boot-fallback h1 em{font-family:Georgia,serif;color:var(--gold);font-weight:400}
.home-boot-fallback p{font-size:14px;line-height:1.8;color:#aac9d0}.home-boot-fallback small{display:block;font-size:11px;line-height:1.7;color:#86abb5;margin-top:12px}
.boot-progress{height:3px;background:#315363;border-radius:999px;overflow:hidden;margin:24px 0 12px}.boot-progress i{display:block;height:100%;width:38%;background:#e4c389;animation:bootSlide 1.15s ease-in-out infinite alternate}
.home-boot-fallback pre{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:14px;padding:12px;border-radius:8px;background:#061c28;color:#f0cbb2;font-size:10px;max-height:130px;overflow:auto;-webkit-user-select:text;user-select:text}
@keyframes bootSlide{from{transform:translateX(-55%)}to{transform:translateX(165%)}}
@media(max-width:620px){.home-boot-fallback{align-items:start;padding-top:32px}.home-boot-fallback section{padding:22px 18px}.home-boot-fallback h1{font-size:34px}.home-boot-fallback .home-secondary{margin-top:16px}}

/* Math Campus 3D brand */
.home-brand .brand-shield{width:40px;height:40px;flex:none;display:block;object-fit:contain}.home-brand .brand-3d{color:#e8bd75}.home-brand small{letter-spacing:1.35px}.loading-mark img{display:block;width:84px;height:84px}@media(max-width:620px){.home-brand .brand-shield{width:32px;height:32px}.home-brand small{font-size:6.5px;letter-spacing:.8px}}
/* Credits and selectable soundtrack */
.credits-page{max-width:1020px}.credits-page>p{color:#aacbd0;line-height:1.7}.credits-maker{display:flex;align-items:center;gap:24px;margin:27px 0;padding:22px;background:linear-gradient(115deg,#153b43,#102c38);border:1px solid #d5b77988;border-radius:20px}.credits-maker img{width:116px;height:116px;flex:none;border:4px solid #e0c187;border-radius:50%;object-fit:cover;object-position:center 53%}.credits-maker small{font-size:10px;letter-spacing:2px;color:#dfc688}.credits-maker h2{font-size:clamp(20px,3vw,29px);font-weight:600;margin:7px 0;color:#f3eee0}.credits-maker p{margin:0 0 9px;color:#abc5ca}.credits-links{display:flex;gap:10px 22px;flex-wrap:wrap}.credits-links a,.music-track a{color:#f0d395;text-underline-offset:3px}.credits-notes{padding:24px;background:#102f3ec9;border:1px solid #829fa534;border-radius:16px}.credits-notes h2{font-size:22px;font-weight:550;color:#e9dac0;margin:0 0 10px}.credits-notes h2:not(:first-child){margin-top:28px}.credits-notes>p{font-size:13px;line-height:1.8;color:#abc5ca}.music-section>p{font-size:13px;line-height:1.7;color:#abc5ca}.music-tracks{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0}.music-track{min-width:0;border:1px solid #6f989a70;border-radius:12px;background:#173948;overflow:hidden}.music-track.selected{border-color:#e7c787;background:#244b4a}.music-track button{width:100%;min-height:88px;padding:13px 11px;display:flex;align-items:flex-start;gap:8px;text-align:left;background:transparent;border:0;color:#edf3eb;cursor:pointer}.music-track button>span:nth-child(2){flex:1;min-width:0}.music-track strong,.music-track small{display:block;overflow-wrap:anywhere}.music-track strong{font-size:13px;line-height:1.4}.music-track small{font-size:11px;color:#a9c6c8;margin-top:5px}.music-number{color:#e1c78f;font-size:11px}.music-state{color:#efd495;font-size:9px;white-space:nowrap}.music-track>small{font-size:10px;line-height:1.6;padding:0 12px 12px;color:#abc5c6}.music-volume{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:15px;background:#0a2736;border:1px solid #6f989a70;border-radius:11px}.music-volume label{font-size:12px;font-weight:600;white-space:nowrap}.music-volume output{color:#e8c98e;margin-left:6px}.music-volume input{flex:1;min-width:120px;accent-color:#e8c98e}.music-volume button{min-height:42px;padding:8px 12px;background:#254954;color:#f7e5bc;border:1px solid #d8bc83;border-radius:8px}.music-section .music-feedback{margin:10px 0 0}.credits-page a:focus-visible,.credits-page button:focus-visible,.credits-page input:focus-visible{outline:2px solid #e8c98e;outline-offset:2px}.panel .credits-page{padding:0}.panel .credits-maker{margin:17px 0}.panel .credits-notes{padding:17px}.panel .music-tracks{grid-template-columns:1fr}.panel .music-track button{min-height:60px}
@media(max-width:700px){.music-tracks{grid-template-columns:1fr}.music-track button{min-height:62px}.credits-maker{padding:15px;gap:14px}.credits-maker img{width:78px;height:78px}.credits-maker h2{font-size:18px}.credits-links a{font-size:12px}.credits-notes{padding:17px}.home-nav button[data-home="credits"]{white-space:normal}}
@media(max-width:380px){.credits-maker{align-items:flex-start}.credits-maker img{width:60px;height:60px}.credits-maker h2{font-size:16px}.home-nav button{font-size:10px;padding:7px 4px}}
/* Install guidance is part of the first screen, on desktop and mobile. */
.pwa-card{margin-top:20px;padding:16px 18px;background:#102f3edc;border:1px solid #9ac6be6b;border-radius:12px;max-width:560px;box-shadow:0 15px 35px #03182055}.pwa-card strong{display:block;color:#f1daa6;font-size:15px}.pwa-card p{font-size:12px;line-height:1.75;color:#c0d8d8;margin:9px 0}.pwa-card b{color:#f2e2bd}.pwa-card small{display:block;color:#9cc5c8;font-size:10px;line-height:1.5;margin-top:9px}.pwa-install{display:inline-block;min-height:44px;padding:10px 17px;border:1px solid #f0d49a;border-radius:8px;background:#ddc594;color:#15313c;font-size:13px;font-weight:700;cursor:pointer}.pwa-install[hidden]{display:none!important}.pwa-install:focus-visible{outline:3px solid #81dce3;outline-offset:3px}@media(max-width:620px){.pwa-card{margin-top:17px;padding:14px}.pwa-card p{font-size:11px}.pwa-card strong{font-size:14px}}
