/*
 * retrocracker.com: the game's own look. The colours are the game's pixel boxes and gold
 * (meepleandmocha/frontend/src/games/nutcracker/style.css, --nc-pixelbox*, --nc-gold*), a winter night behind,
 * every heading and button in the game's pixel letters (site.ts draws them; the words stay as text for
 * a screen reader and when the script has not run).
 */
:root {
  --night-top: #0c0820;
  --night-low: #2a1850;
  --box: #1a1230;
  --box-edge: #f4dcff;
  --ink: #fff6d8;
  --ink-soft: #d8cbe8;
  --shadow: #4a2e78;
  --gold: #ffd25a;
  --gold-edge: #b9862d;
  --gold-ink: #2a1a08;
  --bezel: #3a2468;
  --bezel-lit: #6a4aa8;
  --snow: #f4faff;
  --drop: #05030c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--night-top); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 17px/1.5 system-ui, sans-serif;
  background: linear-gradient(180deg, var(--night-top) 0%, var(--night-low) 70%, var(--night-top) 100%) fixed;
  display: flex; flex-direction: column; align-items: center; overflow-x: hidden;
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
header, main, footer { position: relative; z-index: 1; width: min(100%, 1180px); padding: 0 16px; }

/* Pixel words: an image the script draws, scaled by its height in whole steps, crisp. */
.px { display: block; image-rendering: pixelated; height: var(--h, 22px); width: auto; max-width: 100%; }
[data-pixel].drawn > .said-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The banner: the title in gold, the tag under it, the cast walking along the bottom. */
.banner { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 28px; text-align: center; }
.title { margin: 0; font-size: 44px; letter-spacing: 2px; color: var(--gold); }
.title .px { --h: clamp(44px, 9vw, 110px); }
.tag { margin: 0; color: var(--ink-soft); }
.tag .px { --h: clamp(16px, 2.6vw, 26px); }
.parade { width: 100%; height: clamp(64px, 9vw, 104px); }
.parade canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* The game in a cabinet: the bezel of the game's own frame. */
main { display: flex; flex-direction: column; align-items: center; gap: 26px; padding-bottom: 32px; }
.cabinet { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.screen {
  width: 100%; aspect-ratio: 16 / 10; max-height: calc(100dvh - 120px); background: var(--drop);
  border: 4px solid var(--bezel-lit); border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 6px var(--bezel), 0 10px 0 6px var(--drop), 0 0 60px var(--shadow);
}
.screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.under { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: center; }
.keys { margin: 0; color: var(--ink-soft); }
.keys .px { --h: 14px; }

/* The pixel boxes of the game's cards. */
.box {
  width: min(100%, 760px); padding: 22px 24px; text-align: center; background: var(--box);
  border: 4px solid var(--box-edge); box-shadow: 0 0 0 4px var(--box), 8px 8px 0 4px var(--drop);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.box h2 { margin: 0; color: var(--gold); font-size: 24px; }
.box h2 .px { --h: clamp(24px, 4vw, 34px); }
.box p { margin: 0; max-width: 56ch; color: var(--ink-soft); }

/* Buttons: the game's pixel buttons, gold for the one that matters. */
.pixel-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px;
  background: var(--box); color: var(--ink); text-decoration: none; font: inherit; font-weight: 700; cursor: pointer;
  border: 3px solid var(--box-edge); box-shadow: 4px 4px 0 var(--shadow); transition: transform 0.08s, box-shadow 0.08s;
}
.pixel-button .px { --h: 16px; }
.pixel-button:hover, .pixel-button:focus-visible { background: var(--shadow); outline: 3px solid var(--gold); outline-offset: 2px; }
.pixel-button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.pixel-button.big { min-height: 60px; padding: 12px 26px; }
.pixel-button.big .px { --h: 24px; }
.pixel-button.gold { background: var(--gold); border-color: var(--ink); box-shadow: 5px 5px 0 var(--gold-edge); color: var(--gold-ink); }
.pixel-button.gold:hover, .pixel-button.gold:focus-visible { background: var(--ink); }
.pixel-button.gold { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 5px 5px 0 var(--gold-edge), 0 0 26px var(--gold); } }
.share-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.said { min-height: 1.5em; color: var(--gold); }

/* The soundtrack: a small pixel player (the screen, the bar, three buttons) over the track list. */
.deck {
  width: min(100%, 520px); display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: 14px; background: var(--bezel); border: 3px solid var(--bezel-lit); box-shadow: 6px 6px 0 var(--drop);
}
.lcd {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 64px;
  background: var(--drop); border: 3px solid var(--shadow); overflow: hidden;
}
.lcd .bars { width: 96px; height: 48px; flex: none; image-rendering: pixelated; }
.lcd-text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; flex: 1; }
.lcd .window { width: 100%; overflow: hidden; }
.lcd .window .px { max-width: none; }
.lcd .window.long .px { animation: marquee var(--run, 10s) linear infinite; }
@keyframes marquee { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--shift, 0)); } }
.lcd .now, .lcd .clock { --h: 22px; }
.lcd .px[src=""], .lcd .px:not([src]) { display: none; }
.seek { width: 100%; accent-color: var(--gold); cursor: pointer; }
.seek:disabled { cursor: default; opacity: 0.5; }
.controls { display: flex; justify-content: center; align-items: center; gap: 16px; }
.pixel-button.icon { width: 52px; padding: 8px; }
.pixel-button.icon.big { width: 68px; }
.pixel-button.icon svg { width: 24px; height: 24px; fill: currentColor; shape-rendering: crispEdges; }
.pixel-button.icon.big svg { width: 32px; height: 32px; }
.pixel-button.icon .i-pause, .pixel-button.icon.playing .i-play { display: none; }
.pixel-button.icon.playing .i-pause { display: inline; }
.pixel-button.gold.icon { animation: none; }
.now-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.tracks { list-style: none; margin: 0; padding: 0; width: min(100%, 620px); display: flex; flex-direction: column; gap: 4px; }
.tracks li { display: flex; align-items: stretch; gap: 4px; }
.track {
  flex: 1; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 12px; min-width: 0;
  background: transparent; color: var(--ink-soft); font: inherit; text-align: left; cursor: pointer;
  border: 2px solid transparent;
}
.track:hover, .track:focus-visible { background: var(--shadow); color: var(--ink); outline: none; border-color: var(--gold); }
.track .n { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 700; }
.track .t { flex: 1; min-width: 0; }
.track .d { font-variant-numeric: tabular-nums; opacity: 0.8; }
.tracks li.on .track { background: var(--shadow); color: var(--ink); border-color: var(--box-edge); }
.get {
  display: inline-flex; align-items: center; padding: 0 12px; min-width: 56px; justify-content: center;
  color: var(--gold); font-weight: 700; font-size: 14px; text-decoration: none; border: 2px solid var(--shadow);
}
.get:hover, .get:focus-visible { background: var(--gold); color: var(--gold-ink); outline: none; }
#album:disabled { opacity: 0.6; cursor: progress; animation: none; }

/* The trailer: the video as wide as its box, framed as the game's cabinet is; on its own page, wider. */
.trailer-video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--drop); border: 4px solid var(--bezel-lit); box-shadow: 0 0 0 4px var(--bezel); }
.box a:not(.pixel-button) { color: var(--gold); }
.trailer-page .box { width: min(100%, 1040px); }
.trailer-page .under { margin-top: 4px; }

footer { padding-bottom: 28px; text-align: center; color: var(--ink-soft); font-size: 14px; }
footer p { margin: 0; }

@media (max-width: 700px) {
  body { font-size: 16px; }
  .banner { padding-top: 18px; }
  .screen { aspect-ratio: 4 / 5; max-height: 70dvh; }
  .box { padding: 18px 14px; }
  .pixel-button .px { --h: 14px; }
  .lcd .bars { width: 64px; }
  .track { gap: 8px; padding: 6px 8px; }
  .get { min-width: 48px; padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .lcd .window.long .px { animation: none; }
  .pixel-button.gold { animation: none; }
  #snow { display: none; }
}

/* On a phone: the screen is a poster with a button to the game, which takes the whole screen of its own. */
.screen.poster {
  aspect-ratio: 16 / 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: url("assets/cracker.png") center 30% / auto 45% no-repeat, radial-gradient(circle at 50% 40%, var(--shadow), var(--drop) 70%);
  image-rendering: pixelated;
}
.screen.poster .pixel-button { margin-top: 38%; }
