.rs{position:relative;background:#231f1b;color:#f1e7cf;border-radius:18px;padding:12px;min-height:560px;overflow:hidden;
  padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right));user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}
.rs button{font:inherit;color:inherit;cursor:pointer;min-height:46px;min-width:46px;border:2px solid #4a4238;background:#322b24;border-radius:10px;padding:0 12px;font-weight:700}
.rs button:active{transform:translateY(1px);background:#3d352c}
.rs button:focus-visible{outline:3px solid #f2c230;outline-offset:2px}
.rs button[disabled]{opacity:.4;cursor:default}
.rs-stats{display:flex;gap:8px}
.rs-stats div{flex:1;background:#2f2a25;border-radius:10px;padding:6px 8px;text-align:center}
.rs-stats b{display:block;font-size:1.25rem;font-variant-numeric:tabular-nums;line-height:1.2}
.rs-stats span{font-size:.68rem;letter-spacing:.08em;text-transform:uppercase;opacity:.65}
.rs-goals{display:flex;gap:6px;margin:8px 0}
.rs-g{flex:1;display:flex;align-items:center;gap:6px;border:2px solid #4a4238;border-radius:10px;padding:4px 6px;min-height:46px;font-size:.78rem;line-height:1.15}
.rs-g canvas{width:30px;height:30px;flex:none}
.rs-g.need{border-color:#f2c230}
.rs-g.opt{opacity:.55}
.rs-g.done{background:#2c4a2f;border-color:#6fbf73}
.rs-g b{display:block;font-size:.9rem}
.rs-board{width:100%;touch-action:none;position:relative}
.rs-board canvas{display:block;margin:0 auto;touch-action:none;border-radius:14px}
.rs-hint{min-height:2.6em;margin:8px 2px;font-size:.88rem;line-height:1.3;color:#d9cdb0}
.rs-ctl{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.rs-ov{position:absolute;inset:0;background:rgba(20,17,14,.93);display:flex;align-items:center;justify-content:center;padding:14px;overflow:auto;z-index:5}
.rs-ov[hidden]{display:none}
.rs-card{width:100%;max-width:340px;text-align:center;display:flex;flex-direction:column;gap:10px}
.rs-card h2{font-size:2rem;letter-spacing:.02em;color:#f1e7cf}
.rs-tag{font-size:.92rem;line-height:1.4;color:#d9cdb0}
.rs-big{background:#d9432b!important;border-color:#f08a74!important;color:#fff;font-size:1.15rem;min-height:56px!important}
.rs-sec{min-height:48px}
.rs-small{font-size:.8rem;opacity:.75}
.rs-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;justify-content:center;font-size:.8rem}
.rs-row span{width:100%;opacity:.7}
.rs-row button{min-width:48px}
.rs-row button.on{border-color:#f2c230;background:#4a3f22}
.rs-res{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.rs-res div{background:#2f2a25;border-radius:10px;padding:8px 12px;min-width:90px}
.rs-res b{display:block;font-size:1.3rem}
.rs-res span{font-size:.7rem;text-transform:uppercase;letter-spacing:.08em;opacity:.65}
@media (max-width:380px){.rs-g{font-size:.7rem}.rs-g canvas{width:24px;height:24px}}
@media (prefers-reduced-motion:reduce){.rs button:active{transform:none}}
.rs{background:#231f1b repeating-linear-gradient(135deg,rgba(255,255,255,.025) 0 2px,transparent 2px 9px);padding-bottom:max(12px,env(safe-area-inset-bottom))}
.rs-stats div{border-bottom:3px solid #d9432b}
.rs-stats div.bump b{animation:rsbump .28s ease-out}
@keyframes rsbump{0%{transform:scale(1)}40%{transform:scale(1.25);color:#f2c230}100%{transform:scale(1)}}
.rs-marks{display:flex;gap:10px;justify-content:center;margin-bottom:2px}
.rs-marks canvas{width:40px;height:40px;transform:rotate(-4deg);box-shadow:0 3px 0 rgba(0,0,0,.4);border-radius:7px}
.rs-marks canvas:nth-child(2n){transform:rotate(3deg)}
.rs-card h2{text-shadow:2px 2px 0 #d9432b}
.rs-res div.nb{background:#4a3f22;border:2px solid #f2c230}
.rs-ctl button{min-height:48px}
.rs-board canvas{box-shadow:0 6px 0 rgba(0,0,0,.35)}
@media (max-height:700px){.rs{min-height:0}.rs-hint{min-height:2.2em;margin:4px 2px}}
@media (prefers-reduced-motion:reduce){.rs-stats div.bump b{animation:none}}
#r-undo[hidden]{display:none}
/* full screen: fill the stage, board square as large as fits, controls beside it in landscape */
html.pip-immersive .rs,html.pip-native .rs,.game-wrap:fullscreen .rs{height:100%;min-height:0;border-radius:0;display:flex;flex-direction:column;padding-top:6px;padding-bottom:max(8px,env(safe-area-inset-bottom))}
html.pip-immersive .rs-board,html.pip-native .rs-board,.game-wrap:fullscreen .rs-board{flex:1 1 0;min-height:0}
html.pip-immersive .rs-board canvas,html.pip-native .rs-board canvas,.game-wrap:fullscreen .rs-board canvas{position:absolute;inset:0;margin:auto}
html.pip-immersive .rs-hint,html.pip-native .rs-hint,.game-wrap:fullscreen .rs-hint{min-height:0;margin:4px 2px}
html.pip-immersive .rs-goals,html.pip-native .rs-goals{margin:6px 0}
@media (orientation:landscape) and (max-height:600px){
html.pip-immersive .rs,html.pip-native .rs,.game-wrap:fullscreen .rs{display:grid;grid-template-columns:minmax(0,1fr) minmax(190px,36%);grid-template-rows:auto auto 1fr auto;column-gap:12px}
html.pip-immersive .rs-board,html.pip-native .rs-board,.game-wrap:fullscreen .rs-board{grid-column:1;grid-row:1/5}
html.pip-immersive .rs-hud,html.pip-native .rs-hud,.game-wrap:fullscreen .rs-hud{grid-column:2;grid-row:1}
html.pip-immersive .rs-hint,html.pip-native .rs-hint,.game-wrap:fullscreen .rs-hint{grid-column:2;grid-row:2}
html.pip-immersive .rs-ctl,html.pip-native .rs-ctl,.game-wrap:fullscreen .rs-ctl{grid-column:2;grid-row:4;grid-template-columns:1fr 1fr}
}
.rs{background:radial-gradient(ellipse at 50% 30%,#2f2923 0,#231f1b 60%,#191613 100%),#231f1b}
.rs-board canvas{box-shadow:0 8px 18px rgba(0,0,0,.45),0 0 0 2px rgba(255,255,255,.05)}
.rs-card{background:rgba(35,31,27,.6);border:1px solid #4a4238;border-radius:16px;padding:16px 14px}
/* full screen pass 2: edge-to-edge board, goal tiles and stats never overflow */
html.pip-immersive .rs,html.pip-native .rs{padding:4px max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));width:100%;max-width:none;overflow:hidden}
html.pip-immersive .game-wrap,html.pip-native .game-wrap{padding:0;max-width:none}
html.pip-immersive .game-title,html.pip-native .game-title{display:none}
html.pip-immersive .rs-hud,html.pip-native .rs-hud{min-width:0}
html.pip-immersive .rs-stats,html.pip-native .rs-stats{gap:4px}
html.pip-immersive .rs-stats div,html.pip-native .rs-stats div{min-width:0;padding:2px 4px}
html.pip-immersive .rs-stats b,html.pip-native .rs-stats b{font-size:1.05rem;line-height:1.1}
html.pip-immersive .rs-goals,html.pip-native .rs-goals{gap:4px;margin:4px 0}
html.pip-immersive .rs-g,html.pip-native .rs-g{min-width:0;flex:1 1 0;gap:3px;padding:2px 4px;min-height:44px;font-size:.66rem;overflow:hidden}
html.pip-immersive .rs-g canvas,html.pip-native .rs-g canvas{width:22px;height:22px}
html.pip-immersive .rs-hint,html.pip-native .rs-hint{margin:2px;font-size:.78rem;line-height:1.2}
html.pip-immersive .rs-ctl,html.pip-native .rs-ctl{gap:4px}
html.pip-immersive .rs-ctl button,html.pip-native .rs-ctl button{min-width:0;padding:0 4px;min-height:46px}
@media (orientation:landscape) and (max-height:600px){
html.pip-immersive .rs,html.pip-native .rs{padding-top:4px;padding-bottom:4px}
html.pip-immersive .rs-ctl button,html.pip-native .rs-ctl button{min-height:44px}
}
