:root{--bg:#0f1410;--panel:#171e18;--line:#2c382d;--bone:#efe3c4;--dim:#9aa58f;--brass:#d1a043;--verd:#55b8a6;--crim:#c0382d;--amber:#f2b84b}
*{box-sizing:border-box}
body.mh-body{margin:0;background:var(--bg);color:var(--bone);font-family:ui-serif,Georgia,'Times New Roman',serif;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);-webkit-tap-highlight-color:transparent}
.mh-head{display:flex;justify-content:space-between;align-items:center;padding:.6rem 1rem;border-bottom:1px solid var(--line);font-size:.95rem}
.mh-head a{color:var(--brass);text-decoration:none;min-height:44px;display:inline-flex;align-items:center}
.mh-head span{color:var(--dim)}
.game-wrap{max-width:420px;margin:0 auto;padding:1rem}
.mh h1{margin:0 0 .5rem;font-size:1.5rem;letter-spacing:.08em;text-transform:uppercase;color:var(--brass)}
button{font:inherit;color:var(--bone);background:var(--panel);border:1px solid var(--line);border-radius:10px;min-height:44px;min-width:44px;padding:.4rem .9rem;cursor:pointer;touch-action:manipulation}
button:focus-visible{outline:3px solid var(--amber);outline-offset:2px}
button:disabled{opacity:.4;cursor:default}
button.main{background:var(--brass);color:#1a1307;border-color:var(--brass);font-weight:700}
button.on,button[aria-pressed="true"].tool{border-color:var(--amber);box-shadow:0 0 0 2px rgba(242,184,75,.35) inset}
.hud{display:flex;align-items:center;gap:.5rem;justify-content:space-between;margin-bottom:.5rem}
.hud .a{font-size:1.1rem;font-weight:700}
.hud .b{color:var(--dim);font-size:.85rem}
.hud .btns{display:flex;gap:.4rem}
#stage{position:relative;min-height:400px;display:flex;justify-content:center;align-items:flex-start;background:#0a0d0a;border:1px solid var(--line);border-radius:12px;padding:.4rem 0;overflow:hidden}
#board{display:block;touch-action:none;user-select:none;-webkit-user-select:none;max-width:100%}
.overlay{position:absolute;inset:0;background:rgba(10,13,10,.93);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.65rem;padding:1rem;text-align:center;animation:rise .25s ease-out}
.overlay[hidden]{display:none}
.overlay.won{background:rgba(14,22,15,.94)}
.overlay.lost{background:rgba(26,10,8,.93)}
.overlay h2{margin:0;font-size:1.6rem;letter-spacing:.06em;text-transform:uppercase;color:var(--brass)}
.overlay p{margin:0;color:var(--dim);font-size:.95rem}
.overlay .big{font-size:1.2rem;color:var(--bone)}
.overlay button{width:100%;max-width:280px}
.roomnav{display:flex;align-items:center;gap:.6rem}
.roomnav strong{min-width:6.5rem;font-size:1.2rem}
.chips{display:flex;flex-wrap:wrap;gap:.4rem;justify-content:center}
.chip{font-size:.85rem;padding:.3rem .7rem;width:auto!important}
.chip.on{background:#26331f;border-color:var(--brass)}
.stars{min-height:1.8rem;display:flex;gap:.3rem;justify-content:center}
.st{width:1.6rem;height:1.6rem;background:#2c382d;clip-path:polygon(50% 0,62% 36%,100% 38%,70% 60%,80% 100%,50% 76%,20% 100%,30% 60%,0 38%,38% 36%)}
.st.on{background:var(--amber)}
.tip{min-height:2.6rem;margin:.5rem 0 0;color:var(--dim);font-size:.9rem;line-height:1.35}
.bar{display:flex;gap:.5rem;align-items:stretch}
#tray{display:flex;gap:.5rem;flex:1}
.tool{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1.1;padding:.2rem}
.tool .tn{font-size:.95rem}.tool .tc{font-size:1.1rem;font-weight:700;color:var(--amber)}
.tool.pulse{animation:pulse .5s ease-out}
#btn-mark{min-width:80px}
.hud button{min-height:44px;font-size:.85rem;padding:.2rem .6rem}
@keyframes rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes pulse{0%{transform:scale(1)}40%{transform:scale(1.14);border-color:var(--amber)}100%{transform:scale(1)}}
footer{max-width:420px;margin:0 auto;padding:1rem;color:var(--dim);font-size:.85rem;text-align:center}
footer a,#similar-games a{color:var(--brass)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

body.mh-body{background:radial-gradient(120% 60% at 50% 0,#1b2619 0,var(--bg) 70%) fixed,var(--bg)}
#stage{background:radial-gradient(90% 70% at 50% 30%,#121a12,#080b08);box-shadow:inset 0 0 40px rgba(0,0,0,.6),0 0 0 1px #3a4a32}
.overlay{background:rgba(8,11,8,.94)}
.overlay h2{text-shadow:0 2px 0 #000,0 0 18px rgba(209,160,67,.35)}
#title h2{font-size:2rem}
#res-note,#t-streak{color:var(--verd);min-height:1.2rem}
#res-note:empty{display:none}
#btn-hint{min-width:64px}
.st.on{filter:drop-shadow(0 0 4px rgba(242,184,75,.7))}
.overlay.won .st.on{animation:pulse .6s ease-out}
@media (max-width:420px){.bar{flex-wrap:wrap}#tray{min-width:100%}.bar>button{flex:1}}

/* full screen: stage fills the dock-free area, board scales to it */
html.pip-immersive .game-wrap,html.pip-native .game-wrap{display:flex;flex-direction:column;max-width:none;margin:0;padding:.4rem .6rem calc(.4rem + env(safe-area-inset-bottom));overflow:hidden}
html.pip-immersive .mh,html.pip-native .mh{display:flex;flex-direction:column;flex:1;min-height:0}
html.pip-immersive .mh h1,html.pip-native .mh h1,html.pip-immersive .mh-head,html.pip-immersive .ad-well,html.pip-immersive #similar-games,html.pip-immersive footer,html.pip-native .ad-well{display:none}
html.pip-immersive #stage,html.pip-native #stage{flex:1;min-height:0;align-items:center;padding:.3rem 0}
html.pip-immersive #board,html.pip-native #board{max-height:100%}
html.pip-immersive .tip,html.pip-native .tip{min-height:0;margin:.3rem 0 0}
html.pip-immersive .overlay,html.pip-native .overlay{overflow:auto;justify-content:flex-start;padding-top:.8rem}
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive .overlay,html.pip-native .overlay{gap:.35rem}
html.pip-immersive #loadout,html.pip-immersive #loadout-tip,html.pip-native #loadout,html.pip-native #loadout-tip{display:none}
html.pip-immersive .tip,html.pip-native .tip{display:none}
}
#board{filter:drop-shadow(0 6px 10px rgba(0,0,0,.55))}
.overlay button.main{box-shadow:0 3px 0 #7a5a1c,0 0 14px rgba(209,160,67,.3)}

/* full screen landscape: board takes the left, controls sit in a side column */
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive .game-wrap,html.pip-native .game-wrap{padding:.3rem .5rem}
html.pip-immersive .mh,html.pip-native .mh{display:grid;grid-template-columns:minmax(0,1fr) minmax(190px,230px);grid-template-rows:auto 1fr;column-gap:.6rem;row-gap:.4rem;align-content:stretch}
html.pip-immersive #stage,html.pip-native #stage{grid-column:1;grid-row:1 / span 2;height:100%;min-height:0;padding:.2rem 0}
html.pip-immersive .hud,html.pip-native .hud{grid-column:2;grid-row:1;flex-wrap:wrap;margin:0}
html.pip-immersive .bar,html.pip-native .bar{grid-column:2;grid-row:2;flex-direction:column;justify-content:center;align-self:stretch;flex-wrap:nowrap}
html.pip-immersive #tray,html.pip-native #tray{min-width:0;flex:0 0 auto}
html.pip-immersive .bar>button,html.pip-native .bar>button{flex:0 0 auto;min-height:48px}
}
