@font-face {
  font-family: "Saloon17";
  src: url("assets/fonts/Saloon17.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #0b070d;
  --ink-2: #140d16;
  --panel: #1c1220;
  --panel-2: #24172a;
  --amber: #f2a83c;
  --amber-hot: #ffd15c;
  --cream: #f7ead0;
  --teal: #52e0cf;
  --pink: #e8549c;
  --muted: #a79aa8;
  --line: rgba(242, 168, 60, 0.28);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(232, 84, 156, 0.12), transparent 70%),
    radial-gradient(700px 420px at 100% 20%, rgba(82, 224, 207, 0.08), transparent 70%),
    linear-gradient(180deg, #0b070d 0%, #120b16 45%, #0b070d 100%);
  font-family: var(--mono);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0px,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(45% 30% at 20% 30%, rgba(242, 168, 60, 0.07), transparent 70%),
    radial-gradient(35% 30% at 80% 70%, rgba(82, 224, 207, 0.06), transparent 70%);
}

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

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(242, 168, 60, 0.18);
  background: rgba(11, 7, 13, 0.86);
  backdrop-filter: blur(12px);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.back {
  color: var(--cream);
  text-decoration: none;
  white-space: nowrap;
}
.back:hover { color: var(--amber-hot); }

.bay-label {
  color: var(--amber);
  letter-spacing: 0.22em;
  white-space: nowrap;
}

.links {
  display: flex;
  align-items: center;
  gap: 16px;
}
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--teal); }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

#fullscreen {
  border: 1px solid var(--line);
  background: transparent;
  padding: 7px 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 11px;
}
#fullscreen:hover { border-color: var(--amber); color: var(--amber-hot); }

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 5vw, 64px) 0 40px;
}

.intro {
  text-align: center;
  margin: 0 auto clamp(22px, 4vw, 38px);
  max-width: 860px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}
.kicker span {
  display: inline-block;
  width: 22px;
  height: 1px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--teal);
}

h1 {
  margin: 0;
  font-family: "Saloon17", var(--mono);
  font-size: clamp(38px, 8vw, 78px);
  line-height: 0.95;
  letter-spacing: 0.03em;
  color: var(--amber-hot);
  text-shadow:
    0 3px 0 #5a2414,
    0 0 34px rgba(242, 168, 60, 0.3);
}
h1 span {
  display: inline;
  color: var(--cream);
  font-size: 0.42em;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 0 #3a160e;
}

.lede {
  max-width: 720px;
  margin: 18px auto 10px;
  color: #d9cad3;
  font-size: clamp(13px, 1.7vw, 16px);
  line-height: 1.65;
}

.byline {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cabinet {
  position: relative;
  width: min(1000px, 100%);
  margin: 0 auto;
  padding: 14px clamp(10px, 2.4vw, 24px) 16px;
  border: 1px solid rgba(242, 168, 60, 0.24);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(52, 28, 22, 0.92), rgba(18, 11, 22, 0.96) 26%, rgba(12, 8, 16, 0.98));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 222, 160, 0.14);
}

.cabinet::before,
.cabinet::after {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 12%;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--pink), transparent);
  opacity: 0.5;
}
.cabinet::before { left: -2px; }
.cabinet::after { right: -2px; background: linear-gradient(180deg, transparent, var(--teal), transparent); }

.marquee {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  padding: 2px 0 12px;
  font-family: "Saloon17", var(--mono);
  color: var(--amber-hot);
  text-shadow: 0 2px 0 #4a1c10;
  letter-spacing: 0.06em;
}
.marquee > span:not(.marquee-star) { font-size: clamp(24px, 4vw, 38px); }
.marquee em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--cream);
  padding-bottom: 4px;
}
.marquee-star { color: var(--pink); font-size: 14px; }

.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 3px solid #d58a2e;
  border-radius: 4px;
  background: #050307;
  box-shadow:
    inset 0 0 0 2px #2a140c,
    inset 0 0 60px rgba(0, 0, 0, 0.8),
    0 0 0 1px #08050a;
}

#game-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 960px !important;
  height: 720px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  transform-origin: top left;
  image-rendering: pixelated;
  outline: none;
  touch-action: none;
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(32, 18, 24, 0.72), rgba(5, 3, 7, 0.94));
  color: var(--cream);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.veil[hidden] { display: none; }
.veil.clickable { background: rgba(5, 3, 7, 0.82); }
.veil .small {
  margin: 0;
  max-width: 520px;
  color: #cbb9c3;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.08em;
}
.veil .fail { color: #ff7a5c; font-size: 18px; }

.loader {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(242, 168, 60, 0.25);
  border-top-color: var(--amber-hot);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.start-button {
  appearance: none;
  border: 1px solid var(--amber);
  background: linear-gradient(180deg, rgba(242, 168, 60, 0.2), rgba(242, 168, 60, 0.04));
  color: var(--amber-hot);
  font-family: "Saloon17", var(--mono);
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 0.08em;
  padding: 16px 26px 13px;
  border-radius: 3px;
  box-shadow: 0 0 30px rgba(242, 168, 60, 0.14);
  animation: pulse 2.1s ease-in-out infinite;
  touch-action: manipulation;
}
.start-button span { color: var(--teal); }
.start-button:hover { background: rgba(242, 168, 60, 0.28); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(242, 168, 60, 0.12); }
  50% { box-shadow: 0 0 38px rgba(242, 168, 60, 0.3); }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.controls span { white-space: nowrap; }

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 2px 5px;
  margin-right: 3px;
  border: 1px solid rgba(247, 234, 208, 0.28);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: rgba(247, 234, 208, 0.06);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

/* ── Touch pad ─────────────────────────────────────────────────────────── */
.touch-controls {
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 4px 4px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
body.touch .touch-controls { display: flex; }

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(2, 58px);
  gap: 6px;
}
.pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid rgba(242, 168, 60, 0.34);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(60, 38, 44, 0.9), rgba(22, 14, 26, 0.95));
  color: var(--cream);
  font-size: 18px;
  line-height: 1;
  touch-action: none;
}
.pad span {
  font-size: 7px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.pad.up { grid-column: 2; grid-row: 1; }
.pad.left { grid-column: 1; grid-row: 2; }
.pad.right { grid-column: 3; grid-row: 2; }
.pad.down { grid-column: 2; grid-row: 2; }
.pad.active,
.pad:active {
  border-color: var(--teal);
  background: linear-gradient(180deg, rgba(82, 224, 207, 0.24), rgba(22, 14, 26, 0.95));
  color: var(--teal);
}

.actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.pour {
  width: 104px;
  height: 122px;
  border: 1px solid var(--amber);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 209, 92, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(120, 52, 24, 0.95), rgba(36, 18, 18, 0.98));
  color: var(--amber-hot);
  font-family: "Saloon17", var(--mono);
  font-size: 24px;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  touch-action: none;
}
.pour span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.22em;
  color: #e2b8ae;
}
.pour.active,
.pour:active {
  border-color: var(--teal);
  color: var(--teal);
  background: linear-gradient(180deg, rgba(82, 224, 207, 0.24), rgba(18, 30, 30, 0.98));
}
.utility {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.utility button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(247, 234, 208, 0.2);
  border-radius: 6px;
  background: rgba(247, 234, 208, 0.04);
  color: var(--muted);
  font-size: 12px;
  touch-action: none;
}
.utility button.active { color: var(--teal); border-color: var(--teal); }

.mobile-hint {
  display: none;
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
body.touch .mobile-hint { display: block; }

/* ── Supporting sections ───────────────────────────────────────────────── */
.howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin: 34px auto 0;
  width: min(1000px, 100%);
}
.howto > div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.howto h2 {
  margin: 0 0 8px;
  font-family: "Saloon17", var(--mono);
  font-size: 19px;
  letter-spacing: 0.08em;
  color: var(--amber-hot);
}
.howto p {
  margin: 0;
  color: #bdb0ba;
  font-size: 11px;
  line-height: 1.7;
}

footer {
  margin: 44px auto 0;
  padding-top: 18px;
  border-top: 1px solid rgba(242, 168, 60, 0.14);
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}
footer p { margin: 4px 0; }
footer a { color: var(--teal); text-decoration: none; }
.tiny { color: #7e6f7c; font-size: 9px; }

.noscript {
  text-align: center;
  padding: 20px;
  color: #ff7a5c;
}

/* ── Fullscreen cabinet ────────────────────────────────────────────────── */
.cabinet:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #0b070d;
  padding: 8px 14px;
}
.cabinet:fullscreen .frame {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
  width: 100%;
  max-height: calc(100vh - 180px);
  margin: 0 auto;
}
.cabinet:fullscreen .marquee { padding: 0 0 6px; }
.cabinet:fullscreen .controls { display: none; }
.cabinet:fullscreen .frame #game-canvas {
  width: 960px !important;
  height: 720px !important;
}

body.pseudo-fullscreen .top,
body.pseudo-fullscreen .intro,
body.pseudo-fullscreen .howto,
body.pseudo-fullscreen footer { display: none; }
body.pseudo-fullscreen .cabinet { margin-top: 8px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .top {
    position: static;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 10px 14px;
    font-size: 10px;
  }
  .bay-label { order: 3; width: 100%; letter-spacing: 0.16em; color: #9d7a4a; }
  main { width: calc(100% - 20px); padding-top: 20px; }
  .howto { grid-template-columns: 1fr; gap: 16px; }
  .marquee { gap: 8px; padding-bottom: 8px; }
  .marquee em { display: none; }
  .cabinet { padding: 10px 8px 12px; }
  .controls { font-size: 9px; gap: 6px 12px; padding-top: 10px; }
}

@media (max-width: 480px) {
  h1 span { display: block; margin-top: 6px; font-size: 0.36em; }
  .intro { margin-bottom: 18px; }
  .lede { font-size: 12px; }
  .dpad { grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 52px); gap: 5px; }
  .pour { width: 92px; height: 109px; font-size: 21px; }
  .utility button { width: 38px; height: 38px; }
  .touch-controls { gap: 8px; padding: 12px 0 2px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .top { position: static; }
  .intro { margin-bottom: 12px; }
  .lede, .byline, .howto, footer { display: none; }
  h1 { font-size: 32px; }
  .frame { max-height: 62vh; margin: 0 auto; }
  .touch-controls { padding-top: 8px; }
  .dpad { grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(2, 46px); }
  .pour { width: 84px; height: 98px; font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .start-button { animation: none; }
  .loader { animation-duration: 2s; }
  html { scroll-behavior: auto; }
}
