/* IW30 1996 Mode */

:root {
  --xg-bg-1: #3d0c96;
  --xg-bg-2: #14002f;
  --xg-pink: #f040e7;
  --xg-orange: #f86e21;
  --xg-yellow: #e8c70c;
  --xg-green: #10e010;
  --xg-cyan: #00ccff;
  --xg-violet: #8a5cff;
  --xg-serif: 'new-spirit', Georgia, serif;
  --xg-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --xg-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { background: var(--xg-bg-2); }
body {
  margin: 0;
  min-height: 100vh;
  color: #fff;
  font-family: var(--xg-sans);
  background: var(--xg-bg-2);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* The scroll track: its height is set by the script (one step per photo). */
.xg-track { width: 1px; }

/* Background: purple glow, sweeping spotlights, laser beams */
.xg-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 110%, #7b2cff 0%, transparent 55%),
    radial-gradient(90% 70% at 50% -10%, #5a14c8 0%, transparent 60%),
    linear-gradient(180deg, var(--xg-bg-1), var(--xg-bg-2));
}
.xg-spot {
  position: absolute; top: -20%; width: 70vmax; height: 140vmax;
  background: radial-gradient(50% 60% at 50% 0%, rgba(255, 255, 255, 0.22), transparent 70%);
  transform-origin: 50% 0%;
  mix-blend-mode: screen;
  filter: blur(8px);
}
.xg-spot--a { left: -10%; animation: xg-sweep-a 9s ease-in-out infinite alternate; }
.xg-spot--b { right: -10%; animation: xg-sweep-b 11s ease-in-out infinite alternate; }
@keyframes xg-sweep-a { from { transform: rotate(-28deg); } to { transform: rotate(18deg); } }
@keyframes xg-sweep-b { from { transform: rotate(26deg); } to { transform: rotate(-20deg); } }

.xg-laser {
  position: absolute; bottom: -10vh; left: 50%;
  width: 3px; height: 160vmax;
  transform-origin: 50% 100%;
  mix-blend-mode: screen;
  border-radius: 3px;
  opacity: 0.75;
}
.xg-laser::after {
  content: ''; position: absolute; inset: 0 -6px;
  background: inherit; filter: blur(8px); opacity: 0.7;
}
.xg-laser--1 { left: 8%;  background: linear-gradient(0deg, var(--xg-pink), transparent 90%);   animation: xg-laser-a 3.6s ease-in-out infinite alternate; }
.xg-laser--2 { left: 18%; background: linear-gradient(0deg, var(--xg-cyan), transparent 90%);   animation: xg-laser-b 4.4s ease-in-out infinite alternate; }
.xg-laser--3 { left: 30%; background: linear-gradient(0deg, var(--xg-green), transparent 90%);  animation: xg-laser-a 5.2s ease-in-out infinite alternate-reverse; }
.xg-laser--4 { left: 70%; background: linear-gradient(0deg, var(--xg-yellow), transparent 90%); animation: xg-laser-b 4.8s ease-in-out infinite alternate-reverse; }
.xg-laser--5 { left: 82%; background: linear-gradient(0deg, var(--xg-orange), transparent 90%); animation: xg-laser-a 4s ease-in-out infinite alternate; }
.xg-laser--6 { left: 92%; background: linear-gradient(0deg, var(--xg-violet), transparent 90%); animation: xg-laser-b 3.2s ease-in-out infinite alternate; }
@keyframes xg-laser-a { from { transform: rotate(-38deg); } to { transform: rotate(22deg); } }
@keyframes xg-laser-b { from { transform: rotate(34deg); } to { transform: rotate(-26deg); } }
/* Beams flash brighter on a fresh section (class set by the script). */
body.is-hype .xg-laser { opacity: 1; animation-duration: 0.9s; }

.xg-confetti { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
/* Fireworks draw above the photos (below the HUD and section name). */
.xg-fireworks { position: fixed; inset: 0; z-index: 9; width: 100%; height: 100%; pointer-events: none; }

/* HUD */
.xg-hud {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px)) 0 calc(20px + env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.xg-home {
  pointer-events: auto;
  font-family: var(--xg-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #fff; text-decoration: none;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.xg-count {
  margin: 0;
  font-family: var(--xg-mono); font-size: 14px; letter-spacing: 0.14em; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(240, 64, 231, 0.9);
}
.xg-count__of { opacity: 0.6; }

/* The pile */
.xg-stage {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  pointer-events: none;
}
.xg-pile { position: relative; width: 0; height: 0; pointer-events: auto; cursor: pointer; touch-action: manipulation; }
.xg-card { touch-action: manipulation; }
.xg-card {
  position: absolute; left: 0; top: 0;
  display: none;
  border-radius: 10px;
  background: #241050;
  box-shadow: 0 18px 50px rgba(10, 0, 40, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.92);
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
}
.xg-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.xg-card.is-on { display: block; }

/* Section name slam */
.xg-era {
  position: fixed; z-index: 15; left: 0; right: 0; bottom: calc(9vh + env(safe-area-inset-bottom, 0px));
  text-align: center; pointer-events: none;
  font-family: var(--xg-serif); font-weight: 500;
  font-size: clamp(2.4rem, 9vw, 6rem); line-height: 1;
  color: #fff;
  text-shadow: 0 0 18px var(--xg-accent, var(--xg-pink)), 0 0 46px var(--xg-accent, var(--xg-pink));
  opacity: 0;
}
.xg-era.is-slam { animation: xg-slam 1.6s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
@keyframes xg-slam {
  0%   { opacity: 0; transform: scale(2.2) rotate(-6deg); letter-spacing: 0.3em; }
  18%  { opacity: 1; transform: scale(1) rotate(-2deg); letter-spacing: 0.02em; }
  70%  { opacity: 1; transform: scale(1.03) rotate(-2deg); }
  100% { opacity: 0; transform: scale(0.9) rotate(-2deg) translateY(10px); }
}

/* Intro and finale */
.xg-intro, .xg-finale {
  position: fixed; z-index: 12; left: 0; right: 0;
  text-align: center; pointer-events: none;
  padding: 0 20px;
}
.xg-intro { top: calc(7vh + env(safe-area-inset-top, 0px)); transition: opacity 0.4s ease, transform 0.4s ease; }
.xg-intro.is-gone { opacity: 0; transform: translateY(-20px); }
.xg-intro__kicker, .xg-finale__kicker {
  margin: 0 0 6px;
  font-family: var(--xg-mono); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--xg-yellow);
}
.xg-intro__title, .xg-finale__title {
  margin: 0;
  font-family: var(--xg-serif); font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 4rem); line-height: 0.95;
  background: linear-gradient(90deg, var(--xg-pink), var(--xg-orange), var(--xg-yellow), var(--xg-green), var(--xg-cyan), var(--xg-pink));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: xg-rainbow 4s linear infinite;
  filter: drop-shadow(0 0 18px rgba(240, 64, 231, 0.6));
}
@keyframes xg-rainbow { to { background-position: 300% 0; } }
.xg-intro__hint {
  position: fixed; left: 0; right: 0; bottom: calc(5vh + env(safe-area-inset-bottom, 0px));
  margin: 0; padding: 0 20px;
  font-family: var(--xg-mono); font-size: clamp(14px, 1.35vw, 19px); letter-spacing: 0.2em; text-transform: uppercase;
  text-wrap: balance;
}
/* Old-school marquee (built by the script): the line repeated to fill the
   screen, scrolling right to left, blinking like <blink>. */
.xg-intro__hint.is-marquee { padding: 0; overflow: hidden; white-space: nowrap; animation: xg-old-blink 1.2s steps(1) infinite; }
.xg-marquee { display: inline-block; animation: xg-marquee 20s linear infinite; will-change: transform; }
.xg-marquee__item::after { content: '\2605'; padding: 0 1.4em; color: var(--xg-yellow); }
.xg-marquee__item--warn { color: var(--xg-yellow); text-transform: none; }
@keyframes xg-marquee { to { transform: translateX(-50%); } }
@keyframes xg-old-blink { 67% { opacity: 0; } }
.xg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.xg-finale { top: 50%; transform: translateY(-50%); }
.xg-finale[hidden] { display: none; }
.xg-finale:not([hidden]) { animation: xg-pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes xg-pop { from { opacity: 0; transform: translateY(-50%) scale(0.7); } }
.xg-finale__title { font-size: clamp(2.6rem, 9vw, 6.4rem); margin-bottom: 28px; }
.xg-finale__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; pointer-events: auto; }
.xg-btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  font-family: var(--xg-mono); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 14px 22px; border-radius: 999px;
  color: #14002f; background: #fff;
  box-shadow: 0 0 24px rgba(240, 64, 231, 0.7);
}
.xg-btn--ghost { color: #fff; background: rgba(255, 255, 255, 0.12); box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .xg-spot, .xg-laser, .xg-intro__title, .xg-finale__title, .xg-intro__hint { animation: none; }
  .xg-era.is-slam { animation-duration: 0.01s; }
}

/* Tap-to-explode pieces */
.xg-boom { position: fixed; z-index: 8; pointer-events: none; }
.xg-shard {
  position: absolute;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  will-change: transform, opacity;
}
.xg-flash {
  position: absolute; inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(240, 64, 231, 0.5) 35%, transparent 65%);
  animation: xg-flash 0.5s ease-out forwards;
}
@keyframes xg-flash { from { opacity: 1; transform: scale(0.4); } to { opacity: 0; transform: scale(1.6); } }

/* 1996 pop culture windows (popped in by the script when you go fast) */
.xg-pops { position: fixed; inset: 0; z-index: 11; pointer-events: none; }
.xg-pop {
  position: absolute;
  width: clamp(148px, 16vw, 236px);
  background: #c0c0c0;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
  box-shadow: 0 0 0 1px #000, 0 16px 34px rgba(10, 0, 40, 0.55);
  color: #111;
  opacity: 0;
}
.xg-pop__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  padding: 3px 3px 3px 6px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font: 700 11px/1.2 Tahoma, Verdana, var(--xg-sans);
}
.xg-pop__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xg-pop__x {
  flex: none; width: 15px; height: 13px;
  background: #c0c0c0; border: 1px solid; border-color: #fff #404040 #404040 #fff;
  color: #000; font: 700 8px/11px var(--xg-sans); text-align: center;
}
.xg-pop__art {
  margin: 5px;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  background: #fff; line-height: 0;
}
.xg-pop__art svg, .xg-pop__art img { display: block; width: 100%; height: auto; }
.xg-pop__cap { margin: 0 7px 7px; font: 11px/1.3 Tahoma, Verdana, var(--xg-sans); }
@media (max-width: 699px) { .xg-pop__cap { font-size: 10px; } }

/* The dancing baby dances. */
.xg-pop__dance { transform-box: view-box; transform-origin: 50% 92%; animation: xg-dance 0.5s ease-in-out infinite alternate; }
@keyframes xg-dance { from { transform: rotate(-9deg) translateY(0); } to { transform: rotate(9deg) translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .xg-pop__dance { animation: none; } }

/* Dithered pictures (DITHER in xgames.js): scaled up with hard pixels. */
.xg-pop__art { position: relative; }
.xg-pop__px { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-pop__art .xg-pop__px--b { position: absolute; inset: 0; height: 100%; animation: xg-frame 1s steps(1) infinite; }
@keyframes xg-frame { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .xg-pop__px--b { animation: none; opacity: 0; } }

/* Dithered photos (DITHER_PHOTOS in xgames.js) */
.xg-card__px { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-card.is-px img { visibility: hidden; }
.xg-shard { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }

/* Retro look (xgames.retro.js): dithered background, titles, confetti */
.xg-bg.has-gl { background: none; }
.xg-bg.has-gl > div { display: none; }
.xg-bg-gl { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-retro-fx .xg-confetti, .xg-retro-fx .xg-fireworks { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-pxtext { color: transparent !important; -webkit-text-fill-color: transparent !important; text-shadow: none !important; background: none !important; filter: none !important; }
.xg-intro__title.xg-pxtext, .xg-finale__title.xg-pxtext { position: relative; }
.xg-pxtext__img { position: absolute; max-width: none; pointer-events: none; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-pxtext__img--rainbow { animation: xg-hue 4s linear infinite; }
@keyframes xg-hue { to { filter: hue-rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .xg-pxtext__img--rainbow { animation: none; } }

/* Blue screen of death (going about as fast as possible) */
.xg-bsod {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 24px calc(20px + env(safe-area-inset-right, 0px)) 24px calc(20px + env(safe-area-inset-left, 0px));
  background: #0000aa; color: #fff;
  font: 700 clamp(14px, 1.9vw, 22px)/1.4 'Perfect DOS VGA 437', 'Lucida Console', Consolas, 'Courier New', monospace;
  -webkit-font-smoothing: none;
  touch-action: none;
}
.xg-bsod[hidden] { display: none; }
.xg-bsod__inner { max-width: 44em; }
.xg-bsod p { margin: 0 0 1.4em; }
.xg-bsod__head { display: table; margin: 0 auto 1.6em !important; padding: 0 0.4em; background: #aaaaaa; color: #0000aa; }
.xg-bsod__prompt { text-align: center; }
.xg-bsod__cursor { animation: xg-blink 1s steps(1) infinite; }
@keyframes xg-blink { 50% { opacity: 0; } }
.xg-bsod__actions { text-align: center; margin: 0 !important; }
.xg-bsod__btn {
  appearance: none; cursor: pointer;
  font: inherit; color: #0000aa; background: #aaaaaa;
  border: 0; padding: 0.15em 1.2em;
}
.xg-bsod__btn:hover, .xg-bsod__btn:focus-visible { background: #fff; outline: none; }
html.xg-bsod-on, html.xg-bsod-on body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .xg-bsod__cursor { animation: none; } }

/* 1996 boot after the blue screen: splash, then a command-line boot */
.xg-boot { position: fixed; inset: 0; z-index: 101; background: #000; touch-action: none; }
.xg-boot[hidden] { display: none; }
.xg-boot__splash { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-boot__bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: max(10px, 2.4vh);
  background: repeating-linear-gradient(90deg, #0a2a8a 0, #2f7fe8 12.5%, #9fd6ff 25%, #2f7fe8 37.5%, #0a2a8a 50%);
  background-size: 200% 100%;
  animation: xg-bootbar 1.1s linear infinite;
}
@keyframes xg-bootbar { to { background-position: -200% 0; } }
.xg-boot__cli {
  display: none; position: absolute; inset: 0; margin: 0;
  padding: calc(4vh + env(safe-area-inset-top, 0px)) calc(4vw + env(safe-area-inset-right, 0px)) 4vh calc(4vw + env(safe-area-inset-left, 0px));
  background: #000; color: #c0c0c0;
  font: 700 clamp(12px, 1.5vw, 20px)/1.4 'Perfect DOS VGA 437', 'Lucida Console', Consolas, 'Courier New', monospace;
  -webkit-font-smoothing: none;
  white-space: pre-wrap; word-break: break-word;
}
.xg-boot__cli b { color: #fff; font-weight: 700; }
.xg-boot__cli i { font-style: normal; color: #55ff55; }
.xg-boot__cli .xg-boot__hi { color: #ffff55; }
.xg-boot__cli em { font-style: normal; color: #ff5555; }
.xg-boot.is-cli .xg-boot__splash, .xg-boot.is-cli .xg-boot__bar { display: none; }
.xg-boot.is-cli .xg-boot__cli { display: block; }
.xg-boot__cli::after { content: '_'; animation: xg-blink 1s steps(1) infinite; }

/* Music player (xgames.player.js): shown after a crash and reboot. Three skins. */
.xg-amp {
  --amp-body: #2b2d3c; --amp-hi: #747999; --amp-lo: #0c0d15; --amp-bar: linear-gradient(90deg, #14162a, #4a5080);
  --amp-bartext: #dfe3ff; --amp-lcd: #000; --amp-ink: #00e800; --amp-dim: #0a5a0a; --amp-btn: #40445c; --amp-btnink: #d5d9f2; --amp-on: #00e800;
  position: fixed; left: 16px; bottom: 16px; z-index: 30; width: 296px;
  background: var(--amp-body); color: var(--amp-btnink);
  border: 2px solid; border-color: var(--amp-hi) var(--amp-lo) var(--amp-lo) var(--amp-hi);
  box-shadow: 0 0 0 1px #000, 0 14px 30px rgba(10, 0, 40, 0.55);
  font: 700 10px/1.2 Tahoma, Verdana, var(--xg-sans);
  -webkit-user-select: none; user-select: none;
  animation: xg-amp-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
@keyframes xg-amp-in { from { opacity: 0; transform: translateY(30px) scale(0.9); } }
.xg-amp[data-skin="eleven"] {
  --amp-body: #111; --amp-hi: #c9a227; --amp-lo: #5a4708; --amp-bar: linear-gradient(90deg, #000, #3a2e06);
  --amp-bartext: #f2d57a; --amp-lcd: #1a0d00; --amp-ink: #ffb000; --amp-dim: #6b4a00; --amp-btn: #1e1e1e; --amp-btnink: #f2d57a; --amp-on: #ff3b1f;
}
.xg-amp[data-skin="rave"] {
  --amp-body: #3d0c96; --amp-hi: #f040e7; --amp-lo: #14002f; --amp-bar: linear-gradient(90deg, #f040e7, #00ccff);
  --amp-bartext: #14002f; --amp-lcd: #14002f; --amp-ink: #00f0ff; --amp-dim: #0b5a78; --amp-btn: #5a14c8; --amp-btnink: #fff; --amp-on: #e8c70c;
}
.xg-amp button { font: inherit; color: inherit; cursor: pointer; }
.xg-amp__bar { display: flex; align-items: center; gap: 3px; padding: 2px 3px 2px 6px; background: var(--amp-bar); color: var(--amp-bartext); cursor: grab; touch-action: none; }
.xg-amp__name { flex: 1; letter-spacing: 0.22em; }
.xg-amp__barbtn { width: 16px; height: 14px; padding: 0; background: var(--amp-btn); color: var(--amp-btnink) !important; border: 1px solid; border-color: var(--amp-hi) var(--amp-lo) var(--amp-lo) var(--amp-hi); font-size: 9px !important; line-height: 10px !important; }
.xg-amp__body { padding: 6px; display: grid; gap: 6px; }
.xg-amp.is-shade .xg-amp__body { display: none; }
.xg-amp__lcd { background: var(--amp-lcd); color: var(--amp-ink); border: 2px solid; border-color: var(--amp-lo) var(--amp-hi) var(--amp-hi) var(--amp-lo); padding: 4px 6px; font-family: 'Lucida Console', Consolas, 'Courier New', monospace; overflow: hidden; }
.xg-amp__row { display: flex; align-items: center; gap: 8px; }
.xg-amp__state { width: 12px; font-size: 11px; }
.xg-amp__state[data-state="play"]::before { content: '\25B6\FE0E'; }
.xg-amp__state[data-state="pause"]::before { content: 'II'; letter-spacing: -1px; }
.xg-amp__state[data-state="stop"]::before { content: '\25A0'; }
.xg-amp__time { font-size: 20px; line-height: 1; letter-spacing: 0.05em; min-width: 3.2em; }
.xg-amp__viz { flex: 1; min-width: 0; height: 18px; image-rendering: pixelated; }
.xg-amp__tag { font-size: 9px; color: var(--amp-dim); border: 1px solid var(--amp-dim); padding: 1px 3px; }
.xg-amp__marq { margin-top: 4px; overflow: hidden; white-space: nowrap; font-size: 11px; font-weight: 400; }
.xg-amp__marqtrack { display: inline-block; white-space: pre; animation: xg-marquee 12s linear infinite; will-change: transform; }
.xg-amp input[type="range"] { width: 100%; margin: 0; height: 14px; accent-color: var(--amp-ink); cursor: pointer; }
.xg-amp__ctl { display: flex; gap: 3px; align-items: center; }
.xg-amp__btn { width: 30px; height: 22px; padding: 0; display: grid; place-items: center; background: var(--amp-btn); border: 2px solid; border-color: var(--amp-hi) var(--amp-lo) var(--amp-lo) var(--amp-hi); }
.xg-amp__btn svg { width: 11px; height: 11px; fill: var(--amp-btnink); }
.xg-amp__btn:active, .xg-amp__tog:active { border-color: var(--amp-lo) var(--amp-hi) var(--amp-hi) var(--amp-lo); }
.xg-amp__tog { height: 22px; padding: 0 6px; background: var(--amp-btn); border: 2px solid; border-color: var(--amp-hi) var(--amp-lo) var(--amp-lo) var(--amp-hi); letter-spacing: 0.08em; white-space: nowrap; }
.xg-amp__tog::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 4px; vertical-align: 1px; background: var(--amp-dim); }
.xg-amp__tog[aria-pressed="true"]::before { background: var(--amp-on); box-shadow: 0 0 5px var(--amp-on); }
.xg-amp__ctl .xg-amp__tog:first-of-type { margin-left: auto; }
.xg-amp__volrow { display: flex; align-items: center; gap: 8px; }
.xg-amp__vol { flex: 1; display: flex; align-items: center; gap: 6px; }
.xg-amp__knobwrap { display: none; position: relative; width: 104px; height: 92px; flex: none; }
.xg-amp__knoblabel { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; letter-spacing: 0.2em; font-size: 8px; }
.xg-amp__knob { --turn: 0deg; position: absolute; left: 50%; top: 56%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; cursor: grab; touch-action: none;
  background: radial-gradient(circle at 35% 30%, #5a5a5a, #1a1a1a 60%, #000); border: 2px solid #c9a227; box-shadow: 0 2px 6px #000; }
.xg-amp__knob i { position: absolute; left: 50%; top: 50%; width: 3px; height: 19px; margin: -21px 0 0 -1.5px; background: #fff; border-radius: 2px; transform-origin: 50% 21px; transform: rotate(var(--turn)); }
.xg-amp__knob.is-eleven { border-color: #ff3b1f; box-shadow: 0 0 12px #ff3b1f; }
.xg-amp__knob:focus-visible, .xg-amp button:focus-visible { outline: 2px solid var(--amp-ink); outline-offset: 1px; }
.xg-amp__num { position: absolute; transform: translate(-50%, -50%); font-size: 8px; font-weight: 700; }
.xg-amp__num.is-eleven { color: #ff3b1f; font-size: 11px; }
.xg-amp[data-skin="eleven"] .xg-amp__vol { display: none; }
.xg-amp[data-skin="eleven"] .xg-amp__knobwrap { display: block; }
.xg-amp[data-skin="eleven"] .xg-amp__volrow { justify-content: space-between; }
.xg-amp__list { list-style: none; margin: 0; padding: 2px; max-height: 164px; overflow: auto; background: var(--amp-lcd); border: 2px solid; border-color: var(--amp-lo) var(--amp-hi) var(--amp-hi) var(--amp-lo); }
.xg-amp__list[hidden] { display: none; }
.xg-amp__list button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 2px 4px; background: none; border: 0; text-align: left; color: var(--amp-ink) !important; font: 400 11px/1.3 'Lucida Console', Consolas, 'Courier New', monospace !important; }
.xg-amp__list button.is-on { background: var(--amp-ink); color: var(--amp-lcd) !important; }
@media (max-width: 699px) {
  .xg-amp { left: 0; right: 0; bottom: 0; width: auto; border-left: 0; border-right: 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .xg-amp__bar { cursor: default; }
  .xg-amp__btn { flex: 1; height: 28px; } .xg-amp__tog { height: 28px; }
  .xg-amp__list { max-height: 30vh; }
  /* make room: lift the photos and the section name above the player */
  .xg-has-player .xg-stage { bottom: var(--xg-amp-h, 0px); }
  .xg-has-player .xg-era { bottom: calc(var(--xg-amp-h, 0px) + 3vh); }
}
@media (prefers-reduced-motion: reduce) { .xg-amp, .xg-amp__marqtrack { animation: none; } }

/* The Backrooms (xgames.backrooms.js): the second reboot ends up here */
.xg-br { position: fixed; inset: 0; z-index: 103; background: #000; color: #d8d2c0; font: 400 clamp(13px, 1.5vw, 18px)/1.4 'Perfect DOS VGA 437', 'Lucida Console', Consolas, 'Courier New', monospace; -webkit-font-smoothing: none; touch-action: none; -webkit-user-select: none; user-select: none; }
html.xg-br-on, html.xg-br-on body { overflow: hidden; }
.xg-br__view { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-br__fade { position: absolute; inset: 0; background: #000; pointer-events: none; opacity: 1; }
.xg-br__hud { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); margin: 0; text-align: center; opacity: 0.55; letter-spacing: 0.06em; animation: xg-br-hud 1s ease 9s forwards; }
@keyframes xg-br-hud { to { opacity: 0; } }
.xg-br__prompt { position: absolute; left: 0; right: 0; top: 60%; margin: 0; text-align: center; color: #fff; text-shadow: 0 0 10px rgba(255, 220, 150, 0.6); }
.xg-br__prompt[hidden] { display: none; }
.xg-br__sub { position: absolute; left: 50%; top: calc(18px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); max-width: calc(100% - 32px); box-sizing: border-box; margin: 0; padding: 10px 18px; border-radius: 8px; background: rgba(0, 0, 0, 0.62); text-align: center; color: #fff; font-size: clamp(16px, 2.6vw, 26px); line-height: 1.3; text-shadow: 0 1px 0 #000; }
.xg-br__sub[hidden] { display: none; }
.xg-br__hud5 { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.xg-br__hud5[hidden] { display: none; }
.xg-br__lids { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.xg-br__lids[hidden] { display: none; }
.xg-br__lid { position: absolute; left: -10%; right: -10%; height: 0; background: #000; }
.xg-br__lid--top { top: 0; border-radius: 0 0 50% 50% / 0 0 80px 80px; }
.xg-br__lid--bot { bottom: 0; border-radius: 50% 50% 0 0 / 80px 80px 0 0; }
.xg-br__pad { position: absolute; left: 0; right: 0; bottom: calc(44px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(5, 54px); justify-content: center; gap: 8px; }
.xg-br__pad button { height: 54px; font: 700 20px var(--xg-sans); color: #fff; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 8px; touch-action: none; }
.xg-br__pad button.is-down { background: rgba(255, 255, 255, 0.35); }
.xg-br__pad[hidden] { display: none; }
.xg-br__fire { position: absolute; right: 16px; bottom: calc(120px + env(safe-area-inset-bottom, 0px)); width: 76px; height: 76px; border-radius: 50%; font: 700 15px 'Lucida Console', Consolas, monospace; letter-spacing: 0.06em; color: #04121a; background: #8fe3ff; border: 3px solid rgba(255, 255, 255, 0.8); box-shadow: 0 0 22px rgba(62, 193, 255, 0.7); touch-action: none; -webkit-user-select: none; user-select: none; z-index: 6; }
.xg-br__fire.is-down { background: #fff; }
.xg-br__fire[hidden] { display: none; }
.xg-br__use { font-family: 'Lucida Console', Consolas, monospace !important; }
.xg-br__book { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; padding: 24px; background: rgba(0, 0, 0, 0.82); cursor: pointer; animation: xg-br-book 0.5s ease both; }
.xg-br__book[hidden] { display: none; }
@keyframes xg-br-book { from { opacity: 0; transform: scale(0.8); } }
.xg-br__pages { position: relative; width: min(92vw, 440px); aspect-ratio: 1082 / 1400; max-height: 74vh; transform-style: preserve-3d; transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
.xg-br__book.is-flipped .xg-br__pages { transform: rotateY(180deg); }
.xg-br__cover, .xg-br__back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 30px 60px #000; }
.xg-br__cover { width: 100%; height: 100%; object-fit: contain; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-br__back { transform: rotateY(180deg); display: grid; align-content: center; gap: 16px; padding: 24px; background: #f4f1ea; color: #111; text-align: center; font: 400 clamp(13px, 1.5vw, 16px)/1.45 Georgia, 'Times New Roman', serif; }
.xg-br__back p { margin: 0; animation: none; color: #111; }
.xg-br__warnhead { font: 700 clamp(18px, 2.4vw, 26px)/1.2 'Arial Black', Arial, sans-serif; color: #c4161c; letter-spacing: 0.04em; }
.xg-br__warntext { max-width: 34em; margin: 0 auto !important; }
.xg-br__warnkeys { font-size: 0.85em; color: #555; }
.xg-br__warnbtns { display: flex; gap: 12px; justify-content: center; }
.xg-br__warnbtn { font: 700 14px 'Lucida Console', Consolas, monospace; letter-spacing: 0.12em; padding: 10px 22px; cursor: pointer; background: #c0c0c0; color: #000; border: 2px solid; border-color: #fff #404040 #404040 #fff; }
.xg-br__warnbtn[data-w="go"] { background: #c4161c; color: #fff; border-color: #ff8a8a #5a0a0c #5a0a0c #ff8a8a; }
.xg-br__warnbtn:focus-visible { outline: 3px solid #00ccff; outline-offset: 2px; }
.xg-br__bookhint { margin: 0; color: #fff; animation: xg-blink 1.2s steps(1) infinite; }
.xg-br__bookhint[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .xg-br__pages { transition: none; } }
.xg-br__end { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: #000; }
.xg-br__end[hidden] { display: none; }
.xg-br__end.is-flash { background: #fff; }
.xg-br__end.is-flash .xg-br__line { display: none; }
.xg-br__line { margin: 0; text-align: center; font-size: clamp(16px, 2.2vw, 26px); color: #cfc8b4; opacity: 0; transition: opacity 1.2s ease; }
.xg-br__line.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .xg-br__book p { animation: none; } }

/* Instant messenger (xgames.messenger.js): buddy list after the first reboot */
.xg-im {
  position: fixed; right: 12px; top: 64px; z-index: 31; width: 190px;
  background: #d4d0c8; color: #000;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
  box-shadow: 0 0 0 1px #000, 0 12px 26px rgba(10, 0, 40, 0.5);
  font: 400 11px/1.3 Tahoma, Verdana, var(--xg-sans);
  animation: xg-amp-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.xg-im[hidden] { display: none; }
.xg-im button { font: inherit; cursor: pointer; }
.xg-im__bar { display: flex; align-items: center; gap: 4px; padding: 3px 3px 3px 7px; background: linear-gradient(90deg, #0a246a, #a6caf0); color: #fff; font-weight: 700; }
.xg-im__title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xg-im__x { width: 16px; height: 14px; padding: 0; background: #d4d0c8; color: #000; border: 1px solid; border-color: #fff #404040 #404040 #fff; font-size: 9px; line-height: 10px; }
.xg-im__body { padding: 6px; }
.xg-im.is-shade .xg-im__body { display: none; }
.xg-im__me { margin: 0 0 6px; color: #333; font-size: 10px; }
.xg-im__group { background: #fff; border: 1px solid; border-color: #404040 #fff #fff #404040; margin-bottom: 4px; }
.xg-im__head { padding: 3px 5px; font-weight: 700; color: #0a246a; cursor: pointer; -webkit-user-select: none; user-select: none; }
.xg-im__buddy { display: none; width: 100%; padding: 3px 5px 3px 14px; background: none; border: 0; text-align: left; color: #000; -webkit-user-select: none; user-select: none; }
.xg-im__group.is-open .xg-im__buddy { display: flex; align-items: center; gap: 6px; }
.xg-im__buddy:hover, .xg-im__buddy:focus-visible { background: #0a246a; color: #fff; outline: none; }
.xg-im__dot { width: 8px; height: 8px; border-radius: 50%; background: #2fc24a; box-shadow: 0 0 4px #2fc24a; }
.xg-im__since { margin-left: auto; font-size: 9px; opacity: 0.6; }
.xg-im__hint { margin: 6px 0 0; font-size: 10px; color: #333; animation: xg-blink 1.4s steps(1) infinite; }
.xg-im--chat { top: auto; bottom: 16px; right: 12px; width: min(320px, calc(100vw - 24px)); z-index: 32; }
.xg-im__log { height: 110px; overflow: auto; padding: 4px 6px; margin-bottom: 6px; background: #fff; border: 1px solid; border-color: #404040 #fff #fff #404040; font-size: 12px; }
.xg-im__line { margin: 2px 0; }
.xg-im__line.is-them b { color: #c00; }
.xg-im__line.is-me b { color: #00c; }
.xg-im__form { display: grid; gap: 5px; }
.xg-im__name { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.xg-im__name input, .xg-im__form textarea { flex: 1; font: 12px Tahoma, Verdana, var(--xg-sans); color: #000; background: #fff; border: 1px solid; border-color: #404040 #fff #fff #404040; padding: 3px 4px; min-width: 0; }
.xg-im__form textarea { resize: vertical; }
.xg-im__actions { display: flex; align-items: center; gap: 8px; }
.xg-im__status { flex: 1; font-size: 10px; color: #333; min-height: 1.2em; }
.xg-im__send { padding: 3px 14px; background: #d4d0c8; color: #000; border: 2px solid; border-color: #fff #404040 #404040 #fff; font-weight: 700; }
.xg-im__send:active { border-color: #404040 #fff #fff #404040; }
.xg-im__send:disabled { color: #808080; cursor: default; }
@media (max-width: 699px) {
  /* 16px text in the fields: anything smaller makes iOS zoom in when you tap one */
  .xg-im__name input, .xg-im__form textarea { font-size: 16px; }
  .xg-im { top: 72px; right: 8px; width: 150px; font-size: 10px; }
  .xg-has-im .xg-intro { padding-right: 160px; text-align: left; padding-left: 20px; }
  .xg-has-im .xg-intro__title { font-size: clamp(1.6rem, 9vw, 2.2rem); }
  .xg-im--chat { top: auto; bottom: calc(var(--xg-amp-h, 0px) + 8px); right: 8px; left: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) { .xg-im, .xg-im__hint { animation: none; } }

/* Closing the chat: the Solitaire-win cascade, then the freeze */
.xg-im-cascade { position: fixed; inset: 0; z-index: 31; pointer-events: none; overflow: hidden; }
.xg-im--ghost { position: fixed; animation: none; box-shadow: 0 0 0 1px #000; pointer-events: none; contain: layout paint; }
.xg-im--ghost * { animation: none !important; transition: none !important; }
.xg-im.is-falling { z-index: 33; animation: none; transition: none; pointer-events: none; }
html.xg-frozen * { animation-play-state: paused !important; transition: none !important; }
html.xg-frozen .xg-bsod, html.xg-frozen .xg-bsod * { animation-play-state: running !important; }
html.xg-frozen body { cursor: wait; }

/* The bottle, picked up */
.xg-br__bottle { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; padding: 24px; background: rgba(0, 0, 0, 0.82); animation: xg-br-book 0.5s ease both; cursor: pointer; }
.xg-br__bottle[hidden] { display: none; }
.xg-br__bottle img { max-height: 56vh; width: auto; filter: drop-shadow(0 20px 30px #000); image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-br__bottlecap { margin: 6px 0 0; font: 900 clamp(34px, 7vw, 72px)/1 'Arial Black', Impact, Arial, sans-serif; color: #b7ff4a; letter-spacing: 0.04em; text-shadow: 0 0 18px rgba(120, 255, 60, 0.55), 3px 3px 0 #0d2a14; animation: xg-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.xg-br__bottlehint { margin: 4px 0 0; color: #fff; animation: xg-blink 1.2s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .xg-br__bottlecap, .xg-br__bottlehint { animation: none; } }

/* The egg, taken from the nerd */
.xg-br__egg { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; padding: 24px; background: rgba(0, 0, 0, 0.82); animation: xg-br-book 0.5s ease both; cursor: pointer; }
.xg-br__egg[hidden] { display: none; }
.xg-br__egg img { max-height: 52vh; width: auto; border-radius: 50%; box-shadow: 0 20px 40px #000, 0 0 0 6px #fff; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; }
.xg-br__eggcap { margin: 8px 0 0; text-align: center; font: 900 clamp(22px, 4.2vw, 44px)/1.15 'Arial Black', Impact, Arial, sans-serif; color: #ffd23b; text-shadow: 3px 3px 0 #5a2d00, 0 0 18px rgba(255, 210, 59, 0.5); animation: xg-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.xg-br__egghint { margin: 4px 0 0; color: #fff; animation: xg-blink 1.2s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .xg-br__eggcap, .xg-br__egghint { animation: none; } }

/* Transport-only mode (the □ button; phones boot in it) */
.xg-amp__now { display: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 10px/1.2 'Lucida Console', Consolas, monospace; letter-spacing: 0.04em; opacity: 0.85; }
.xg-amp.is-compact .xg-amp__name { flex: none; margin-right: 8px; }
.xg-amp.is-compact .xg-amp__now { display: block; }
.xg-amp.is-compact .xg-amp__row, .xg-amp.is-compact .xg-amp__seek, .xg-amp.is-compact .xg-amp__volrow, .xg-amp.is-compact .xg-amp__list, .xg-amp.is-compact .xg-amp__ctl .xg-amp__tog { display: none; }
.xg-amp.is-compact .xg-amp__now { display: none; }
.xg-amp.is-compact .xg-amp__lcd { padding: 3px 6px; }
.xg-amp.is-compact .xg-amp__marq { margin-top: 0; }
.xg-amp.is-compact .xg-amp__body { padding: 4px 6px; }
.xg-amp.is-compact .xg-amp__ctl { gap: 4px; }
.xg-amp.is-compact .xg-amp__btn { flex: 1; }

/* The gate: "Y'all ready for this?" on a fresh load, before the photos */
html.xg-gated, html.xg-gated body { overflow: hidden; }
.xg-gated .xg-stage, .xg-gated .xg-intro__hint, .xg-gated .xg-amp, .xg-gated .xg-count { visibility: hidden; }
.xg-gate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; transition: opacity 0.6s ease; }
.xg-gate.is-gone { opacity: 0; pointer-events: none; }
.xg-gate__float { animation: xg-gate-drift 11s ease-in-out infinite alternate; will-change: transform; }
/* a 1996 web button: purple, chunky bevel, rainbow trim */
.xg-gate__btn {
  appearance: none; cursor: pointer; display: grid; place-items: center;
  width: max-content; max-width: min(92vw, 560px); padding: 6px; border: 0; border-radius: 4px;
  background: linear-gradient(135deg, var(--xg-pink), var(--xg-orange), var(--xg-yellow), var(--xg-green), var(--xg-cyan), var(--xg-pink));
  background-size: 300% 300%; animation: xg-gate-rainbow 6s linear infinite, xg-gate-breathe 3.2s ease-in-out infinite;
  color: #fff; font: 700 clamp(24px, 3.2vw, 36px)/1.1 var(--xg-serif); text-align: center;
  box-shadow: 0 0 0 3px #14002f, 0 0 40px rgba(240, 64, 231, 0.6), 0 24px 50px rgba(10, 0, 40, 0.6);
  transition: transform 0.25s ease;
}
.xg-gate__btn span {
  display: grid; place-items: center; width: 100%; padding: 22px 40px;
  background: #5a1ec2; border-style: solid; border-width: 8px; border-color: #b48cff #2a0a6a #2a0a6a #b48cff;
  box-shadow: inset 2px 2px 0 #d8c4ff, inset -2px -2px 0 #1a0547;
  text-shadow: 2px 2px 0 #1a0547;
}
.xg-gate__btn:hover, .xg-gate__btn:focus-visible { transform: scale(1.06); outline: none; }
.xg-gate__btn:hover span { background: #6a2ad8; }
.xg-gate__btn:active span { border-color: #2a0a6a #b48cff #b48cff #2a0a6a; box-shadow: inset -2px -2px 0 #d8c4ff, inset 2px 2px 0 #1a0547; transform: translate(2px, 2px); }
@keyframes xg-gate-rainbow { to { background-position: 300% 300%; } }
@keyframes xg-gate-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 3px #14002f, 0 0 40px rgba(240, 64, 231, 0.6), 0 24px 50px rgba(10, 0, 40, 0.6); }
  50% { transform: scale(1.03); box-shadow: 0 0 0 3px #14002f, 0 0 70px rgba(0, 204, 255, 0.75), 0 30px 60px rgba(10, 0, 40, 0.6); }
}
/* a slow wander around the middle of the screen, with a little lean */
@keyframes xg-gate-drift {
  0%   { transform: translate(-1.2vw, -1vh) rotate(-0.6deg); }
  25%  { transform: translate(1vw, -1.4vh) rotate(0.4deg); }
  50%  { transform: translate(1.4vw, 1vh) rotate(-0.3deg); }
  75%  { transform: translate(-1vw, 1.4vh) rotate(0.6deg); }
  100% { transform: translate(-1.6vw, -0.4vh) rotate(-0.4deg); }
}
/* ...and the photos come in once it opens */
.xg-gate-open .xg-stage { animation: xg-gate-in 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes xg-gate-in { from { opacity: 0; transform: scale(0.55) translateY(40px); } }
@media (max-width: 600px) { .xg-gate__btn span { padding: 20px 24px; } }
@media (prefers-reduced-motion: reduce) { .xg-gate__btn, .xg-gate__float { animation: none; } .xg-gate-open .xg-stage { animation: none; } }
