/* Rune Slide: carved basalt, lantern amber. All rules scoped to .rs. */
.rs{--bg:#151a20;--slab:#1d242c;--edge:#36414d;--ink:#ece6d6;--mute:#9aa5b1;--amber:#ffb347;--amber2:#ffd48a;--bad:#ff6f6f;
  position:relative;color:var(--ink);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--bg);border:1px solid var(--edge);border-radius:18px;padding:12px 10px calc(12px + env(safe-area-inset-bottom,0px));
  min-height:440px;background-image:radial-gradient(120% 70% at 50% 0,#222c37 0,transparent 60%),radial-gradient(90% 50% at 50% 100%,#2a1f10 0,transparent 70%);touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}
.rs [hidden]{display:none!important}
.rs h2{font:800 1.9rem/1.1 Georgia,"Times New Roman",serif;letter-spacing:.04em;margin:0;color:var(--amber2)}
.rs p{margin:0}
.rs-screen{display:flex;flex-direction:column;align-items:center;gap:12px}
.rs-title{padding:10px 0 4px;text-align:center}
.rs-title canvas{width:240px;height:80px;display:block}
.rs-tag{color:var(--mute);font-size:.95rem;max-width:28ch}
.rs-stats{color:var(--mute);font-size:.82rem;min-height:1.2em}
.rs-row{display:flex;gap:10px;width:100%;justify-content:center}
.rs-btn{appearance:none;border:1px solid var(--edge);background:var(--slab);color:var(--ink);font:700 .95rem/1 system-ui,sans-serif;
  min-height:48px;min-width:48px;padding:0 14px;border-radius:12px;cursor:pointer;box-shadow:0 3px 0 #0b0e12;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:transform .08s,box-shadow .08s,background .15s}
.rs-btn:active{transform:translateY(2px);box-shadow:0 1px 0 #0b0e12}
.rs-btn:focus-visible{outline:3px solid var(--amber);outline-offset:2px}
.rs-btn[disabled]{opacity:.4;cursor:default}
.rs-primary{background:var(--amber);color:#1b1306;border-color:#ffd48a;box-shadow:0 3px 0 #9a5f12;min-width:180px;font-size:1.1rem}
.rs-primary:active{box-shadow:0 1px 0 #9a5f12}
.rs-row .rs-btn{flex:1;max-width:170px}
.rs-top{display:flex;align-items:center;justify-content:space-between;width:100%;gap:8px}
.rs-top h3{font:800 1.05rem/1.2 Georgia,serif;color:var(--amber2)}
.rs-world{width:100%}
.rs-world h4{font:700 .78rem/1 system-ui;text-transform:uppercase;letter-spacing:.08em;color:var(--mute);margin:8px 2px}
.rs-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;width:100%}
.rs-lv{position:relative;flex-direction:column;gap:3px;padding:0;min-height:52px;font-size:1rem}
.rs-lv i{display:flex;gap:2px;height:6px}
.rs-lv i b{width:6px;height:6px;background:#2d3640;transform:rotate(45deg)}
.rs-lv i b.on{background:var(--amber)}
.rs-lv.cur{border-color:var(--amber)}
.rs-hud{display:flex;justify-content:space-between;align-items:baseline;width:100%;font-size:.9rem;color:var(--mute);gap:8px}
.rs-hud strong{color:var(--ink);font-weight:700}
.rs-moves{font-variant-numeric:tabular-nums;color:var(--ink);font-weight:700}
.rs-moves.warn{color:var(--bad)}
.rs-note{width:100%;min-height:2.6em;font-size:.88rem;line-height:1.3;color:var(--amber2);text-align:center}
.rs-board{position:relative;display:flex;justify-content:center;width:100%}
.rs-board canvas{display:block;touch-action:none;max-width:100%;border-radius:16px}
#rs-legend{display:block;max-width:100%}
.rs-ctl{display:flex;gap:6px;width:100%;justify-content:center}
.rs-ctl .rs-btn{flex:1;min-width:0;padding:0 4px;font-size:.82rem}
.rs-result{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
  background:rgba(14,18,23,.9);border-radius:16px;text-align:center;padding:12px;animation:rs-pop .22s ease-out}
.rs-result h3{font:800 1.5rem/1.1 Georgia,serif;color:var(--amber2)}
.rs-result .rs-sub{color:var(--mute);font-size:.9rem}
.rs-stars{display:flex;gap:8px;height:34px}
.rs-stars b{width:34px;height:34px;background:#2d3640;clip-path:polygon(50% 2%,62% 36%,98% 38%,69% 59%,80% 94%,50% 73%,20% 94%,31% 59%,2% 38%,38% 36%)}
.rs-stars b.on{background:var(--amber)}
.rs-result .rs-row{flex-wrap:wrap}
.rs-toast{position:absolute;left:50%;bottom:76px;transform:translateX(-50%);background:#0b0e12;border:1px solid var(--edge);color:var(--ink);
  padding:8px 14px;border-radius:10px;font-size:.85rem;max-width:90%;text-align:center;pointer-events:none;z-index:3}
#rs-res-undo[hidden]{display:none}
.rs-stars b.on{animation:rs-star .45s cubic-bezier(.3,1.6,.5,1) both;filter:drop-shadow(0 0 6px #ffb34799)}
.rs-stars b.on:nth-child(2){animation-delay:.12s}.rs-stars b.on:nth-child(3){animation-delay:.24s}
.rs-lv.done{border-color:#7a5a24}
.rs-board canvas{box-shadow:0 6px 24px rgba(0,0,0,.45),inset 0 0 0 1px var(--edge)}
@keyframes rs-star{from{transform:scale(.2) rotate(-40deg);opacity:0}to{transform:none;opacity:1}}
@keyframes rs-pop{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.rs-result,.rs-stars b.on{animation:none}.rs-btn{transition:none}}

/* Full screen (shell: html.pip-immersive for both native and immersive). The stage becomes a flex column and the board takes what is left. */
html.pip-immersive body[data-pip-frame] .game-wrap.pip-stage{display:flex;flex-direction:column;overflow:hidden;padding-left:max(8px,0px);padding-right:8px;padding-bottom:8px}
html.pip-immersive .game-wrap.pip-stage>.game-title,html.pip-immersive .game-wrap.pip-stage>.pip-actions{display:none}
html.pip-immersive .game-wrap.pip-stage>.rs{flex:1 1 0;min-height:0;display:flex;flex-direction:column;border-radius:12px;padding:8px 8px 8px}
html.pip-immersive .rs>.rs-screen:not([hidden]){flex:1 1 0;min-height:0;width:100%}
html.pip-immersive .rs-title{justify-content:center;gap:16px}
html.pip-immersive #rs-select{justify-content:flex-start;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
html.pip-immersive #rs-game{gap:8px}
html.pip-immersive .rs-board{flex:1 1 0;min-height:0;align-items:center;overflow:hidden}
html.pip-immersive .rs-board canvas{flex:none}
html.pip-immersive .rs-note{min-height:0;font-size:.82rem}
html.pip-immersive .rs-note:empty{display:none}
html.pip-immersive .rs-ctl{padding-bottom:env(safe-area-inset-bottom,0px)}
html.pip-immersive .rs-ctl .rs-btn{min-height:48px}
html.pip-immersive .rs-toast{bottom:84px}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .game-wrap.pip-stage{padding-top:8px!important;padding-bottom:6px}
  html.pip-immersive #rs-game{display:grid;grid-template-columns:minmax(0,1fr) 250px;grid-template-rows:auto auto auto 1fr auto;column-gap:10px;row-gap:6px;align-items:start}
  html.pip-immersive #rs-game>.rs-hud,html.pip-immersive #rs-game>.rs-note,html.pip-immersive #rs-game>#rs-legend{grid-column:2}
  html.pip-immersive #rs-game>.rs-hud{grid-row:1;flex-direction:column;align-items:flex-start;gap:2px}
  html.pip-immersive #rs-game>.rs-note{grid-row:2}
  html.pip-immersive #rs-game>#rs-legend{grid-row:3}
  html.pip-immersive #rs-game>.rs-board{grid-column:1;grid-row:1/6;align-self:stretch}
  html.pip-immersive #rs-game>.rs-ctl{grid-column:2;grid-row:5;flex-wrap:wrap;align-self:end}
  html.pip-immersive #rs-game>.rs-ctl .rs-btn{flex:1 1 72px;min-height:44px}
  html.pip-immersive .rs-title{gap:8px}
  html.pip-immersive .rs-title canvas{display:none}
}
