/* Fonts and palette from the arcade art kit (SIL OFL 1.1, self-hosted). */
@font-face { font-family: "Press Start 2P"; src: url("fonts/press-start-2p.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "VT323"; src: url("fonts/vt323.woff2") format("woff2"); font-display: swap; }
/* Arcade shell styles: header / gutter / sidebar ad layout around a letterboxed canvas. */
:root {
  --bg: #0B0B1A;
  --panel: #1E1E46;
  --line: #4A4A88;
  --text: #E8E8F8;
  --muted: #8C8CB8;
  --accent: #FFD23F;
  --accent2: #2DE2E6;
  --danger: #FF3B4E;
  --font-head: "Press Start 2P", "Courier New", ui-monospace, monospace;
  --header-h: 106px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; display: flex; flex-direction: column; }
.muted { color: var(--muted); }

.site-header {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; border-bottom: 1px solid var(--line); min-height: var(--header-h);
}
.brand {
  font: 400 16px/1 var(--font-head); letter-spacing: 2px; color: var(--accent);
  text-decoration: none; text-shadow: 0 0 8px rgba(255, 210, 63, .5);
}
.game-title { font: 400 12px/1 var(--font-head); color: var(--accent2); white-space: nowrap; }
.header-actions { display: flex; gap: 8px; margin-left: auto; }

.layout {
  flex: 1; display: grid; gap: 16px; padding: 16px;
  grid-template-columns: 160px minmax(0, 1fr) 300px; align-items: start;
}
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.panel h2, .panel h3 { margin: 0 0 8px; font-family: var(--font-head); }
.panel h2 { color: var(--accent); font-size: 20px; }
.panel h3 { font-size: 14px; color: var(--accent2); text-transform: uppercase; letter-spacing: 1px; }
.panel p { margin: 4px 0; font-size: 14px; }
.controls { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.controls b { color: var(--text); }
.scores { margin: 0; padding-left: 22px; font: 20px/1.2 "VT323", ui-monospace, monospace; }

/* ---- ad slots (placeholders until a provider is enabled) ---- */
.ad-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed #3a3f6b; border-radius: 4px; color: #5d6294; font-size: 12px;
  background: repeating-linear-gradient(45deg, #10132a, #10132a 10px, #13173a 10px, #13173a 20px);
}
.ad-label { font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.ad-header { flex: 1 1 auto; max-width: 728px; height: 90px; margin: 0 auto; }
.ad-tall { width: 160px; height: 600px; position: sticky; top: 16px; }
.ad-box { width: 300px; height: 250px; }
.ad-mobile { display: none; }

/* ---- game stage ---- */
.stage-wrap { min-width: 0; }
.stage {
  position: relative; width: 100%;
  height: calc(100vh - var(--header-h) - 34px); min-height: 360px;
  display: flex; align-items: center; justify-content: center;
}
.stage canvas {
  display: block; background: #000; border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 0 40px rgba(63, 208, 255, .08); outline: none;
}
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 15, .62); backdrop-filter: blur(2px); z-index: 5; padding: 12px;
}
.overlay.hidden { display: none; }
.overlay-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px 22px; max-width: 460px; width: 100%; text-align: center;
  max-height: 100%; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.overlay-panel h2 { margin: 0 0 8px; font: 400 16px/1.5 var(--font-head); color: var(--accent); }
.overlay-panel p { margin: 6px 0; }
.overlay-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.level-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 12px 0 4px;
}
.level-btn {
  font: 400 10px/1 var(--font-head); padding: 8px 0; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--line); background: #1b1f3d; color: var(--text);
}
.level-btn.cleared { background: #1f4a3a; border-color: #2f8f63; }
.level-btn.current { outline: 2px solid var(--accent); }
.level-btn:disabled { opacity: .3; cursor: not-allowed; }
.level-btn:not(:disabled):hover { background: #2a3170; }

.btn {
  font: 600 14px/1 system-ui, sans-serif; padding: 10px 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #1d2147; color: var(--text);
}
.btn:hover { background: #262b5c; }
.btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.btn-primary:hover { background: #ffe07a; }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 10px; font-size: 12px; }

/* ---- simulated rewarded ad ---- */
.ad-modal {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .82);
}
.ad-modal-box {
  width: min(420px, 92vw); background: #fff; color: #222; border-radius: 10px; padding: 16px;
  font-family: system-ui, sans-serif;
}
.ad-modal-tag { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #888; }
.ad-modal-art {
  height: 180px; margin: 10px 0; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3fd0ff, #b44bff); color: #fff; font: 400 16px/1 var(--font-head);
}
.ad-modal-bar { height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin: 10px 0; }
.ad-modal-fill { height: 100%; width: 0; background: #2a9d4b; }
.ad-modal-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ad-modal .btn { background: #2a9d4b; color: #fff; border-color: #2a9d4b; }
.ad-modal .btn-ghost { background: transparent; color: #555; border-color: #ccc; }

/* ---- responsive ---- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .ad-gutter { display: none; }
}
@media (max-width: 800px) {
  :root { --header-h: 48px; }
  .layout { grid-template-columns: 1fr; padding: 8px; }
  .sidebar, .ad-header, .game-title { display: none; }
  .site-header { min-height: var(--header-h); padding: 6px 10px; }
  .stage { height: calc(100vh - var(--header-h) - 50px - 20px); height: calc(100dvh - var(--header-h) - 50px - 20px); }
  .ad-mobile {
    display: flex; position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 320px; height: 50px; z-index: 10; background-color: #10132a;
  }
  body { padding-bottom: 50px; }
}
