/* Shared chrome for the canvas arcade games. Set --accent / --accent-dark / --bg per page. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { --accent: #ffe600; --accent-dark: #b37400; --bg: #05050f; --panel: #0d0d22; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: #fff;
  font-family: "Press Start 2P", ui-monospace, monospace;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
canvas.game { display: block; }
a { color: inherit; }

.hud {
  position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 12px 16px; pointer-events: none; font-size: 12px; z-index: 4;
  background: linear-gradient(color-mix(in srgb, var(--bg) 85%, transparent), transparent);
}
.hud .col { display: flex; flex-direction: column; gap: 6px; }
.hud .center { align-items: center; text-align: center; }
.hud .right { align-items: flex-end; text-align: right; }
.hud .label { color: var(--accent); font-size: 9px; }
.hud .dim { color: #888; font-size: 8px; }

.hud-buttons { position: fixed; bottom: 12px; right: 12px; display: flex; gap: 8px; z-index: 6; }
.icon-btn {
  pointer-events: auto; font: inherit; font-size: 16px; background: #111a; color: #fff; border: 1px solid #333;
  border-radius: 8px; padding: 8px 10px; cursor: pointer; text-decoration: none; line-height: 1;
}
.icon-btn:hover { border-color: var(--accent); }

.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; padding: 20px; overflow-y: auto;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 60%, transparent) 0%, color-mix(in srgb, var(--bg) 94%, transparent) 70%);
}
.panel { text-align: center; max-width: 600px; }
.panel h1 { margin: 0 0 8px; font-size: clamp(22px, 6.5vw, 48px); color: var(--accent); text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent), 4px 4px 0 var(--accent-dark); line-height: 1.25; }
.panel h1 small { display: block; font-size: 0.4em; color: #fff; opacity: .85; margin-bottom: 10px; letter-spacing: 4px; text-shadow: none; }
.panel p { font-size: 10px; line-height: 2; color: #bbb; margin: 16px 0; }
.panel .k { color: #fff; }
.btn {
  font: inherit; font-size: 14px; background: var(--accent); color: #000; border: 0; border-radius: 6px; padding: 16px 26px;
  cursor: pointer; box-shadow: 0 6px 0 var(--accent-dark); margin: 8px; text-decoration: none; display: inline-block;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--accent-dark); }
.btn.alt { background: #1b1b3a; color: #fff; box-shadow: 0 6px 0 #0b0b20; }
.btn.small { font-size: 11px; padding: 12px 16px; }
.choice { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.choice button { font: inherit; font-size: 10px; background: #1b1b3a; color: #fff; border: 2px solid #333; border-radius: 8px; padding: 12px 14px; cursor: pointer; line-height: 1.6; }
.choice button.on { border-color: var(--accent); color: var(--accent); }
.choice button small { display: block; font-size: 7px; color: #999; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 20px 0 10px; }
.stats div { background: #111; border: 1px solid #333; border-radius: 8px; padding: 12px 4px; font-size: 15px; }
.stats span { display: block; font-size: 7px; color: var(--accent); margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; top: 118px; transform: translate(-50%, -10px); background: #000c; border: 2px solid var(--accent);
  color: var(--accent); font-size: 11px; padding: 10px 14px; border-radius: 6px; opacity: 0; pointer-events: none;
  white-space: nowrap; transition: opacity .25s, transform .25s; z-index: 8;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: flex; }
  .hud { font-size: 10px; }
}
.pad-btn {
  font: inherit; font-size: 20px; width: 64px; height: 64px; border-radius: 16px; background: #ffffff14; color: #fff;
  border: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); touch-action: none; display: grid; place-items: center;
}
.pad-btn.on { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* Infinite / Classic content switching. Only ever hide: a shown element keeps its own
   display, so flex rows (tag chips, legends) stay flex instead of reverting to block. */
:root:not([data-mode="classic"]) .only-classic { display: none !important; }
[data-mode="classic"] .only-infinite { display: none !important; }
.end-message { color: #fff !important; font-size: 11px !important; }
#over.won h1, #over.won h2 { color: #7dff6a; }
.stats span span { margin: 0; }

/* Phones: let descriptions flow instead of breaking where the desktop layout does, and keep the HUD on one line */
@media (max-width: 480px) {
  .overlay { padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .panel p { line-height: 1.8; margin: 12px 0; }
  .panel p br { display: none; }
  .btn { padding: 14px 20px; margin: 6px; }
  .hud { padding: calc(8px + env(safe-area-inset-top)) 10px 8px; gap: 8px; font-size: 10px; }
  .hud .label { font-size: 7px; white-space: nowrap; }
  .hud .dim { font-size: 7px; }
  .hud-buttons { bottom: calc(10px + env(safe-area-inset-bottom)); right: 10px; }
}
