/* ═══════════════════════════════════════════════════════════
   NEO GEO BOOT ANIMATION  — ng- prefix to avoid collisions
   ═══════════════════════════════════════════════════════════ */

:root {
  --ng-serif: "Baskerville Old Face", "Baskerville", "Hoefler Text",
              "Times New Roman", serif;
}

html {
  font-size: 18px;
}

/* Boost body copy — catches elements with inherited or very small px sizes */
body, p, li, td, th, span:not(.font-arcade):not([class*="cd-"]):not([class*="ng-"]) {
  font-size: max(1rem, 15px);
}

/* ── Container that gets .ng-booting added by JS ─────────────── */
.ng-boot-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  overflow: hidden;
}

/* CRT scanlines on the wrap */
.ng-boot-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.14) 50%);
  background-size: 100% 2px;
  pointer-events: none;
  z-index: 2;
}

/* BG flash: wrap goes white → black when animation fires */
.ng-boot-wrap.ng-booting {
  animation: ng-bg-fade 1.5s linear forwards;
}

@keyframes ng-bg-fade {
  0%   { background-color: #fff; }
  100% { background-color: #000; }
}

/* ── Inner stage – pixel-doubled ─────────────────────────────── */
.ng-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform: scale(2);
  transform-origin: center;
  position: relative;
  z-index: 1;
}

/* ── NEO·GEO LOGO ────────────────────────────────────────────── */
.ng-neo-logo {
  font-family: var(--ng-serif);
  font-size: 50px;
  font-weight: 900;
  letter-spacing: -2px;
  transform: scale(1.1, -1);   /* starts flipped */
  transform-origin: center;
  color: #000;
  margin-bottom: 12px;
  user-select: none;
  line-height: 1;
}

.ng-booting .ng-neo-logo {
  animation:
    ng-y-collapse 1.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards,
    ng-color      1.5s linear forwards;
}

@keyframes ng-y-collapse {
  0%   { transform: scale(1.1, -1); }
  50%  { transform: scale(1.1, 0.01); }
  100% { transform: scale(1, 1); }
}

@keyframes ng-color {
  0%   { color: #000; }
  100% { color: #fff; }
}

/* ── SPEC TEXT ───────────────────────────────────────────────── */
.ng-text-box {
  color: #fff;
  font-family: var(--ng-serif);
  font-weight: 900;
  display: flex;
  flex-direction: column;
  line-height: 0.85;
  margin-top: -2px;
}

.ng-line {
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  clip-path: inset(0 100% 0 0);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ng-booting .ng-line-1 {
  animation: ng-typing 0.4s steps(12) 1.8s forwards;
}
.ng-booting .ng-line-2 {
  animation: ng-typing 0.4s steps(13) 2.2s forwards;
}

@keyframes ng-typing {
  to { clip-path: inset(0 0 0 0); }
}

/* ── SNK LOGO ────────────────────────────────────────────────── */
.ng-snk-logo {
  margin-top: 25px;
  width: 105px;
  height: 40px;
  -webkit-mask-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/SNK_logo.svg/3840px-SNK_logo.svg.png');
          mask-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/SNK_logo.svg/3840px-SNK_logo.svg.png');
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  background-color: #000033;
  opacity: 0;
}

.ng-booting .ng-snk-logo {
  animation:
    ng-snk-in    0.3s ease-out 2.8s forwards,
    ng-snk-color 1.0s linear   2.8s forwards;
}

@keyframes ng-snk-in {
  from { opacity: 0; transform: scale(1.1); filter: blur(2px); }
  to   { opacity: 1; transform: scale(1);   filter: blur(0); }
}

@keyframes ng-snk-color {
  from { background-color: #000033; }
  to   { background-color: #0046FF; }
}

/* ── HERO "PRESS START" footer ───────────────────────────────── */
.ng-hero-footer {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  text-align: center;
  opacity: 0;
  z-index: 3;
  animation: ng-fade-in 0.6s ease 4.1s forwards;
}

@keyframes ng-fade-in {
  to { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   CRT TV WRAPPER
   ═══════════════════════════════════════════════════════════ */

.tv-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#tv-power { display: none; }

.tv-case {
  /* Full-width on mobile, capped on desktop, always 4:3 */
  width: 100%;
  max-width: 720px;
  aspect-ratio: 4 / 3;
  min-height: 260px;   /* safety on very narrow screens */
  background: linear-gradient(150deg, #363636, #212121);
  border-radius: 16px 16px 10px 10px;
  display: flex;
  align-items: stretch;
  padding: 18px 14px 18px 18px;
  gap: 12px;
  box-shadow:
    inset 2px 2px 6px rgba(255,255,255,0.07),
    inset -2px -2px 6px rgba(0,0,0,0.5),
    0 24px 48px rgba(0,0,0,0.75);
  border: 3px solid #111;
  box-sizing: border-box;
}

/* Inner bezel that holds the tube */
.tv-bezel {
  flex: 1;
  background: #0a0a0a;
  border-radius: 28px;
  padding: 12px;
  display: flex;
  box-shadow: inset 0 0 28px #000;
  overflow: hidden;
}

/* The CRT glass */
.tv-screen {
  width: 100%;
  background: #050505;
  border-radius: 16px / 5px;   /* subtle horizontal CRT curve */
  position: relative;
  overflow: hidden;
  scrollbar-width: none;        /* hide scrollbar — retro feel */
  -ms-overflow-style: none;
  transition: background 0.3s;
}
.tv-screen::-webkit-scrollbar { display: none; }

/* Scanlines */
.tv-scanlines {
  position: sticky;
  top: 0;
  width: 100%;
  height: 0;           /* zero height — visual only */
  pointer-events: none;
  z-index: 50;
}
.tv-scanlines::before {
  content: '';
  position: absolute;
  inset: 0;
  height: 100vh;       /* covers full scroll height */
  background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.25) 50%);
  background-size: 100% 4px;
}

/* Glass glare */
.tv-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 40;
}

/* ── CRT power-on animation (CSS-only, checkbox-driven) ──────── */
#tv-power:checked + .tv-case .tv-screen {
  animation: tv-turn-on 0.5s ease-out forwards, tv-flicker 0.12s 0.5s 4 ease;
}
#tv-power:checked + .tv-case .tv-power-led {
  background: #ff2222 !important;
  box-shadow: 0 0 8px #ff0000;
}
#tv-power:checked + .tv-case .tv-power-btn {
  color: #eee;
}

/* ── CRT power-off animation ──────────────────────────────────── */
#tv-power:not(:checked) + .tv-case .tv-screen {
  animation: tv-turn-off 0.8s ease-in forwards;
}
#tv-power:not(:checked) + .tv-case .tv-power-led {
  background: #1e1e1e !important;
  box-shadow: none;
}
#tv-power:not(:checked) + .tv-case .tv-power-btn {
  color: #666;
}

@keyframes tv-turn-on {
  0%   { transform: scale(1, 0.004); filter: brightness(8); opacity: 0; }
  35%  { transform: scale(1, 0.004); filter: brightness(4); opacity: 1; }
  100% { transform: scale(1, 1);     filter: brightness(1); opacity: 1; }
}
@keyframes tv-flicker {
  0%   { opacity: 0.92; }
  50%  { opacity: 1; }
  100% { opacity: 0.96; }
}

@keyframes tv-turn-off {
  0%   { transform: scale(1, 1);     filter: brightness(1); opacity: 1; }
  35%  { transform: scale(1, 0.01);  filter: brightness(2); opacity: 0.5; }
  100% { transform: scale(1, 0.001); filter: brightness(0); opacity: 0; }
}

/* ── OFF state hint ──────────────────────────────────────────── */
.tv-off-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
#tv-power:checked + .tv-case .tv-off-hint {
  display: none;
}

/* ── Side panel ──────────────────────────────────────────────── */
.tv-side-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
  gap: 14px;
  flex-shrink: 0;
  width: 52px;
}

.tv-speaker {
  width: 32px;
  height: 88px;
  background: repeating-linear-gradient(
    #0a0a0a, #0a0a0a 3px,
    #1c1c1c 3px, #1c1c1c 6px
  );
  border-radius: 3px;
}

.tv-power-btn {
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 40% 35%, #4a4a4a, #2e2e2e);
  border-radius: 50%;
  border: 3px solid #111;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 6.5px;
  font-family: monospace;
  font-weight: bold;
  box-shadow: 0 4px 0 #111, 0 0 0 1px #3a3a3a;
  transition: color 0.2s, transform 0.1s, box-shadow 0.1s;
  user-select: none;
  letter-spacing: 0.06em;
}
.tv-power-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #111;
}

.tv-power-led {
  width: 5px;
  height: 5px;
  background: #1e1e1e;
  border-radius: 50%;
  margin-bottom: 3px;
  transition: background 0.3s, box-shadow 0.3s;
}

/* ── TV legs ─────────────────────────────────────────────────── */
.tv-legs {
  width: 75%;
  max-width: 460px;
  height: 16px;
  display: flex;
  justify-content: space-between;
}
.tv-leg {
  width: 52px;
  height: 100%;
  background: linear-gradient(#1e1e1e, #181818);
  border-radius: 0 0 7px 7px;
}

/* ── In-TV boot screen ───────────────────────────────────────── */
#tv-boot-screen {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;      /* JS shows/hides */
  align-items: stretch;
  transition: opacity 0.4s;
}

/* Boot stage inside TV — no scale(2), sized to fit the screen */
.ng-stage-tv {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: relative;
  z-index: 1;
  padding: 0;
  gap: 8px;
}

/* Increase logo size inside TV */
.ng-stage-tv .ng-neo-logo {
  font-size: 52px !important;
  margin-bottom: 0 !important;
}

/* Overlay fade-out */
#tv-boot-screen.ng-fadeout {
  opacity: 0;
}

/* ── TV power hint ───────────────────────────────────────────── */
@keyframes tv-hint-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
#tv-power:checked + .tv-case .tv-side-panel #tv-hint {
  display: none;
}

/* ── Mobile: drop aspect-ratio so content fits without scrolling ── */
@media (max-width: 640px) {
  .tv-case {
    aspect-ratio: unset;
    min-height: 500px;
    height: auto;
  }
  .tv-bezel {
    overflow: hidden;
  }
  .tv-screen {
    overflow: hidden;
    height: 100%;
  }
  /* boot screen fills the taller TV on mobile */
  #tv-boot-screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}

/* ── News article body ─────────────────────────────────────────────────── */
.news-body {
    color: #F5F0E8;
    font-size: 0.95rem;
    line-height: 1.8;
}
.news-body h2 {
    font-family: 'Press Start 2P', monospace;
    color: #FFD700;
    font-size: 0.7rem;
    margin: 2rem 0 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #333;
}
.news-body p  { margin-bottom: 1.1rem; }
.news-body ul { list-style: none; margin: 0 0 1.1rem 0; padding: 0; }
.news-body ul li::before { content: "► "; color: #E53935; font-size: 0.7em; }
.news-body ul li { margin-bottom: 0.4rem; }
.news-body strong { color: #FFD700; }
.news-body em { color: #67e8f9; font-style: normal; }

.news-video-embed {
    margin: 1.5rem 0;
    border: 2px solid #FFD700;
    aspect-ratio: 16/9;
    background: #000;
}

/* ── Arcade corner badge (above TV) ────────────────────────────── */
@keyframes badge-dot-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.arcade-corner-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.07), transparent);
    border-top: 1px solid rgba(255,215,0,0.3);
    border-bottom: 1px solid rgba(255,215,0,0.3);
}

.arcade-corner-badge-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #E53935;
    animation: badge-dot-blink 1s step-end infinite;
    box-shadow: 0 0 6px #E53935;
}

/* ── INSERT COIN zone ───────────────────────────────────────────── */
.insert-coin-zone {
    padding: 8px 10px 12px;
    background: linear-gradient(180deg, #0a0a0a 0%, #1a0000 100%);
    border-top: 2px solid #FFD700;
    margin-top: 2px;
}

/* ── INSERT COIN button ─────────────────────────────────────────── */
@keyframes coin-pulse {
    0%, 100% {
        box-shadow: 0 4px 0 #7f0000,
                    0 0 12px rgba(229,57,53,0.7),
                    0 0 30px rgba(229,57,53,0.3),
                    0 0 50px rgba(255,215,0,0.15);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 4px 0 #7f0000,
                    0 0 22px rgba(229,57,53,1),
                    0 0 50px rgba(229,57,53,0.5),
                    0 0 80px rgba(255,215,0,0.3);
        transform: translateY(-3px);
    }
}

@keyframes coin-icon-bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    40%       { transform: translateY(-4px) rotate(5deg); }
    70%       { transform: translateY(-2px) rotate(-3deg); }
}

@keyframes coin-shimmer {
    0%   { left: -100%; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { left: 200%; opacity: 0; }
}

.insert-coin-btn {
    display: block;
    background: linear-gradient(180deg, #FF5252 0%, #D32F2F 45%, #7f0000 100%);
    border: 3px solid #FFD700;
    border-bottom-width: 5px;
    color: #FFD700;
    animation: coin-pulse 1.2s ease-in-out infinite;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.insert-coin-btn:hover {
    background: linear-gradient(180deg, #FF6E6E 0%, #E53935 45%, #9a0000 100%);
    border-color: #ffe066;
}

.insert-coin-btn:active {
    transform: translateY(4px) !important;
    border-bottom-width: 1px !important;
    box-shadow: 0 0 8px rgba(229,57,53,0.5) !important;
    animation: none !important;
}

.insert-coin-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px 8px;
    gap: 2px;
}

.insert-coin-icon {
    font-size: 1.4rem;
    animation: coin-icon-bounce 1.2s ease-in-out infinite;
    display: block;
    line-height: 1;
}

.insert-coin-text {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255,215,0,0.6), 0 1px 0 #000;
    line-height: 1.4;
}

.insert-coin-sub {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.38rem;
    letter-spacing: 0.1em;
    color: #67e8f9;
    opacity: 0.9;
}

.insert-coin-shimmer {
    position: absolute;
    top: 0; bottom: 0;
    left: -100%;
    width: 50%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    animation: coin-shimmer 2s ease-in-out infinite;
    pointer-events: none;
}

/* ── Guess the Game: screenshot fills available TV height ─── */
#arcade-guess:not(.hidden) { display: flex; }
.guess-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 12px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
#guess-screenshot {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  background: #111;
  box-sizing: border-box;
  display: block;
}

/* ─── Countdown arcade cabinet ─── */

/* Custom font classes (Tailwind doesn't ship these) */
.font-arcade { font-family: 'Press Start 2P', system-ui, monospace; }
.font-vt323  { font-family: 'VT323', ui-monospace, monospace; }

/* Cabinet frame — double gold border */
.cd-cabinet {
    border: 2px solid #ffd23f;
    box-shadow:
        0 0 0 2px #000,
        0 0 0 4px #a88a17,
        0 0 28px rgba(255,210,63,.18) inset,
        0 0 48px rgba(255,42,42,.08);
}

/* CRT scanlines + vignette */
.cd-crt::before {
    content: "";
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,.04) 0 1px,
        transparent 1px 3px
    );
    pointer-events: none;
    mix-blend-mode: overlay;
    z-index: 1;
}
.cd-crt::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Digits — red arcade glow */
.cd-digit {
    color: #ff2a2a;
    text-shadow:
        0 0 2px #ff6a6a,
        0 0 8px rgba(255,42,42,.55),
        0 0 22px rgba(255,42,42,.35);
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    font-smooth: never;
}

/* Labels — amber glow */
.cd-label {
    color: #ffd23f;
    text-shadow: 0 0 6px rgba(255,210,63,.45);
    letter-spacing: .18em;
}

/* Marquee header — amber glow */
.cd-marquee {
    color: #ffd23f;
    text-shadow: 0 0 8px rgba(255,210,63,.55), 0 0 22px rgba(255,210,63,.25);
    letter-spacing: .22em;
}

/* Colon separator — 1 Hz blink */
@keyframes cd-blink-1hz { 0%,49%{opacity:1} 50%,100%{opacity:.15} }
.cd-colon { animation: cd-blink-1hz 1s steps(1,end) infinite; }

/* INSERT COIN — yellow blink */
.cd-coin {
    color: #ffd23f;
    text-shadow: 0 0 6px rgba(255,210,63,.4);
    animation: cd-blink-1hz 1.4s steps(1,end) infinite;
}

/* Fluid sizes — min tuned so 4 blocks + 3 colons fit on 320px mobile */
.cd-digit-xl  { font-size: clamp(18px, 5.6vw, 76px); line-height: 1; display: inline-block; }
.cd-colon-xl  { font-size: clamp(14px, 3.8vw, 56px); line-height: 1; display: inline-block; }
.cd-label-sm  { font-size: clamp(6px, 1.4vw, 13px); letter-spacing: .12em; }
.cd-marquee-md{ font-size: clamp(10px, 1.6vw, 22px); }

/* Urgent mode — last 10 seconds */
@keyframes cd-urgent-flash {
    0%,100% { color: #ff2a2a; text-shadow: 0 0 8px rgba(255,42,42,.55), 0 0 22px rgba(255,42,42,.35); }
    50%     { color: #fff;    text-shadow: 0 0 10px #fff, 0 0 28px #ff2a2a; }
}
.cd-urgent .cd-digit { animation: cd-urgent-flash .35s steps(1,end) infinite; }
