/* ==========================================================================
   ULTIMATE OLYMPIC DECATHLON - cabinet and CRT
   The canvas is 384x288 (4:3). Everything here is the furniture around it:
   bezel, marquee, scanlines and the control panel.
   ========================================================================== */

@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 {
  --cab-dark: #0a0a12;
  --cab-mid: #16161f;
  --bezel: #23232e;
  --chrome: #3a3a4a;
  --gold: #ffd21e;
  --hot: #ff3a2f;
  --cool: #21b6ff;
  --green: #35e05a;
}

* { 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: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  /* A dark arcade room: pool of light behind the cabinet. */
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, #1d1d33 0%, #0b0b14 60%, #050508 100%),
    var(--cab-dark);
}

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

/* --- Marquee ------------------------------------------------------------ */
#marquee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #2a2a3c 0%, #14141f 100%);
  border: 2px solid var(--chrome);
  border-bottom: 3px solid #000;
  overflow: hidden;
  white-space: nowrap;
}
.marquee-title {
  font-size: clamp(7px, 1.35vw, 13px);
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 45%, #e08000 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}
.rings { color: var(--cool); font-size: 9px; letter-spacing: -2px; opacity: 0.8; }
.flag {
  width: 20px; height: 13px; flex: none;
  border: 1px solid #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.flag[data-c="usa"] { background: repeating-linear-gradient(180deg, #d22 0 2px, #fff 2px 4px); }
.flag[data-c="jpn"] { background: radial-gradient(circle at 50% 50%, #d22 0 4px, #fff 4px); }
.flag[data-c="gbr"] { background: linear-gradient(90deg, #1b3f8b 40%, #fff 40% 60%, #1b3f8b 60%); }
.flag[data-c="fra"] { background: linear-gradient(90deg, #1b3f8b 33%, #fff 33% 66%, #d22 66%); }

@media (max-width: 560px) { .flag, .rings { display: none; } }

/* --- Bezel and screen --------------------------------------------------- */
#bezel {
  padding: clamp(8px, 2vw, 20px);
  border-radius: 10px;
  background:
    linear-gradient(160deg, #2c2c3a 0%, #191922 40%, #101018 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 40px rgba(0, 0, 0, 0.7);
}

#screen {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 2px solid #000;
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.95),
    0 0 20px rgba(60, 140, 255, 0.10);
}

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

/* Scanlines and a soft glare. Both purely decorative, both skippable for
   anyone who would rather not have a flickery screen. */
#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% 50% at 50% 0%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.45) 100%);
}
@media (prefers-reduced-motion: reduce) {
  #scanlines { opacity: 0.35; }
}

/* --- Control panel ------------------------------------------------------ */
#panel {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 10px;
  border-radius: 4px 4px 9px 9px;
  background: linear-gradient(180deg, #23232f 0%, #14141d 100%);
  border: 2px solid var(--chrome);
  border-top: 3px solid #000;
}
#panel button {
  font-family: inherit;
  font-size: 12px;
  color: #12121a;
  border: 0;
  border-radius: 999px;
  padding: 16px 26px;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.45);
}
#panel button:active, #panel button.down {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}
#panel .z { background: linear-gradient(180deg, #ff6a5e, var(--hot)); }
#panel .x { background: linear-gradient(180deg, #62d6ff, var(--cool)); }
#panel .act { background: linear-gradient(180deg, #ffe873, var(--gold)); padding-left: 44px; padding-right: 44px; }

#hint {
  margin: 0;
  text-align: center;
  font-size: 8px;
  line-height: 1.7;
  color: #6f6f8a;
}
#hint b { color: var(--gold); }

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