/* Ripple Switch: lacquer and tide. Salt cells, deep teal, copper rings. */
:root{--ink:#08131a;--ink2:#0f2029;--salt:#ece4d0;--tide:#143842;--tide2:#1f6070;--cu:#e58a45;--cuhi:#ffc08a;--lock:#d65a3f;--tx:#e9e3d2;--mut:#93a6ad}
*{box-sizing:border-box}
body{margin:0;background:var(--ink);color:var(--tx);font-family:ui-rounded,"Trebuchet MS",system-ui,sans-serif;-webkit-tap-highlight-color:transparent}
.game-header{display:flex;justify-content:space-between;align-items:center;padding:.7rem 1rem;padding-left:max(1rem,env(safe-area-inset-left));padding-right:max(1rem,env(safe-area-inset-right));background:var(--ink2);border-bottom:1px solid #1c3844}
.game-header a{color:var(--cuhi);text-decoration:none;min-height:44px;display:inline-flex;align-items:center}
.game-tag{color:var(--mut);font-size:.85rem}
.game-wrap{padding-bottom:max(1rem,env(safe-area-inset-bottom));padding-left:max(1rem,env(safe-area-inset-left));padding-right:max(1rem,env(safe-area-inset-right))}
.game-title h1{font:italic 700 2rem/1.1 Georgia,"Times New Roman",serif;margin:.4rem 0 .8rem;color:var(--salt);letter-spacing:.01em}
.game-title h1::after{content:"";display:block;width:3.2rem;height:3px;margin-top:.45rem;background:var(--cu);border-radius:2px}
.scr[hidden]{display:none}
.lede{margin:0 0 1rem;line-height:1.45;color:var(--tx)}
.btn{display:flex;align-items:center;justify-content:center;width:100%;min-height:48px;margin:.5rem 0;padding:.6rem 1rem;border:2px solid #2a5463;border-radius:14px;background:var(--ink2);color:var(--tx);font:600 1rem/1 inherit;font-family:inherit;text-decoration:none;cursor:pointer;touch-action:manipulation}
.btn:hover{border-color:var(--cu)}
.btn:active{transform:translateY(1px)}
.btn:focus-visible,canvas:focus-visible,.lv:focus-visible{outline:3px solid var(--cuhi);outline-offset:2px}
.btn.primary{background:var(--cu);border-color:var(--cu);color:#1b0f06;font-size:1.15rem;min-height:56px}
.btn.ghost{background:transparent;border-color:#1f3a46;color:var(--mut)}
.note{color:var(--mut);font-size:.88rem;margin:.1rem 0 .6rem;text-align:center}
.note.warn{color:var(--cuhi)}
.demo{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;width:150px;margin:0 auto 1.1rem;padding:8px;background:#08131a;border:1px solid #2a4a57;border-radius:14px}
.demo i{aspect-ratio:1;border-radius:7px;background:var(--salt);animation:dm 2.4s steps(1) infinite}
.demo i.b{background:var(--tide);box-shadow:inset 0 0 0 2px var(--tide2);animation-delay:.8s}
.demo i.c{animation-delay:0s}
@keyframes dm{0%{filter:none}50%{filter:hue-rotate(160deg) brightness(1.3)}}
.bar{display:flex;align-items:center;gap:.8rem}.bar .btn{width:auto;min-width:88px}.bar h2{margin:0;font:italic 700 1.4rem Georgia,serif}
.lvgrid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin-top:.6rem}
.lv{min-height:56px;border:2px solid #2a5463;border-radius:12px;background:var(--ink2);color:var(--tx);font:inherit;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:4px;touch-action:manipulation}
.lv b{font-size:1rem}
.lv.cur{border-color:var(--cu)}
.lv.locked{opacity:.4;cursor:default}
.stars{display:inline-flex;gap:3px}
.st{display:inline-block;width:11px;height:11px;background:#27434e;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(--cu)}
.stars.big .st{width:34px;height:34px}.stars.big{gap:8px;justify-content:center}
.hud{display:flex;justify-content:space-between;align-items:center;gap:.6rem;font-size:.95rem;margin-bottom:.4rem}
.hud b{font:italic 700 1.2rem Georgia,serif;color:var(--salt)}
.gatechip{margin-left:.6rem;font-size:.78rem;padding:.15rem .5rem;border-radius:999px;border:1px solid var(--cu);color:var(--cuhi)}
.beat{height:5px;background:#12303b;border-radius:3px;overflow:hidden;margin-bottom:.6rem}
#beat-fill{height:100%;background:var(--cu);transform:scaleX(0);transform-origin:left center}
.board{position:relative;width:100%;display:flex;justify-content:center}
canvas{display:block;touch-action:none;user-select:none;-webkit-user-select:none;border-radius:16px;max-width:100%}
.result{position:absolute;left:50%;top:50%;width:min(86%,320px);transform:translate(-50%,-50%);background:#0b1b23f2;border:2px solid var(--cu);border-radius:18px;padding:1rem;text-align:center;box-shadow:0 10px 40px #000a}
.result h2{margin:.1rem 0 .6rem;font:italic 700 1.5rem Georgia,serif;color:var(--salt)}
.result p{margin:.6rem 0;color:var(--mut);font-size:.92rem}
.result .btn{margin:.4rem 0}
.result.in{animation:pop .28s ease-out}
@keyframes pop{from{opacity:0;transform:translate(-50%,-46%) scale(.94)}to{opacity:1}}
.tip{margin:.7rem 0 0;padding:.6rem .8rem;border-left:3px solid var(--cu);background:var(--ink2);border-radius:0 10px 10px 0;font-size:.92rem;line-height:1.4}
.ctl{display:grid;grid-template-columns:1fr 1fr;gap:0 .6rem;margin-top:.5rem}
.about{margin-top:1.5rem;color:var(--mut);font-size:.9rem;line-height:1.55}
.about h2{font:italic 700 1.15rem Georgia,serif;color:var(--salt)}
.pip-actions{margin-top:1rem}
footer{padding:1rem;text-align:center;color:var(--mut);font-size:.82rem}footer a{color:var(--cuhi)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

.result.in .stars.big .st.on{animation:starpop .45s ease-out both}
.result.in .stars.big .st.on:nth-child(2){animation-delay:.12s}
.result.in .stars.big .st.on:nth-child(3){animation-delay:.24s}
@keyframes starpop{0%{transform:scale(.3);opacity:0}70%{transform:scale(1.25)}100%{transform:scale(1);opacity:1}}
#hud-pulses{font-variant-numeric:tabular-nums}
.board{touch-action:manipulation;-webkit-user-select:none;user-select:none}

/* Full screen: the board fills the stage below the dock; nothing scrolls. */
html.pip-immersive .game-wrap.pip-stage,html.pip-native .game-wrap.pip-stage{display:flex;flex-direction:column;overflow:hidden;padding-bottom:max(.5rem,env(safe-area-inset-bottom))}
html.pip-immersive .pip-stage .about,html.pip-native .pip-stage .about,html.pip-immersive .pip-stage .lede,html.pip-native .pip-stage .lede,html.pip-immersive .pip-stage #btn-mute,html.pip-native .pip-stage #btn-mute{display:none}
html.pip-immersive .pip-stage .rs,html.pip-native .pip-stage .rs{flex:1;min-height:0;display:flex;flex-direction:column}
html.pip-immersive .pip-stage .scr:not([hidden]),html.pip-native .pip-stage .scr:not([hidden]){flex:1;min-height:0;display:flex;flex-direction:column}
html.pip-immersive .pip-stage #scr-title,html.pip-native .pip-stage #scr-title{justify-content:center;overflow:auto}
html.pip-immersive .pip-stage #scr-levels,html.pip-native .pip-stage #scr-levels{overflow:auto}
html.pip-immersive .pip-stage .board,html.pip-native .pip-stage .board{flex:1;min-height:0;align-items:center;overflow:hidden}
html.pip-immersive .pip-stage .ctl,html.pip-native .pip-stage .ctl{grid-template-columns:repeat(3,1fr);margin-top:.3rem}
html.pip-immersive .pip-stage .ctl .btn,html.pip-native .pip-stage .ctl .btn{min-height:48px;margin:.2rem 0;padding:.4rem .5rem;font-size:.9rem}
@media (orientation:landscape){
  html.pip-immersive .pip-stage #scr-play,html.pip-native .pip-stage #scr-play{display:grid;grid-template-columns:minmax(0,1fr) 190px;grid-template-rows:auto auto 1fr;column-gap:.8rem}
  html.pip-immersive .pip-stage #scr-play .hud,html.pip-native .pip-stage #scr-play .hud{grid-column:2;grid-row:1}
  html.pip-immersive .pip-stage #scr-play .beat,html.pip-native .pip-stage #scr-play .beat{grid-column:2;grid-row:2}
  html.pip-immersive .pip-stage #scr-play .board,html.pip-native .pip-stage #scr-play .board{grid-column:1;grid-row:1/4}
  html.pip-immersive .pip-stage #scr-play .tip,html.pip-native .pip-stage #scr-play .tip{grid-column:2;grid-row:3;align-self:start}
  html.pip-immersive .pip-stage #scr-play .ctl,html.pip-native .pip-stage #scr-play .ctl{grid-column:2;grid-row:3;align-self:end;grid-template-columns:1fr 1fr}
  html.pip-immersive .pip-stage #scr-play .tip:not([hidden]),html.pip-native .pip-stage #scr-play .tip:not([hidden]){font-size:.8rem}
}
.rs[data-screen="play"] .board{background:radial-gradient(ellipse at 50% 40%,#12303b 0,transparent 70%)}

html.pip-native .pip-stage #scr-play[hidden],html.pip-immersive .pip-stage #scr-play[hidden],#scr-play[hidden]{display:none}
