.sg{--ink:#15110d;--panel:#211b15;--cream:#f1e6c8;--brass:#cfa650;--dim:#a79a7d;--bad:#ff6a58;
  background:var(--ink);color:var(--cream);border-radius:14px;padding:10px 10px calc(10px + env(safe-area-inset-bottom));
  border:2px solid #3a2f22;font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-user-select:none;user-select:none;position:relative}
.sg *{box-sizing:border-box}
.sg-hud{padding:2px 4px 8px}
.sg-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.sg-lvl{font-weight:800;font-size:1.05rem;letter-spacing:.04em;text-transform:uppercase;color:var(--brass)}
.sg-moves{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.82rem;color:var(--cream);white-space:pre}
.sg-note{min-height:2.5em;font-size:.86rem;line-height:1.25;color:var(--dim);margin-top:4px}
.sg-stage{position:relative;display:flex;justify-content:center;align-items:flex-start;min-height:440px}
#sg-canvas{display:block;touch-action:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;border-radius:8px;background:#15110d;max-width:100%}
.sg-bar{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap}
.sg-bar .sg-btn{flex:1 1 0;min-width:64px;padding:0 6px;font-size:.85rem}
.sg-btn{min-height:46px;min-width:46px;border:2px solid #5b4a31;background:#2c241a;color:var(--cream);border-radius:10px;font:700 .95rem system-ui,sans-serif;padding:0 14px;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.sg-btn:active{transform:translateY(1px);background:#3a2f21}
.sg-btn:focus-visible,.sg-cell:focus-visible{outline:3px solid #ffe9a8;outline-offset:2px}
.sg-btn:disabled{opacity:.4}
.sg-btn.sg-primary{background:var(--brass);border-color:#e8c777;color:#1c150a;min-height:54px;font-size:1.1rem;width:100%}
.sg-ov{position:absolute;inset:0;background:var(--ink);border-radius:8px;display:flex;flex-direction:column;justify-content:center;gap:12px;padding:16px;overflow-y:auto;touch-action:pan-y;z-index:3}
.sg-ov[hidden]{display:none}
.sg-levels{justify-content:flex-start}
.sg-hero svg{width:100%;height:auto;max-height:150px;display:block;border-bottom:3px solid var(--brass)}
.sg-wordmark{font-size:2.2rem;letter-spacing:.14em;font-weight:900;text-align:center;color:var(--brass);margin:0}
.sg-h{font-size:1.5rem;text-align:center;color:var(--brass);margin:0}.sg-h.bad{color:var(--bad)}
.sg-lede{font-size:.95rem;line-height:1.4;text-align:center;color:var(--cream);margin:0}
.sg-stats{font:.78rem ui-monospace,Menlo,Consolas,monospace;text-align:center;color:var(--dim);margin:0}
.sg-row{display:flex;gap:8px}.sg-row .sg-btn{flex:1 1 0;padding:0 6px;font-size:.9rem}
.sg-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:6px}
.sg-cell{position:relative;min-height:48px;border:2px solid #5b4a31;background:#2c241a;color:var(--cream);border-radius:8px;font:800 .95rem ui-monospace,Menlo,Consolas,monospace;cursor:pointer;touch-action:manipulation}
.sg-cell.done{border-color:var(--brass)}.sg-cell.lock{opacity:.35}
.sg-cell i{position:absolute;left:0;right:0;bottom:1px;font-style:normal;font-size:.6rem;color:var(--brass);letter-spacing:.05em}
.sg-stars{display:flex;justify-content:center;gap:6px}.sg-stars svg{width:26px;height:26px;transform-origin:center}.sg-stars.big svg{width:46px;height:46px}
.sg-stars .on{fill:var(--brass);stroke:#fff1c4;stroke-width:1}.sg-stars .off{fill:#2c241a;stroke:#5b4a31;stroke-width:1}
@media (prefers-reduced-motion:no-preference){.sg-stars svg{animation:sgpop .4s ease-out both}.sg-stars svg:nth-child(2){animation-delay:.12s}.sg-stars svg:nth-child(3){animation-delay:.24s}}
@keyframes sgpop{from{transform:scale(.3);opacity:0}to{transform:scale(1);opacity:1}}
@media (max-width:360px){.sg-grid{grid-template-columns:repeat(5,1fr)}.sg-wordmark{font-size:1.8rem}}
@supports(padding:max(0px)){.sg{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}}

.sg-moves.low{color:var(--bad);font-weight:800}
.sg-prog{height:10px;border-radius:6px;background:#2c241a;border:1px solid #5b4a31;overflow:hidden}.sg-prog i{display:block;height:100%;background:var(--brass)}
.sg-zone{grid-column:1/-1;margin:8px 0 0;font-size:.78rem;letter-spacing:.08em;text-transform:uppercase;color:var(--dim)}
.sg-zone:first-child{margin-top:0}
@media (prefers-reduced-motion:no-preference){.sg-fall{animation:sgfall 1.6s ease-in infinite}.sg-fall.d2{animation-delay:.5s}.sg-fall.d3{animation-delay:1s}}
@keyframes sgfall{from{transform:translateY(0);opacity:1}to{transform:translateY(46px);opacity:0}}
@media (max-height:700px){.sg-hero svg{max-height:90px}.sg-ov{gap:8px;padding:12px}}

/* full screen (native and immersive) */
html.pip-immersive .game-wrap.pip-stage{display:flex;flex-direction:column;max-width:none;margin:0;padding:6px 8px calc(6px + env(safe-area-inset-bottom));overflow:hidden}
html.pip-immersive .pip-stage>.ad-well,html.pip-immersive .pip-stage>.noscript,html.pip-immersive .pip-stage>noscript{display:none}
html.pip-immersive .sg{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;padding:8px;border-radius:12px}
html.pip-immersive .sg-hud{padding:0 4px 4px}
html.pip-immersive .sg-note{min-height:0;font-size:.8rem;margin-top:2px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html.pip-immersive .sg-stage{flex:1 1 0;min-height:0;overflow:hidden;align-items:center}
html.pip-immersive .sg-bar{margin-top:6px;flex-wrap:nowrap}
html.pip-immersive .sg-bar .sg-btn{min-width:0;min-height:48px}
html.pip-immersive .sg-hero svg{max-height:70px}
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive .sg{display:grid;grid-template-columns:minmax(0,1fr) 172px;grid-template-rows:auto minmax(0,1fr);grid-template-areas:"stage hud" "stage bar";column-gap:10px}
html.pip-immersive .sg-hud{grid-area:hud}
html.pip-immersive .sg-stage{grid-area:stage}
html.pip-immersive .sg-bar{grid-area:bar;display:grid;grid-template-columns:1fr 1fr;align-content:start;gap:6px;margin-top:0}
html.pip-immersive .sg-hero{display:none}
html.pip-immersive .sg-ov{gap:6px;padding:8px}
}
.sg-stage canvas{box-shadow:0 6px 18px rgba(0,0,0,.45),inset 0 0 0 1px #3a2f22}
.sg-stage{background:radial-gradient(ellipse at 50% 40%,#2a2218 0%,#15110d 75%);border-radius:8px}
