:root{--bg:#101a1b;--panel:#1b2729;--panel2:#223235;--chalk:#d9e8de;--dim:#8fa8a0;--gold:#f2cf63;--hot:#ff5a3c;--gate:#5fd0e0;--ink:#0f1718}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--chalk);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);-webkit-tap-highlight-color:transparent}
a{color:var(--gold)}
.game-header{display:flex;justify-content:space-between;align-items:center;padding:.6rem 1rem;max-width:420px;margin:0 auto;font-size:.9rem}
.game-header a{display:inline-flex;align-items:center;min-height:44px;text-decoration:none}
.game-tag{color:var(--dim)}
.bb-title{margin:0 0 .5rem;font-size:1.5rem;letter-spacing:.02em}
.bb{display:flex;flex-direction:column;gap:.6rem}
.bb-bar{display:flex;align-items:center;justify-content:space-between;gap:.5rem}
.bb-name{flex:1;text-align:center;font-size:.9rem;font-weight:700;color:var(--gold);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bb-btn{min-height:48px;min-width:48px;padding:0 .9rem;border:2px solid var(--chalk);border-radius:12px;background:var(--panel);color:var(--chalk);font:700 .95rem system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.bb-btn:active{transform:translateY(1px);background:var(--panel2)}
.bb-btn:focus-visible,.bb-go:focus-visible,.bb-tile:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.bb-btn.primary{background:var(--gold);color:var(--ink);border-color:var(--gold)}
.bb-btn.wide{width:100%}
.bb-btn:disabled{opacity:.5}
.bb-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:.35rem;font-size:.72rem;font-weight:700;text-align:center}
.bb-stats span{background:var(--panel);border:1px solid rgba(217,232,222,.25);border-radius:8px;padding:.4rem .15rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bb-field{position:relative;min-height:340px;background:var(--panel);border-radius:14px;display:flex;justify-content:center;align-items:flex-start;overflow:hidden;border:2px solid rgba(217,232,222,.3)}
#bb-canvas{display:block;touch-action:none;user-select:none;-webkit-user-select:none;max-width:100%}
.bb-overlay{position:absolute;inset:0;background:rgba(10,18,18,.82);display:flex;align-items:center;justify-content:center;padding:.6rem;z-index:3}
.bb-overlay[hidden]{display:none}
.bb-card{width:100%;max-height:100%;overflow:auto;display:flex;flex-direction:column;gap:.6rem;background:var(--panel);border:2px solid var(--chalk);border-radius:14px;padding:1rem;animation:bbpop .22s ease-out}
.bb-h{margin:0;font-size:1.5rem;text-align:center;color:var(--gold)}
.bb-p{margin:0;font-size:.95rem;line-height:1.4;text-align:center}
.bb-small{margin:0;font-size:.8rem;line-height:1.35;color:var(--dim);text-align:center}
.bb-small.good{color:var(--gold)}
.bb-row{display:flex;gap:.5rem}
.bb-row .bb-btn{flex:1}
.bb-stars{display:flex;justify-content:center;gap:.3rem}
.bb-stars span{display:inline-flex;animation:bbstar .4s ease-out both}
.bb-stars .on{fill:var(--gold);stroke:var(--ink);stroke-width:1}
.bb-stars .off{fill:none;stroke:var(--dim);stroke-width:1.2}
.bb-levels{display:grid;grid-template-columns:repeat(3,1fr);gap:.4rem;max-height:250px;overflow:auto;padding-right:2px}
.bb-chap{grid-column:1/-1;font-size:.75rem;font-weight:800;color:var(--gate);margin-top:.3rem}
.bb-tile{min-height:52px;border:2px solid var(--chalk);border-radius:10px;background:var(--panel2);color:var(--chalk);display:flex;flex-direction:column;align-items:center;justify-content:center;font:inherit;cursor:pointer;touch-action:manipulation}
.bb-tile .n{font-weight:800;font-size:1.05rem}
.bb-tile .s{font-size:.68rem;color:var(--gold)}
.bb-tile.locked{opacity:.4;border-style:dashed}
.bb-note-row{display:flex;flex-direction:column;gap:.1rem;font-size:.82rem;border-left:3px solid var(--gate);padding-left:.55rem}
.bb-note-row b{color:var(--gold)}
.bb-msg{margin:0;min-height:2.6em;font-size:.92rem;line-height:1.3;text-align:center}
.bb-actions{display:grid;grid-template-columns:1fr 2fr;gap:.6rem}
.bb-go{min-height:60px;border:2px solid var(--ink);border-radius:14px;background:var(--hot);color:#fff;font:800 1.4rem system-ui,sans-serif;letter-spacing:.08em;cursor:pointer;touch-action:manipulation;box-shadow:0 4px 0 #8f2a17}
.bb-go:active{transform:translateY(3px);box-shadow:0 1px 0 #8f2a17}
.bb-go:disabled{opacity:.45}
.bb-note{margin:0;font-size:.8rem;color:var(--dim);line-height:1.35;text-align:center}
.bb-keys{margin:.2rem 0 0;font-size:.72rem;color:var(--dim);text-align:center}
footer{max-width:420px;margin:0 auto;padding:1rem;font-size:.8rem;color:var(--dim)}
@keyframes bbpop{from{transform:scale(.94);opacity:0}to{transform:none;opacity:1}}
@keyframes bbstar{from{transform:scale(0) rotate(-40deg)}to{transform:none}}
@media (prefers-reduced-motion:reduce){.bb-card,.bb-stars span{display:inline-flex;animation:none}.bb-btn:active,.bb-go:active{transform:none}}
@media (max-width:360px){.bb-stats{font-size:.64rem}}
.bb-title{font-size:1.2rem;margin:0 0 .3rem}
.bb-field{background:radial-gradient(ellipse at 50% 40%,#2a4043 0%,#1b2729 70%);box-shadow:inset 0 0 28px rgba(0,0,0,.45)}
.bb-card{background:linear-gradient(180deg,#223235,#1b2729);box-shadow:0 8px 24px rgba(0,0,0,.45)}
.bb-stats span{background:linear-gradient(180deg,#223235,#1b2729)}
@media (hover:none){.bb-keys{display:none}}
@media (max-height:700px){.bb-note{display:none}}
.bb-bar{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
.bb-go{background:linear-gradient(180deg,#ff7254,#ff5a3c)}
/* full screen: board fills the stage, chrome hidden, nothing scrolls */
html.pip-immersive .game-wrap,html.pip-native .game-wrap,.game-wrap:fullscreen{display:flex;flex-direction:column;min-height:0;overflow:hidden!important;padding-left:.6rem;padding-right:.6rem;padding-bottom:.4rem}
html.pip-native .game-wrap,.game-wrap:fullscreen{height:100%;max-width:none;margin:0;padding-top:calc(env(safe-area-inset-top,0px) + 52px)}
html.pip-immersive .bb-title,html.pip-native .bb-title,html.pip-immersive .bb-keys,html.pip-native .bb-keys,html.pip-immersive .bb-note,html.pip-native .bb-note,html.pip-immersive .game-header,html.pip-native .game-header,html.pip-immersive .ad-well,html.pip-native .ad-well,html.pip-immersive #similar-games,html.pip-native #similar-games,html.pip-immersive footer,html.pip-native footer{display:none!important}
html.pip-immersive .bb,html.pip-native .bb{flex:1;min-height:0;gap:.4rem}
html.pip-immersive .bb-field,html.pip-native .bb-field{flex:1 1 0;min-height:0;align-items:center}
html.pip-immersive .bb-msg,html.pip-native .bb-msg{min-height:0;font-size:.85rem}
html.pip-immersive .bb-go,html.pip-native .bb-go{min-height:52px}
@media (orientation:landscape){
html.pip-immersive .bb,html.pip-native .bb{display:grid;grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:auto auto 1fr auto auto;column-gap:.6rem;row-gap:.35rem}
html.pip-immersive .bb-field,html.pip-native .bb-field{grid-column:1;grid-row:1/-1}
html.pip-immersive .bb>:not(.bb-field),html.pip-native .bb>:not(.bb-field){grid-column:2}
html.pip-immersive .bb-stats,html.pip-native .bb-stats{grid-template-columns:1fr 1fr}
html.pip-immersive .bb-msg,html.pip-native .bb-msg{align-self:center;font-size:.8rem}
}
.bb-field{border-color:rgba(242,207,99,.35);box-shadow:inset 0 0 28px rgba(0,0,0,.45),0 6px 18px rgba(0,0,0,.35)}
.bb-btn{background:linear-gradient(180deg,#2a3d40,#1b2729);box-shadow:0 2px 0 rgba(0,0,0,.35)}
.bb-btn.primary{background:linear-gradient(180deg,#f8dc82,#f2cf63)}
