@font-face { font-family: Pixelify; src: url(fonts/pixelify-400.woff2) format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: Pixelify; src: url(fonts/pixelify-700.woff2) format("woff2"); font-weight: 700; font-display: block; }
:root { --bg: #1a1c2c; --ink: #f4f4f4; --dim: #9aa3b5; --panel: rgba(26, 28, 44, .92); --line: #3b3f5c; --blue: #4fb3ff; --red: #ff6a6a; --gold: #f6d04d; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: Pixelify, ui-monospace, monospace; overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
#app { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#stage { position: relative; width: min(100vw, calc(100dvh * 16 / 9)); aspect-ratio: 16 / 9; }
#game { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; background: var(--bg); }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55em; padding: 1em; text-align: center; background: rgba(26, 28, 44, .82); overflow: auto; font-size: clamp(13px, 2.1vw, 18px); }
.screen[hidden], [hidden] { display: none !important; }
h1 { margin: 0; font-size: 2.6em; font-weight: 700; letter-spacing: .04em; color: var(--gold); text-shadow: 0 3px 0 #8a5a1c; }
h2 { margin: 0; font-size: 1.8em; }
p { margin: 0; }
.tag, .small { color: var(--dim); }
.small { font-size: .85em; }
.code { font-size: 3em; letter-spacing: .25em; color: var(--gold); }
.row { display: flex; gap: .5em; align-items: center; justify-content: center; flex-wrap: wrap; }
.field { display: flex; gap: .5em; align-items: center; color: var(--dim); }
input, select { font: inherit; color: var(--ink); background: #0f1020; border: 2px solid var(--line); padding: .35em .6em; border-radius: 0; -webkit-user-select: text; user-select: text; }
#codeIn { width: 6em; text-transform: uppercase; letter-spacing: .2em; text-align: center; }
#linkOut { width: min(22em, 70vw); }
.btn { font: inherit; color: var(--ink); background: #2b2f4a; border: 2px solid #5b6190; padding: .4em 1em; cursor: pointer; box-shadow: 0 3px 0 #11121f; }
.btn:hover { background: #363b5d; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #11121f; }
.btn.big { background: #2f6e45; border-color: #5aa548; font-size: 1.1em; }
.btn.big:hover { background: #3a8455; }
.btn.ghost { background: transparent; box-shadow: none; }
.heroes { display: flex; gap: .5em; }
.hero { background: #0f1020; border: 2px solid var(--line); padding: .3em .4em .2em; cursor: pointer; color: var(--dim); font: inherit; font-size: .8em; display: flex; flex-direction: column; align-items: center; gap: .2em; }
.hero canvas { width: 2.6em; height: auto; image-rendering: pixelated; }
.hero[aria-checked="true"] { border-color: var(--gold); color: var(--ink); background: #22243a; }
.how { max-width: 34em; text-align: left; color: var(--dim); font-size: .85em; }
.how summary { cursor: pointer; text-align: center; color: var(--ink); }
.how p { margin: .4em 0; }
.how table { border-collapse: collapse; width: 100%; }
.how td { padding: .12em .5em; border-bottom: 1px solid #2b2f4a; }
.how td:last-child { color: var(--ink); white-space: nowrap; }
.how b { color: var(--ink); font-weight: 400; }
.err { color: var(--red); }
.result { background: rgba(26, 28, 44, .7); }
.icon-btn { position: absolute; top: 1.2%; left: .8%; z-index: 5; font: inherit; font-size: min(14px, 1.6vw); width: 3.2%; aspect-ratio: 1; padding: 0; display: grid; place-items: center; color: var(--ink); background: rgba(15, 16, 32, .7); border: 2px solid var(--line); cursor: pointer; }
.icon-btn.off { color: #5b6190; text-decoration: line-through; }
.net { position: absolute; top: 2%; left: 4.6%; width: 6%; text-align: left; z-index: 5; font-size: min(11px, 1.3vw); color: var(--dim); }
.toast { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); background: var(--panel); border: 2px solid var(--line); padding: .4em .9em; font-size: clamp(12px, 1.8vw, 16px); z-index: 6; }

/* phone controls */
#pad { width: min(100vw, 900px); display: flex; justify-content: space-between; align-items: center; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 10px; touch-action: none; }
.stick { position: relative; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 2px solid rgba(255, 255, 255, .15); touch-action: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(255, 255, 255, .25); border: 2px solid rgba(255, 255, 255, .4); }
.btns { display: grid; grid-template-columns: repeat(3, 62px); grid-template-rows: 62px 62px; gap: 8px; grid-template-areas: 'f sh j' '. h a'; }
.pb.fire { grid-area: f; } .pb.shield { grid-area: sh; } .pb.jump { grid-area: j; } .pb.smash { grid-area: h; } .pb.slash { grid-area: a; }
.padhint { margin: 0; font-size: 11px; color: var(--dim); text-align: center; flex: 1; align-self: flex-end; }
.pb { position: relative; overflow: hidden; font: inherit; font-size: 11px; color: var(--ink); border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); touch-action: none; padding: 0; }
.pb span { position: relative; z-index: 1; }
.pb i { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--cd, 0) * 100%); background: rgba(0, 0, 0, .55); }
.pb.slash { background: #b8423c; } .pb.smash { background: #7d2f6b; } .pb.shield { background: #3a6fb0; } .pb.jump { background: #4f8a4a; } .pb.fire { background: #c7742a; }
.pb.on { filter: brightness(1.4); transform: scale(.94); }
@media (orientation: landscape) and (pointer: coarse) {
  #pad { position: fixed; inset: auto 0 0 0; width: 100vw; pointer-events: none; padding: 0 calc(14px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }
  #pad > * { pointer-events: auto; opacity: .75; }
  .padhint { position: absolute; left: calc(14px + env(safe-area-inset-left)); bottom: calc(140px + env(safe-area-inset-bottom)); flex: none; text-align: left; opacity: .9 !important; pointer-events: none !important; }
  #stage { width: min(100vw, calc(100dvh * 16 / 9)); }
}

/* key guide strip (desktop) */
.keys { position: absolute; left: 50%; top: .4%; transform: translateX(-50%); z-index: 4; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .15em .9em; max-width: 72%;
  padding: .15em .6em; background: rgba(17, 18, 31, .6); border: 1px solid var(--line); font-size: clamp(9px, 1.15vw, 13px); color: #d8dcea; pointer-events: auto; }
.keys kbd { font: inherit; display: inline-block; min-width: 1.5em; padding: 0 .3em; margin-right: .2em; text-align: center; color: var(--ink); background: #2b2f4a; border: 1px solid #5b6190; border-bottom-width: 2px; }
.keys-x { font: inherit; font-size: .9em; color: var(--dim); background: none; border: 1px solid var(--line); cursor: pointer; padding: 0 .4em; }
