/* ============================================================
   HAM PIZZA — shared arcade shell
   Every standalone game under /games/ links this so the cabinets
   match the hub: same palette, same CRT treatment, same chrome.
   Game-specific colours belong in the game's own <style>.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root{
  --bg:#0b100e;
  --bg-panel:#131b18;
  --bg-raised:#1b2622;
  --ink:#e8e4d8;
  --ink-dim:#7f9089;
  --amber:#ffb000;
  --amber-dim:#7a5600;
  --line:#28352f;
  --green:#33ff99;
  --purple:#c49dff;
  --cyan:#5ad1ff;
  --red:#ff6b4a;
  --accent:var(--amber);
}

*{ box-sizing:border-box; }

html,body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:var(--ink);
  font-family:'IBM Plex Mono', monospace;
  -webkit-text-size-adjust:100%;
}

body{
  /* room for the fixed bar + the iOS home indicator */
  padding:calc(52px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom));
  overscroll-behavior:none;
  -webkit-user-select:none;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}

/* ---------- CRT treatment (matches the hub) ---------- */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.035) 0px,
    rgba(255,255,255,0.035) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index:50;
  mix-blend-mode:overlay;
}
body::after{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.6) 100%);
  z-index:49;
}

/* ---------- top bar: exit + title + stats ---------- */
.hp-bar{
  position:fixed;
  top:0; left:0; right:0;
  z-index:60;
  display:flex;
  align-items:center;
  gap:12px;
  padding:calc(10px + env(safe-area-inset-top)) 14px 10px;
  background:rgba(11,16,14,0.93);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(6px);
}

.hp-exit{
  flex:none;
  font-size:11px;
  letter-spacing:1px;
  color:var(--ink-dim);
  text-decoration:none;
  border:1px solid var(--line);
  padding:0 12px;
  background:var(--bg-panel);
  white-space:nowrap;
  /* 44px so it's a real touch target, not a 31px sliver */
  min-height:44px;
  display:inline-flex;
  align-items:center;
}
.hp-exit:hover, .hp-exit:focus-visible{
  color:var(--accent);
  border-color:var(--accent);
  outline:none;
}

.hp-title{
  flex:1 1 auto;
  min-width:0;
  font-family:'Press Start 2P', monospace;
  font-size:clamp(9px, 2.6vw, 13px);
  color:var(--accent);
  letter-spacing:1px;
  text-shadow:0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:center;
}

.hp-stats{
  flex:none;
  font-size:11px;
  letter-spacing:1px;
  color:var(--ink-dim);
  white-space:nowrap;
}
.hp-stats b{ color:var(--ink); font-weight:600; }

/* On a phone the score matters more than the title — you know what you
   launched. Drop the title, keep EXIT and the score readout. */
@media (max-width:560px){
  .hp-title{ display:none; }
  .hp-stats{ margin-left:auto; font-size:10.5px; }
}

/* ---------- shared game furniture ---------- */
.hp-stage{
  max-width:940px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
}

.hp-panel{
  width:100%;
  background:var(--bg-panel);
  border:1px solid var(--line);
  padding:16px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
}

/* Canvases scale down on small screens instead of overflowing. */
.hp-panel canvas, canvas.hp-canvas{
  max-width:100%;
  height:auto;
  touch-action:none;
  background:var(--bg-raised);
  border:1px solid var(--line);
}

.hp-hint{
  color:var(--ink-dim);
  font-size:12px;
  line-height:1.7;
  text-align:center;
  letter-spacing:0.4px;
}
.hp-hint kbd{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  border:1px solid var(--line);
  background:var(--bg-raised);
  color:var(--ink);
  padding:2px 6px;
}

.hp-btn{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  letter-spacing:1px;
  color:var(--ink);
  background:var(--bg-raised);
  border:1px solid var(--line);
  padding:11px 18px;
  cursor:pointer;
  min-height:44px;               /* touch target */
}
.hp-btn:hover, .hp-btn:focus-visible{
  border-color:var(--accent);
  color:var(--accent);
  outline:none;
}
.hp-btn.primary{
  color:var(--bg);
  background:var(--accent);
  border-color:var(--accent);
  font-weight:600;
}

/* ---------- on-screen controls for touch ---------- */
.hp-touch{
  display:none;
  gap:12px;
  width:100%;
  max-width:420px;
}
.hp-touch .hp-btn{ flex:1; font-size:20px; padding:16px 0; min-height:58px; }

/* Coarse pointer = no keyboard. Show the pad, hide keyboard-only hints. */
@media (pointer:coarse){
  .hp-touch{ display:flex; }
  .hp-kbd-only{ display:none; }
}
