/* ==========================================================================
   SANCTUARY OF THE PLANET OF THE APES - cabinet

   The canvas is 448x336 game pixels, doubled to 896x672. Everything in this
   file is the furniture around it.

   Fury's cabinet was a neon club machine. This one is field kit: olive drab,
   stencil, a scuffed steel bezel. The frame should agree with the game.
   ========================================================================== */

@font-face {
  font-family: 'Press Start 2P';
  src: url('press-start-2p.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --olive: #3e4a34;
  --olive-dk: #222a1c;
  --steel: #4a4a48;
  --amber: #ffa32a;
  --gold: #ffc23a;
  --rust: #a84a1e;
  --deep: #0a0a08;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-family: 'Press Start 2P', ui-monospace, monospace;
  color: #fff8ec;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  /* Dawn over a ruined city: warm at the horizon, dark everywhere else. */
  background:
    radial-gradient(ellipse 80% 55% at 50% 78%, #4a2a18 0%, #1d1510 45%, #0a0a08 100%),
    var(--deep);
}

#cab {
  width: min(100%, calc((100vh - 305px) * 4 / 3 + 48px), 940px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Marquee ------------------------------------------------------------ */
#marquee {
  text-align: center;
  padding: 11px 10px 9px;
  border-radius: 7px 7px 3px 3px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.16) 0 2px, rgba(0,0,0,0) 2px 5px),
    linear-gradient(180deg, #37422e 0%, #1c2316 100%);
  border: 2px solid var(--steel);
  border-bottom: 3px solid #000;
}
.title {
  display: block;
  font-size: clamp(13px, 2.6vw, 26px);
  letter-spacing: 0.16em;
  color: var(--gold);
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(255, 194, 58, 0.45);
}
.sub {
  display: block;
  margin-top: 8px;
  font-size: clamp(5px, 0.95vw, 9px);
  letter-spacing: 0.16em;
  color: #b9c2a8;
}

/* --- Bezel and screen --------------------------------------------------- */
#bezel {
  padding: clamp(8px, 2vw, 18px);
  border-radius: 10px;
  background: linear-gradient(160deg, #3a3a36 0%, #232320 40%, #141412 100%);
  border: 2px solid #000;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.08),
    inset 0 -3px 0 rgba(0, 0, 0, 0.6),
    0 14px 44px rgba(0, 0, 0, 0.85);
}

#screen {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 2px solid #000;
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.95), 0 0 24px rgba(255, 163, 42, 0.12);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #000;
}

#scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.22) 0px, rgba(0, 0, 0, 0.22) 1px,
    rgba(0, 0, 0, 0) 1px, rgba(0, 0, 0, 0) 3px
  );
  mix-blend-mode: multiply;
}
#glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.52) 100%);
}
@media (prefers-reduced-motion: reduce) { #scanlines { opacity: 0.3; } }

/* --- Control panel ------------------------------------------------------ */
#panel {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 4px 4px 9px 9px;
  background: linear-gradient(180deg, #37422e 0%, #1a2014 100%);
  border: 2px solid var(--steel);
  border-top: 3px solid #000;
}
.stick { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stick .row { display: flex; gap: 4px; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

#panel button {
  font-family: inherit;
  font-size: 10px;
  color: #17140d;
  border: 0;
  border-radius: 8px;
  padding: 12px 13px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(180deg, #ded8c4, #a09a86);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
#panel button small { display: block; font-size: 7px; opacity: 0.65; margin-top: 3px; }
#panel button:active, #panel button.down {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
#panel .p { background: linear-gradient(180deg, #ffb46a, var(--rust)); color: #fff8ec; }
#panel .k { background: linear-gradient(180deg, #ffd97a, var(--amber)); }
#panel .s { background: linear-gradient(180deg, #8fe6ff, #2aa8d8); }

#panel .go { background: linear-gradient(180deg, #b8f0a8, #3aa83a); }

#hint {
  margin: 0;
  text-align: center;
  font-size: 7px;
  line-height: 1.9;
  color: #7c8470;
}
#hint b { color: var(--gold); }

#music {
  position: fixed;
  top: 10px;
  left: 10px;
  font-family: inherit;
  font-size: 9px;
  color: #fff8ec;
  background: #2a3220;
  border: 1px solid var(--steel);
  border-radius: 5px;
  padding: 8px 10px;
  cursor: pointer;
}
