*{box-sizing:border-box}[hidden]{display:none!important}
:root{font-family:"Microsoft JhengHei","PingFang TC",system-ui,sans-serif;color:#25493c;background:#f5f2e8;font-synthesis:none}
body{margin:0;height:100svh;height:100dvh;display:flex;flex-direction:column;overflow:hidden;background:radial-gradient(ellipse at top left,#e0edd7,transparent 60%),#f5f2e8;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #d39443;outline-offset:2px}canvas:focus{outline:none}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;width:min(1200px,100%);margin:auto;padding:12px 24px;font-size:12px;flex:none}.topbar a{color:inherit;text-decoration:none}.topbar>span{font-size:18px;font-weight:800;letter-spacing:2px}.topbar small{font-size:10px;font-weight:400;letter-spacing:1px}.sound-tools{display:flex;gap:8px;align-items:center}.sound-tools button{border:1px solid #c4d0bb;border-radius:20px;background:#fff8;padding:6px 12px;color:inherit}.volume-label{display:flex;align-items:center;gap:3px;font-size:10px}.volume-label input{width:55px;accent-color:#426b50}
.game-shell{display:flex;flex-direction:column;flex:1;min-height:0;width:min(1100px,100%);margin:auto;padding:0 24px 8px;gap:8px}
.hud{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:3px 10px;min-height:44px}.hud>div:first-child{display:flex;align-items:center;gap:12px}.hud-label{font-size:11px}.hud #hearts{color:#c27158;letter-spacing:2px;font-size:23px}.hud-right{display:flex;gap:16px;align-items:center}.hud-right>strong{font-size:25px;font-variant-numeric:tabular-nums}.hud small{font-size:11px}.hud #score,#enemy-count{font-size:12px}.hud button{background:#fff9;border:1px solid #c1ccb7;border-radius:9px;width:34px;height:34px;color:inherit}
.stage{position:relative;flex:1;min-height:0;overflow:hidden;border:5px solid #fff;border-radius:22px;background:#d9e4d3;box-shadow:0 10px 35px #234b3615;isolation:isolate}.stage canvas{display:block;width:100%;height:100%;touch-action:none}
.overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;overflow-y:auto;padding:12px;background:#254c4260;backdrop-filter:blur(2px)}
.menu-card{flex:none;width:370px;max-width:100%;max-height:100%;overflow-y:auto;text-align:center;background:#fbf8edf5;border:1px solid #fff;border-radius:22px;padding:22px 28px;box-shadow:0 10px 40px #203e3230}
.badge{font-size:10px;letter-spacing:2px;color:#66805b;background:#e7edcf;padding:5px 10px;border-radius:20px}h1{font-size:39px;letter-spacing:2px;margin:15px 0 10px;line-height:1.15}h1>span{color:#d3a246}h1 small{display:block;font-size:17px;letter-spacing:5px;margin-top:7px;color:#7c8860}.menu-card h2{font-size:29px;line-height:1.35;margin:12px 0}.menu-card>p{font-size:12px;line-height:1.7;color:#718169}.menu-card .food-copy{padding:9px;background:#eef1dc;border-radius:10px}.primary,.secondary{display:block;width:100%;padding:11px;border:0;border-radius:11px;font-weight:700;font-size:14px}.primary{background:#2b5944;color:#fff;box-shadow:0 3px 0 #1b3d2e}.secondary{padding:8px;background:#e7ebd7;color:#54704d;margin-top:8px;font-size:12px}.text-button{border:0;background:none;color:#607654;font-size:11px;padding:11px}.menu-card .menu-note{font-size:10px;margin:3px 0;color:#8b967f}#help{font-size:11px;line-height:1.7;text-align:left;border-top:1px solid #d5ddc3}#help p{margin:7px 0}.stars{color:#c59b3e!important;font-size:24px!important;letter-spacing:5px}.results{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:10px 0 14px}.results div{background:#e9efda;border-radius:8px;padding:6px}.results dt{font-size:10px;color:#7b8a6e}.results dd{font-size:19px;font-weight:700;margin:3px}.return-link{display:block;font-size:11px;color:#607654;margin-top:8px}
.bottom-dock{flex:none;display:grid;grid-template-columns:minmax(160px,1fr) auto minmax(160px,1fr);align-items:center;gap:12px;min-height:58px}
.pill-bar{grid-column:1;justify-self:start;background:#234c3f;color:#f9f4dc;border:1px solid #e6dca9;border-radius:13px;padding:9px 12px;display:flex;gap:12px;align-items:center;min-height:51px}.pill-bar span{font-size:12px;font-weight:700;white-space:nowrap}.pill-bar small{font-size:10px;white-space:nowrap;opacity:.8}.pill-bar.ready{color:#ffe184;border-color:#d9ae51}#pill-dots{display:flex;gap:4px;margin-top:5px}#pill-dots i{width:12px;height:12px;background:#54715b;border:1px solid #99ae80;border-radius:50%}#pill-dots i.filled{background:#f3d36b;border-color:#fff0b2}
.touch-controls{grid-column:2;display:flex;align-items:center;justify-content:center;gap:30px;touch-action:none;padding:4px 14px;border:1px solid #ced9be;border-radius:22px;background:#e4ebd8}
#joystick{position:relative;width:86px;height:86px;border:2px solid #b4c7a6;border-radius:50%;background:#c7d7b5;touch-action:none}
#stick{position:absolute;width:36px;height:36px;left:23px;top:23px;border:2px solid #f5f3d9;border-radius:50%;background:#547b5e;pointer-events:none;box-shadow:0 3px 7px #284c3b30}#joystick small{position:absolute;bottom:2px;text-align:center;width:100%;font-size:9px;color:#6d8661;pointer-events:none}
#skill{width:90px;height:76px;border:2px solid #c5cfad;border-radius:20px;background:#638365;color:#e9eddb;box-shadow:0 4px 0 #42664e;touch-action:none}#skill span{display:block;font-size:11px}#skill strong{display:block;font-size:20px;line-height:1.5}#skill.ready{background:#f0d16d;color:#3f5e3c;border-color:#ffe8a2;box-shadow:0 4px 0 #b18d3e}
.toast{grid-column:3;font-size:11px;line-height:1.6;color:#698062;margin:0;text-align:right;max-width:250px}.game-footer{flex:none;display:flex;justify-content:space-between;flex-wrap:wrap;gap:4px;font-size:10px;color:#8b977e}.game-footer small{font-size:9px}
@media(max-width:1000px),(pointer:coarse){.topbar{padding:8px 14px}.topbar>span{font-size:14px}.topbar>span small{display:none}.volume-label{display:none}.game-shell{padding:0 10px 5px;gap:5px}.hud{min-height:37px;padding:0 4px}.hud-label{display:none}.hud-right{gap:8px}.hud-right>strong{font-size:22px}.hud #hearts{font-size:20px}.hud #score,#enemy-count{font-size:10px}.stage{border-width:3px;border-radius:16px}.keyboard-hint,.game-footer small{display:none}.game-footer{justify-content:center;font-size:9px}.bottom-dock{min-height:96px;gap:8px;grid-template-columns:minmax(135px,1fr) auto minmax(0,1fr)}.pill-bar{padding:7px 9px}.pill-bar small{display:none}.toast{font-size:10px}.touch-controls{gap:20px;padding:4px 12px}}
@media(orientation:portrait) and (max-width:1000px){.bottom-dock{display:flex;flex-direction:column;gap:6px;min-height:139px}.pill-bar{align-self:stretch;min-height:34px;justify-content:flex-start;border-radius:10px;padding:5px 10px;gap:16px}.pill-bar>div{display:flex;gap:12px;align-items:center}.pill-bar small{display:block;font-size:9px}#pill-dots{margin-top:0;gap:3px}#pill-dots i{width:10px;height:10px}.pill-bar span{font-size:11px}.touch-controls{align-self:center}.toast{display:none}.topbar{font-size:10px;gap:6px}.sound-tools button{font-size:10px;padding:5px 9px}.menu-card{padding:14px 20px}.menu-card h1{font-size:32px;margin:10px 0}.menu-card>p{font-size:11px;margin:8px 0}.menu-card .food-copy{padding:6px}.game-footer{display:none}}
@media(orientation:landscape) and (max-height:550px){.topbar{padding:4px 12px;font-size:10px}.topbar>span{font-size:12px}.sound-tools button{font-size:10px;padding:4px 8px}.game-shell{gap:3px}.hud{min-height:30px}.hud #hearts{font-size:18px}.hud-right>strong{font-size:18px}.hud button{width:27px;height:27px}.game-footer,.toast{display:none}.bottom-dock{min-height:88px}.touch-controls{gap:18px;padding:3px 10px}#joystick{width:76px;height:76px}#stick{left:18px;top:18px}#skill{height:66px;width:85px}.menu-card{width:460px;padding:10px 16px;display:grid;grid-template-columns:1fr 1fr;gap:5px 12px;align-items:center}.menu-card h1{font-size:25px;margin:0;grid-column:1}.menu-card h1 small{font-size:12px}.menu-card .badge{grid-column:1}.menu-card>p{font-size:10px;margin:0}.menu-card .food-copy{display:none}.menu-card .primary,.menu-card .secondary{padding:8px;margin:0}.menu-card .menu-note{display:none}.menu-card h2{font-size:21px;margin:5px}.results{gap:4px;margin:0}.results dd{font-size:15px}.text-button{padding:5px}#help{grid-column:1/-1}}
@media(max-height:650px) and (orientation:portrait){.topbar{padding-top:5px;padding-bottom:5px}.game-shell{gap:3px}.menu-card{padding:10px 15px}.menu-card h1{font-size:27px;margin:5px 0}.menu-card h1 small{font-size:12px}.menu-card>p{margin:5px 0}.menu-card .food-copy{display:none}.primary{padding:8px}.text-button{padding:8px}.bottom-dock{min-height:128px}.touch-controls{padding:2px 12px}#joystick{width:78px;height:78px}#stick{left:19px;top:19px}#skill{height:68px}.menu-card .menu-note{display:none}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}

.start-audio-note{display:block;color:#7b8b71;font-size:10px;margin-top:6px}
#bonus-time{font-size:10px;color:#8b6633;white-space:nowrap}#audio-summary{font-size:10px;color:#6d8063}
.sound-overlay{position:fixed;inset:0;z-index:20;background:#254c4270;display:flex;align-items:center;justify-content:center;padding:16px;overflow:auto}
.sound-card{width:380px;max-width:100%;max-height:100%;overflow:auto;background:#fbf8ed;border:1px solid white;border-radius:22px;padding:24px;box-shadow:0 12px 45px #203e3230;text-align:center}
.sound-card h2{font-size:22px;margin:16px 0}.sound-card p{font-size:12px;color:#718169;line-height:1.7}
.audio-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid #d9dfc8}
.audio-row button{padding:9px 12px;border:1px solid #b9c9aa;border-radius:18px;background:#e3ecd4;color:#315640;font-size:13px;min-width:90px}
.audio-row label{display:flex;flex-direction:column;gap:7px;font-size:11px;text-align:left}.audio-row input{width:150px;max-width:100%;accent-color:#426b50}
@media(max-width:1000px){#audio-summary{display:none}.hud-right{display:grid;grid-template-columns:auto auto 34px;column-gap:6px;row-gap:0}.hud-right>strong{grid-column:1;grid-row:1}.hud-right>#score{grid-column:2;grid-row:1}.hud-right>button{grid-column:3;grid-row:1 / span 2}#bonus-time{font-size:9px;grid-column:1 / span 2;grid-row:2}.sound-card{padding:18px}.audio-row input{width:120px}}
@media(orientation:landscape) and (max-height:550px){.sound-card{padding:12px 20px;width:460px}.sound-card h2{font-size:18px;margin:8px 0}.sound-card p{margin:5px 0}.audio-row{padding:6px 0}.start-audio-note{display:none}}


.audio-preview{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.audio-preview button{flex:1;min-height:40px}.sound-card{max-height:calc(100dvh - 24px);overflow:auto}

/* Keep the thumb centered at every existing responsive control size. */
#stick{left:calc(50% - 18px);top:calc(50% - 18px)}
#game{touch-action:none}
