html, body { margin: 0; height: 100%; background: #000; color: #eee; overflow: hidden; overscroll-behavior: none; }
body { font-family: ui-monospace, "SF Mono", Consolas, monospace; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
#stage { position: fixed; inset: 0; display: grid; place-items: center; }
.screen.game { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.gwrap { position: relative; width: min(100vw, calc(100dvh * 16 / 9)); aspect-ratio: 16 / 9; }
.gwrap canvas { display: block; width: 100%; height: 100%; image-rendering: auto; }
.gscan { position: absolute; inset: 0; pointer-events: none; opacity: .14; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.6) 2px 3px); }
.gfoot, .phqr { display: none !important; }
.back { position: fixed; top: 10px; left: 12px; z-index: 20; font-size: 11px; letter-spacing: .25em; color: #777; text-decoration: none; padding: 6px 8px; }
.back:hover { color: #fff; }
.sig { position: fixed; right: 12px; bottom: 8px; z-index: 20; pointer-events: none; font-family: "Segoe Script", "Snell Roundhand", "Bradley Hand", "Brush Script MT", "Apple Chancery", cursive; font-size: .5rem; line-height: 1; white-space: nowrap; }
.sig-by { color: #8c8c8c; }
.sig-name { color: #fff; font-size: 1.25em; margin-left: .15em; }

/* ---------- režimy ---------- */
body[data-mode="play"] .back, body[data-mode="game"] .back { display: none; }
#pad, .tback, .rotate { display: none; }

/* ---------- dotykový ovládač ---------- */
body.touch .back { display: none; }
body.touch .tback { display: grid; place-items: center; position: fixed; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); z-index: 30; width: 40px; height: 40px; padding: 0;
  font: 26px/1 ui-monospace, monospace; color: #bbb; background: rgba(0,0,0,.55); border: 1px solid #333; }
body.touch[data-mode="play"] #pad { display: block; }
#pad { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.joy { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 50%;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.18); pointer-events: auto; touch-action: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.5); }
.joy span { position: absolute; left: 0; right: 0; bottom: -2px; transform: translateY(100%); text-align: center; font-size: 9px; letter-spacing: .08em; color: rgba(255,255,255,.35); white-space: nowrap; }
.rb { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 10px; align-items: end; pointer-events: auto; }
.rb button { font: 600 12px/1 ui-monospace, monospace; letter-spacing: .14em; color: #eee; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.35); touch-action: none; -webkit-tap-highlight-color: transparent; }
.rb button.on { background: #fff; color: #000; }
.rb .fire { grid-column: 2; grid-row: 1 / span 2; width: 92px; height: 92px; border-radius: 50%; border-color: #c0392b; color: #fff; font-size: 15px; }
.rb .fire.on { background: #c0392b; color: #fff; }
.rb .jump { grid-column: 1; grid-row: 1; width: 64px; height: 48px; }
.rb .wpn { grid-column: 1; grid-row: 2; width: 64px; height: 36px; font-size: 9px; }
@media (orientation: portrait) {
  body.touch .rotate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 50; background: #000; color: #ccc; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; }
}
body.touch[data-mode="play"] .sig { display: none; }
