/* ==========================================================================
   1976 Gaming — shared shell styles (arcade hub + game cabinet)
   ========================================================================== */

:root {
  --bg: #07090d;
  --bg-raise: #10141c;
  --line: #1e2635;
  --ink: #e8edf5;
  --ink-dim: #8b98ad;
  --amber: #ffb43c;
  --cyan: #45d4e8;
  --green: #66e08a;
  --red: #ff5d55;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

a { color: var(--cyan); }

/* ==========================================================================
   Arcade hub
   ========================================================================== */

.hub {
  min-height: 100%;
  padding: clamp(20px, 5vw, 56px) clamp(16px, 5vw, 48px) 64px;
  max-width: 1080px;
  margin: 0 auto;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(69, 212, 232, 0.13), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(255, 180, 60, 0.08), transparent 60%);
}

.marquee {
  text-align: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: clamp(20px, 4vw, 36px);
  margin-bottom: clamp(24px, 5vw, 44px);
}

.marquee__year {
  font-family: var(--mono);
  font-size: clamp(56px, 17vw, 132px);
  line-height: 0.9;
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--amber);
  text-shadow: 0 0 24px rgba(255, 180, 60, 0.45), 0 0 70px rgba(255, 180, 60, 0.18);
}

.marquee__word {
  display: block;
  font-family: var(--mono);
  font-size: clamp(13px, 3.4vw, 20px);
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: var(--cyan);
  margin-top: 12px;
}

.marquee__blurb {
  color: var(--ink-dim);
  max-width: 54ch;
  margin: 20px auto 0;
  font-size: clamp(14px, 2.4vw, 16px);
  line-height: 1.6;
}

.shelf {
  display: grid;
  gap: clamp(16px, 3vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  list-style: none;
  padding: 0;
  margin: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-raise), #0a0d13);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: #33445e;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  outline: none;
}

.card__art {
  aspect-ratio: 16 / 9;
  display: block;
  width: 100%;
  height: auto; /* beat the img height attribute, or aspect-ratio is ignored */
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  background: #05070a;
}

.card__body { padding: 16px 18px 20px; }

.card__title {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.01em;
}

.card__meta {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 6px 0 10px;
}

.card__blurb {
  margin: 0;
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.55;
}

.card__play {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--green);
}

.card--soon { opacity: 0.55; pointer-events: none; }
.card--soon .card__play { color: var(--ink-dim); }

.hub__foot {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.7;
}

/* ==========================================================================
   Game cabinet
   ========================================================================== */

.cabinet {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #05070a;
}

.cabinet__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--bg-raise);
}

.cabinet__back {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--ink-dim);
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.cabinet__back:hover { color: var(--cyan); background: rgba(69, 212, 232, 0.08); }

.cabinet__ident {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: center;
}

.cabinet__title {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
  white-space: nowrap;
}

.cabinet__sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.cabinet__tools { display: flex; gap: 6px; }

.iconbtn {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
  touch-action: manipulation;
}
.iconbtn:hover { color: var(--ink); border-color: #33445e; }
.iconbtn.is-off { color: var(--red); border-color: rgba(255, 93, 85, 0.4); }

.cabinet__screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: crosshair;
}

.cabinet__canvas {
  display: block;
  image-rendering: auto;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* --- Touch controls (only on touch devices) ------------------------------- */

.touchpad { position: absolute; inset: 0; pointer-events: none; }

.touchbtn {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255, 180, 60, 0.55);
  background: rgba(255, 180, 60, 0.14);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  pointer-events: auto;
  touch-action: none;
  display: none;
  backdrop-filter: blur(2px);
}

.touchbtn--right { right: max(16px, env(safe-area-inset-right)); }
.touchbtn--left { left: max(16px, env(safe-area-inset-left)); }
.touchbtn.is-down { background: rgba(255, 180, 60, 0.4); transform: scale(0.94); }

@media (pointer: coarse) {
  .touchbtn { display: block; }
  .cabinet__screen { cursor: none; }
}

.rotate-hint {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 12px;
  border-radius: 20px;
  pointer-events: none;
}

@media (pointer: coarse) and (orientation: portrait) {
  .rotate-hint { display: block; }
}

/* --- Overlay -------------------------------------------------------------- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(70% 70% at 50% 45%, rgba(4, 8, 14, 0.82), rgba(2, 4, 7, 0.96));
  backdrop-filter: blur(3px);
  z-index: 5;
}

.overlay[hidden] { display: none; }

.overlay__card {
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 14, 20, 0.94);
  padding: clamp(18px, 4vw, 30px);
}

.overlay__heading {
  font-family: var(--mono);
  font-size: clamp(18px, 5vw, 26px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 14px;
}

.overlay__body p {
  margin: 0 0 9px;
  color: var(--ink-dim);
  font-size: clamp(13px, 3.2vw, 15px);
  line-height: 1.6;
}

.overlay__body strong { color: var(--ink); font-weight: 600; }
.overlay__body .score { font-family: var(--mono); color: var(--cyan); font-size: 1.35em; }

.bigbtn {
  margin-top: 18px;
  width: 100%;
  padding: 15px 18px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #07090d;
  background: var(--amber);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  touch-action: manipulation;
}
.bigbtn:hover { filter: brightness(1.1); }
.bigbtn:active { transform: translateY(1px); }

.overlay__hint {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  line-height: 1.6;
}

/* --- Leaderboard ---------------------------------------------------------- */

.board {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
}

.board__row {
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 12px;
  text-align: left;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.015);
}

.board__row:nth-child(even) { background: rgba(255, 255, 255, 0.04); }

.board__row--mine {
  background: rgba(255, 180, 60, 0.16);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--amber);
}

.board__rank { color: var(--ink-dim); font-size: 11px; }
.board__initials { letter-spacing: 0.22em; color: var(--cyan); }
.board__row--mine .board__initials { color: var(--amber); }
.board__score { color: var(--ink); letter-spacing: 0.06em; }

.board__empty {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
}

/* --- Initials entry ------------------------------------------------------- */

.entry {
  display: block;
  margin-top: 16px;
}

.entry[hidden] { display: none; }

.entry__label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.entry__input {
  width: 100%;
  padding: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #33445e;
  border-radius: 9px;
}

.entry__input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 180, 60, 0.16);
}

.overlay__error {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--red);
}

.overlay__error[hidden] { display: none; }

.linkbtn {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  touch-action: manipulation;
}
.linkbtn:hover { color: var(--ink); border-color: #33445e; }
.linkbtn[hidden] { display: none; }

.bigbtn:disabled,
.linkbtn:disabled { opacity: 0.5; cursor: default; }

/* Best score on a hub card */
.card__best {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--amber);
}
.card__best span { color: var(--ink-dim); }

/* A phone held in landscape gives the overlay ~350px of height. Tighten
   everything so the start button stays above the fold instead of needing a
   scroll the player won't know is there. */
@media (max-height: 560px) {
  .overlay { padding: 10px; }
  .overlay__card { width: min(560px, 100%); padding: 14px 18px; }
  .overlay__heading { font-size: clamp(15px, 3.6vw, 19px); margin-bottom: 8px; }
  .overlay__body p { font-size: clamp(11px, 2.4vw, 13px); line-height: 1.45; margin-bottom: 6px; }
  .bigbtn { margin-top: 10px; padding: 11px 16px; font-size: 12px; }
  .overlay__hint { margin-top: 7px; font-size: 10px; line-height: 1.4; }
  .board { margin-top: 9px; font-size: 11.5px; }
  .board__row { padding: 4px 10px; }
  .entry { margin-top: 10px; }
  .entry__input { padding: 7px; font-size: 22px; }
  .entry__label { margin-bottom: 5px; }
  .linkbtn { margin-top: 6px; padding: 7px; }
}

@media (max-height: 430px) {
  .overlay__body p:nth-child(n + 4) { display: none; }
  /* Ten rows will not fit next to an input on a short screen; six will. */
  .board__row:nth-child(n + 7) { display: none; }
}
