*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden}body{background:#e7ddc4;color:#4d4537;font-family:"Microsoft YaHei","PingFang SC",sans-serif;display:flex;align-items:center;justify-content:center;gap:64px;background-image:radial-gradient(ellipse at 20% 20%,#f7efd9,transparent 65%),radial-gradient(ellipse at 90% 100%,#b9c7ac,transparent 55%)}button{font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}button:focus-visible{outline:3px solid #986b46;outline-offset:3px}#game{position:relative;width:min(100vw,calc(100dvh * 420 / 740));height:min(100dvh,calc(100vw * 740 / 420));overflow:hidden;background:#c4cf9d;box-shadow:0 28px 90px #4b574640;border:1px solid #f7eddc55;isolation:isolate}#world{width:100%;height:100%;display:block;touch-action:none;user-select:none}#screen{position:absolute;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center}#screen>*{pointer-events:auto}#screen.empty{display:none}.panel{width:90%;max-height:94%;overflow:auto;padding:26px 23px;border:1px solid #fff4d6;border-radius:23px;background:#fff6e4f5;box-shadow:0 12px 45px #26332f38;text-align:center}.panel h2{font-size:26px;margin:8px 0 10px;letter-spacing:2px}.eyebrow{font-size:10px;letter-spacing:4px;color:#8b775b;font-weight:bold}.sub{font-size:12px;line-height:1.8;color:#8c816b;margin:9px 0 18px}.home{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;padding:8% 8% 7%;text-align:center;background:linear-gradient(#fbf0dfe8 0%,#fff4dbad 27%,#f8e5bd0a 55%,#f9e8cbe8 100%)}.home h1{font-family:"STKaiti","KaiTi",serif;font-size:clamp(32px,6.5vh,46px);letter-spacing:5px;margin:10px 0;color:#5e4934;text-shadow:0 2px #fff9eb}.home .subtitle{font-size:12px;letter-spacing:3px;color:#897054}.home .hero-stage{position:relative;flex:1;width:100%;min-height:90px}.hero-portrait{position:absolute;width:76%;aspect-ratio:1;left:12%;top:10%;background:url('assets/characters.webp') 0 0/400% 400%;filter:drop-shadow(0 12px 9px #66764b35);animation:float 3s ease-in-out infinite}.home .ribbon{font-size:11px;letter-spacing:2px;background:#fff4dccc;border:1px solid #decea8;padding:8px 20px;border-radius:20px;transform:rotate(-2deg);margin-bottom:18px}.primary{border:1px solid #a56546;border-bottom:4px solid #91523e;background:#be7959;color:#fff5df;border-radius:14px;padding:14px 22px;box-shadow:0 6px 15px #6a4b2820;font-weight:700;letter-spacing:2px;width:100%;font-size:15px}.primary:hover{background:#c98764}.secondary{border:1px solid #ccbda0;background:#f9efd8;color:#78664e;border-radius:12px;padding:11px 14px;font-size:12px}.secondary:hover{background:#fff9e9}.home .links{display:flex;gap:12px;margin-top:12px;width:100%}.home .links button{flex:1;background:#fff2d8bd}.version{font-size:9px;color:#9a8564;letter-spacing:1px;margin:15px 0 0}.level-card{display:block;width:100%;border:1px solid #ccbb96;border-radius:14px;padding:15px;text-align:left;color:#4e5848;background:#e2e5ca;margin:10px 0;position:relative;overflow:hidden}.level-card:nth-of-type(2){background:#cee0d9}.level-card:nth-of-type(3){background:#696b84;color:#fff3df}.level-card b{display:block;font-size:17px;margin-bottom:5px}.level-card small{font-size:10px;opacity:.8}.level-card .number{float:right;font:italic 34px Georgia;opacity:.3}.level-card:disabled{opacity:.5;cursor:default}.back{margin-top:14px;width:100%}.choice{width:100%;text-align:left;border:1px solid #decba9;border-radius:14px;padding:13px 12px;margin:6px 0;background:#fffaf0;display:flex;align-items:center;gap:12px;min-height:75px;color:#67513e}.choice:hover{border-color:#ac8054;background:#f6ebd4;transform:translateY(-1px)}.choice b{font-size:15px}.choice small{display:block;font-size:11px;line-height:1.5;color:#a0876b;margin-top:4px}.icon{display:inline-block;width:42px;height:42px;flex-shrink:0;background-image:url('assets/characters.webp');background-size:400% 400%}.generic-icon{width:42px;font-size:26px;color:#b78364;text-align:center}.row{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid #dfd1b6;font-size:13px;gap:10px;text-align:left}.toggle{border:1px solid #a9b89b;background:#e1e7d0;border-radius:20px;padding:7px 13px;color:#53634a;min-width:60px}.toggle.off{background:#e7ddca;color:#968976;border-color:#c8b99e}.buttons{display:grid;gap:10px;margin-top:16px}.result-cat{width:100px;height:100px;background:url('assets/characters.webp') 0 0/400% 400%;margin:auto;animation:float 1.3s ease-in-out infinite}.result-stat{display:flex;justify-content:space-around;margin:22px 0}.result-stat b{font-size:24px;display:block;color:#987349}.result-stat small{font-size:10px;color:#998970}.cats{display:flex;justify-content:center;gap:16px;margin:20px 0}.cat-entry{width:125px;background:#e6ead8;border-radius:14px;padding:12px 4px;font-size:12px}.cat-entry .icon{width:75px;height:75px}.cat-entry small{display:block;font-size:10px;line-height:1.6;color:#8e846c}.locked{filter:grayscale(1);opacity:.45}#hud{position:absolute;left:5%;right:5%;top:max(12px,env(safe-area-inset-top));pointer-events:none;color:#fff8e3;text-shadow:0 1px 3px #334235;z-index:2}.hud-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}.hud-top div{display:flex;align-items:center;gap:13px}.hud-top small{letter-spacing:2px;font-size:12px}.hud-top b{font:600 19px Georgia}.hud-top button{pointer-events:auto;background:#f7edceeb;border:1px solid #b8ba9c;width:34px;height:31px;border-radius:9px;color:#52634d;font-weight:bold;font-size:17px}.health{height:12px;position:relative;border:1px solid #fff0cebc;border-radius:6px;overflow:hidden;background:#4554479e}.health i{display:block;height:100%;background:linear-gradient(90deg,#db8e87,#f0b5a0);transition:width .12s}.health span{position:absolute;inset:0;text-align:center;font:9px/11px sans-serif}.experience{height:4px;margin-top:5px;background:#3c504e80;border-radius:4px;overflow:hidden}.experience i{display:block;height:100%;background:#ffe6a1}.hud-stats{display:flex;justify-content:space-between;font-size:10px;margin-top:6px}#skills{position:absolute;top:550px;left:0;display:flex;gap:6px}#skills .slot{border:1px solid #f1debc9e;border-radius:8px;background:#4d6558aa;width:34px;height:39px;text-align:center;position:relative}#skills .slot .icon{width:28px;height:28px}#skills .slot small{position:absolute;bottom:0;left:0;right:0;font-size:8px}#saveWarning{position:absolute;bottom:0;left:0;right:0;background:#745332;color:#fff4d6;padding:5px;font-size:10px;text-align:center;z-index:20}.desktop-note{width:220px;color:#7e8067}.desktop-note>span{letter-spacing:5px;font-size:10px}.desktop-note p{font-family:"STKaiti","KaiTi",serif;line-height:1.9;font-size:25px;letter-spacing:2px}.desktop-note small{font-size:10px;line-height:2;color:#99937d}@keyframes float{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-8px) rotate(2deg)}}@media(max-width:820px){.desktop-note{display:none}body{gap:0}#game{border:0}}@media(max-height:680px){.panel{padding:15px 20px}.panel h2{font-size:23px}.sub{margin:5px 0 10px}.choice{min-height:60px;padding:9px}.home{padding-top:6%}.home .ribbon{margin-bottom:10px}.version{margin-top:8px}#skills{top:460px}}

#hud{height:calc(100% - max(24px, env(safe-area-inset-top)))}#skills{top:auto;bottom:110px}

#screen{z-index:5}

input[type=range]{width:145px;accent-color:#b37857}.panel:has(input[type=range]) .row{padding:10px 0}

.new-run{margin-top:8px;width:100%}.ready-hint{pointer-events:none!important;position:absolute;bottom:24%;background:#fff5e7ed;color:#685440;border:1px solid #e5c899;border-radius:16px;padding:15px 25px;text-align:center;font-size:15px;box-shadow:0 6px 24px #34442d33}.ready-hint small{font-size:10px;line-height:2}#screen:has(.ready-hint){pointer-events:none}.home .hero-portrait{background-image:url('assets/cat-actions.webp');background-position:0 100%}.panel{padding-bottom:max(22px,env(safe-area-inset-bottom))}#skills{bottom:max(90px,calc(env(safe-area-inset-bottom) + 60px))}

.region-mode #hud .health,.region-mode #hud .experience,.region-mode #hud .hud-stats,.region-mode #skills{display:none}.region-mode #levelName{font-size:11px}.region-mode #clock{font-size:11px}.region-controls{pointer-events:auto;position:absolute;bottom:4%;display:flex;gap:8px}.region-controls button{font-size:10px;padding:6px 10px;border:1px solid #ada888;border-radius:7px;background:#fff7e6d9;color:#425239}.home>[data-action=region]{margin-top:6px}

.region-mode #screen.empty{display:flex;pointer-events:none}.region-mode #screen.empty .region-controls{pointer-events:auto}.region-mode .hud-top{background:#f9efd9df;border-radius:8px;padding:3px 8px;color:#425239;text-shadow:none}.region-controls{bottom:5.5%}

.levels-preview #levelName{font-size:10px;letter-spacing:0}.levels-preview .hud-top{background:#253345cf;border-radius:9px;padding:5px}.levels-preview .health{position:absolute;top:auto;bottom:145px;left:0;right:0}.levels-preview .experience{position:absolute;bottom:136px;left:0;right:0}.levels-preview .hud-stats{position:absolute;bottom:119px;left:0;right:0}.levels-preview #skills{bottom:68px}

.levels-preview .hud-top{background:none;padding:0;justify-content:flex-end}.levels-preview .hud-top>div{position:absolute;left:0;right:45px;bottom:174px;background:#253345d9;padding:7px 9px;border-radius:7px;justify-content:space-between}.levels-preview .hud-top b{font-size:15px}
.garden-art-controls{display:none}.garden-art .garden-art-controls{position:absolute;display:flex;gap:8px;left:12px;top:14px;z-index:3}.garden-art-controls button{padding:6px 8px;font-size:11px;border:1px solid #d0ba8f;border-radius:6px;background:#fff5dfdc;color:#394938}
.v2-controls{display:none}.combat-v2 .v2-controls{display:flex;position:absolute;right:14px;bottom:52px;gap:10px;z-index:4}.v2-controls button{border:2px solid #e9ce97;border-radius:50%;width:60px;height:60px;background:#fff0d7e8;color:#453f3a;font-weight:bold;font-size:12px}.v2-controls button:disabled{opacity:.65}.combat-v2 .garden-art-controls{display:none}.combat-v2 #skills{bottom:132px}.combat-v2 .hud-top>div{bottom:226px}.combat-v2 .health{bottom:204px}.combat-v2 .experience{bottom:195px}.combat-v2 .hud-stats{bottom:178px}
/* Compact top HUD; keep lower combat sightlines clear and controls above gesture area. */
.adventure-v3 #hud{top:max(10px,env(safe-area-inset-top));height:auto;left:4%;right:4%}
.adventure-v3 .hud-top{display:flex;justify-content:space-between;margin:0 0 5px;padding:4px 6px;background:#253345a8;border-radius:7px}
.adventure-v3 .hud-top>div{position:static;background:none;padding:0;display:flex;gap:12px;font-size:10px}
.adventure-v3 .health,.adventure-v3 .experience,.adventure-v3 .hud-stats{position:static;width:100%}
.adventure-v3 #skills{position:static;margin-top:7px;display:flex;gap:4px}
.adventure-v3 #skills .slot{width:28px;height:30px;background:#25334588}
.adventure-v3 #skills .icon{width:23px;height:23px}
.adventure-v3 .v2-controls{bottom:max(56px,calc(env(safe-area-inset-bottom) + 28px))}
.adventure-v3 .v2-controls button{width:56px;height:56px}
.home{overflow:auto}.home .hero-stage{min-height:70px}.home>button{flex-shrink:0}
.adventure-v3 .health{position:relative}.adventure-v3 .health span{line-height:11px}
.home .hero-stage{flex:0 0 120px;min-height:120px;pointer-events:none}.home .hero-portrait{width:118px;height:118px;left:calc(50% - 59px);top:0;pointer-events:none}.review-tools{width:100%;margin-top:10px;font-size:11px}.review-tools summary{cursor:pointer;padding:8px;color:#6f634e}.review-tools>button{display:block;width:100%;margin:5px 0}
.adventure-v3 .health{top:auto;bottom:auto;left:auto;right:auto}.adventure-v3 .health span{display:block}
/* A separate touch dock keeps the complete existing 420x740 battle canvas unobscured. */
#game.combat-safe{width:min(100vw,calc((100dvh - 78px - env(safe-area-inset-bottom)) * 420 / 740));height:min(calc(100dvh - 78px - env(safe-area-inset-bottom)),calc(100vw * 740 / 420));margin-bottom:calc(78px + env(safe-area-inset-bottom));overflow:visible}
.combat-safe .v2-controls{bottom:-70px;right:10px;gap:12px;background:#25354bee;border-radius:18px;padding:6px;touch-action:none}
.combat-safe .v2-controls button{width:54px;height:54px;background:#f5e3bf}
.combat-dock-hint{display:none}.combat-safe .combat-dock-hint{display:block;position:absolute;left:12px;bottom:-44px;color:#536049;font-size:12px;pointer-events:none}
#maps-v4-debug[hidden]{display:none!important}

/* Mainline task and one transient cooperation selector. Existing canvas geometry stays fixed. */
#story-objective{font-size:12px;color:#fff0be;background:#263344dd;border-radius:6px;padding:4px 7px;margin-top:4px;max-width:max-content}
#story-objective[hidden],.v2-controls [hidden]{display:none!important}
.combat-safe .v2-controls{right:6px;gap:6px;padding:5px}
.combat-safe .v2-controls button{font-size:10px}
.combat-safe .combat-dock-hint{left:8px;bottom:-14px;font-size:10px;color:#344037}
#story-choices{position:absolute;right:110px;bottom:68px;display:flex;gap:6px;padding:5px;border-radius:10px;background:#22344fee}
#story-choices button{width:80px;height:50px;border-radius:10px}

/* Phone controls stay below the battlefield, including the cooperative picker. */
#story-choices{bottom:0;right:120px;z-index:6}#story-choices button{min-width:80px;min-height:54px}.v2-controls button{touch-action:none}.v2-controls{user-select:none;-webkit-user-select:none}#story-coop.lesson{outline:3px solid #ffe499;outline-offset:2px}html,body{overscroll-behavior:none}

#asset-overlay,#diagnostic-panel{position:fixed;inset:0;z-index:1000;background:#263a40dc;display:grid;place-items:center;padding:20px;padding-bottom:max(20px,env(safe-area-inset-bottom));}#asset-overlay[hidden],#diagnostic-panel[hidden]{display:none}#asset-overlay>div,#diagnostic-panel>div{background:#fff5de;color:#303e37;border-radius:18px;padding:20px;max-width:430px;width:100%;max-height:90dvh;overflow:auto}#asset-overlay button,#diagnostic-panel button{min-height:44px;padding:10px;margin:5px;touch-action:manipulation}#diagnostic-panel{z-index:1001}#diagnostic-panel textarea{width:100%;height:38vh;font:12px monospace;user-select:text;-webkit-user-select:text;touch-action:auto}
