/* Battle Tower on the open web - the page's styles (docs/design/WEB_GAME.md section 1, 6).
 * Self-contained: no studio stylesheet is loaded. The canvases keep the runners' own class names
 * (.wp-canvas, .bp-canvas, .ss-play-canvas) and are sized the way the studios size them
 * (isometric-studio.css 549-565, mode7-studio.css 568): 960 x 540 logical, scaled down on a narrow
 * screen, image-rendering: pixelated. */
:root {
  --bg: #0b0d12; --bg2: #121620; --bar: #171c28; --card: #1a2030; --border: #2a3347; --border2: #3a4660;
  --text: #e6e9f0; --text2: #b7bfd0; --muted: #8791a8; --faint: #5d6880;
  --accent: #ffcf5a; --accent2: #ffe08a; --ok: #8fe0a0; --danger: #ff8a8a; --info: #9cc3e6;
  --mono: Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 Archivo, "Segoe UI", system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--info); }
button, .btn { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--border2); border-radius: 6px; padding: 8px 16px; cursor: pointer; }
button:hover { border-color: var(--accent); color: var(--accent2); }
button:focus-visible, .play-sel { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: default; }
button.primary { border-color: var(--accent); color: var(--accent); font-weight: 700; }
button.small { padding: 3px 9px; font-size: 12px; }

/* header and footer are index.html's; the shell owns #play-root */
.play-header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding: 12px 18px 6px; }
.play-header h1 { margin: 0; font-size: 22px; letter-spacing: .02em; color: var(--accent); }
.play-header .play-sub { color: var(--muted); font-size: 12px; }
.play-footer { padding: 12px 18px 20px; color: var(--muted); font-size: 12px; max-width: 980px; }
.play-footer .play-labels { color: var(--faint); font-family: var(--mono); font-size: 11px; margin-top: 6px; }
.play-footer .play-small-link { color: var(--muted); font-size: 11px; }
#play-root { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; position: relative; }

/* the HUD strip (6: floor - match - wins - party - credits - mute - Report) */
.play-hud { width: min(960px, 100%); display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 7px 12px; background: var(--bar); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text2); min-height: 38px; }
.play-hud b { color: var(--accent); font-weight: 700; }
.play-hud .play-hud-party { color: var(--text2); }
.play-hud .play-hud-party i { font-style: normal; color: var(--muted); }
.play-hud .play-hud-spacer { flex: 1; }
.play-hud .play-hud-note { color: var(--faint); font-size: 11px; }

/* the stage: exactly one runner mounted at a time (world host and battle host are both inside) */
.play-stage { position: relative; width: min(960px, 100%); aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--border); overflow: hidden; }
.play-stage .play-host { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: stretch; }
.play-stage .play-host:empty { display: none; }   /* an unmounted host never sits over the one that plays (clicks must reach its canvas) */
.play-stage .wp-wrap { outline: none; display: flex; flex-direction: column; width: 100%; height: 100%; }
.play-stage .wp-wrap:focus-visible .wp-canvas { box-shadow: inset 0 0 0 2px var(--accent); }
.play-stage .wp-canvas, .play-stage .bp-canvas, .play-stage .ss-play-canvas { display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9; background: #000; image-rendering: pixelated; outline: none; }
.play-stage .bp-canvas:focus-visible, .play-stage .ss-play-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.play-stage .wp-log { display: none; }     /* the runner's own event log is a studio tool; the HUD tells the state */
.play-stage.is-idle { background: radial-gradient(ellipse at 50% 40%, #1b2234 0%, #0b0d12 70%); }

/* the bar above the Slum Street canvas (6.6) */
.play-bar { width: min(960px, 100%); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 12px; background: var(--bar); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text2); }
.play-bar .play-bar-label { color: var(--accent2); }
.play-bar .play-bar-note { color: var(--muted); font-size: 12px; }

/* panels: centred cards over the stage (title, avatar pick, results, defeat, summit, controls) */
.play-panels { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 12px; z-index: 20; background: rgba(5, 7, 12, .72); }
.play-panels.is-open { display: flex; }
.play-panel { width: min(640px, 100%); max-height: 100%; overflow: auto; background: var(--card); border: 1px solid var(--border2); border-radius: 10px; padding: 18px 22px; box-shadow: 0 12px 40px rgba(0, 0, 0, .6); }
.play-panel h2 { margin: 0 0 6px; font-size: 20px; color: var(--accent); }
.play-panel h3 { margin: 14px 0 4px; font-size: 14px; color: var(--text2); }
.play-panel p { margin: 6px 0; color: var(--text2); }
.play-panel .play-note { color: var(--muted); font-size: 12px; }
.play-panel .play-grade { font-size: 44px; font-weight: 700; color: var(--accent); line-height: 1; margin: 6px 0; }
.play-panel .play-grade small { font-size: 16px; color: var(--text2); margin-left: 10px; font-weight: 400; }
.play-panel .play-lines { margin: 8px 0; padding: 0; list-style: none; }
.play-panel .play-lines li { padding: 3px 0; border-bottom: 1px solid var(--border); color: var(--text2); }
.play-panel .play-lines li b { color: var(--text); }
.play-panel .play-lines li.ok { color: var(--ok); }
.play-panel .play-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.play-panel .play-credits { margin-top: 12px; color: var(--muted); font-size: 12px; }   /* the title's Credits link (3.5, GD-055 R6) */
.play-panel .play-footer-line { margin-top: 14px; color: var(--faint); font-size: 11px; font-family: var(--mono); }
.play-panel table.play-keys { border-collapse: collapse; width: 100%; font-size: 12px; }
.play-panel table.play-keys td { padding: 3px 6px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: top; }
.play-panel table.play-keys td:first-child { color: var(--text); white-space: nowrap; font-family: var(--mono); }
.play-panel .play-warn { color: var(--danger); }

/* the avatar picker (6.1): idle frame 0 off the keyed sheet, name, one note */
.play-avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.play-avatar { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; text-align: center; }
.play-avatar canvas { width: 72px; height: 72px; image-rendering: pixelated; background: var(--bg2); border-radius: 6px; }
.play-avatar .play-avatar-name { font-weight: 700; color: var(--text); }
.play-avatar .play-avatar-note { font-size: 11px; color: var(--muted); }

/* loading (6.10) */
.play-loading { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 15; background: rgba(5, 7, 12, .85); color: var(--text2); font-family: var(--mono); font-size: 13px; }
.play-loading.is-open { display: flex; }
.play-loading .play-progress { width: min(420px, 80%); height: 8px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 4px; overflow: hidden; }
.play-loading .play-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }

/* toasts bottom-centre */
.play-toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 50; pointer-events: none; width: min(720px, calc(100% - 24px)); }
.play-toast { background: rgba(26, 32, 48, .96); color: var(--text); border: 1px solid var(--border2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 14px; font-size: 13px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); animation: play-toast-in .18s ease-out; max-width: 100%; }
.play-toast.danger { border-left-color: var(--danger); }
.play-toast.ok { border-left-color: var(--ok); }
@keyframes play-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
  .play-header h1 { font-size: 18px; }
  .play-panel { padding: 14px; }
  .play-hud { font-size: 12px; gap: 4px 10px; }
}
