/* ===== Tweak these ===== */
:root {
  --sky-top: #79cfff;          /* gradient: top -> middle -> bottom (matches your sketch) */
  --sky-mid: #7aa6ff;
  --sky-bottom: #727ef8;
  --shade: 0.30;               /* darkness of the see-through black filter (0 = none, 1 = black) */
  --button-bg: rgba(0, 0, 0, 0.74);       /* black rounded buttons; slightly see-through */
  --button-bg-hot: rgba(0, 0, 0, 0.88);
  --text: #f4f4f8;
  --font: "BestTen CRT", ui-monospace, "Courier New", monospace;
  --btn-h: 76px;               /* button height; main.js rounds it so the character is drawn at a whole-number scale */
  --btn-radius: 14px;
}

/* Your pixel font (BestTen-CRT). This is a small copy with only Latin letters/numbers/punctuation and kana,
   made from your .otf. For other characters, point src at the full BestTen-CRT.otf instead. */
@font-face {
  font-family: "BestTen CRT";
  src: url("assets/fonts/BestTen-CRT-subset.woff") format("woff");
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--sky-bottom);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: none;
}
img { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ===== Sky ===== */
.sky {
  position: fixed; inset: 0; overflow: hidden;
  background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 52%, var(--sky-bottom) 100%);
}
.sun {
  position: absolute; top: 4%; right: 5%;
  width: calc(var(--u, 4) * 32px); height: auto;
  animation: sun-pulse 2.4s steps(1) infinite;
}
@keyframes sun-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* Cloud layers. JS sizes them to a whole number of art-pixels and loops them seamlessly. */
.clouds { position: absolute; left: 0; width: 100%; overflow: hidden; pointer-events: none; }
.clouds .track {
  position: absolute; left: 0; top: 0; height: 100%;
  background-repeat: repeat-x; background-position: 0 0;
  image-rendering: pixelated;
  will-change: transform;
  animation: drift var(--dur, 120s) linear infinite;
}
@keyframes drift { to { transform: translate3d(calc(var(--tile) * -1), 0, 0); } }
.clouds.far  { top: 8%;  opacity: 0.55; }   /* farther layer: fainter and slower (see data-speed in index.html) */
.clouds.near { top: 30%; opacity: 0.92; }

/* Stars: a pixel "+" that shimmers in hard steps. Positions are in main.js. */
.star {
  position: absolute; width: 0; height: 0;
  animation: twinkle var(--dur, 3s) steps(1) infinite var(--delay, 0s);
}
.star::before, .star::after { content: ""; position: absolute; background: #fff; }
.star::before { width: calc(var(--u, 4) * 3px); height: calc(var(--u, 4) * 1px); left: calc(var(--u, 4) * -1.5px); top: calc(var(--u, 4) * -0.5px); }
.star::after  { height: calc(var(--u, 4) * 3px); width: calc(var(--u, 4) * 1px); top: calc(var(--u, 4) * -1.5px); left: calc(var(--u, 4) * -0.5px); }
.star.small::before, .star.small::after { opacity: 0; }                 /* "small" stars are single dots... */
.star.small { width: calc(var(--u, 4) * 1px); height: calc(var(--u, 4) * 1px); background: #fff; margin: calc(var(--u, 4) * -0.5px) 0 0 calc(var(--u, 4) * -0.5px); }
@keyframes twinkle {
  0%   { opacity: 0.25; transform: scale(0.67); }
  25%  { opacity: 0.7;  transform: scale(1); }
  50%  { opacity: 1;    transform: scale(1.33); }
  75%  { opacity: 0.7;  transform: scale(1); }
  100% { opacity: 0.25; transform: scale(0.67); }
}

/* See-through black filter so the buttons keep the focus (stronger in the middle) */
.shade {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 56%, rgba(0,0,0,calc(var(--shade) * 0.9)) 0%, rgba(0,0,0,calc(var(--shade) * 0.35)) 100%);
}

/* ===== Foreground ===== */
.stage {
  position: relative; z-index: 2; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(16px, 3.2vh, 34px);
  padding: 4vh 16px;
}
.brand { display: flex; align-items: center; gap: clamp(10px, 2vw, 24px); }
.logo { height: clamp(34px, 6.4vh, 64px); width: auto; }
.spacer { height: clamp(34px, 6.4vh, 64px); width: auto; }
.spacer-line { width: 2px; height: clamp(30px, 6vh, 58px); background: rgba(255,255,255,0.55); }
.logo-text { white-space: nowrap; font-size: clamp(14px, min(4.2vw, 3.4vh), 34px); letter-spacing: 0.04em; text-shadow: 2px 2px 0 rgba(0,0,0,.35); }

.menu { display: flex; flex-direction: column; gap: clamp(10px, 1.8vh, 18px); width: min(88vw, 540px); }
.opt {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: var(--btn-h);
  padding: 0 28px;
  background: var(--button-bg);
  color: var(--text); text-decoration: none;
  font-size: clamp(22px, calc(var(--btn-h) * 0.5), 52px); line-height: 1; letter-spacing: 0.02em;
  border-radius: var(--btn-radius);
  transition: background 0.12s steps(2), transform 0.12s steps(2);
  -webkit-tap-highlight-color: transparent;
}
.opt .label { text-shadow: 2px 2px 0 rgba(0,0,0,.5); }
.opt:hover, .opt:focus-visible, .opt.hot { background: var(--button-bg-hot); transform: scale(1.03); outline: none; }
.opt:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.85); }

/* The character: same height as its button, hidden until the button is highlighted, then it dances.
   main.js sizes it (width/height/background-size) so it is drawn at a whole-number scale. */
.char {
  position: absolute; top: 50%; right: calc(100% + 10px);
  height: var(--btn-h); width: var(--btn-h);
  translate: 0 -50%;
  transform-origin: 50% 100%;
  background-repeat: no-repeat; background-position: 0 0;
  image-rendering: pixelated; image-rendering: crisp-edges;
  opacity: 0; visibility: hidden; pointer-events: none;
  --char-anim: dance 0.7s steps(1) infinite;                 /* still picture: tilts left/right in two steps */
}
.char.sheet { --char-anim: dance 0.7s steps(1) infinite, frames var(--fdur, 0.6s) steps(var(--frames, 1)) infinite; }
.char.sheet.notilt { --char-anim: frames var(--fdur, 0.6s) steps(var(--frames, 1)) infinite; }
.char.notilt:not(.sheet) { --char-anim: none; }
.opt:hover .char, .opt:focus-visible .char, .opt.hot .char { opacity: 1; visibility: visible; animation: var(--char-anim); }
@keyframes dance  { 0% { rotate: -9deg; } 50% { rotate: 9deg; } }
@keyframes frames { to { background-position-x: calc(var(--sheet-w, 0px) * -1); } }

/* Phones: no room beside the buttons, so the character tucks onto the left end of its button */
@media (max-width: 760px) {
  .char { right: auto; left: 8px; }
  .opt { padding-left: calc(var(--char-w, 64px) + 20px); padding-right: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .star, .sun, .clouds .track { animation: none !important; }
  .opt:hover .char, .opt:focus-visible .char, .opt.hot .char { animation: none; rotate: 0deg; }
}
