:root{color-scheme:dark;background:#000;color:#fff4c9;font:14px/1.55 monospace}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
#stage{position:fixed;inset:0;background:#000;isolation:isolate}
canvas{display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;touch-action:none;cursor:crosshair;outline:none}
button,input{font:inherit}button{color:#fff4c9;background:#10140f;border:1px solid #777c63;padding:6px 10px;cursor:pointer;border-radius:0}
button:hover{background:#334329}button:active{background:#495b32}button:disabled{opacity:.55;cursor:wait}
:focus-visible{outline:2px solid #ffd96f;outline-offset:3px}
#sound-toggle,#help-toggle{position:absolute;top:12px;width:32px;height:32px;padding:0;z-index:3}#sound-toggle{right:52px}#help-toggle{right:12px}
#help{position:absolute;right:12px;top:52px;width:270px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 64px);overflow:auto;padding:14px;background:#10140ff5;border:1px solid #777c63}
#help p{margin:0 0 14px}#help div{display:flex;align-items:center;gap:8px;margin-bottom:10px}label{display:flex;gap:8px;align-items:center}input{width:80px;accent-color:#ffd96f}kbd{color:#ffd96f;font:inherit}
#overlay{position:absolute;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center}
#overlay[hidden],#help[hidden]{display:none}
#overlay h1{font:24px monospace;margin:0}#overlay p{max-width:32ch;margin:12px 0 20px}
#overlay.end{background:#000b}#overlay button{pointer-events:auto}
#overlay.title h1,#overlay.title p{display:none}
#overlay #select{display:none}
#overlay.title #select,#overlay.title #start{display:block;position:absolute;top:calc(50% + var(--title-start-y));width:var(--title-start-w);height:var(--title-start-h);background:transparent;border:0;color:transparent;padding:0}
#overlay.title #select{left:calc(50% + var(--title-select-x))}
#overlay.title #start{left:calc(50% + var(--title-start-x))}
#overlay.title #select:hover,#overlay.title #start:hover{outline:1px solid #ffd96f}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
::selection{background:#ffd96f;color:#10140f}


/* Mobile presentation uses the game's original title/controller art. */
#rotate-nudge,#touch-controls{display:none}
@media (hover:none) and (pointer:coarse){
  html,body,#stage{width:100dvw;height:100dvh}
  canvas{cursor:default;width:100dvw;height:100dvh}
  #rotate-nudge{position:absolute;inset:0;z-index:20;align-items:center;justify-content:center;text-align:center;padding:24px;overflow:hidden;background:#000 url('assets/portrait_title.png') center/cover no-repeat}
  #rotate-nudge:before{content:'';position:absolute;inset:-3%;background:linear-gradient(180deg,rgba(0,0,0,.18),rgba(0,0,0,.56)),radial-gradient(circle at 50% 58%,transparent 0 24%,rgba(0,0,0,.55) 78%);backdrop-filter:blur(1.2px)}
  .rotate-card{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:10px;padding:18px 22px 16px;background:rgba(0,0,0,.64);border:1px solid rgba(218,158,28,.65);box-shadow:0 8px 28px #000b;color:#fff4c9;text-shadow:0 2px #000}
  .rotate-card strong{font-size:20px;letter-spacing:.08em;text-transform:uppercase}.rotate-card small{color:#d7c99b;max-width:28ch}
  .phone-shape{display:block;width:34px;height:58px;border:3px solid #d59c1c;border-radius:6px;position:relative;animation:turn-phone 1.8s ease-in-out infinite}
  .phone-shape:after{content:'';position:absolute;width:4px;height:4px;background:#d59c1c;border-radius:50%;left:12px;bottom:4px}
  @keyframes turn-phone{0%,30%{transform:rotate(0)}70%,100%{transform:rotate(90deg)}}
  @media (orientation:portrait){#rotate-nudge{display:flex}#sound-toggle,#help-toggle,#help{visibility:hidden}}
  @media (orientation:landscape){
    #touch-controls{display:block;position:absolute;inset:0;z-index:4;pointer-events:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
    #touch-controls button,.stick-zone{touch-action:none;-webkit-tap-highlight-color:transparent}
    .stick-zone{position:absolute;left:max(14px,env(safe-area-inset-left));bottom:max(10px,env(safe-area-inset-bottom));width:164px;height:164px;pointer-events:auto}
    .stick-home{position:absolute;left:50%;top:50%;width:96px;height:96px;transform:translate(-50%,-50%);border:1px solid rgba(218,158,28,.38);border-radius:50%;background:radial-gradient(circle,rgba(0,0,0,.05),rgba(0,0,0,.24));box-shadow:inset 0 0 22px #0008}
    #stick-puck{position:absolute;left:50%;top:50%;width:104px;height:auto;transform:translate(-50%,-50%);image-rendering:pixelated;filter:drop-shadow(0 4px 2px #000b);opacity:.82;pointer-events:none;will-change:transform}
    .stick-zone.active #stick-puck{opacity:1}
    .action-pad{position:absolute;right:max(18px,env(safe-area-inset-right));bottom:max(22px,env(safe-area-inset-bottom));width:174px;height:92px;pointer-events:none}
    .action-pad>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 4px 2px #000b);opacity:.84}
    .action-pad button{position:absolute;pointer-events:auto;width:72px;height:72px;padding:0;border:0;background:transparent;color:transparent;opacity:0}
    .action-pad button.pressed,.action-pad button:active{opacity:.18;background:#ffd96f;border-radius:50%}
    .action-b{left:3px;bottom:0}.action-a{right:4px;top:0}
    .touch-system{position:absolute;left:50%;bottom:max(10px,env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;gap:16px;pointer-events:none}
    .touch-system .art-button{position:relative;pointer-events:auto;width:68px;height:34px;padding:0;border:0;background:transparent;opacity:.82}
    .touch-system .art-button img{width:100%;height:100%;object-fit:contain;image-rendering:pixelated;pointer-events:none}
    .touch-system .art-button.pressed,.touch-system .art-button:active{opacity:1;transform:translateY(1px)}
    #sound-toggle,#help-toggle{z-index:8}
  }
}
