:root{--ink:#3b302d;--muted:#7e6d68;--accent:#ee786e;--gold:#d5a04f;--line:rgba(63,43,35,.12);--shadow:0 18px 50px rgba(94,63,45,.18)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:radial-gradient(circle at 50% -10%,#fffdf8 0,#f9eee5 52%,#efd8ca 100%);color:var(--ink);font-family:Inter,Pretendard,"Noto Sans KR",system-ui,sans-serif}body{min-height:100vh;overflow-x:hidden}.app-shell{width:min(100%,520px);min-height:100vh;margin:auto;padding:18px 16px 28px}.topbar,.hud,.mode-tabs{display:flex;align-items:center}.topbar{justify-content:space-between;gap:12px}.eyebrow{margin:0 0 2px;font-size:10px;font-weight:900;letter-spacing:.14em;color:var(--accent)}h1{margin:0;font-size:clamp(23px,7vw,34px);line-height:1.05;letter-spacing:-.04em}.hud{margin:17px 0 12px;padding:12px 13px;border:1px solid rgba(255,255,255,.8);border-radius:18px;background:rgba(255,255,255,.66);backdrop-filter:blur(12px);box-shadow:0 10px 35px rgba(102,72,55,.08);gap:14px}.hud>div{display:grid;gap:1px;min-width:0}.hud>div:first-child{flex:1}.hud small{font-size:9px;font-weight:900;letter-spacing:.15em;color:var(--muted)}.hud strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.icon-button{border:0;background:#f0e7de;color:var(--ink);font-weight:800;border-radius:11px;padding:9px 10px}.mode-tabs{gap:6px;padding:5px;background:rgba(91,65,53,.08);border-radius:15px}.mode-tab{flex:1;border:0;border-radius:11px;padding:10px 5px;background:transparent;color:var(--muted);font-size:11px;font-weight:900}.mode-tab.active{background:#fff;color:var(--ink);box-shadow:0 5px 16px rgba(72,48,38,.12)}.stage-card{position:relative;margin-top:10px;width:100%;aspect-ratio:1/1.12;border-radius:28px;overflow:hidden;background:linear-gradient(155deg,#f8e8d8,#e4b98e);box-shadow:var(--shadow);border:1px solid rgba(255,255,255,.82)}#game-canvas{display:block;width:100%;height:100%;touch-action:none}.busy{position:absolute;inset:0;display:grid;place-items:center;background:rgba(255,250,244,.42);backdrop-filter:blur(3px);font-weight:900}.busy[hidden]{display:none!important}.toast{position:absolute;left:50%;bottom:18px;transform:translate(-50%,12px);opacity:0;pointer-events:none;background:rgba(54,41,37,.88);color:white;padding:8px 13px;border-radius:999px;font-size:12px;font-weight:800;transition:.25s}.toast.show{opacity:1;transform:translate(-50%,0)}.controls{text-align:center;padding:14px 5px 0}.primary-button{width:100%;border:0;border-radius:17px;padding:15px;color:white;background:linear-gradient(135deg,var(--accent),#f0a062);box-shadow:0 10px 24px rgba(218,103,88,.28);font-size:14px;font-weight:950;letter-spacing:.02em}.primary-button:active{transform:translateY(2px)}#hint{min-height:34px;margin:10px 6px 0;color:var(--muted);font-size:11px;line-height:1.45}.kr{--accent:#c26a52;background:radial-gradient(circle at 50% -10%,#fffdf4 0,#f7ecdc 55%,#e7cfb6 100%)}.kr .kr .primary-button{background:linear-gradient(135deg,#bd7658,#9b8b55)}@media(min-width:600px){.app-shell{padding-top:28px}.stage-card{aspect-ratio:1/1}}
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@700;900&family=Gowun+Dodum&display=swap');
.viewport-hud{
  width:min(92vw,440px);height:100dvh;margin:0 auto;box-sizing:border-box;
  padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));
}
#splash-screen{
  position:fixed;inset:0;z-index:1000;overflow:hidden;background:#9d6745;
  font-family:'Fredoka','Gowun Dodum',system-ui,sans-serif;
  transition:opacity .4s ease;
}
#splash-screen::before{
  content:"";position:absolute;inset:-24px;pointer-events:none;
  background:url('../assets/ui/gonu_title_background.jpg') center 42% / cover no-repeat;
  filter:blur(20px) brightness(.76);
}
#title-screen{
  --top-inset:max(12px,env(safe-area-inset-top));
  --bottom-inset:max(12px,env(safe-area-inset-bottom));
  position:relative;display:grid;place-items:center;
}
.splash-art{
  position:relative;container-type:inline-size;
  width:min(100%,calc((100dvh - var(--top-inset) - var(--bottom-inset)) * 1536 / 2752));
  aspect-ratio:1536 / 2752;
  background:url('../assets/ui/gonu_title_background.jpg') center / contain no-repeat;
  box-shadow:0 12px 40px #46260f59;
}
.game-hidden{visibility:hidden;height:100vh;overflow:hidden}
.splash-leave{opacity:0;pointer-events:none}
body.game-active #splash-screen{display:none}
body.game-active #splash-screen::before{display:none;filter:none}
body.game-active .guide-backdrop{background:transparent;backdrop-filter:none}
html:is([lang="en"],[lang="ja"]) .app-shell:not(.game-hidden) .game-hud #game-title{
  font-size:clamp(12px,3.5vw,18px);line-height:1.08;white-space:normal;
}
.splash-heading{
  position:absolute;inset:12% 15% auto;height:21%;display:grid;place-items:center;
  text-align:center;pointer-events:none;
}
.splash-title h1{
  margin:0;color:#ff9a40;font-size:clamp(14px,10.1cqw,44px);font-weight:900;
  line-height:.97;letter-spacing:-.035em;
  -webkit-text-stroke:.105em #fff1d2;paint-order:stroke fill;
  filter:drop-shadow(0 .06em 0 #6d2c15) drop-shadow(0 .045em .025em #44220dcc);
}
.splash-title h1 span{display:block}
.splash-title h1 span:last-child{color:#ff8048}
.splash-subtitle{
  margin: .45em 0 0;color:#fff0d3;font-size:clamp(10px,4.9cqw,22px);
  font-weight:900;line-height:1;letter-spacing:-.035em;text-shadow:0 2px 2px #5a2d13;
}
.splash-controls{position:absolute;inset:0;pointer-events:none}
.splash-util-row{display:contents}
#btn-start,.splash-util,#lang-bar{
  position:absolute;pointer-events:auto;
  border:1px solid #fff1d5;border-radius:clamp(6px,3cqw,16px);
  box-shadow:inset 0 0 0 2px #dcad8c80,0 3px 0 #9e623e,0 5px 9px #3d180b66;
}
#btn-start{
  left:28%;bottom:9.8%;width:44%;height:10%;padding:0;display:grid;place-items:center;
  background:none;box-shadow:none;border:0;color:#62361f;
  font:900 clamp(9px,4.6cqw,21px)/1 'Fredoka','Gowun Dodum',system-ui,sans-serif;
  text-shadow:0 1px #fff1d4;cursor:pointer;transition:transform .12s;
}
#btn-start::before{
  content:"";position:absolute;inset:5% 0 0;pointer-events:none;
  background:url('../assets/ui/gonu_start_sheet.jpg') 50.34% 41.52% / 123.671% 625.455% no-repeat;
  clip-path:polygon(0.48% 77.73%,1.13% 70.45%,2.09% 58.64%,2.74% 46.82%,3.22% 31.36%,4.35% 24.55%,6.12% 21.82%,11.59% 21.36%,12.40% 13.64%,14.49% 6.82%,16.75% 4.09%,19.48% 4.55%,26.09% 8.18%,36.23% 11.36%,45.73% 11.82%,57.00% 11.82%,66.67% 9.09%,76.97% 2.73%,82.61% 0.91%,85.35% 2.27%,86.96% 7.27%,88.57% 20.91%,92.91% 21.36%,95.01% 23.18%,96.30% 31.36%,97.75% 46.82%,97.75% 59.09%,98.71% 65.45%,99.36% 75.91%,99.19% 86.36%,97.75% 90.00%,95.81% 91.82%,77.29% 93.18%,75.85% 99.09%,72.30% 93.18%,62.96% 93.64%,6.12% 93.18%,3.06% 91.36%,1.13% 86.82%);
}
#btn-start .lang-text{
  position:absolute;top:42%;left:10%;right:10%;transform:translateY(-50%);text-align:center;
}
#btn-start:active,.splash-util:active{transform:translateY(2px)}
.splash-util,#lang-bar{background:linear-gradient(#fff6e6,#efc6a4)}
.splash-util{
  bottom:9.8%;width:10.8%;aspect-ratio:1;padding:0;display:grid;place-items:center;
  color:#655f85;font:clamp(10px,4.8cqw,20px)/1 "Segoe UI Emoji",system-ui,sans-serif;
  cursor:pointer;
}
#btn-sound{left:3.5%}
#btn-howto{right:15.5%}
#btn-settings{right:3.5%}
#lang-bar{
  left:15%;bottom:2.9%;width:70%;height:5.3%;display:grid;grid-template-columns:repeat(3,1fr);
  padding:0 4%;transition:transform .2s;
}
#lang-bar>span{display:none}
#sound-settings{
  position:absolute;z-index:1;right:3.5%;bottom:18%;width:min(84%,230px);
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;
  padding:9px 12px;border:1px solid #edd0aa;border-radius:12px;
  background:#fff0d9;color:#63402e;box-shadow:0 4px 12px #4c2d2666;
  font:700 clamp(10px,3.6cqw,14px)/1 system-ui,sans-serif;
}
#sound-settings[hidden]{display:none}
#sfx-volume{width:100%;min-width:0;accent-color:#a65f43}
#sound-settings output{min-width:4ch;text-align:right}
.lang-opt{
  padding:0;border:0;background:transparent;color:#65402d;cursor:pointer;
  font:700 clamp(8px,4.2cqw,18px)/1 'Gowun Dodum',system-ui,sans-serif;
}
.lang-opt.active{color:#9b4438;text-decoration:underline;text-underline-offset:3px}
#title-screen button,.game-hud button{white-space:nowrap;word-break:keep-all}
#title-screen button:focus-visible{outline:2px solid #5f3624;outline-offset:2px}
@media(prefers-reduced-motion:reduce){#splash-screen,#btn-start,#lang-bar{transition:none}}


.guide-modal{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:16px;font-family:Inter,Pretendard,"Noto Sans KR",system-ui,sans-serif}
.guide-modal[hidden]{display:none}
.guide-backdrop{position:absolute;inset:0;border:0;background:rgba(54,35,27,.58);backdrop-filter:blur(7px)}
.guide-panel{position:relative;width:min(94vw,81svh,670px);height:auto;aspect-ratio:1585/1800;display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;gap:12px;padding:20px 22px 18px;border:0;border-radius:26px;background:#f8efdf url('../assets/ui/guide_panel_frame.jpg') center/100% 100% no-repeat;box-shadow:0 28px 70px rgba(54,31,21,.34);color:#4d3730;overflow:hidden}
.guide-panel::before{content:none}.guide-header{position:relative;z-index:1;min-height:74px;display:flex;align-items:center;justify-content:flex-end;padding:10px 13px 8px;background:url('../assets/ui/chroma/wood_sign.png') center/76% 100% no-repeat}.guide-heading{position:absolute;left:50%;top:50%;width:62%;text-align:center;transform:translate(-50%,-48%);pointer-events:none}.guide-header small{display:block;color:#76513d;font-size:8px;font-weight:900;letter-spacing:.13em;line-height:1.05}.guide-header h2{margin:3px 0 0;color:#50372c;font-size:22px;line-height:1.05}.guide-header button{position:relative;z-index:2;width:38px;height:38px;border:0;border-radius:50%;background:#f1d8ca;color:#6e4a3d;font-size:26px;line-height:1;cursor:pointer}
.guide-summary{margin:0;padding:11px 13px;border-radius:15px;background:rgba(255,255,255,.58);color:#796057;font-size:12px;line-height:1.55;box-shadow:inset 0 0 0 1px rgba(111,82,61,.06)}
.guide-menu{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.modal-tab{min-height:54px;padding:5px 7px 11px;border:0;background:url('../assets/ui/chroma/tab_inactive.png') no-repeat center;background-size:100% 100%;font-family:'Gowun Dodum',sans-serif;color:#6d4c41;font-size:10px;font-weight:900;line-height:1.25;cursor:pointer;text-shadow:0 1px 2px rgba(255,255,255,.9);filter:drop-shadow(0 3px 3px rgba(81,51,36,.18));transition:transform .15s,filter .15s}.modal-tab.active{background:url('../assets/ui/chroma/tab_active.png') no-repeat center;background-size:100% 100%;color:#bf360c;transform:translateY(-2px);filter:drop-shadow(0 5px 4px rgba(131,64,47,.24))}html[lang="ja"] .modal-tab{font-size:9px}
.guide-content{min-height:0;padding:16px;border-radius:18px;background:rgba(255,255,255,.58);box-shadow:inset 0 0 0 1px rgba(119,78,61,.08);overflow:auto;overscroll-behavior:contain}.guide-content h3{margin:0 0 12px;color:#5d4037;font-size:18px}.guide-content-body,#guide-content-body{white-space:pre-line;color:#66514a;font-size:12px;line-height:1.7;overflow-wrap:anywhere}
.guide-close-bottom{height:44px;border:0;border-radius:14px;background:#7d5a4d;color:#fff;font-weight:900;cursor:pointer}
body.guide-open{overflow:hidden}
@media(max-width:520px){.guide-panel{padding:14px;gap:9px}.guide-menu{grid-template-columns:repeat(2,minmax(0,1fr))}.guide-menu button:last-child{grid-column:1/-1}.guide-summary{font-size:11px}.guide-content{padding:13px}}

/* Main game HUD skin cut from the supplied chroma-key asset sheet. */
.app-shell .topbar{position:relative}.app-shell .topbar::after{content:none}
.app-shell .hud{padding:8px 9px;border:0;background:rgba(255,250,239,.26);box-shadow:none;backdrop-filter:none;gap:7px}
.app-shell .hud>div{min-height:58px;justify-content:center;padding:11px 18px 13px;border:18px solid transparent;border-width:13px 24px;filter:drop-shadow(0 4px 4px rgba(88,55,35,.17))}
.app-shell .hud>div:first-child{border-image:url('../assets/ui/main_skin/hud_unlock.png') 32% 20% fill stretch}.app-shell .hud>div:nth-child(2){min-width:94px;border-image:url('../assets/ui/main_skin/hud_score.png') 32% 20% fill stretch;text-align:center}
.app-shell .hud small{color:#67483a}.app-shell .hud strong{color:#43312a}
.app-shell .hud>.icon-button{min-width:48px;min-height:48px;padding:7px 9px;border-radius:16px;background:url('../assets/ui/main_skin/mode_inactive.png') center/100% 100% no-repeat;filter:drop-shadow(0 3px 3px rgba(88,55,35,.14))}
.app-shell .mode-tabs{gap:8px;padding:3px;background:transparent}.app-shell .mode-tab{min-height:62px;padding:8px 18px 12px;border:22px solid transparent;border-width:15px 26px;border-image:url('../assets/ui/main_skin/mode_inactive.png') 31% 18% fill stretch;background:none;color:#6d4c41;filter:drop-shadow(0 4px 4px rgba(88,55,35,.16))}.app-shell .mode-tab.active{border-image-source:url('../assets/ui/main_skin/mode_active.png');background:none;color:#a74437;box-shadow:none;transform:translateY(-2px)}
.app-shell .controls{position:relative}.app-shell .controls::after{content:"";position:absolute;right:7px;top:13px;width:45px;height:45px;background:url('../assets/ui/main_skin/decor_leaf.png') center/contain no-repeat;pointer-events:none;transform:rotate(10deg)}.app-shell .primary-button{min-height:88px;padding:16px 64px 20px 28px;border:25px solid transparent;border-width:17px 38px;border-image:url('../assets/ui/main_skin/action_button.png') 32% 18% fill stretch;border-radius:0;background:none;box-shadow:none;color:#6b4039;text-shadow:0 1px 1px rgba(255,255,255,.78);filter:drop-shadow(0 7px 6px rgba(101,59,44,.2))}
.app-shell .camera-tools{grid-template-columns:repeat(2,42px);gap:4px;padding:6px;border:0;border-radius:22px;background:rgba(255,248,235,.34);box-shadow:none;backdrop-filter:none}.app-shell .camera-tools button{height:42px;border-radius:50%;color:transparent!important;font-size:0!important;line-height:0;text-shadow:none!important;text-indent:-9999px;overflow:hidden;white-space:nowrap}.app-shell .camera-tools button.active{filter:saturate(1.18) brightness(1.04) drop-shadow(0 3px 3px rgba(95,58,38,.2))}

.toolbar-btn,.toolbar-btn:hover,.toolbar-btn:active,.toolbar-btn:focus,.toolbar-btn.active{background-color:transparent!important;background-image:none!important;border:none!important;outline:none!important;box-shadow:none!important}.toolbar-btn::before,.toolbar-btn::after{display:none!important;content:none!important}.app-shell .camera-tools .toolbar-btn>img{display:block!important;width:100%;height:100%;object-fit:contain;pointer-events:none;text-indent:0}.toolbar-btn[data-view="quarter"]>img{content:url('../assets/ui/main_skin/tool_next.png')}.toolbar-btn[data-view="top"]>img{content:url('../assets/ui/main_skin/tool_book.png')}.toolbar-btn[data-view="left"]>img{content:url('../assets/ui/main_skin/tool_undo.png')}.toolbar-btn[data-view="right"]>img{content:url('../assets/ui/main_skin/tool_undo.png');transform:scaleX(-1)}.toolbar-btn[data-view="auto"]>img{content:url('../assets/ui/main_skin/tool_auto.png')}.toolbar-btn[data-view="reset"]>img{content:url('../assets/ui/main_skin/tool_rotate.png')}
#mochi-skin-toggle{position:absolute;z-index:4;left:10px;top:10px;min-width:88px;height:34px;padding:2px 13px 5px;border:0;background:url('../assets/ui/main_skin/skin_starlight.png') center / contain no-repeat;color:#50302b;font-family:'Gowun Dodum',sans-serif;font-size:10px;font-weight:900;filter:drop-shadow(0 3px 4px rgba(77,45,29,.2));cursor:pointer;white-space:nowrap}
#mochi-skin-toggle[data-skin="classic"]{background-image:url('../assets/ui/main_skin/skin_classic.png')}
#mochi-skin-toggle:focus{outline:none}
#mochi-skin-toggle:focus-visible{
  text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px;
}

/* Full-screen 3D studio: scene coordinates and GLB scales remain unchanged. */
body.game-active{overflow:hidden;background:#211710}.app-shell:not(.game-hidden){position:fixed;inset:0;z-index:1;width:100vw;max-width:none;min-height:100vh;margin:0;padding:0;pointer-events:none;overflow:hidden}.app-shell:not(.game-hidden) .stage-card{position:fixed;inset:0;z-index:0;width:100vw;height:100vh;aspect-ratio:auto;margin:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:hidden;pointer-events:none}.app-shell:not(.game-hidden) #game-canvas{position:fixed;inset:0;z-index:0;width:100vw;height:100vh;pointer-events:auto}.app-shell:not(.game-hidden) .topbar,.app-shell:not(.game-hidden) .hud,.app-shell:not(.game-hidden) .mode-tabs,.app-shell:not(.game-hidden) .controls,.app-shell:not(.game-hidden) .brand-credit{position:fixed;z-index:10;pointer-events:none}.app-shell:not(.game-hidden) button,.app-shell:not(.game-hidden) .mode-tab,.app-shell:not(.game-hidden) #mochi-skin-toggle,.app-shell:not(.game-hidden) .camera-tools{pointer-events:auto}.app-shell:not(.game-hidden) .topbar{top:14px;left:50%;width:min(92vw,520px);transform:translateX(-50%);justify-content:center;text-align:center}.app-shell:not(.game-hidden) .hud{top:70px;left:50%;width:min(94vw,520px);margin:0;transform:translateX(-50%);background:rgba(255,247,235,.52);border-radius:22px;backdrop-filter:blur(8px)}.app-shell:not(.game-hidden) .mode-tabs{top:145px;left:50%;width:min(94vw,520px);transform:translateX(-50%)}.app-shell:not(.game-hidden) .controls{left:50%;bottom:20px;width:min(94vw,520px);padding:0;transform:translateX(-50%)}.app-shell:not(.game-hidden) .brand-credit{left:50%;bottom:2px;width:max-content;padding:0;transform:translateX(-50%);font-size:8px;color:rgba(255,248,235,.78)}.app-shell:not(.game-hidden) .camera-tools{position:fixed;top:14px;right:14px;z-index:12}.app-shell:not(.game-hidden) #mochi-skin-toggle{position:fixed;top:14px;left:14px;z-index:12}.app-shell:not(.game-hidden) .orbit-tip{position:fixed;z-index:9;bottom:120px}.app-shell:not(.game-hidden) #hint{margin-top:4px;color:#fff;text-shadow:0 1px 4px rgba(45,24,14,.75)}
@media(max-width:620px){.app-shell:not(.game-hidden) .topbar{top:8px}.app-shell:not(.game-hidden) .topbar .eyebrow{font-size:8px}.app-shell:not(.game-hidden) .topbar h1{font-size:22px}.app-shell:not(.game-hidden) .hud{top:48px;max-width:calc(100vw - 16px);transform:translateX(-50%) scale(.92);transform-origin:top center}.app-shell:not(.game-hidden) .mode-tabs{top:116px;max-width:calc(100vw - 16px)}.app-shell:not(.game-hidden) .camera-tools{top:184px;right:8px}.app-shell:not(.game-hidden) #mochi-skin-toggle{top:184px;left:8px}.app-shell:not(.game-hidden) .controls{bottom:12px}.app-shell:not(.game-hidden) .orbit-tip{bottom:112px}}

/* Full-screen HUD composition v2: keep the board clear and frame the title. */
.app-shell:not(.game-hidden) .topbar{
  top:10px;left:50%;width:360px;height:112px;padding:20px 46px 24px;
  transform:translateX(-50%);display:flex;align-items:center;justify-content:center;
  background:url('../assets/ui/main_skin/mode_inactive.png') center/100% 100% no-repeat;
  filter:drop-shadow(0 7px 6px rgba(58,35,23,.28));
}
.app-shell:not(.game-hidden) .topbar>div{width:100%;text-align:center}
.app-shell:not(.game-hidden) .topbar .eyebrow{margin:0 0 3px;color:#b76550;font-size:9px;letter-spacing:.13em;text-shadow:0 1px 0 #fff}
.app-shell:not(.game-hidden) .topbar h1{margin:0;color:#4b352c;font-size:32px;line-height:1;font-weight:950;text-shadow:0 2px 0 rgba(255,255,255,.8)}
.app-shell:not(.game-hidden) .hud{
  top:14px;left:14px;width:320px;margin:0;padding:3px;transform:none;
  display:grid;grid-template-columns:1fr 92px repeat(3,44px);gap:3px;
  background:transparent;border-radius:0;backdrop-filter:none;
}
.app-shell:not(.game-hidden) .hud>div{min-height:70px;padding:12px 13px 14px;border-width:12px 18px}
.app-shell:not(.game-hidden) .hud>div:nth-child(2){min-width:0}
.app-shell:not(.game-hidden) .hud small{font-size:8px}.app-shell:not(.game-hidden) .hud strong{font-size:11px}
.app-shell:not(.game-hidden) .hud>.icon-button{align-self:center;min-width:42px;min-height:42px;padding:5px;font-size:0}
.app-shell:not(.game-hidden) .hud>#reset-button{font-size:9px}
.app-shell:not(.game-hidden) .hud>#sound-toggle,.app-shell:not(.game-hidden) .hud>#next-track{font-size:16px}
.app-shell:not(.game-hidden) .mode-tabs{
  top:112px;left:50%;width:min(500px,48vw);height:64px;padding:0;gap:4px;transform:translateX(-50%);
}
.app-shell:not(.game-hidden) .mode-tab{min-height:60px;padding:8px 18px 12px;border-width:14px 25px;font-size:12px}
.app-shell:not(.game-hidden) .camera-tools{top:14px;right:14px;padding:7px;background:rgba(255,248,235,.48);border-radius:26px;filter:drop-shadow(0 5px 5px rgba(58,35,23,.2))}
.app-shell:not(.game-hidden) #mochi-skin-toggle{top:100px;left:18px;min-width:112px;height:42px;font-size:11px}
.app-shell:not(.game-hidden) .controls{left:50%;bottom:26px;width:min(600px,64vw);padding:0;transform:translateX(-50%)}
.app-shell:not(.game-hidden) .primary-button{min-height:74px;padding:12px 68px 17px 32px;font-size:16px}
.app-shell:not(.game-hidden) #hint{min-height:0;margin:1px 0 0;color:#fff;font-size:10px;text-shadow:0 2px 5px rgba(35,20,12,.95)}
.app-shell:not(.game-hidden) .brand-credit{display:none}
.app-shell:not(.game-hidden) .orbit-tip{bottom:114px}

@media(max-width:900px){
  .app-shell:not(.game-hidden) .topbar{width:300px;height:94px;padding:16px 38px 20px}
  .app-shell:not(.game-hidden) .topbar h1{font-size:26px}
  .app-shell:not(.game-hidden) .topbar .eyebrow{font-size:7px}
  .app-shell:not(.game-hidden) .hud{top:100px;left:8px;width:300px;grid-template-columns:1fr 82px repeat(3,39px)}
  .app-shell:not(.game-hidden) .hud>div{min-height:62px;padding:10px 10px 12px}
  .app-shell:not(.game-hidden) .hud>.icon-button{min-width:37px;min-height:37px}
  .app-shell:not(.game-hidden) .mode-tabs{top:92px;width:min(430px,58vw)}
  .app-shell:not(.game-hidden) .camera-tools{top:8px;right:8px}
  .app-shell:not(.game-hidden) #mochi-skin-toggle{top:8px;left:8px}
  .app-shell:not(.game-hidden) .controls{width:min(540px,82vw);bottom:18px}
}

@media(max-width:620px){
  .app-shell:not(.game-hidden) .topbar{top:6px;width:250px;height:78px;padding:12px 31px 16px}
  .app-shell:not(.game-hidden) .topbar h1{font-size:21px}
  .app-shell:not(.game-hidden) .topbar .eyebrow{display:none}
  .app-shell:not(.game-hidden) .hud{top:82px;left:6px;width:calc(100vw - 12px);grid-template-columns:1fr 76px repeat(3,36px);transform:none}
  .app-shell:not(.game-hidden) .hud>div{min-height:56px;padding:8px 8px 10px;border-width:10px 14px}
  .app-shell:not(.game-hidden) .hud>.icon-button{min-width:34px;min-height:34px}
  .app-shell:not(.game-hidden) .mode-tabs{top:140px;width:calc(100vw - 12px);height:54px}
  .app-shell:not(.game-hidden) .mode-tab{min-height:52px;padding:6px 12px 10px;border-width:12px 20px;font-size:10px}
  .app-shell:not(.game-hidden) .camera-tools{top:198px;right:6px;grid-template-columns:repeat(2,38px)}
  .app-shell:not(.game-hidden) .camera-tools button{height:38px}
  .app-shell:not(.game-hidden) #mochi-skin-toggle{top:198px;left:6px;height:38px}
  .app-shell:not(.game-hidden) .controls{bottom:10px;width:calc(100vw - 18px)}
  .app-shell:not(.game-hidden) .primary-button{min-height:66px;font-size:14px}
  .app-shell:not(.game-hidden) .orbit-tip{bottom:100px}
}

/* Compact summon banner cut from the original UI sheet. */
.app-shell:not(.game-hidden) .controls{width:210px;bottom:18px}
.app-shell:not(.game-hidden) .controls::after{right:-2px;top:-3px;width:34px;height:34px}
.app-shell:not(.game-hidden) .primary-button{
  width:210px;min-height:0;height:72px;padding:8px 35px 13px 22px;
  border-width:13px 27px;font-size:14px;white-space:nowrap;
}
.app-shell:not(.game-hidden) #hint{position:absolute;left:50%;top:68px;width:340px;transform:translateX(-50%);font-size:9px}
@media(max-width:620px){
  .app-shell:not(.game-hidden) .controls{width:180px;bottom:12px}
  .app-shell:not(.game-hidden) .primary-button{width:180px;height:62px;padding:7px 29px 11px 18px;border-width:11px 23px;font-size:13px}
  .app-shell:not(.game-hidden) #hint{top:58px;width:280px}
}

/* Collision guard: HUD items wrap inside their own panel instead of crossing mode banners. */
.app-shell:not(.game-hidden) .hud{
  width:320px;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:70px 40px;
  gap:2px 4px;
}
.app-shell:not(.game-hidden) .hud>div:first-child{grid-column:1/5;grid-row:1}
.app-shell:not(.game-hidden) .hud>div:nth-child(2){grid-column:5/7;grid-row:1}
.app-shell:not(.game-hidden) .hud>#reset-button{grid-column:1/3;grid-row:2}
.app-shell:not(.game-hidden) .hud>#sound-toggle{grid-column:3/5;grid-row:2}
.app-shell:not(.game-hidden) .hud>#next-track{grid-column:5/7;grid-row:2}
.app-shell:not(.game-hidden) .hud>.icon-button{width:100%;height:38px;min-width:0;min-height:0;padding:4px}

@media(max-width:620px){
  .app-shell:not(.game-hidden) .mode-tabs{top:86px}
  .app-shell:not(.game-hidden) .hud{
    top:146px;left:6px;width:286px;height:104px;
    grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:64px 36px;
  }
  .app-shell:not(.game-hidden) .hud>div{min-height:60px}
  .app-shell:not(.game-hidden) .hud>.icon-button{height:34px}
  .app-shell:not(.game-hidden) #mochi-skin-toggle{top:8px;left:6px}
  .app-shell:not(.game-hidden) .camera-tools{top:8px;right:6px}
}

/* Bottom HUD layout: preserve the skin selector and title positions. */
.app-shell:not(.game-hidden) .mode-tabs{
  top:auto;bottom:108px;left:50%;width:min(500px,48vw);transform:translateX(-50%);
}
.app-shell:not(.game-hidden) .hud{
  top:auto;right:14px;bottom:10px;left:auto;transform:none;
}
.app-shell:not(.game-hidden) .controls{
  right:auto;bottom:14px;left:18px;transform:none;
}
.app-shell:not(.game-hidden) .orbit-tip{bottom:184px}

@media(max-width:900px){
  .app-shell:not(.game-hidden) .mode-tabs{top:auto;bottom:106px;width:min(430px,58vw)}
  .app-shell:not(.game-hidden) .hud{top:auto;right:8px;bottom:8px;left:auto}
  .app-shell:not(.game-hidden) .controls{right:auto;bottom:10px;left:8px}
}

@media(max-width:620px){
  .app-shell:not(.game-hidden) .mode-tabs{top:auto;bottom:112px;width:calc(100vw - 12px)}
  .app-shell:not(.game-hidden) .hud{top:auto;right:6px;bottom:6px;left:auto}
  .app-shell:not(.game-hidden) .controls{right:auto;bottom:8px;left:6px}
  .app-shell:not(.game-hidden) .orbit-tip{bottom:174px}
}

/* Compact mode banners directly beneath the title banner. */
.app-shell:not(.game-hidden) .mode-tabs{
  top:104px;bottom:auto;left:50%;width:336px;height:50px;gap:2px;transform:translateX(-50%);
}
.app-shell:not(.game-hidden) .mode-tab{
  min-height:48px;padding:5px 12px 9px;border-width:11px 18px;font-size:11px;line-height:1.1;
  font-weight:950;text-shadow:0 1px 1px #fff,0 0 3px rgba(255,255,255,.9);
}
@media(max-width:900px){
  .app-shell:not(.game-hidden) .mode-tabs{top:86px;bottom:auto;width:280px;height:46px}
  .app-shell:not(.game-hidden) .mode-tab{min-height:44px;padding:4px 9px 8px;border-width:10px 15px;font-size:10.5px}
}
@media(max-width:620px){
  .app-shell:not(.game-hidden) .mode-tabs{top:72px;bottom:auto;width:238px;height:42px}
  .app-shell:not(.game-hidden) .mode-tab{min-height:40px;padding:3px 6px 7px;border-width:9px 12px;font-size:10.5px;letter-spacing:-.03em;white-space:nowrap}
}

/* Safe-area HUD shell: one centered overlay with non-overlapping top and bottom zones. */
.app-shell:not(.game-hidden){
  inset:0;left:0;right:0;width:100%;max-width:460px;height:100dvh;min-height:0;margin:0 auto;
  padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));
  display:flex;flex-direction:column;justify-content:space-between;overflow:visible;
}
.app-shell:not(.game-hidden) .topbar{position:absolute;top:max(8px,env(safe-area-inset-top));left:50%;z-index:14}
.app-shell:not(.game-hidden) #mochi-skin-toggle{position:absolute;top:max(8px,env(safe-area-inset-top));left:8px;z-index:16}
.app-shell:not(.game-hidden) .camera-tools{position:absolute;top:max(8px,env(safe-area-inset-top));right:8px;z-index:16}
.app-shell:not(.game-hidden) .mode-tabs{position:absolute;z-index:13}
.app-shell:not(.game-hidden) .bottom-hud{
  position:absolute;z-index:15;right:12px;bottom:max(10px,env(safe-area-inset-bottom));left:12px;
  display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:58px 46px 18px;
  gap:5px 6px;pointer-events:none;
}
.app-shell:not(.game-hidden) .bottom-hud .hud,.app-shell:not(.game-hidden) .bottom-hud .controls{display:contents}
.app-shell:not(.game-hidden) .bottom-hud .hud>div{position:relative;min-width:0;min-height:58px;padding:9px 14px 11px}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:first-child{grid-column:1/5;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:nth-child(2){grid-column:5/7;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud .hud>.icon-button{position:relative;width:100%;height:46px;min-width:0;min-height:0;padding:5px;pointer-events:auto}
.app-shell:not(.game-hidden) .bottom-hud #reset-button{grid-column:4;grid-row:2}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle{grid-column:5;grid-row:2}
.app-shell:not(.game-hidden) .bottom-hud #next-track{grid-column:6;grid-row:2}
.app-shell:not(.game-hidden) .bottom-hud #spawn-button{
  grid-column:1/4;grid-row:2;width:100%;height:46px;min-height:0;padding:5px 24px 8px 16px;
  border-width:9px 18px;font-size:clamp(12px,3.2vw,14px);pointer-events:auto;
}
.app-shell:not(.game-hidden) .bottom-hud .controls::after{display:none}
.app-shell:not(.game-hidden) .bottom-hud #hint{
  position:relative;grid-column:1/7;grid-row:3;top:auto;left:auto;width:100%;min-height:0;margin:0;
  transform:none;text-align:center;font-size:clamp(9px,2.3vw,11px);line-height:18px;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;
}
.app-shell:not(.game-hidden) .bottom-hud small{font-size:clamp(8px,2vw,10px)}
.app-shell:not(.game-hidden) .bottom-hud strong{font-size:clamp(10px,2.7vw,13px)}
.app-shell:not(.game-hidden) .orbit-tip{bottom:148px}

@media(max-width:620px){
  .app-shell:not(.game-hidden){max-width:460px;padding-inline:8px}
  .app-shell:not(.game-hidden) .bottom-hud{right:8px;left:8px;grid-template-rows:54px 43px 18px;gap:4px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:54px;padding:7px 10px 9px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>.icon-button{height:43px}
  .app-shell:not(.game-hidden) .bottom-hud #spawn-button{height:43px;font-size:12px}
  .app-shell:not(.game-hidden) .orbit-tip{bottom:140px}
}

/* HUD restore: title, status, and mode rows stay at the top; actions stay at the bottom. */
.app-shell:not(.game-hidden){width:100%;max-width:440px;height:100dvh;margin:0 auto;pointer-events:none}
.app-shell:not(.game-hidden) .topbar{display:flex;visibility:visible;top:10px;width:360px;height:112px}
.app-shell:not(.game-hidden) #mochi-skin-toggle{top:12px;left:6px;min-width:82px;width:82px;height:38px;padding-inline:8px;font-size:10px}
.app-shell:not(.game-hidden) .camera-tools{top:10px;right:6px;grid-template-columns:repeat(2,34px);padding:5px}
.app-shell:not(.game-hidden) .camera-tools button{height:34px}
.app-shell:not(.game-hidden) .bottom-hud{
  top:126px;right:auto;bottom:auto;left:50%;width:330px;height:58px;
  transform:translateX(-50%);display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:58px;gap:4px;
}
.app-shell:not(.game-hidden) .bottom-hud .hud{display:contents;visibility:visible}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:first-child{grid-column:1/4;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:nth-child(2){grid-column:4/5;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud #reset-button{grid-column:5/7;grid-row:1;position:relative;width:100%;height:48px;align-self:center}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle,
.app-shell:not(.game-hidden) .bottom-hud #next-track{
  position:fixed;z-index:16;bottom:max(42px,calc(env(safe-area-inset-bottom) + 42px));width:44px;height:44px;pointer-events:auto;
}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle{left:calc(50% + 72px)}
.app-shell:not(.game-hidden) .bottom-hud #next-track{left:calc(50% + 120px)}
.app-shell:not(.game-hidden) .mode-tabs{top:190px;bottom:auto;width:336px;height:48px}
.app-shell:not(.game-hidden) .game-hud>.controls{
  position:absolute;z-index:15;right:auto;bottom:max(12px,env(safe-area-inset-bottom));left:8px;width:180px;
  transform:none;display:flex;flex-direction:column;gap:6px;padding:0;pointer-events:none;
}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button{width:180px;height:48px;min-height:0;padding:5px 24px 8px 16px;border-width:9px 18px;pointer-events:auto}
.app-shell:not(.game-hidden) .game-hud>.controls::after{display:none}
.app-shell:not(.game-hidden) .game-hud>.controls #hint{
  position:fixed;right:8px;bottom:max(10px,env(safe-area-inset-bottom));left:8px;top:auto;width:auto;margin:0;
  transform:none;text-align:center;font-size:clamp(9px,2.2vw,11px);line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.app-shell:not(.game-hidden) .orbit-tip{bottom:84px}

@media(max-width:900px){
  .app-shell:not(.game-hidden) .topbar{top:8px;width:300px;height:94px}
  .app-shell:not(.game-hidden) .bottom-hud{top:106px;width:310px;height:56px;grid-template-rows:56px}
  .app-shell:not(.game-hidden) .mode-tabs{top:166px;width:280px}
}
@media(max-width:620px){
  .app-shell:not(.game-hidden) .topbar{top:6px;width:250px;height:78px}
  .app-shell:not(.game-hidden) #mochi-skin-toggle{top:8px;width:78px;min-width:78px;height:36px;font-size:9px}
  .app-shell:not(.game-hidden) .camera-tools{top:6px;grid-template-columns:repeat(2,32px);padding:4px}
  .app-shell:not(.game-hidden) .camera-tools button{height:32px}
  .app-shell:not(.game-hidden) .bottom-hud{top:88px;width:292px;height:54px;grid-template-rows:54px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:54px;padding:7px 9px 9px}
  .app-shell:not(.game-hidden) .bottom-hud #reset-button{height:43px;font-size:8px}
  .app-shell:not(.game-hidden) .mode-tabs{top:146px;width:238px;height:42px}
  .app-shell:not(.game-hidden) .game-hud>.controls{bottom:max(12px,env(safe-area-inset-bottom));left:6px;width:166px}
  .app-shell:not(.game-hidden) .game-hud>.controls .primary-button{width:166px;height:44px;font-size:12px}
  .app-shell:not(.game-hidden) .bottom-hud #sound-toggle{left:calc(50% + 50px)}
  .app-shell:not(.game-hidden) .bottom-hud #next-track{left:calc(50% + 98px)}
}

/* Canonical HUD composition: one hierarchy, three scales, clear play space. */
.app-shell:not(.game-hidden){
  position:fixed;inset:0;left:0;right:0;width:100%;max-width:440px;height:100dvh;margin:0 auto;padding:0;
  display:block;overflow:visible;pointer-events:none;
}
.app-shell:not(.game-hidden) .topbar{
  position:absolute!important;display:flex!important;visibility:visible!important;z-index:20;
  top:max(8px,env(safe-area-inset-top));left:50%;width:240px;height:76px;padding:13px 30px 17px;
  transform:translateX(-50%);background-size:100% 100%;
}
.app-shell:not(.game-hidden) .topbar .eyebrow{font-size:clamp(6px,1.7vw,8px);margin-bottom:2px}
.app-shell:not(.game-hidden) .topbar h1{font-size:clamp(20px,5.8vw,27px);line-height:1}
.app-shell:not(.game-hidden) #mochi-skin-toggle{
  position:absolute!important;z-index:22;top:max(10px,env(safe-area-inset-top));left:4px;
  width:76px;min-width:76px;height:34px;padding:1px 6px 4px;font-size:9px;
}
.app-shell:not(.game-hidden) .camera-tools{
  position:absolute!important;z-index:22;top:max(7px,env(safe-area-inset-top));right:4px;
  grid-template-columns:repeat(2,30px);gap:2px;padding:4px;border-radius:18px;
}
.app-shell:not(.game-hidden) .camera-tools button{width:30px;height:30px}

.app-shell:not(.game-hidden) .bottom-hud{
  position:absolute!important;z-index:19;top:max(88px,calc(env(safe-area-inset-top) + 88px));right:auto;bottom:auto;left:50%;
  width:286px;height:52px;transform:translateX(-50%);display:grid;
  grid-template-columns:3fr 1.35fr 1.65fr;grid-template-rows:52px;gap:4px;
}
.app-shell:not(.game-hidden) .bottom-hud .hud{display:contents!important;visibility:visible!important}
.app-shell:not(.game-hidden) .bottom-hud .hud>div{min-width:0;min-height:52px;padding:7px 9px 9px;border-width:10px 14px}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:first-child{grid-column:1;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:nth-child(2){grid-column:2;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud #reset-button{
  position:relative!important;grid-column:3;grid-row:1;align-self:center;inset:auto;width:100%;height:42px;min-width:0;min-height:0;
  font-size:clamp(8px,2vw,10px);pointer-events:auto;
}
.app-shell:not(.game-hidden) .bottom-hud small{font-size:clamp(7px,1.8vw,9px)}
.app-shell:not(.game-hidden) .bottom-hud strong{font-size:clamp(9px,2.5vw,12px)}

.app-shell:not(.game-hidden) .mode-tabs{
  position:absolute!important;z-index:18;top:max(144px,calc(env(safe-area-inset-top) + 144px));bottom:auto;left:50%;
  width:232px;height:40px;gap:2px;transform:translateX(-50%);
}
.app-shell:not(.game-hidden) .mode-tab{
  min-height:40px;padding:3px 5px 7px;border-width:9px 12px;
  font-size:clamp(9.5px,2.6vw,11px);line-height:1;letter-spacing:-.035em;white-space:nowrap;
}

.app-shell:not(.game-hidden) .game-hud>.controls{
  position:absolute!important;z-index:20;right:auto;bottom:max(32px,calc(env(safe-area-inset-bottom) + 32px));left:50%;
  width:166px;padding:0;transform:translateX(-58%);display:block;pointer-events:none;
}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button{
  width:166px;height:46px;min-height:0;padding:5px 24px 8px 16px;border-width:9px 18px;
  font-size:clamp(12px,3vw,14px);pointer-events:auto;
}
.app-shell:not(.game-hidden) .game-hud>.controls::after{display:none!important}
.app-shell:not(.game-hidden) .game-hud>.controls #hint{
  position:fixed;right:8px;bottom:max(7px,env(safe-area-inset-bottom));left:8px;top:auto;width:auto;margin:0;
  transform:none;text-align:center;font-size:clamp(9px,2.2vw,10px);line-height:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle,
.app-shell:not(.game-hidden) .bottom-hud #next-track{
  position:fixed!important;z-index:21;bottom:max(34px,calc(env(safe-area-inset-bottom) + 34px));
  width:42px;height:42px;min-width:0;min-height:0;pointer-events:auto;
}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle{left:calc(50% + 40px)}
.app-shell:not(.game-hidden) .bottom-hud #next-track{left:calc(50% + 86px)}
.app-shell:not(.game-hidden) .orbit-tip{bottom:91px}

@media(max-height:620px){
  .app-shell:not(.game-hidden) .topbar{width:210px;height:66px}
  .app-shell:not(.game-hidden) .bottom-hud{top:74px;width:270px;height:48px;grid-template-rows:48px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:48px}
  .app-shell:not(.game-hidden) .mode-tabs{top:126px;height:38px}
  .app-shell:not(.game-hidden) .mode-tab{min-height:38px}
}

/* Unified two-slot mode selector: one wood panel, transparent hit areas. */
.app-shell:not(.game-hidden) .mode-tabs{
  padding:10px 12px 12px;gap:8px;
}
.app-shell:not(.game-hidden) .mode-tab,
.app-shell:not(.game-hidden) .mode-tab.active{
  position:relative;min-width:0;height:46px;min-height:46px;padding:0 5px 3px;
  border:2px solid #774533!important;border-radius:15px!important;
  border-image:none!important;
  background:
    linear-gradient(180deg,rgba(255,220,170,.18),rgba(113,55,31,.08)),
    linear-gradient(100deg,#bf7548,#d48d5c 48%,#bd7045)!important;
  box-shadow:
    inset 0 2px 0 rgba(255,214,164,.42),
    inset 0 -4px 0 rgba(103,52,34,.18),
    0 3px 0 rgba(83,43,31,.45)!important;
  color:#fff6e8!important;text-shadow:0 1px 0 #684033;
  filter:none!important;transform:none!important;
}
.app-shell:not(.game-hidden) .mode-tab.active{
  color:#fff!important;
  background:
    linear-gradient(180deg,rgba(255,235,191,.28),rgba(124,57,30,.04)),
    linear-gradient(100deg,#c77a4b,#df9964 48%,#c47749)!important;
  box-shadow:
    inset 0 2px 0 rgba(255,229,185,.58),
    inset 0 -4px 0 rgba(103,52,34,.2),
    0 3px 0 rgba(83,43,31,.5)!important;
}
.app-shell:not(.game-hidden) .mode-tab:focus{outline:none}
.app-shell:not(.game-hidden) .mode-tab:focus-visible{outline:2px solid #fff8df;outline-offset:2px}

/* Final hierarchy requested: title -> modes -> score row; audio tools stay at the top. */
.app-shell:not(.game-hidden) .mode-tabs{
  top:max(84px,calc(env(safe-area-inset-top) + 84px));width:232px;height:40px;
}
.app-shell:not(.game-hidden) .bottom-hud{
  top:max(128px,calc(env(safe-area-inset-top) + 128px));width:286px;height:52px;
}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle,
.app-shell:not(.game-hidden) .bottom-hud #next-track{
  position:absolute!important;top:auto;bottom:auto;width:38px;height:38px;
}
.app-shell:not(.game-hidden) .bottom-hud #sound-toggle{
  position:fixed!important;top:max(50px,calc(env(safe-area-inset-top) + 50px));left:4px;
}
.app-shell:not(.game-hidden) .bottom-hud #next-track{
  position:fixed!important;top:max(50px,calc(env(safe-area-inset-top) + 50px));left:44px;
}
.app-shell:not(.game-hidden) .game-hud>.controls{bottom:max(32px,calc(env(safe-area-inset-bottom) + 32px))}

@media(max-height:620px){
  .app-shell:not(.game-hidden) .mode-tabs{top:70px}
  .app-shell:not(.game-hidden) .bottom-hud{top:112px}
  .app-shell:not(.game-hidden) .bottom-hud #sound-toggle,
  .app-shell:not(.game-hidden) .bottom-hud #next-track{top:44px;width:34px;height:34px}
  .app-shell:not(.game-hidden) .bottom-hud #next-track{left:40px}
}

/* Semantic primary action: the knead/summon control is itself a soft mochi. */
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button{
  position:relative;width:148px;height:58px;min-height:0;padding:5px 17px 8px;
  border:3px solid #704638;border-radius:48% 48% 44% 44% / 47% 47% 40% 40%;
  background:
    radial-gradient(ellipse at 31% 20%,rgba(255,255,255,.92) 0 7%,rgba(255,255,255,0) 18%),
    linear-gradient(180deg,#ffd2db 0%,#f7aebe 58%,#e78fa4 100%);
  color:#6b3d3b;font-family:'Gowun Dodum',sans-serif;font-size:clamp(12px,3vw,14px);font-weight:950;
  text-shadow:0 1px 1px rgba(255,255,255,.9);
  box-shadow:inset 0 4px 7px rgba(255,255,255,.62),inset 0 -7px 8px rgba(181,76,101,.2),0 5px 0 #b96879,0 9px 15px rgba(65,37,27,.28);
  filter:none;overflow:visible;transform:translateY(-2px);transition:transform .1s ease,box-shadow .1s ease;
}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button::before{
  content:"";position:absolute;top:-10px;left:18px;width:20px;height:13px;
  background:#88a84e;border:2px solid #4f672d;border-radius:100% 0 100% 0;
  transform:rotate(-25deg);box-shadow:0 1px 2px rgba(45,36,20,.25);pointer-events:none;
}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button::after{
  content:"";position:absolute;right:16px;bottom:7px;width:26px;height:8px;
  border-radius:50%;background:rgba(180,71,95,.13);filter:blur(2px);pointer-events:none;
}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button:active{
  transform:translateY(3px) scale(.98);
  box-shadow:inset 0 3px 8px rgba(180,73,96,.22),0 1px 0 #ad5e70,0 4px 8px rgba(65,37,27,.2);
}
.app-shell:not(.game-hidden) .game-hud>.controls{width:148px;transform:translateX(-62%)}

/* Keep the primary action and its explanatory tip on separate bottom rows. */
.app-shell:not(.game-hidden) .game-hud>.controls{
  bottom:max(48px,calc(env(safe-area-inset-bottom) + 48px));
}
.app-shell:not(.game-hidden) .game-hud>.controls #hint{
  right:12px;bottom:max(8px,env(safe-area-inset-bottom));left:12px;
  height:22px;line-height:22px;padding:0 8px;border-radius:11px;
  background:rgba(62,39,29,.68);color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.55);
}
.app-shell:not(.game-hidden) .orbit-tip{bottom:124px}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .game-hud>.controls{bottom:max(44px,calc(env(safe-area-inset-bottom) + 44px))}
  .app-shell:not(.game-hidden) .game-hud>.controls #hint{height:20px;line-height:20px}
  .app-shell:not(.game-hidden) .orbit-tip{bottom:116px}
}

/* Independent docks prevent transformed HUD parents from pulling controls out of place. */
.app-shell:not(.game-hidden) .audio-dock{
  position:absolute;z-index:22;top:max(50px,calc(env(safe-area-inset-top) + 50px));left:4px;
  display:flex;align-items:center;gap:4px;pointer-events:none;
}
.app-shell:not(.game-hidden) .audio-dock .icon-button{
  position:static!important;inset:auto!important;width:38px;height:38px;min-width:0;min-height:0;padding:4px;
  border:0;border-radius:13px;background:url('../assets/ui/main_skin/mode_inactive.png') center/100% 100% no-repeat;
  filter:drop-shadow(0 3px 3px rgba(70,43,29,.2));pointer-events:auto;
}
.app-shell:not(.game-hidden) .hint-dock{
  position:absolute;z-index:22;right:10px;bottom:max(7px,env(safe-area-inset-bottom));left:10px;
  height:24px;pointer-events:none;
}
.app-shell:not(.game-hidden) .hint-dock #hint{
  position:static!important;inset:auto!important;width:100%!important;height:24px;margin:0!important;padding:0 10px;
  transform:none!important;border-radius:12px;background:rgba(59,37,28,.72);color:#fff;
  font-size:clamp(9px,2.2vw,10px);line-height:24px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  text-shadow:0 1px 2px rgba(0,0,0,.55);
}
.app-shell:not(.game-hidden) .game-hud>.controls{bottom:max(42px,calc(env(safe-area-inset-bottom) + 42px))}
.app-shell:not(.game-hidden) .game-hud>.controls #hint{display:none}
.app-shell:not(.game-hidden) .bottom-hud{grid-template-columns:3fr 1.35fr 1.65fr}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .audio-dock{top:44px}
  .app-shell:not(.game-hidden) .game-hud>.controls{bottom:max(39px,calc(env(safe-area-inset-bottom) + 39px))}
}

/* Brand scale rule: no banner may visually exceed the Mochi Flip product name. */
.app-shell:not(.game-hidden) .topbar{width:260px;height:80px}
.app-shell:not(.game-hidden) .mode-tabs{width:232px}
.app-shell:not(.game-hidden) .bottom-hud{width:244px;height:48px;grid-template-rows:48px}
.app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:48px;padding:6px 7px 8px;border-width:9px 12px;filter:drop-shadow(0 3px 3px rgba(88,55,35,.13))}
.app-shell:not(.game-hidden) .bottom-hud #reset-button{height:39px}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .topbar{width:230px;height:68px}
  .app-shell:not(.game-hidden) .mode-tabs{width:206px}
  .app-shell:not(.game-hidden) .bottom-hud{width:218px;height:44px;grid-template-rows:44px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:44px}
  .app-shell:not(.game-hidden) .bottom-hud #reset-button{height:36px}
}

/* Role-based sizing: compact read-only data, generous interactive targets. */
.app-shell:not(.game-hidden) .topbar{width:246px}
.app-shell:not(.game-hidden) .mode-tabs{width:226px;height:46px}
.app-shell:not(.game-hidden) .mode-tab{min-height:46px;padding-top:5px;padding-bottom:8px}
.app-shell:not(.game-hidden) .bottom-hud{width:218px;height:48px;grid-template-columns:2.7fr 1.2fr 1.8fr}
.app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:44px}
.app-shell:not(.game-hidden) .bottom-hud #reset-button{height:44px;min-height:44px}
.app-shell:not(.game-hidden) #mochi-skin-toggle{width:84px;min-width:84px;height:44px}
.app-shell:not(.game-hidden) .camera-tools{grid-template-columns:repeat(2,42px)}
.app-shell:not(.game-hidden) .camera-tools button{width:42px;height:42px;min-width:42px;min-height:42px}
.app-shell:not(.game-hidden) .audio-dock .icon-button{width:44px;height:44px;min-width:44px;min-height:44px}
.app-shell:not(.game-hidden) .audio-dock{gap:4px}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .topbar{width:224px}
  .app-shell:not(.game-hidden) .mode-tabs{width:204px;height:44px}
  .app-shell:not(.game-hidden) .mode-tab{min-height:44px}
  .app-shell:not(.game-hidden) .bottom-hud{width:196px;height:44px;grid-template-rows:44px}
  .app-shell:not(.game-hidden) .bottom-hud #reset-button{height:44px;min-height:44px}
}

/* Quick-control family: reset, sound, and next track belong together. */
.app-shell:not(.game-hidden) .audio-dock{
  top:max(58px,calc(env(safe-area-inset-top) + 58px));left:5px;flex-direction:column;gap:4px;
}
.app-shell:not(.game-hidden) .audio-dock .icon-button{
  display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;
}
.app-shell:not(.game-hidden) .audio-dock #reset-button{font-size:0!important}
.app-shell:not(.game-hidden) .audio-dock #reset-button::before{
  content:"↻";display:block;color:#704b3e;font-size:22px;font-weight:950;line-height:1;text-indent:0;
}
.app-shell:not(.game-hidden) .bottom-hud{
  width:176px;grid-template-columns:2.2fr 1fr;
}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:first-child{grid-column:1;grid-row:1}
.app-shell:not(.game-hidden) .bottom-hud .hud>div:nth-child(2){grid-column:2;grid-row:1}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .audio-dock{top:52px}
  .app-shell:not(.game-hidden) .bottom-hud{width:164px}
}

/* Read-only cards may be compact, but their values must remain visible. */
.app-shell:not(.game-hidden) .bottom-hud{
  top:max(132px,calc(env(safe-area-inset-top) + 132px));width:226px;height:44px;
  grid-template-columns:2fr 1fr;grid-template-rows:44px;
}
.app-shell:not(.game-hidden) .bottom-hud .hud>div{
  min-height:44px;height:44px;padding:6px 10px 7px;border:0!important;align-content:center;justify-content:center;overflow:hidden;
  isolation:isolate;
}
.app-shell:not(.game-hidden) .bottom-hud .hud>div::before{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  border:solid transparent;border-width:9px 19px 15px 13px;
  border-image:url('../assets/ui/main_skin/hud_status_wood.png') 40 76 65 52 fill stretch;
}
.app-shell:not(.game-hidden) .bottom-hud .hud small{
  display:block;font-size:8px;line-height:1;white-space:nowrap;
}
.app-shell:not(.game-hidden) .bottom-hud .hud strong{
  display:block;margin-top:4px;font-size:10px;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .bottom-hud{top:114px;width:204px;height:42px;grid-template-rows:42px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>div{min-height:42px;height:42px;padding-block:5px 6px}
}

/* Right-thumb quick controls, attached directly below the camera toolbar. */
.app-shell:not(.game-hidden) .audio-dock{
  top:149px;right:4px;left:auto;padding:4px;gap:1px;
  flex-direction:column;border-radius:19px;background:rgba(255,248,235,.42);
  filter:drop-shadow(0 4px 5px rgba(58,35,23,.18));
}
.app-shell:not(.game-hidden) .audio-dock .icon-button{
  width:42px;height:42px;min-width:42px;min-height:42px;filter:none;
}
@media(max-height:620px){
  .app-shell:not(.game-hidden) .audio-dock{top:143px;right:4px;padding:3px}
  .app-shell:not(.game-hidden) .audio-dock .icon-button{width:40px;height:40px;min-width:40px;min-height:40px}
}

/* Compact bottom action and content-fitted tip banner. */
.app-shell:not(.game-hidden) .game-hud>.controls{width:132px;transform:translateX(-60%)}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button{
  width:132px;height:52px;padding:4px 14px 7px;font-size:12px;border-width:3px;
  box-shadow:inset 0 4px 7px rgba(255,255,255,.62),inset 0 -6px 7px rgba(181,76,101,.2),0 4px 0 #b96879,0 7px 12px rgba(65,37,27,.25);
}
.app-shell:not(.game-hidden) .game-hud>.controls .primary-button::before{top:-9px;left:16px;width:18px;height:12px}
.app-shell:not(.game-hidden) .hint-dock{
  right:auto;left:50%;width:max-content;max-width:calc(100% - 20px);transform:translateX(-50%);
}
.app-shell:not(.game-hidden) .hint-dock #hint{
  width:auto!important;max-width:100%;padding:0 14px;
}

/* Representative HUD proposal: centered brand stack with balanced wooden side rails. */
.app-shell:not(.game-hidden) .topbar{
  top:10px;width:250px;height:78px;padding:7px 26px 11px;border:18px solid transparent;
  border-width:13px 25px;border-image:url('../assets/ui/main_skin/hud_wood.png') 31% 20% fill stretch;
  background:none;filter:drop-shadow(0 6px 5px rgba(55,31,20,.28));
}
.app-shell:not(.game-hidden) .topbar .eyebrow{display:none}
.app-shell:not(.game-hidden) .topbar h1{color:#fff7e7;font-size:clamp(23px,6vw,29px);text-shadow:0 2px 0 #5e392e,1px 0 0 #5e392e,-1px 0 0 #5e392e}

.app-shell:not(.game-hidden) .mode-tabs{
  top:92px;width:250px;height:70px;padding:9px 10px 11px;gap:5px;border:14px solid transparent;
  border-width:10px 17px;border-image:url('../assets/ui/main_skin/hud_wood.png') 31% 20% fill stretch;
  background:none;filter:drop-shadow(0 4px 4px rgba(55,31,20,.22));
}
.app-shell:not(.game-hidden) .mode-tab{
  min-height:48px;height:48px;padding:4px 7px 7px;border-width:10px 13px;font-size:clamp(10px,2.7vw,12px);
}
.app-shell:not(.game-hidden) .bottom-hud{top:166px;width:220px;height:42px;grid-template-rows:42px;gap:5px}
.app-shell:not(.game-hidden) .bottom-hud .hud>div{height:42px;min-height:42px;padding:5px 9px 6px}

.app-shell:not(.game-hidden) #mochi-skin-toggle{
  top:8px;left:4px;width:86px;min-width:86px;height:48px;z-index:24;
  padding:7px 4px 0 0;
}
html:is([lang="en"],[lang="ja"]) .app-shell:not(.game-hidden) #mochi-skin-toggle{font-size:9px}
.app-shell:not(.game-hidden) .audio-dock{
  top:58px;right:auto;left:4px;display:block;width:56px;aspect-ratio:112 / 408;
  padding:0;border:0;border-radius:0;
  background:url('../assets/ui/main_skin/audio_dock_wood.png') center / contain no-repeat;
  box-shadow:none;filter:drop-shadow(0 3px 3px rgba(52,31,21,.28));
}
.app-shell:not(.game-hidden) .audio-dock .icon-button{
  position:absolute!important;inset:auto!important;
  top:var(--dock-slot)!important;left:49%!important;transform:translate(-50%,-50%);
  width:88%;height:22%;min-width:0;min-height:0;padding:0;
  border:0;border-radius:14px;background:transparent;box-shadow:none;filter:none;
  font-size:0;cursor:pointer;
}
.app-shell:not(.game-hidden) .audio-dock #reset-button{--dock-slot:37.5%}
.app-shell:not(.game-hidden) .audio-dock #reset-button::before{content:none}
.app-shell:not(.game-hidden) .audio-dock #sound-toggle{--dock-slot:60%}
.app-shell:not(.game-hidden) .audio-dock #next-track{--dock-slot:83%}
.app-shell:not(.game-hidden) .audio-dock .icon-button:focus-visible{
  outline:2px solid #fff5da;outline-offset:-4px;
}
.app-shell:not(.game-hidden) .audio-dock #sound-toggle[aria-pressed="true"]::after{
  content:"";position:absolute;top:50%;left:50%;width:52%;height:3px;border-radius:3px;
  background:#502619;box-shadow:0 0 0 1px #fff1d6;
  transform:translate(-50%,-50%) rotate(-42deg);pointer-events:none;
}

.app-shell:not(.game-hidden) .camera-tools{
  top:8px;right:4px;width:48px;padding:2px;grid-template-columns:42px;gap:1px;
  border:1px solid #754938;border-radius:16px;background:linear-gradient(90deg,#925638,#c78356 50%,#915438);
  box-shadow:inset 0 0 0 1px rgba(255,213,162,.28),0 3px 5px rgba(52,31,21,.22);filter:none;
}
.app-shell:not(.game-hidden) .camera-tools button{
  width:42px;height:42px;min-width:42px;min-height:42px;padding:2px;
}

.app-shell:not(.game-hidden) .game-hud>.controls{bottom:max(42px,calc(env(safe-area-inset-bottom) + 42px))}
.app-shell:not(.game-hidden) .orbit-tip{bottom:110px}

@media(max-height:620px){
  .app-shell:not(.game-hidden) .topbar{top:6px;width:224px;height:68px}
  .app-shell:not(.game-hidden) .mode-tabs{top:76px;width:216px;height:62px;padding-block:7px 9px}
  .app-shell:not(.game-hidden) .mode-tab{height:44px;min-height:44px;font-size:10px}
  .app-shell:not(.game-hidden) .bottom-hud{top:140px;width:196px;height:40px;grid-template-rows:40px}
  .app-shell:not(.game-hidden) .bottom-hud .hud>div{height:40px;min-height:40px}
  .app-shell:not(.game-hidden) #mochi-skin-toggle{top:6px;width:78px;min-width:78px;height:44px}
  .app-shell:not(.game-hidden) .audio-dock{top:50px}
  .app-shell:not(.game-hidden) .camera-tools{top:6px}
}

/* Final mode selector skin: one wooden panel with two integrated hit areas. */
.app-shell:not(.game-hidden) .mode-tabs{
  padding:10px 12px 12px!important;gap:8px!important;
}
.app-shell:not(.game-hidden) .mode-tab,
.app-shell:not(.game-hidden) .mode-tab.active{
  min-width:0!important;height:46px!important;min-height:46px!important;padding:0 5px 3px!important;
  border:2px solid #754432!important;border-radius:15px!important;border-image:none!important;
  background:linear-gradient(180deg,rgba(255,224,181,.2),rgba(111,53,31,.08)),linear-gradient(100deg,#bf7548,#d58d5b 48%,#bc7045)!important;
  box-shadow:inset 0 2px 0 rgba(255,220,174,.44),inset 0 -4px 0 rgba(103,52,34,.18),0 3px 0 rgba(83,43,31,.45)!important;
  color:#fff6e8!important;text-shadow:0 1px 0 #684033!important;filter:none!important;transform:none!important;
}
.app-shell:not(.game-hidden) .mode-tab.active{
  background:linear-gradient(180deg,rgba(255,239,202,.3),rgba(124,57,30,.04)),linear-gradient(100deg,#c77a4b,#df9964 48%,#c47749)!important;
}
.app-shell:not(.game-hidden) .mode-tab:focus{outline:none!important}
.app-shell:not(.game-hidden) .mode-tab:focus-visible{outline:2px solid #fff8df!important;outline-offset:2px}

.app-shell:not(.game-hidden) .game-hud>.controls #spawn-button{
  width:112px;height:auto;min-height:0;aspect-ratio:353 / 278;
  padding:14px 3px 0;border:0;border-image:none;border-radius:0;
  background:url('../assets/ui/main_skin/mochi_summon.png') center / contain no-repeat;
  box-shadow:none;filter:drop-shadow(0 4px 4px rgba(65,37,27,.24));
  color:#512d2b;font-size:13px;line-height:1.2;cursor:pointer;
}
.app-shell:not(.game-hidden) .game-hud>.controls #spawn-button::before,
.app-shell:not(.game-hidden) .game-hud>.controls #spawn-button::after{content:none}
.app-shell:not(.game-hidden) .game-hud>.controls #spawn-button[hidden]{display:none}
.app-shell:not(.game-hidden):has(#spawn-button:not([hidden])) .orbit-tip{
  bottom:calc(env(safe-area-inset-bottom) + 138px);
}
.app-shell:not(.game-hidden) .hint-dock.reversi-result{height:auto;bottom:max(12px,env(safe-area-inset-bottom))}
.app-shell:not(.game-hidden) .hint-dock.reversi-result #hint{
  height:auto;min-height:0;padding:8px 16px;
  font-size:clamp(12px,3.3vw,15px);line-height:1.35;white-space:normal;
  background:#fff3de;color:#563328;text-shadow:none;border:1px solid #906048;
}

.app-shell:not(.game-hidden) .bottom-hud .hud>div:first-child{padding-block:3px 4px}
.app-shell:not(.game-hidden) #unlock-label{
  margin-top:2px;line-height:1.1;white-space:normal;overflow-wrap:anywhere;
}

.game-hud{
  --hud-top:max(12px,env(safe-area-inset-top));
  --hud-bottom:max(12px,env(safe-area-inset-bottom));
  --rail-top:var(--hud-top);
  --title-height:78px;
  position:relative;z-index:10;pointer-events:none;
}
.app-shell:not(.game-hidden) .stage-card,
.app-shell:not(.game-hidden) #game-canvas{
  width:100%;height:100%;height:100dvh;
}
.app-shell:not(.game-hidden) .game-hud .topbar{
  top:var(--hud-top);height:var(--title-height);
}
.app-shell:not(.game-hidden) .game-hud .topbar h1{
  font-size:clamp(20px,5.9vw,29px);white-space:nowrap;
}
.app-shell:not(.game-hidden) .game-hud #mochi-skin-toggle{
  top:var(--hud-top);left:12px;width:70px;min-width:70px;
  font-size:clamp(9px,2.65vw,10px);
}
html:is([lang="en"],[lang="ja"]) .app-shell:not(.game-hidden) .game-hud #mochi-skin-toggle{
  font-size:clamp(8px,2.55vw,9px);
}
.app-shell:not(.game-hidden) .game-hud .camera-tools{top:var(--rail-top);right:12px}
.app-shell:not(.game-hidden) .game-hud .audio-dock{top:calc(var(--rail-top) + 50px);left:12px}
.app-shell:not(.game-hidden) .game-hud .mode-tabs{
  top:calc(var(--hud-top) + var(--title-height) + 4px);
  width:min(250px,calc(100% - 24px));height:62px;border-width:7px 9px;
  padding:0 6px!important;gap:6px!important;
}
.app-shell:not(.game-hidden) .game-hud .mode-tab{
  font-size:clamp(10px,2.75vw,12px);padding-inline:3px!important;
}
html[lang="en"] .app-shell:not(.game-hidden) .game-hud .mode-tab{
  font-size:clamp(9px,2.6vw,11px);
}
.app-shell:not(.game-hidden) .game-hud .bottom-hud{
  top:calc(var(--hud-top) + var(--title-height) + 70px);
}
.app-shell:not(.game-hidden) .game-hud>.controls{
  bottom:calc(var(--hud-bottom) + 30px);left:50%;transform:translateX(-50%);
}
.app-shell:not(.game-hidden) .game-hud>.controls #spawn-button{font-size:clamp(11px,3.4vw,13px)}
.app-shell:not(.game-hidden) .game-hud .hint-dock{bottom:var(--hud-bottom);max-width:calc(100% - 24px)}
.app-shell:not(.game-hidden) .game-hud .orbit-tip{
  position:absolute;bottom:calc(var(--hud-bottom) + 34px);
}
.app-shell:not(.game-hidden) .game-hud:has(#spawn-button:not([hidden])) .orbit-tip{
  bottom:calc(var(--hud-bottom) + 123px);
}
@media(max-width:460px){
  .game-hud{--rail-top:calc(var(--hud-top) + var(--title-height) + 118px)}
  .app-shell:not(.game-hidden) .game-hud .topbar{
    left:calc(50% + 28px);width:min(250px,calc(100% - 124px));
    border-width:11px 17px;padding-inline:11px;
  }
  .app-shell:not(.game-hidden) .game-hud .audio-dock{top:var(--rail-top)}
}
@media(max-height:480px){
  .game-hud{--title-height:62px}
  .app-shell:not(.game-hidden) .game-hud .camera-tools{
    width:91px;grid-template-columns:repeat(2,42px);
  }
  .app-shell:not(.game-hidden) .game-hud .audio-dock{width:48px}
  .app-shell:not(.game-hidden) .game-hud>.controls #spawn-button{width:96px}
  .app-shell:not(.game-hidden) .game-hud:has(#spawn-button:not([hidden])) .orbit-tip{
    bottom:calc(var(--hud-bottom) + 109px);
  }
}
@media(max-width:460px) and (max-height:410px){
  .app-shell:not(.game-hidden) .game-hud .camera-tools,
  .app-shell:not(.game-hidden) .game-hud .audio-dock{top:auto;bottom:var(--hud-bottom)}
}

/* AI status stays readable without covering the board. */
.app-shell:not(.game-hidden) #busy{
  inset:auto auto max(60px,calc(env(safe-area-inset-bottom) + 60px)) 50%;
  transform:translateX(-50%);padding:5px 12px;border-radius:999px;
  background:#56392b;color:#fff5e6;font-size:11px;white-space:nowrap;
  filter:none;backdrop-filter:none;pointer-events:none;
}

.reversi-settings-toggle{
  position:absolute;z-index:19;left:50%;transform:translateX(-50%);
  top:calc(var(--hud-top) + var(--title-height) + 118px);
  width:122px;min-height:38px;
  padding:0 12px 3px;border:0;
  background:url('../assets/ui/chroma/tab_inactive.png') center / 100% 100% no-repeat;
  color:#49291d;font-family:inherit;font-size:12px;font-weight:800;
  cursor:pointer;pointer-events:auto;white-space:nowrap;
}
.reversi-settings{
  position:absolute;z-index:20;left:50%;top:52%;transform:translate(-50%,-50%);
  width:min(340px,100%);min-height:min(380px,calc(100dvh - var(--hud-top) - var(--hud-bottom) - 24px));
  display:flex;flex-direction:column;justify-content:center;gap:12px;isolation:isolate;
  padding:34px clamp(30px,11vw,55px) 36px;
  color:#49291d;pointer-events:auto;
}
.reversi-settings[hidden],.reversi-settings-toggle[hidden]{display:none}
.reversi-settings::before{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  /* Skip the unwanted neighboring sprite in the first 30px of the crop. */
  background:url('../assets/ui/chroma/scroll_paper.png') center bottom / 100% 107% no-repeat;
}
.reversi-settings h2{margin:0;text-align:center;font-size:clamp(16px,5vw,20px)}
.reversi-settings h2:focus{outline:none}
.reversi-pieces,.reversi-difficulty{display:grid;gap:8px}
.reversi-pieces{grid-template-columns:minmax(0,1fr)}
.reversi-pieces label{display:grid;gap:4px;font-size:12px;font-weight:800}
.reversi-settings select,.reversi-settings button{
  width:100%;min-width:0;min-height:38px;padding:4px 8px;border:1px solid #986747;
  border-radius:7px;background:#fff6e5;color:#49291d;font:inherit;
  font-size:13px;cursor:pointer;
}
.reversi-settings select:disabled{cursor:default}
.reversi-difficulty{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.reversi-difficulty button,#reversi-settings-done{
  padding:0 0 3px;border:0;white-space:nowrap;font-weight:800;
  background: url('../assets/ui/chroma/tab_inactive.png') center / 100% 100% no-repeat;
}
.reversi-difficulty button{font-size:clamp(10px,3.2vw,12px)}
.reversi-difficulty button[aria-pressed="true"],#reversi-settings-done{
  background-image:url('../assets/ui/chroma/tab_active.png');
  padding-bottom:8px;
}
#reversi-settings-done{width:110px;align-self:center}
@media(max-height:390px){
  .reversi-settings{top:50%;gap:6px;padding-block:20px}
  .reversi-pieces{gap:4px}
  .reversi-settings :is(select,button){min-height:32px}
}
@media(max-width:460px) and (max-height:480px){
  .app-shell:not(.game-hidden) .game-hud:has(.reversi-settings:not([hidden])) .camera-tools{
    top:auto;bottom:var(--hud-bottom);right:4px;width:75px;grid-template-columns:repeat(2,34px);
  }
  .app-shell:not(.game-hidden) .game-hud:has(.reversi-settings:not([hidden])) .camera-tools button{
    width:34px;height:34px;min-width:34px;min-height:34px;
  }
  .app-shell:not(.game-hidden) .game-hud:has(.reversi-settings:not([hidden])) .audio-dock{
    top:auto;bottom:var(--hud-bottom);
  }
}

/* Korean title artwork uses a region of the supplied sheet. */
.splash-title h1.splash-title-ja{display:none}
html[lang="ja"] .splash-title h1[lang="en"],
html[lang="ja"] .splash-subtitle{display:none}
html[lang="ja"] .splash-title h1.splash-title-ja{display:block;font-size:clamp(13px,8.6cqw,38px);line-height:1.12}
html[lang="ja"] .splash-title-ja span:first-child{
  font-size:clamp(20px,15cqw,66px);line-height:1.04;margin-bottom:.12em;
}
html[lang="en"] .splash-subtitle{display:none}
html[lang="ko"] .splash-heading{inset:11.2% 17% auto;height:22%}
html[lang="ko"] .splash-heading::before{
  content:"";position:absolute;inset:0;
  background:url('../assets/ui/gonu_korean_logo.png') center / contain no-repeat;
  filter:drop-shadow(0 .7cqw .9cqw #4727139e);
}
html[lang="ko"] .splash-title h1{display:none}
html[lang="ko"] .splash-subtitle{opacity:0}

.stage-card.screen-shake{animation:screen-shake 120ms ease-out}
@keyframes screen-shake{
  0%,100%{translate:0 0}
  18%{translate:-3px 0}
  36%{translate:3px 0}
  57%{translate:-2px 0}
  78%{translate:1px 0}
}
@media(prefers-reduced-motion:reduce){
  @keyframes screen-shake{from,to{translate:0 0}}
}

/* Note8 fullscreen test fix: viewport-sized artwork and reachable controls. */
#title-screen.viewport-hud {width:100vw;max-width:none;height:100vh;height:100dvh;margin:0;padding:0;--top-inset:0px;--bottom-inset:0px;}
#title-screen .splash-art {width:100%;height:100%;aspect-ratio:auto;background-size:cover;box-shadow:none;}
#title-screen .splash-heading {left:9%;right:9%;top:12%;height:21%;}
#title-screen #lang-bar {bottom:max(2.9%,env(safe-area-inset-bottom));}
/* Reversi portrait HUD only: keep side rails off the board. */
@media (max-width:600px) and (min-height:620px) {
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud {--title-height:56px;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .topbar {height:56px;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .topbar h1 {font-size:20px;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .camera-tools {top:auto;bottom:76px;left:50%;right:auto;transform:translateX(-50%);width:300px;max-width:calc(100vw - 24px);display:grid;grid-template-columns:repeat(6,minmax(44px,1fr));gap:3px;padding:5px;box-sizing:border-box;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .camera-tools button {width:44px;height:44px;min-width:44px;min-height:44px;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock {top:auto;bottom:132px;left:50%;right:auto;transform:translateX(-50%);width:166px;height:52px;aspect-ratio:auto;display:flex;align-items:center;justify-content:center;gap:6px;padding:4px;background:linear-gradient(90deg,#a96d47,#dbac76,#a96d47);border:1px solid #754938;border-radius:14px;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock .icon-button {position:relative!important;inset:auto!important;transform:none;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;background:#f3d7b0;border:1px solid #825236;border-radius:10px;font-size:0;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock #reset-button::before {content:"↻";font-size:27px;color:#563528;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock #sound-toggle::before {content:"♪";font-size:27px;color:#563528;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock #next-track::before {content:"▶";font-size:22px;color:#563528;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) #reversi-settings-toggle {top:auto;bottom:190px;min-height:44px;width:140px;}
}
/* Reversi settings dialog: a single foreground panel, no rail overlap. */
.game-hud:has(#reversi-settings:not([hidden])) :is(.camera-tools,.audio-dock,.topbar,.mode-tabs,.bottom-hud,#mochi-skin-toggle,#reversi-settings-toggle,.orbit-tip,.hint-dock,.controls) {visibility:hidden!important;pointer-events:none!important;}
#reversi-settings {position:fixed;z-index:200;top:50%;left:50%;width:min(92vw,380px);min-height:420px;max-height:calc(100dvh - 32px);overflow-y:auto;padding:44px 42px 40px;gap:18px;justify-content:center;}
#reversi-settings h2 {font-size:21px;line-height:1.3;margin:0 0 4px;}
#reversi-settings .reversi-pieces {gap:14px;}
#reversi-settings .reversi-pieces label {gap:7px;font-size:14px;line-height:1.4;}
#reversi-settings select {min-height:46px;padding:8px 10px;font-size:14px;max-width:100%;}
#reversi-settings .reversi-difficulty {gap:7px;grid-template-columns:repeat(3,minmax(0,1fr));}
#reversi-settings .reversi-difficulty button {min-height:46px;padding:4px 0;font-size:13px;border:1px solid #936140;border-radius:10px;background:#ecd0a9;color:#503121;box-shadow:inset 0 1px 0 #fff3da;}
#reversi-settings .reversi-difficulty button[aria-pressed="true"] {background:#a15e39;color:#fff7e8;border-color:#6f422c;box-shadow:inset 0 0 0 2px #d9ac76;}
#reversi-settings #reversi-settings-done {width:150px;min-height:48px;margin:2px auto 0;padding:4px 10px;font-size:16px;}
@media(max-height:520px){#reversi-settings{min-height:0;padding:28px 38px;gap:10px;}#reversi-settings .reversi-pieces{gap:8px;}}
@media(max-width:600px) and (min-height:620px){
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock{display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .audio-dock .icon-button{position:relative!important;top:auto!important;left:auto!important;bottom:auto!important;right:auto!important;transform:none!important;align-self:center!important;}
}
/* Compact top HUD; skin selector belongs beside bottom actions, not the title. */
@media(max-width:600px) and (min-height:620px){
.app-shell:not(.game-hidden) .game-hud {--hud-top:8px;--title-height:48px;}
.app-shell:not(.game-hidden) .game-hud .topbar {left:50%;top:8px;transform:translateX(-50%);width:min(290px,calc(100vw - 24px));height:48px;padding:7px 15px;border-width:8px 14px;}
.app-shell:not(.game-hidden) .game-hud .topbar h1 {font-size:clamp(19px,5vw,24px);white-space:nowrap;line-height:1.1;}
.app-shell:not(.game-hidden) .game-hud .mode-tabs {top:60px;width:min(290px,calc(100vw - 24px));height:54px;}
.app-shell:not(.game-hidden) .game-hud .bottom-hud {top:118px;}
.app-shell:not(.game-hidden) .game-hud #mochi-skin-toggle {top:auto;bottom:62px;left:auto;right:14px;width:70px;min-width:70px;height:48px;min-height:48px;font-size:10px;line-height:1.15;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .topbar {height:48px;}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud .topbar h1 {font-size:clamp(19px,5vw,24px);}
.app-shell:not(.game-hidden):has(.mode-tab[data-mode="reversi"].active) .game-hud #mochi-skin-toggle {bottom:190px;left:10px;right:auto;width:64px;min-width:64px;}
}
/* In-game wooden sign: fit Korean lettering to the usable inner width. */
html[lang="ko"] .app-shell:not(.game-hidden) .game-hud .topbar > div {
  flex: 1 1 0;
  min-width: 0;
  container-type: inline-size;
}
html[lang="ko"] .app-shell:not(.game-hidden) .game-hud .topbar #game-title {
  font-size: min(25px, 14cqw);
  margin: 0;
  text-align: center;
  line-height: 1.12;
  white-space: nowrap;
}
