@font-face{font-family:'Fredoka';font-weight:500;font-display:swap;src:url(../assets/fonts/fredoka-500.woff2) format('woff2')}
@font-face{font-family:'Fredoka';font-weight:600;font-display:swap;src:url(../assets/fonts/fredoka-600.woff2) format('woff2')}
@font-face{font-family:'Fredoka';font-weight:700;font-display:swap;src:url(../assets/fonts/fredoka-700.woff2) format('woff2')}
@font-face{font-family:'Lilita One';font-weight:400;font-display:swap;src:url(../assets/fonts/lilita.woff2) format('woff2')}
/* Layout: slim control strip on top, the machine fills the middle, one coaching line below. Single look: night-shift blueprint, brass parts, one hot orange ball. */
:root{
  --ink:#0c1a22;
  --ink-2:#10303d;
  --line:#2f6070;
  --chalk:#e6eef2;
  --muted:#8fa7b8;
  --brass:#e0a93a;
  --ball:#ff7b3d;
  --good:#5fd38d;
  --bad:#ff5d6c;
  --steel:#7f98ab;
  --pink:#ff6fa3;
  --teal:#35c2c9;
  --font-display:'Lilita One','Fredoka',system-ui,sans-serif;
  --font-body:'Fredoka',system-ui,-apple-system,'Segoe UI',sans-serif;
  color-scheme:dark;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{background:var(--ink);color:var(--chalk);font-family:var(--font-body);font-size:15px;overflow:hidden}
#app{height:100%;display:flex;flex-direction:column;padding-inline:16px;padding-block:10px;gap:8px}
.hud{display:flex;flex-wrap:wrap;align-items:center;gap:10px 22px}
.hud #btnMenu{padding:6px 12px}
.brand{font-family:var(--font-display);font-weight:900;font-size:26px;letter-spacing:.06em;color:var(--brass);line-height:1}
.lvl{display:flex;align-items:center;gap:8px}
#lvlName{font-family:var(--font-display);font-weight:700;font-size:24px;letter-spacing:.04em;min-width:5.2em;text-align:center;line-height:1}
#lvlName small{display:block;font-family:var(--font-body);font-weight:600;font-size:11px;letter-spacing:.04em;color:var(--muted);margin-top:2px;text-transform:uppercase}
.meter{display:flex;align-items:center;gap:8px;min-width:0}
.meter .lab{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
#pips,#hearts{display:flex;gap:4px;flex-wrap:wrap}
.pip{width:14px;height:14px;border-radius:50%;border:2px solid var(--line)}
.pip.on{background:var(--good);border-color:var(--good)}
.life{width:14px;height:14px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);border:2px solid var(--line)}
.life.on{background:var(--ball);border-color:var(--ball)}
.actions{display:flex;gap:8px;margin-left:auto;flex-wrap:wrap}
button{font:inherit;font-weight:700;color:var(--chalk);background:var(--ink-2);border:1.5px solid var(--line);border-radius:6px;padding:7px 14px;cursor:pointer}
button:hover{border-color:var(--steel)}
button:focus-visible{outline:2px solid var(--teal);outline-offset:2px}
button.primary{background:var(--brass);border-color:var(--brass);color:#1b1405}
button.primary:hover{filter:brightness(1.08)}
button:disabled{opacity:.45;cursor:default}
.lvl button{padding:5px 10px}
#stage{position:relative;flex:1;min-height:0;display:flex;align-items:center;justify-content:center}
canvas{display:block;touch-action:none;border:1.5px solid var(--line);border-radius:4px;background:var(--ink-2)}
#tip{min-height:2.6em;color:var(--muted);font-size:14px;line-height:1.35;max-width:96ch}
#tip b{color:var(--chalk)}
#overlay,#note{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(8,14,20,.62)}
.card{background:var(--ink);border:1.5px solid var(--brass);border-radius:8px;padding:22px 28px;text-align:center;max-width:min(92%,380px);display:flex;flex-direction:column;gap:10px;align-items:center}
.card h2{margin:0;font-family:var(--font-display);font-weight:900;font-size:40px;letter-spacing:.04em;line-height:1;color:var(--brass);text-wrap:balance}
.card p{margin:0;color:var(--muted)}
#stars{font-size:34px;letter-spacing:.12em;color:var(--brass);line-height:1}
#stars .off{color:var(--line)}
.card .row{display:flex;gap:10px;margin-top:6px;flex-wrap:wrap;justify-content:center}
.card.note{max-width:min(94%,440px);text-align:left;align-items:stretch;border-color:var(--teal)}
.card.note h2{color:var(--chalk);font-size:32px}
.card.note .k{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--teal);margin-bottom:-4px}
.card.note p b{color:var(--chalk)}
#noteCv{width:100%;height:auto;max-width:300px;align-self:center;border-radius:4px;background:var(--ink-2);border:1px solid var(--line)}

/* ---------- screens ---------- */
#screens{position:fixed;inset:0;z-index:20}
.scr{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:24px 16px;overflow:auto;text-align:center}
.scr.dim{background:rgba(8,14,20,.74)}
.scr h2{margin:0;font-family:var(--font-display);font-weight:900;font-size:clamp(34px,6vw,52px);letter-spacing:.05em;color:var(--brass);line-height:1}
.scr p{margin:0;color:var(--muted);max-width:52ch;line-height:1.45}
.logo{font-family:var(--font-display);font-weight:900;font-size:clamp(70px,15vw,160px);letter-spacing:.07em;color:var(--brass);line-height:.9;text-shadow:0 4px 0 #6a4a12,0 0 44px rgba(224,169,58,.35)}
.tag{font-size:clamp(15px,2.4vw,19px);color:var(--chalk);letter-spacing:.02em}
.hero{height:clamp(120px,26vh,230px);width:auto;filter:drop-shadow(0 10px 18px rgba(0,0,0,.5));animation:bob 3.2s ease-in-out infinite}
@keyframes bob{50%{transform:translateY(-6px)}}
.menu{display:flex;flex-direction:column;gap:10px;width:min(320px,100%)}
.menu button,.scr .row button{padding:12px 20px;font-size:17px}
.scr .row{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.small{font-size:13px;color:var(--muted)}
.tabs{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.tabs button{padding:8px 14px}
.tabs button[aria-selected=true]{background:var(--brass);border-color:var(--brass);color:#1b1405}
.grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;width:min(560px,100%)}
.tile{aspect-ratio:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:4px;background:var(--ink-2)}
.tile .n{font-family:var(--font-display);font-weight:900;font-size:clamp(24px,5vw,34px);line-height:1}
.tile .st{font-size:13px;letter-spacing:.08em;color:var(--brass);line-height:1;min-height:13px}
.tile .st .off{color:var(--line)}
.tile.next{border-color:var(--brass);box-shadow:0 0 0 2px rgba(224,169,58,.35)}
.tile[disabled]{opacity:.38}
.steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px;width:min(940px,100%)}
.step{background:rgba(12,26,34,.82);border:1.5px solid var(--line);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:10px;align-items:center;text-align:center}
.step b{font-family:var(--font-display);font-size:24px;letter-spacing:.04em;color:var(--chalk)}
.step p{font-size:14px}
.step .vis{height:56px;display:flex;align-items:center;justify-content:center;gap:10px}
.step .vis img{height:26px}
.ghost{opacity:.45;outline:2px dashed var(--good);outline-offset:3px}
.knob{width:16px;height:16px;background:var(--brass);clip-path:polygon(25% 5%,75% 5%,100% 50%,75% 95%,25% 95%,0 50%)}
.wnum{font-family:var(--font-display);font-weight:700;font-size:22px;letter-spacing:.2em;color:var(--teal);text-transform:uppercase}
.wname{font-family:var(--font-display);font-weight:900;font-size:clamp(40px,8vw,72px);letter-spacing:.04em;line-height:1;color:var(--chalk);text-wrap:balance}
.wgoal{font-size:12px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--brass)}
#ovLevels{background:transparent}
@media (max-width:640px){.brand{display:none}.actions{margin-left:0}#tip{font-size:13px}}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto}}

/* ===== premium skin: glossy enamel and brass ===== */
:root{--ink:#0a1a22;--ink-2:#123a43;--line:#2d6b72;--chalk:#fff4d6;--muted:#a9c9c4;--brass:#f0bd45;--cream:#fff4d6}
body{background:linear-gradient(rgba(5,16,22,.76),rgba(5,16,22,.9)),url(../assets/bg.jpg) center/cover no-repeat fixed;font-weight:500}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
canvas{border:3px solid #d9a233;border-radius:16px;box-shadow:0 0 0 2px #6a4a12,0 14px 44px rgba(0,0,0,.55),inset 0 0 40px rgba(0,0,0,.3);background:#0e2a33}
.brand{font-family:var(--font-display);font-weight:400;font-size:30px;letter-spacing:.04em;color:#ffd96a;text-shadow:0 2px 0 #7a520e,0 0 18px rgba(240,189,69,.35)}
#lvlName{font-family:var(--font-display);font-weight:400;font-size:26px;letter-spacing:.02em;color:var(--cream);text-shadow:0 2px 0 rgba(0,0,0,.4)}
#lvlName small{font-family:var(--font-body);font-weight:600;color:var(--muted);letter-spacing:.06em}
.meter .lab{font-weight:600;color:var(--muted)}
#tip{color:var(--muted);font-size:15px}
#tip b{color:var(--cream)}
/* pill buttons: ends keep their shape, the middle stretches */
button{--h:42px;height:var(--h);border:0 solid transparent;border-width:0 calc(var(--h)/2);border-image:url(../assets/ui/pill_teal.png) 0 61 0 61 fill/0 calc(var(--h)/2) 0 calc(var(--h)/2) stretch;border-radius:0;background:none;padding:0 4px;
  font:600 17px/1 var(--font-body);color:var(--cream);text-shadow:0 1.5px 0 rgba(0,0,0,.45);transition:transform .08s,filter .12s}
button:hover{filter:brightness(1.12);border-color:transparent}
button:active{transform:translateY(1.5px) scale(.985)}
button.primary{background:none;border-color:transparent;border-image-source:url(../assets/ui/pill_gold.png);color:#3a2506;text-shadow:0 1px 0 rgba(255,240,180,.6)}
button.primary:hover{filter:brightness(1.08)}
button:disabled{opacity:.5;filter:grayscale(.5)}
button.round{--h:46px;width:46px;height:46px;border:0;border-image:none;padding:0;background:center/contain no-repeat;font-size:0}
#btnMenu{background-image:url(../assets/ui/r_menu.png)}
#btnGuide{background-image:url(../assets/ui/r_help.png)}
#btnReset{background-image:url(../assets/ui/r_restart.png)}
.hud #btnStart{--h:46px;min-width:90px}
.hud #btnHint,#side #btnHint{--h:40px}
button:focus-visible{outline:none;filter:brightness(1.15) drop-shadow(0 0 6px rgba(255,217,106,.9))}
button.tile:focus-visible{filter:brightness(1.15) drop-shadow(0 0 8px rgba(255,217,106,.9))}
/* meters */
.pip{width:22px;height:22px;border:0;border-radius:0;background:url(../assets/ui/pip_off.png) center/contain no-repeat}
.pip.on{background-size:contain;background-position:center;background-repeat:no-repeat;background-color:transparent;border-color:transparent;background-image:url(../assets/ui/pip_on.png);filter:drop-shadow(0 0 4px rgba(120,255,120,.7))}
.life{width:17px;height:24px;border:0;border-radius:0;transform:none;background:url(../assets/ui/drop_off.png) center/contain no-repeat}
.life.on{background-size:contain;background-position:center;background-repeat:no-repeat;background-color:transparent;border-color:transparent;background-image:url(../assets/ui/drop_on.png);filter:drop-shadow(0 0 4px rgba(255,140,50,.6))}
/* cards use the riveted panel frame */
.card{background:none;border:30px solid transparent;border-image:url(../assets/ui/panel.png) 62 fill/30px stretch;border-radius:0;padding:4px 14px;max-width:min(94%,460px);gap:12px}
.card.note{border-color:transparent;max-width:min(94%,500px)}
.card h2{font-family:var(--font-display);font-weight:400;font-size:42px;color:#ffd96a;text-shadow:0 2px 0 #7a520e}
.card.note h2{color:var(--cream);font-size:34px;text-shadow:0 2px 0 rgba(0,0,0,.4)}
.card p{color:#d3e6e2}.card.note p b{color:var(--cream)}
.card.note .k{color:#ffd96a;font-weight:600}
#noteCv{background:rgba(0,0,0,.28);border:0;border-radius:12px}
#stars{display:flex;gap:6px;justify-content:center}
#stars img{width:54px;height:54px;filter:drop-shadow(0 3px 3px rgba(0,0,0,.4))}
#note,#overlay{background:rgba(4,14,20,.6);backdrop-filter:blur(3px)}
/* screens */
.scr.full{background:radial-gradient(ellipse at 50% 45%,rgba(6,22,30,.2),rgba(4,12,18,.82) 85%),url(../assets/bg.jpg) center/cover no-repeat}
.scr.dim{background:rgba(4,14,20,.7);backdrop-filter:blur(4px)}
.scr h2{font-family:var(--font-display);font-weight:400;color:#ffd96a;text-shadow:0 3px 0 #7a520e,0 0 24px rgba(240,189,69,.3);letter-spacing:.02em}
.scr p{color:#cfe3df}
.logo{width:min(560px,86vw);height:auto;filter:drop-shadow(0 10px 18px rgba(0,0,0,.55));animation:pop 4s ease-in-out infinite}
@keyframes pop{50%{transform:scale(1.015) translateY(-3px)}}
.hero{height:clamp(130px,28vh,250px);filter:drop-shadow(0 14px 18px rgba(0,0,0,.55))}
.tag{color:var(--cream);font-weight:600;font-size:clamp(16px,2.4vw,20px);text-shadow:0 2px 6px rgba(0,0,0,.6)}
.menu button{--h:54px;font-size:20px}
.scr .row button{--h:48px;font-size:18px;padding:0 6px}
.small{color:var(--muted);font-weight:600}
.tabs button{--h:36px;font-size:16px}
.tabs button[aria-selected=true]{background:none;border-color:transparent;border-image-source:url(../assets/ui/pill_gold.png);color:#3a2506;text-shadow:0 1px 0 rgba(255,240,180,.6)}
.grid{gap:12px;width:min(580px,100%)}
button.tile{--h:auto;height:auto;border:0;border-image:none;padding:0;aspect-ratio:1;background:url(../assets/ui/tile_open.png) center/100% 100% no-repeat;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0}
button.tile.cur{background-image:url(../assets/ui/tile_gold.png);color:#3a2506;text-shadow:0 1px 0 rgba(255,240,180,.6);animation:glow 1.8s ease-in-out infinite}
button.tile.lock{background-image:url(../assets/ui/tile_lock.png)}
@keyframes glow{50%{filter:brightness(1.12) drop-shadow(0 0 10px rgba(255,200,70,.7))}}
.tile .n{font-family:var(--font-display);font-weight:400;font-size:clamp(26px,5vw,36px);line-height:1;margin-top:-4px}
.tile .st{display:flex;gap:1px;min-height:16px}
.tile .st img{width:15px;height:15px}
.tile[disabled]{opacity:1;filter:none}
.step{background:rgba(8,32,40,.78);border:2px solid #b98a2e;border-radius:14px}
.step b{font-family:var(--font-display);font-weight:400;color:#ffd96a}
.step .vis img{height:24px}
.wnum{color:#7fe3e8;font-family:var(--font-display);font-weight:400}
.wname{font-family:var(--font-display);font-weight:400;color:var(--cream);text-shadow:0 4px 0 rgba(0,0,0,.45)}
.wgoal{color:#ffd96a;font-weight:700}

/* ===== scaling: --ui is set from js/config.js and the screen height (js/render.js, uiScale) ===== */
:root{--ui:1}
body{margin:0}
html,body{height:100%}
@supports (height:100dvh){html,body{height:100dvh}}
body{overscroll-behavior:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}
#app{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right));padding-bottom:max(10px,env(safe-area-inset-bottom))}
/* content-box: the canvas content is exactly the size set from script, so the bitmap is never resampled */
canvas{box-sizing:content-box}
#noteCv{box-sizing:border-box}
.hud button,#side button{--h:calc(40px*var(--ui));font-size:calc(17px*var(--ui))}
.hud #btnStart{--h:calc(46px*var(--ui))}
.hud #btnHint,#side #btnHint{--h:calc(40px*var(--ui))}
.hud button.round,#side button.round{--h:calc(46px*var(--ui));width:calc(46px*var(--ui));height:calc(46px*var(--ui));font-size:0}
.brand{font-size:calc(30px*var(--ui))}
#lvlName{font-size:calc(26px*var(--ui))}
.pip{width:calc(22px*var(--ui));height:calc(22px*var(--ui))}
.life{width:calc(17px*var(--ui));height:calc(24px*var(--ui))}
.grid{width:min(580px,100%,calc((100vh - 190px)*2.3))}
@media (max-height:700px){
  #app{padding-top:6px;gap:5px}
  #tip{min-height:2.2em;font-size:14px}
}
@media (max-height:520px){
  #app{padding-top:3px;padding-bottom:max(3px,env(safe-area-inset-bottom));padding-inline:max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right));gap:3px}
  .hud{gap:3px 12px}
  .brand,.meter .lab{display:none}
  #tip{min-height:0;font-size:12px;line-height:1.25}
  .scr{gap:8px;padding:10px 12px}
  .hero{height:64px}
  .logo{width:min(320px,56vw)}
  .scr h2{font-size:28px}
  .menu{gap:6px}
  .menu button{--h:40px;font-size:16px}
  .scr .row button{--h:38px;font-size:16px}
  .tabs button{--h:30px;font-size:14px}
  .grid{gap:6px}
  .tile .n{font-size:22px}
  .card{border-width:18px;border-image-width:18px;gap:6px;padding:0 6px;max-height:100%;overflow:auto}
  .card h2,.card.note h2{font-size:28px}
  #stars img{width:34px;height:34px}
  #noteCv{max-width:200px}
}
#pips.many{gap:2px}
#pips.many .pip{width:calc(17px*var(--ui));height:calc(17px*var(--ui))}
@media (max-width:1300px){.hud{gap:6px 14px}.meter{gap:6px}.actions{gap:6px}}
@media (max-width:1100px){.brand{display:none}}
@media (max-width:1250px){#pips.many .pip{width:calc(15px*var(--ui));height:calc(15px*var(--ui))}}

/* ===== UI build: hint count, in-page confirm ===== */
#ask{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(4,14,20,.6);backdrop-filter:blur(3px);z-index:3}
#btnHint .cnt{display:inline-block;min-width:1.35em;margin-left:.35em;padding:0 .3em;border-radius:1em;background:rgba(0,0,0,.35);font-size:.9em;line-height:1.35}
#btnHint small{margin-left:.4em;font-size:.72em;font-weight:600;opacity:.85}
#btnHint.on{filter:brightness(1.25) drop-shadow(0 0 6px rgba(255,217,106,.9))}

/* ===== UI build: title, world map, level path ===== */
.tmenu{display:flex;flex-direction:row;flex-wrap:wrap;width:min(500px,100%);gap:10px}
.tmenu #tPlay{flex:1 0 100%}
.tmenu button{flex:1 1 0;min-width:0;--h:50px;font-size:18px;padding:0 4px;white-space:nowrap}
#scr-title #tSound{position:absolute;top:10px;right:12px;--h:34px;font-size:14px;padding:0 2px}
.rankline{min-height:1.2em;font-family:var(--font-display);font-size:clamp(17px,2.6vw,22px);letter-spacing:.03em;color:#ffd96a;text-shadow:0 2px 0 rgba(0,0,0,.5)}
.shelf{display:flex;gap:10px;justify-content:center;padding:6px 14px;border-radius:14px;background:rgba(4,14,20,.55);border:2px solid rgba(185,138,46,.55)}
/* plates: the real plate images. empty is a dim ghost, gold glows */
.plate{display:inline-block;width:34px;height:34px;position:relative;line-height:0}
.plate img{width:100%;height:100%;object-fit:contain;display:block;filter:drop-shadow(0 2px 3px rgba(0,0,0,.6))}
.plate.empty img{filter:grayscale(.75) brightness(.38) contrast(1.1) drop-shadow(0 1px 2px rgba(0,0,0,.7));opacity:.62}   /* an empty slot: the engraving is still there, but clearly not won yet */
.plate.empty{border-radius:50%;box-shadow:inset 0 0 0 2px rgba(201,162,74,.28)}
.shelf .plate{width:42px;height:42px}
.plate.gold img{filter:drop-shadow(0 0 5px rgba(255,214,70,.85)) drop-shadow(0 2px 3px rgba(0,0,0,.5))}
.plate.big{width:104px;height:104px}
.wcard .plate{width:46px;height:46px}
#scr-map{justify-content:flex-start;gap:8px;padding:14px 12px}
.maphead{display:flex;align-items:center;gap:6px 20px;flex-wrap:wrap;justify-content:center}
.maphead h2{font-size:clamp(30px,5vw,46px)}
.mstars{display:flex;align-items:center;gap:6px;font-family:var(--font-display);font-size:24px;color:var(--cream)}
.mstars img{width:28px;height:28px}
.mapbar{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.mapbar button,#scr-map .row button{--h:42px;font-size:17px}
.wpath{display:flex;gap:16px;width:min(1180px,100%);overflow-x:auto;padding:10px 6px 14px;scroll-snap-type:x proximity;align-items:stretch}
.wcard{position:relative;flex:1 0 168px;display:flex;flex-direction:column;align-items:center;gap:5px;padding:10px 10px 12px;text-align:center;cursor:pointer;scroll-snap-align:center;
  background:rgba(8,32,40,.82);border:2px solid #b98a2e;border-radius:14px}
.wcard:not(:last-child)::after{content:'';position:absolute;top:46px;left:100%;width:16px;border-top:4px dotted rgba(255,217,106,.55)}
.wcard:focus-visible{outline:3px solid #ffd96a;outline-offset:2px}
.wcard.locked,.wcard.soon{border-color:#4f6670;background:rgba(8,24,30,.82)}
.wcard.cleared{box-shadow:0 0 14px rgba(255,217,106,.35)}
.wthumb{position:relative;width:100%;aspect-ratio:16/9;border-radius:9px;overflow:hidden;border:2px solid rgba(0,0,0,.45)}
.wthumb img{width:100%;height:100%;object-fit:cover;display:block}
.wcard.locked .wthumb img,.wcard.soon .wthumb img{filter:grayscale(.85) brightness(.55) blur(1.5px)}
.lockmark{position:absolute;inset:0;background:url(../assets/ui/tile_lock.png) center/contain no-repeat;opacity:.9;margin:14% 30%}
.wcard .wnum{font-size:12px;font-family:var(--font-body);font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:#7fe3e8;line-height:1.1}
.wcard .wn{font-family:var(--font-display);font-size:19px;color:var(--cream);line-height:1.05;text-wrap:balance;min-height:2.1em;display:flex;align-items:center}
.wcard .wplate{min-height:48px}
.wstat{font-size:13px;font-weight:600;color:#cfe3df;line-height:1.3}
.wstat b{color:#ffd96a}
.wrank{font-size:12px;font-weight:700;color:#ffd96a}
.wrank.dim{color:var(--muted);font-weight:600}
.bar{width:100%;height:6px;border-radius:3px;background:rgba(0,0,0,.45);overflow:hidden}
.bar i{display:block;height:100%;background:linear-gradient(90deg,#c8902c,#ffd96a)}
.mnote{min-height:2.6em;max-width:70ch;color:#cfe3df}
/* level path: nodes in a snake, 2 rows, joined by a line */
.grid.path{display:flex;flex-direction:column;gap:12px;width:min(640px,100%,calc((100vh - 210px)*2.6))}
.prow{position:relative;display:flex;justify-content:flex-start}
.prow.rev{flex-direction:row-reverse}
.prow::before{content:'';position:absolute;top:50%;height:0;border-top:4px dotted rgba(255,217,106,.45);left:calc(50%/var(--per));width:calc((var(--cnt) - 1)*100%/var(--per))}
.prow.rev::before{left:auto;right:calc(50%/var(--per))}
.prow:not(:last-child)::after{content:'';position:absolute;top:50%;height:calc(100% + 12px);border-left:4px dotted rgba(255,217,106,.45);right:calc(50%/var(--per))}
.prow.rev:not(:last-child)::after{right:auto;left:calc(50%/var(--per))}
.prow .tile{flex:0 0 calc(100%/var(--per));z-index:1;max-width:calc(100%/var(--per))}
.tile{position:relative}
.tile .st img{width:14px;height:14px}
.tile.dimmed{opacity:.35}
@media (max-height:520px){
  #scr-map{gap:4px;padding:6px 10px}
  .maphead h2{font-size:26px}.mstars{font-size:19px}.mstars img{width:22px;height:22px}
  .wpath{gap:12px;padding:4px 4px 6px}
  .wcard{flex-basis:140px;padding:6px 6px 8px;gap:3px}
  .wcard:not(:last-child)::after{top:34px;width:12px}
  .wcard .wn{font-size:16px}.wstat{font-size:11.5px}.wrank{font-size:11px}.wcard .wplate{min-height:36px}
  .plate{width:28px;height:28px}.shelf .plate{width:34px;height:34px}.wcard .plate{width:34px;height:34px}
  .mapbar button,#scr-map .row button{--h:34px;font-size:15px}
  .mnote{min-height:2em;font-size:12px}
  .tmenu{gap:6px;width:min(400px,100%)}.tmenu button{--h:38px;font-size:16px}
  #scr-levels h2{display:none}
  .rankline{font-size:15px}.shelf{padding:3px 10px;gap:8px}
  .grid.path{gap:6px;width:min(560px,100%,calc((100vh - 195px)*2.6))}
  .prow:not(:last-child)::after{height:calc(100% + 6px)}
  .tile .st img{width:11px;height:11px}
  #scr-levels{gap:5px}
}
@media (max-height:440px){#scr-title .hero{display:none}#scr-title{gap:6px}}

/* ===== gate moment and end ===== */
#scr-gate{gap:0;padding:12px}
.gskip{position:absolute;top:10px;right:12px;--h:34px;font-size:14px;padding:0 2px;z-index:3}
.gwrap{display:flex;flex-direction:column;align-items:center;gap:12px;width:100%}
.gtext{display:flex;flex-direction:column;align-items:center;gap:5px;max-width:100%}
.gframe{position:relative;width:min(520px,86vw,calc((100vh - 420px)*1.78));aspect-ratio:16/9;border-radius:14px;border:3px solid #d9a233;box-shadow:0 0 0 2px #6a4a12,0 14px 40px rgba(0,0,0,.55);flex:none}
.gframe .fxbox{border-radius:11px}
#gRank{font-size:clamp(34px,6vw,54px);line-height:1}
#gLine{font-style:italic;max-width:44ch;min-height:1.5em;margin:0}
.gshelf{display:flex;gap:10px;justify-content:center;margin:4px 0}
.gslot{position:relative;width:56px;height:56px;border-radius:50%;display:grid;place-items:center;background:radial-gradient(circle at 50% 40%,#0b2a35,#04141b 70%);border:3px solid #b98a2e;box-shadow:inset 0 3px 8px rgba(0,0,0,.8),0 0 0 1px #4a3208,0 2px 5px rgba(0,0,0,.5)}
.gslot .plate{width:46px;height:46px}
.gslot.lit{animation:slotlit 1s ease-out}
@keyframes slotlit{0%{box-shadow:inset 0 3px 8px rgba(0,0,0,.8),0 0 26px 8px rgba(255,214,90,.95)}100%{box-shadow:inset 0 3px 8px rgba(0,0,0,.8),0 0 0 1px #4a3208,0 2px 5px rgba(0,0,0,.5)}}
.gfly{position:fixed;left:0;top:0;width:110px;height:110px;z-index:70;pointer-events:none;transform-origin:center;filter:drop-shadow(0 6px 10px rgba(0,0,0,.6)) drop-shadow(0 0 12px rgba(255,214,90,.6));opacity:0}
/* corner cogs: a big one meshing with a small one that turns the other way */
.cogs{position:absolute;inset:0;pointer-events:none;z-index:2}
.cog{position:absolute;filter:drop-shadow(0 2px 3px rgba(0,0,0,.6))}
.cog svg{display:block;width:100%;height:100%}
.cog.a{width:64px;height:64px}.cog.b{width:40px;height:40px}
.cog.tl.a{left:-26px;top:-26px}.cog.tl.b{left:31px;top:-27px}
.cog.br.a{right:-26px;bottom:-26px}.cog.br.b{right:31px;bottom:-27px}
.cogs.run .cog.a{animation:cogspin 18s linear infinite}
.cogs.run .cog.b{animation:cogspin 11s linear infinite reverse}
@keyframes cogspin{to{transform:rotate(360deg)}}
/* the sequence: before an element's turn it is hidden, then it arrives */
#scr-gate.seq .gframe{animation:framein .6s ease-out both}
@keyframes framein{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
#scr-gate.seq #gWorld,#scr-gate.seq #gRank,#scr-gate.seq #gMean,#scr-gate.seq #gShelf{opacity:0}
#scr-gate.seq #gGo{opacity:0;pointer-events:none}
#scr-gate.seq #gWorld.in{animation:wslide .6s cubic-bezier(.2,.9,.3,1) both}
@keyframes wslide{from{opacity:0;transform:translateX(-90px)}60%{opacity:1;transform:translateX(6px)}to{opacity:1;transform:none}}
#scr-gate.seq #gRank.in{animation:rankdrop .8s cubic-bezier(.2,1.4,.4,1) both}
@keyframes rankdrop{from{opacity:0;transform:translateY(-90px) scale(1.9)}to{opacity:1;transform:none}}
#scr-gate.seq #gMean.in,#scr-gate.seq #gShelf.in{animation:gfade .6s ease-out both}
@keyframes gfade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
#gGo.pulse{animation:gopulse 1.5s ease-in-out infinite}
@keyframes gopulse{0%,100%{transform:scale(1);filter:brightness(1)}50%{transform:scale(1.06);filter:brightness(1.18)}}
#scr-gate.shake{animation:gshake .3s linear}
@keyframes gshake{0%,100%{transform:none}15%{transform:translate(-5px,3px)}35%{transform:translate(5px,-3px)}55%{transform:translate(-3px,-2px)}75%{transform:translate(3px,2px)}}
@media (prefers-reduced-motion:reduce){.cogs.run .cog{animation:none}#gGo.pulse,#scr-gate.shake,.gslot.lit{animation:none}}
@media (min-aspect-ratio:2/1),(max-height:520px){
  .gwrap{flex-direction:row;justify-content:center;gap:30px;align-items:center}
  .gframe{width:min(52vw,calc((100vh - 50px)*1.78))}
  .gtext{width:min(38vw,380px)}
  #gRank{font-size:32px}
  .gslot{width:44px;height:44px;border-width:2px}.gslot .plate{width:36px;height:36px}
  .gshelf{gap:6px;margin:2px 0}
  #gLine{font-size:14px;min-height:2.6em}
  #scr-end{gap:6px}
}

/* ===== UI build: daily ===== */
#tDaily small,#mDaily small{font-size:.72em;font-weight:600;opacity:.9;margin-left:.3em}
#scr-daily{gap:10px}
.dstats{display:flex;gap:6px 28px;flex-wrap:wrap;justify-content:center;font-family:var(--font-display);font-size:clamp(18px,3vw,24px);color:var(--cream)}
.dstats b{color:#ffd96a;font-weight:400}
.dcards{display:flex;gap:14px;flex-wrap:wrap;justify-content:center}
.dcard{min-width:140px;display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 16px;background:rgba(8,32,40,.82);border:2px solid #b98a2e;border-radius:14px}
.dcard.done{border-color:#4f6670;opacity:.92}
.dcard .dn{font-family:var(--font-display);font-size:22px;color:var(--cream)}
.dcard .dst{display:flex;gap:2px;min-height:26px;align-items:center}
.dcard .dst img{width:26px;height:26px}
.dcard button{--h:40px;font-size:17px;min-width:100px}
.linkbtn{--h:30px;font-size:15px;border-image:none;border:0;background:none;color:#ffd96a;text-decoration:underline;padding:0 6px;text-shadow:none}
#scr-daily #dInfo{max-width:54ch}
@media (max-height:520px){
  #scr-daily{gap:5px}
  .dcards{gap:8px}.dcard{min-width:112px;padding:6px 10px;gap:4px}.dcard .dn{font-size:18px}.dcard .dst img{width:20px;height:20px}.dcard button{--h:34px;font-size:15px}
  #scr-daily h2{font-size:28px}
}

/* ===== UI build: plaque, name, full screen share ===== */
#scr-plaque{gap:10px}
#pqCv{width:min(760px,92vw,calc((100vh - 150px)*1.58));height:auto;aspect-ratio:1200/760;border-radius:18px;border:0;box-shadow:0 14px 40px rgba(0,0,0,.6)}
#nameAsk{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:rgba(4,14,20,.7);backdrop-filter:blur(3px)}
#nameIn{width:min(300px,80vw);height:46px;padding:0 14px;font:600 20px var(--font-body);color:var(--cream);background:rgba(0,0,0,.35);border:2px solid #b98a2e;border-radius:12px;text-align:center;-webkit-user-select:text;user-select:text}
#nameIn:focus{outline:3px solid #ffd96a;outline-offset:2px}
#pqFull{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;background:#05121a;cursor:pointer}
#pqFull canvas{width:min(96vw,calc((100vh - 40px)*1.58));height:auto;aspect-ratio:1200/760;border:0;border-radius:0;box-shadow:none}
@media (max-height:520px){#pqCv{width:min(560px,92vw,calc((100vh - 120px)*1.58))}#scr-plaque{gap:6px;padding:6px}}

/* ===== real art: story frames, finale shelf, plaque backdrop ===== */
.scr.story{padding:0;gap:0;justify-content:flex-end;cursor:pointer;background:#050d14}

.stcap{position:relative;width:100%;padding:44px 20px 18px;background:linear-gradient(transparent,rgba(3,9,14,.88) 55%);display:flex;flex-direction:column;align-items:center;gap:4px}
.stcap p{font-size:clamp(16px,2.4vw,24px);color:#fff4d6;max-width:46ch;text-shadow:0 2px 6px rgba(0,0,0,.8)}
.shelfstage{position:relative;width:min(100%,640px,calc((100vh - 220px)*1.78));aspect-ratio:16/9;border-radius:14px;overflow:hidden;border:3px solid #d9a233;box-shadow:0 0 0 2px #6a4a12,0 14px 40px rgba(0,0,0,.55);flex:none}
.shelfbg{position:absolute;inset:0;width:100%;height:100%;display:block}
.splate{position:absolute;width:15.6%;aspect-ratio:1/.56;transform:translate(-50%,-50%);animation:platedrop .7s cubic-bezier(.2,1.3,.4,1) both;animation-delay:calc(.25s + var(--i)*.18s);filter:drop-shadow(0 0 7px rgba(255,214,70,.55))}
.splate img{width:100%;height:100%;object-fit:fill;display:block}
@keyframes platedrop{from{transform:translate(-50%,-260%);opacity:0}to{transform:translate(-50%,-50%);opacity:1}}
@media (prefers-reduced-motion:reduce){.splate{animation:none}}
#scr-plaque{background:linear-gradient(rgba(3,9,14,.45),rgba(3,9,14,.8)),url(../assets/story/story7.jpg) center/cover no-repeat}

/* ===== living stills: push-in, vignette, effects canvas, text that arrives line by line ===== */
.fxbox{position:absolute;inset:0;overflow:hidden;border-radius:inherit;background:#050d14}
.fxbox .zoom{position:absolute;inset:0;transform-origin:62% 58%;animation:stpush 14s ease-in-out infinite alternate;will-change:transform}
.fxbox img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
canvas.fxcv,canvas#fxTop{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border:0;border-radius:0;background:none;box-shadow:none;box-sizing:border-box}
canvas#fxTop{position:fixed;width:100vw;height:100vh}
.fxbox .vig{position:absolute;inset:0;pointer-events:none;background:radial-gradient(ellipse at 50% 46%,transparent 52%,rgba(2,6,10,.5) 100%)}
@keyframes stpush{from{transform:scale(1) translate(0,0)}to{transform:scale(1.07) translate(-1.1%,-.7%)}}
.scr.story .gskip{z-index:2}
.stcap p{min-height:2.9em}
.stcap .ln{opacity:0;transition:opacity .9s ease}.stcap .ln.on{opacity:1}
.stcap .small{opacity:0;transition:opacity .6s}.stcap .small.on{opacity:.9;animation:hintpulse 1.8s ease-in-out .6s infinite}
@keyframes hintpulse{0%,100%{opacity:.35}50%{opacity:1}}
@media (prefers-reduced-motion:reduce){.fxbox .zoom{animation:none}.stcap .ln,.stcap .small{transition:none}.stcap .small.on{animation:none}}

/* win card stars pop in one by one */
#stars img.pre{opacity:0;transform:scale(.2)}
#stars img.pop{animation:starpop .55s cubic-bezier(.2,1.7,.4,1) both}
@keyframes starpop{from{opacity:0;transform:scale(.2) rotate(-40deg)}60%{opacity:1;transform:scale(1.25) rotate(8deg)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){#stars img.pop{animation:none}}

/* ===== mockup pass: title, world map, levels. One brass and teal set ===== */
:root{--br1:#f6d684;--br2:#c8902c;--br3:#7a520e;--tl1:#10525a;--tl2:#0a3239}
button{display:inline-flex;align-items:center;justify-content:center}
.foot button{--h:52px;font-size:20px;padding:0 4px;min-width:130px}
.foot #lBack::before,.foot #mBack::before,.foot #dBack::before,.foot #lMap::before,.foot #mPlaque::before,.foot #mDaily::before,.foot #lDaily::before{content:'';flex:none;width:1.15em;height:1.15em;margin-right:.45em;background:center/contain no-repeat}
.foot #lBack::before,.foot #mBack::before,.foot #dBack::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 4 3 12l8 8v-5h10V9H11z' fill='%23ffd96a' stroke='%237a520e' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E")}
.foot #lMap::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5l6-2 6 2 6-2v16l-6 2-6-2-6 2z' fill='%23ffe9a8' stroke='%237a520e' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M9 3v16M15 5v16' stroke='%237a520e' stroke-width='1.2'/%3E%3C/svg%3E")}
.foot #mPlaque::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='%23e0a93a' stroke='%237a520e' stroke-width='1.6'/%3E%3Ccircle cx='12' cy='12' r='4' fill='none' stroke='%237a520e' stroke-width='2.4' stroke-dasharray='2.4 1.6'/%3E%3C/svg%3E")}
.foot #mDaily::before,.foot #lDaily::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='16' rx='2' fill='%23ffe9a8' stroke='%237a520e' stroke-width='1.4'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4' stroke='%237a520e' stroke-width='1.6'/%3E%3Cpath d='M7 13h2v2H7zM11 13h2v2h-2zM15 13h2v2h-2zM7 17h2v2H7zM11 17h2v2h-2z' fill='%237a520e'/%3E%3C/svg%3E")}
#lPreview{--h:40px;font-size:15px}
.hang{position:relative;display:inline-block;margin:6px auto 0;padding:2px 64px 6px;border-radius:16px;background:linear-gradient(var(--tl1),var(--tl2));border:4px solid var(--br2);box-shadow:inset 0 0 0 2px var(--br3),inset 0 8px 14px rgba(255,255,255,.07),0 8px 18px rgba(0,0,0,.55)}
.hang::before,.hang::after{content:'';position:absolute;bottom:100%;width:5px;height:70px;left:20%;background:repeating-linear-gradient(#b8944a 0 5px,#4a3a18 5px 8px)}
.hang::after{left:auto;right:20%}
.hang h2{margin:0;font-size:clamp(30px,5vw,50px);line-height:1.1}
.hgear{position:absolute;top:50%;width:44px;height:44px;margin-top:-22px;filter:drop-shadow(0 2px 3px rgba(0,0,0,.6))}
.hgear.l{left:-22px}.hgear.r{right:-22px}
.hgear svg{display:block;width:100%;height:100%}
.pillb{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:2px 26px;border-radius:999px;background:linear-gradient(var(--tl1),var(--tl2));border:3px solid var(--br2);box-shadow:inset 0 0 0 1.5px var(--br3),0 3px 8px rgba(0,0,0,.5);font-family:var(--font-display);font-size:clamp(17px,2.4vw,24px);color:var(--cream);line-height:1.35}
.pillb img{width:26px;height:26px}
.pills{display:flex;flex-direction:column;align-items:center;gap:6px}
#mRank{font-family:var(--font-body);font-weight:700;font-size:clamp(14px,1.8vw,18px);padding:1px 20px}
.banner{gap:14px;padding:2px 14px}
.banner .bg{width:26px;height:26px;display:block}.banner .bg svg{width:100%;height:100%;display:block}
.banner .bg:last-child svg{transform:scaleX(-1)}
.tabs{gap:8px 10px}
.tabs button{--h:42px;font-size:18px;padding:0 4px;min-width:104px}
.tabs button:disabled{opacity:.5;filter:saturate(.6)}
/* levels */
#scr-levels{justify-content:flex-start;gap:8px;padding:10px 12px 12px;background:#050d14}
#scr-levels #lStars{font-size:clamp(16px,2.2vw,22px);padding:0 20px;margin-top:-2px}
#scr-levels .foot{margin-top:auto}
#lGrid.grid.path{--pad:6%;--rg:clamp(14px,6vh,48px);display:flex;flex-direction:column;justify-content:center;flex:1;gap:var(--rg);width:min(1040px,100%);container-type:inline-size;margin:0 0 4px}
.prow{position:relative;display:grid;grid-template-columns:repeat(var(--per),1fr);padding:0 var(--pad);align-items:center;--cell:calc((100% - 2*var(--pad))/var(--per))}
.prow.rev{direction:rtl}
.prow>*{direction:ltr}
.prow .tile{flex:none;max-width:none;width:68%;justify-self:center;z-index:1}
.prow::before{content:'';position:absolute;top:50%;height:16px;margin-top:-8px;left:calc(var(--pad) + var(--cell)/2);width:calc((100% - 2*var(--pad))*(var(--cnt) - 1)/var(--per));border:0;border-radius:8px;
  background:repeating-linear-gradient(90deg,transparent 0 22px,rgba(70,42,6,.5) 22px 25px,transparent 25px 48px),linear-gradient(#fbe3a0,#e0a83c 32%,#b57c1e 62%,#6e4710);box-shadow:0 2px 4px rgba(0,0,0,.55)}
.prow.rev::before{left:auto;right:calc(var(--pad) + var(--cell)/2)}
.prow:not(:last-child)::after{content:'';position:absolute;top:calc(50% - 8px);height:calc(100% + var(--rg) + 16px);left:calc(100% - var(--pad) - var(--cell)/2);right:auto;width:calc(var(--cell)*.34 + 28px);border:16px solid #d19a2e;border-left:0;border-radius:0 44px 44px 0;box-sizing:border-box;filter:drop-shadow(0 2px 3px rgba(0,0,0,.5));box-shadow:inset -3px 0 0 rgba(255,232,150,.45)}
.prow.rev:not(:last-child)::after{left:auto;right:calc(100% - var(--pad) - var(--cell)/2);border:16px solid #d19a2e;border-right:0;border-radius:44px 0 0 44px;box-shadow:inset 3px 0 0 rgba(255,232,150,.45)}
.tile .n{font-size:clamp(14px,4.4cqw,34px);margin-top:0}
.tile .st{min-height:0}
.tile .st img{width:clamp(8px,1.9cqw,17px);height:clamp(8px,1.9cqw,17px)}
button.tile.cur{width:84%;z-index:2;animation:tileglow 1.8s ease-in-out infinite;filter:drop-shadow(0 0 12px rgba(255,190,60,.9))}
@keyframes tileglow{50%{filter:brightness(1.1) drop-shadow(0 0 22px rgba(255,200,70,1))}}
button.tile.lock{opacity:.8}
button.tile.lock .n{display:none}
@media (prefers-reduced-motion:reduce){button.tile.cur{animation:none}}
/* world map */
#scr-map{justify-content:flex-start;gap:8px;padding:10px 14px 12px;background:linear-gradient(rgba(3,10,16,.58),rgba(3,10,16,.86)),url(../assets/story/story1.jpg) center/cover no-repeat #050d14}
#scr-map .foot{margin-top:auto}
.wpath{gap:30px;padding:16px 8px 10px;width:min(1240px,100%);margin:auto}
.wcard{flex:1 1 0;min-width:176px;gap:6px;padding:10px 10px 14px;border:3px solid var(--br2);border-radius:18px;background:linear-gradient(#0f5560,#0a3a42 55%,#08292f);box-shadow:inset 0 0 0 2px var(--br3),0 10px 22px rgba(0,0,0,.55)}
.wcard::before{content:'';position:absolute;top:-10px;left:50%;width:16px;height:16px;margin-left:-8px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffe9a8,#c8902c 60%,#6a4a12);box-shadow:0 1px 3px rgba(0,0,0,.6)}
.wcard:not(:last-child)::after{top:34%;left:calc(100% + 3px);width:24px;height:0;border-top:5px dotted #d9a233;filter:drop-shadow(0 1px 1px rgba(0,0,0,.6))}
.wcard.locked,.wcard.soon{background:linear-gradient(#0c3b43,#08262c 55%,#061b20);border-color:#8a6a28}
.wcard.cleared{box-shadow:inset 0 0 0 2px var(--br3),0 10px 22px rgba(0,0,0,.55),0 0 16px rgba(255,217,106,.3)}
.wthumb{border:2px solid rgba(0,0,0,.55);border-radius:10px}
.wcard.locked .wthumb img,.wcard.soon .wthumb img{filter:grayscale(.7) brightness(.5)}
.wcard .wnum{color:#e8bd5a;font-size:13px}
.wcard .wn{color:#fff4d6;font-size:21px;min-height:2.2em;justify-content:center}
.wcard .wplate{min-height:72px;display:grid;place-items:center}
.wcard .plate{width:70px;height:70px}
.padl{display:block;width:66px;height:66px;border-radius:50%;background:radial-gradient(circle at 40% 35%,#4a5558,#222b2e 70%);border:3px solid #6a6a60;box-shadow:inset 0 0 8px rgba(0,0,0,.7),0 2px 5px rgba(0,0,0,.6);position:relative}
.padl::before{content:'';position:absolute;inset:16% 22%;background:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath d='M6 12V8a6 6 0 0 1 12 0v4' fill='none' stroke='%23c9c3b0' stroke-width='3'/%3E%3Crect x='3' y='12' width='18' height='14' rx='3' fill='%23e8e0c4' stroke='%23555' stroke-width='1.4'/%3E%3Ccircle cx='12' cy='18' r='2.2' fill='%23333'/%3E%3Cpath d='M12 19v4' stroke='%23333' stroke-width='2'/%3E%3C/svg%3E")}
.wstat{font-size:15px;color:#fff4d6}
.wstat b{color:#ffd96a}
.wrank{font-size:14px}
.bar{height:11px;border-radius:6px;border:2px solid #7a5a1c;background:rgba(0,0,0,.55)}
/* title */
#scr-title{gap:10px}
#scr-title .logo{width:min(660px,84vw)}
#scr-title .tag{font-size:clamp(17px,2.4vw,23px);color:#fff4d6;font-weight:700}
#scr-title .shelf{gap:14px;padding:0;background:none;border:0}
#scr-title .shelf .plate{width:clamp(44px,7vw,62px);height:clamp(44px,7vw,62px)}
.tmenu{width:min(560px,100%);gap:12px}
.tmenu #tPlay{--h:78px;font-size:46px;letter-spacing:.02em;padding:0}
.tmenu button{--h:58px;font-size:22px}
/* small screens */
@media (max-width:560px){
  .hang{padding:2px 50px 4px}.hgear{width:36px;height:36px;margin-top:-18px}.hgear.l{left:-18px}.hgear.r{right:-18px}
  .tabs button{min-width:0;--h:34px;font-size:14px}
  #lGrid.grid.path{--pad:7%;--rg:18px}.prow .tile{width:80%}button.tile.cur{width:96%}
  .foot button{--h:44px;font-size:17px;min-width:0}
  .wpath{gap:22px;scroll-snap-type:x mandatory}.wcard{flex:0 0 min(236px,70vw)}
  .tmenu #tPlay{--h:68px;font-size:38px}.tmenu button{--h:50px;font-size:17px}
}
@media (max-height:520px){
  .hang{padding:0 46px 3px;margin-top:2px}.hang h2{display:block!important;font-size:28px}.hang::before,.hang::after{height:30px}
  .hgear{width:32px;height:32px;margin-top:-16px}.hgear.l{left:-16px}.hgear.r{right:-16px}
  .pillb{font-size:15px;padding:0 16px;border-width:2px}.pillb img{width:18px;height:18px}.banner .bg{width:18px;height:18px}
  #scr-levels{gap:4px;padding:4px 10px 6px}
  .tabs button{--h:30px;font-size:14px;min-width:84px}
  #lGrid.grid.path{--rg:8px;width:min(760px,100%,calc((100vh - 190px)*3.4))}
  .prow::before{height:11px;margin-top:-5.5px}
  .prow:not(:last-child)::after{border-width:11px;border-radius:0 30px 30px 0;top:calc(50% - 5.5px);height:calc(100% + var(--rg) + 11px)}
  .prow.rev:not(:last-child)::after{border-width:11px;border-right:0;border-radius:30px 0 0 30px}
  .foot button{--h:38px;font-size:16px;min-width:100px}
  #scr-map{gap:3px;padding:4px 10px 6px}
  .wpath{padding:10px 6px 6px;gap:22px}
  .wcard{min-width:136px;gap:3px;padding:6px 6px 8px;flex-basis:136px}.wcard .wn{font-size:15px;min-height:2.1em}
  .wthumb{display:none}.wcard .wplate{min-height:44px}.wcard .plate{width:42px;height:42px}.padl{width:42px;height:42px;border-width:2px}
  .wstat{font-size:12px}.wrank{font-size:11.5px}.wcard .wnum{font-size:11px}.bar{height:8px}
  .tmenu #tPlay{--h:54px;font-size:32px}.tmenu button{--h:42px;font-size:18px}
  #scr-title .shelf .plate{width:38px;height:38px}
  #lPreview{--h:34px}
}
@media (max-height:440px){#scr-title{gap:6px}.tmenu #tPlay{--h:46px;font-size:28px}.tmenu button{--h:38px;font-size:16px}#scr-title .logo{width:min(380px,50vh*2.4)}}

/* ---- Daily screen: same set as the Levels and World map screens ---- */
#scr-daily{justify-content:flex-start;gap:12px;padding:10px 14px 12px;background:linear-gradient(rgba(3,10,16,.58),rgba(3,10,16,.86)),url(../assets/story/story1.jpg) center/cover no-repeat #050d14}
#scr-daily .foot{margin-top:auto}
.dpills{flex-direction:row;flex-wrap:wrap;justify-content:center;gap:10px}
.dpills .pillb b{color:#ffd96a;font-weight:400}
#scr-daily .banner{max-width:92vw}
.dcards{display:flex;flex-wrap:nowrap;justify-content:center;gap:24px;margin-top:8px;width:min(860px,100%)}
.dcard{position:relative;min-width:0;flex:1 1 0;max-width:260px;gap:10px;padding:16px 16px 18px;border:3px solid var(--br2);border-radius:18px;background:linear-gradient(#0f5560,#0a3a42 55%,#08292f);box-shadow:inset 0 0 0 2px var(--br3),0 10px 22px rgba(0,0,0,.55)}
.dcard::before{content:'';position:absolute;top:-10px;left:50%;width:16px;height:16px;margin-left:-8px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffe9a8,#c8902c 60%,#6a4a12);box-shadow:0 1px 3px rgba(0,0,0,.6)}
.dcard.done{background:linear-gradient(#0c3b43,#08262c 55%,#061b20);border-color:#8a6a28;opacity:1}
.dcard .dn{font-size:26px;color:#fff4d6}
.dcard .dst{min-height:36px;gap:4px}.dcard .dst img{width:34px;height:34px}
.dcard .small{color:#cfe6ea}
.dcard button{--h:46px;font-size:19px;min-width:120px}
#scr-daily .dinfo{max-width:58ch;margin:0;padding:0 12px;text-align:center;font-size:clamp(13px,1.7vw,16px);line-height:1.4;color:#cfe6ea}
@media (max-width:640px){.dcards{flex-direction:column;align-items:stretch;gap:14px;width:100%}.dcard{max-width:none;flex-direction:row;justify-content:space-between;align-items:center;padding:10px 14px;gap:8px}.dcard .dn{font-size:21px}.dcard .dst img{width:24px;height:24px}.dcard .dst{min-height:0}.dcard button{--h:40px;min-width:92px;font-size:17px}.dcard::before{display:none}}
@media (max-height:520px){#scr-daily{gap:5px;padding:4px 10px 6px}.dcards{gap:12px;margin-top:2px}.dcard{padding:8px 10px 10px;gap:5px}.dcard .dn{font-size:20px}.dcard .dst img{width:24px;height:24px}.dcard .dst{min-height:26px}.dcard button{--h:36px;font-size:16px}#scr-daily .dinfo{font-size:12px}}

/* win card: the Daily prompt is a real button, not a text link */
#ovDaily{--h:38px;font-size:16px;margin:4px auto 6px}
#ovDaily::before{content:'';flex:none;width:1.15em;height:1.15em;margin-right:.45em;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='16' rx='2' fill='%23ffe9a8' stroke='%237a520e' stroke-width='1.4'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4' stroke='%237a520e' stroke-width='1.6'/%3E%3Cpath d='M7 13h2v2H7zM11 13h2v2h-2zM15 13h2v2h-2zM7 17h2v2H7zM11 17h2v2h-2z' fill='%237a520e'/%3E%3C/svg%3E") center/contain no-repeat}

/* the Hint button glows after a failed run, so a stuck player sees where help is */
@keyframes hintNudge{0%,100%{filter:none}50%{filter:brightness(1.22) drop-shadow(0 0 9px rgba(255,217,106,.95))}}
#btnHint.nudge{animation:hintNudge 1.3s ease-in-out infinite}
@media (prefers-reduced-motion:reduce){#btnHint.nudge{animation:none;filter:brightness(1.2) drop-shadow(0 0 7px rgba(255,217,106,.9))}}

/* ---------- loading screen: the title picture with a ball that rolls along the bar ---------- */
#scr-load{gap:12px}
#scr-load .lload{width:min(420px,78vw);display:flex;flex-direction:column;gap:10px;margin-top:10px}
#scr-load .ltrack{position:relative;height:12px;border-radius:7px;background:rgba(0,0,0,.5);border:1.5px solid #8a6a2a;box-shadow:inset 0 2px 4px rgba(0,0,0,.5)}
#scr-load .ltrack i{position:absolute;left:0;top:0;bottom:0;width:0;border-radius:6px;background:linear-gradient(90deg,#c8902c,#ffd96a)}
#scr-load .ltrack img{position:absolute;top:50%;left:0;width:26px;height:26px;margin:-13px 0 0 -13px;filter:drop-shadow(0 3px 3px rgba(0,0,0,.5))}
#scr-load .lsay{font-size:15px;letter-spacing:.14em;text-transform:uppercase;color:#cfe3df;font-weight:700;min-height:1.2em}
@media (max-height:440px){#scr-load .hero{display:none}#scr-load{gap:6px}#scr-load .logo{width:min(380px,50vh*2.4)}}

/* ---------- portrait phones: ask for landscape while a level is on screen ---------- */
#rotate{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;
  background:radial-gradient(ellipse at 50% 50%,rgba(6,22,30,.15),rgba(4,12,18,.7) 90%),url(../assets/bg.jpg) 30% center/cover no-repeat}
#rotate .rbox{display:flex;flex-direction:column;align-items:center;gap:14px;max-width:320px}
#rotate .rphone{width:96px;height:96px;color:#ffd96a;animation:rturn 2.6s ease-in-out infinite;filter:drop-shadow(0 6px 10px rgba(0,0,0,.5))}
@keyframes rturn{0%,15%{transform:rotate(0)}55%,85%{transform:rotate(-90deg)}100%{transform:rotate(0)}}
#rotate h2{margin:0;font-family:var(--font-display);font-weight:400;font-size:34px;line-height:1.05;color:#ffd96a;text-shadow:0 3px 0 #7a520e,0 0 24px rgba(240,189,69,.3)}
#rotate p{margin:0;color:#cfe3df;line-height:1.4;font-size:17px}
@media (prefers-reduced-motion:reduce){#rotate .rphone{animation:none;transform:rotate(-90deg)}}

/* ---------- the tip: a small note over the top of the board that fades away ---------- */
#tip{position:absolute;left:50%;top:12px;transform:translateX(-50%);z-index:6;pointer-events:none;box-sizing:border-box;
  width:max-content;max-width:min(86%,620px);padding:8px 16px;text-align:center;font-size:15px;line-height:1.35;min-height:0;color:var(--cream);
  background:rgba(6,16,22,.84);border:1.5px solid rgba(240,189,69,.6);border-radius:10px;box-shadow:0 6px 18px rgba(0,0,0,.45);
  opacity:0;transition:opacity .6s ease}
#tip.show{opacity:1}
#tip:empty{display:none}
#tip b{color:#fff}
@media (max-height:520px){#tip{top:6px;font-size:12px;padding:5px 11px;line-height:1.25}}
@media (prefers-reduced-motion:reduce){#tip{transition:none}}
#side{display:none}

/* ---------- wide screens (laptops, the portal's game frame, phones held sideways) ----------
 * One row of controls on top (menu, level, delivered, spills, Start). Help, hint and reset stand in a column on the right. The board takes the rest.
 * Used from 8:5 upward and at least 600px wide, where this gives a bigger board than the stacked layout. The Exit, cloud and sound icons the portal
 * puts on the left edge of a phone keep 54px free there. */
@media (min-aspect-ratio:8/5) and (min-width:600px){
  :root{--side:76px}
  #app{display:grid;grid-template-columns:var(--side) minmax(0,1fr) var(--side);grid-template-rows:auto minmax(0,1fr);column-gap:8px;row-gap:6px;
    padding-top:max(6px,env(safe-area-inset-top));padding-bottom:max(6px,env(safe-area-inset-bottom));
    padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
  .brand{display:none}
  .hud{grid-column:1/-1;grid-row:1;flex-wrap:nowrap;gap:6px 18px}
  .hud .actions{margin-left:auto;flex-wrap:nowrap}
  #stage{grid-column:2;grid-row:2;min-height:0}
  #side{grid-column:3;grid-row:2;display:flex;flex-direction:column;align-items:stretch;gap:10px;padding-top:4px}
  #side button{width:100%;min-width:0}
  #side button.round{width:calc(46px*var(--ui));align-self:center}
}
@media (min-aspect-ratio:8/5) and (min-width:1000px){:root{--side:88px}#tip{font-size:16px}}
@media (min-aspect-ratio:8/5) and (min-width:1600px){:root{--side:112px}#tip{font-size:18px;max-width:min(86%,760px)}}
@media (min-aspect-ratio:8/5) and (min-width:600px) and (pointer:coarse){
  #app{padding-left:max(54px,env(safe-area-inset-left));grid-template-columns:0 minmax(0,1fr) var(--side)}
}

/* world finales (js/finale.js): a wide brass tile under the level path, and a chip on a cleared world's map card */
.fintile{--h:auto;height:auto;border-image:none;display:flex;flex-direction:column;align-items:center;gap:3px;width:min(420px,100%);margin:6px auto 0;padding:10px 18px 9px;cursor:pointer;
  background:linear-gradient(180deg,#5a3c12,#2a1a08);border:2px solid #e0a93a;border-radius:14px;color:var(--cream);box-shadow:0 0 0 3px rgba(0,0,0,.35),0 0 18px rgba(255,180,60,.35)}
.fintile.fresh{animation:glow 1.8s ease-in-out infinite}
.fintile .fk{font-family:var(--font-body);font-weight:700;font-size:12px;letter-spacing:.16em;text-transform:uppercase;color:#ffd96a}
.fintile .fn{font-family:var(--font-display);font-size:clamp(20px,3.4vw,26px);line-height:1.05}
.fintile .st{display:flex;gap:2px}.fintile .st img{width:16px;height:16px}
.fintile:focus-visible{outline:3px solid #ffd96a;outline-offset:2px}
.finchip{--h:30px;height:var(--h);border-image:none;margin-top:2px;padding:0 12px;font-size:13px;font-weight:700;border-radius:15px;background:linear-gradient(180deg,#7a5418,#3e2a0a);border:1.5px solid #e0a93a;color:#fff3c9;display:inline-flex;align-items:center;gap:4px}
.finchip .fs{display:inline-flex}.finchip .fs img{width:12px;height:12px}
@media (max-height:520px){.fintile{padding:6px 14px 6px;margin-top:2px}.fintile .fn{font-size:18px}.finchip{--h:24px;font-size:11.5px}}
.prow:has(+ .fintile)::after{display:none}   /* the path ends at level 14; the finale tile sits apart */

/* Vishwa's cabinet (js/shop.js) and the ball balance */
.bicon{width:16px;height:16px;vertical-align:-3px;margin-right:4px}
#ovText .ovballs{display:block;margin-top:6px;color:#ffe9a0}
.mballs #hudBalls{font-family:var(--font-display);font-size:18px;color:#ffe9a0;white-space:nowrap}
.scards{display:grid;grid-template-columns:repeat(3,minmax(0,220px));gap:10px;justify-content:center;width:min(720px,100%)}
#scr-shop{overflow-y:auto}
.scard{flex:0 1 230px;display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 12px 12px;background:rgba(8,32,40,.86);border:2px solid #b98a2e;border-radius:14px;text-align:center}
.scard.gold{box-shadow:0 0 14px rgba(255,214,110,.35)}
.scard .sswatch{width:100%;max-width:240px;height:60px}
.scard .sn{font-family:var(--font-display);font-size:20px;color:var(--cream)}
.scard .small{min-height:3.2em;color:#cfe3df}
.scard .sp{font-family:var(--font-display);font-size:19px;color:#ffd96a}
.scard .own{font-family:var(--font-body);font-size:12px;color:#7fe3e8;margin-left:6px}
.scard button{--h:38px;font-size:16px}
@media (max-height:520px){.scards{grid-template-columns:repeat(6,minmax(0,1fr));width:min(100%,920px);gap:6px}.scard{padding:4px 6px;gap:3px}.scard .small{display:none}.scard .sn{font-size:15px}.scard .sp{font-size:15px}.scard .sswatch{height:34px}.scard button{--h:30px;font-size:13px}}
@media (max-width:560px) and (min-height:521px){.scards{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* cabinet: compact cards on ordinary laptop heights so the title and Back both fit (placed last so it wins over the base card rules) */
@media (min-height:521px) and (max-height:860px){.scard{gap:2px;padding:5px 10px 7px}.scard .sswatch{height:38px}.scard .small{min-height:0;font-size:12px}.scard .sn{font-size:18px}.scard button{--h:30px;font-size:14px}#scr-shop{justify-content:flex-start;padding-top:8px}}
