/* ============================================================
   HITSS'S BIRTHDAY QUEST — retro-future glass
   ============================================================ */

:root {
  --bg: #05010f;
  --hot-pink: #ff4fd8;
  --cyan: #46f3ff;
  --gold: #ffd93b;
  --violet: #9d5cff;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.22);
  --ink: #f4efff;
  --pixel: "Press Start 2P", monospace;
  --retro: "VT323", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--retro);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#scroll-space { height: 1000vh; width: 1px; }

#world {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  z-index: 0;
}

/* subtle CRT scanlines + vignette over the whole experience */
#crt-film {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

#flash {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: #fff;
  opacity: 0;
}

/* ============================ HUD ============================ */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
}

#progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--hot-pink), var(--cyan), var(--gold));
  box-shadow: 0 0 12px var(--hot-pink);
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.hud-right { display: flex; gap: 8px; }

.hud-chip {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(160deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04));
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hud-chip:active { transform: scale(0.94); }

/* ============================ toast ============================ */

#toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 70;
  font-family: var(--pixel);
  font-size: 11px;
  padding: 12px 18px;
  border-radius: 14px;
  color: var(--bg);
  background: linear-gradient(160deg, #fff8, #ffffffd8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), inset 0 1px 0 #fff;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  max-width: 88vw;
}

/* ============================ overlays ============================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  padding: 12px;
}

.overlay.interactive.active { pointer-events: auto; }

/* boot screen shows immediately, before GSAP takes over */
#ov-boot { opacity: 1; }

.ov-inner {
  width: min(680px, 94vw);
  max-height: calc(100dvh - 90px);
  margin-top: 40px;
  text-align: center;
}

/* -------- glass / liquid glass -------- */

.glass-card {
  position: relative;
  border-radius: 26px;
  padding: 26px 22px;
  background: linear-gradient(165deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* liquid-glass specular sweep */
.glass-card::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -30%;
  width: 60%;
  height: 220%;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.14) 48%, rgba(255,255,255,0.28) 50%, rgba(255,255,255,0.14) 52%, transparent 70%);
  transform: rotate(8deg);
  animation: liquid-sweep 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes liquid-sweep {
  0%, 55%, 100% { transform: translateX(-40%) rotate(8deg); opacity: 0; }
  70% { opacity: 1; }
  85% { transform: translateX(340%) rotate(8deg); opacity: 0; }
}

.glass-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 26px;
  padding: 14px 26px;
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(255,255,255,0.14), rgba(255,255,255,0.05));
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 10px 30px rgba(0,0,0,0.4);
}

.cd-label { font-family: var(--pixel); font-size: 8px; color: var(--cyan); letter-spacing: 2px; }
#cd-value { font-family: var(--pixel); font-size: 14px; color: var(--gold); text-shadow: 0 0 14px var(--gold); }

/* ============================ typography ============================ */

.pixel-h2 {
  font-family: var(--pixel);
  font-size: clamp(15px, 3.4vw, 24px);
  line-height: 1.6;
  margin-bottom: 12px;
  text-shadow: 0 0 18px rgba(255, 79, 216, 0.6);
}

.glitch-title {
  font-family: var(--pixel);
  font-size: clamp(22px, 6vw, 52px);
  line-height: 1.45;
  color: var(--ink);
  text-shadow:
    3px 3px 0 var(--hot-pink),
    -3px -3px 0 var(--cyan),
    0 0 40px rgba(157, 92, 255, 0.8);
  animation: glitch-jitter 3.2s infinite steps(1);
}

@keyframes glitch-jitter {
  0%, 92%, 100% { transform: translate(0, 0); }
  93% { transform: translate(-2px, 1px) skewX(2deg); }
  95% { transform: translate(2px, -1px) skewX(-2deg); }
  97% { transform: translate(-1px, 0); }
}

.boot-kicker {
  font-family: var(--pixel);
  font-size: clamp(8px, 2vw, 11px);
  color: var(--cyan);
  letter-spacing: 3px;
  margin-bottom: 22px;
  text-shadow: 0 0 12px var(--cyan);
}

.press-start {
  font-family: var(--pixel);
  font-size: clamp(10px, 2.4vw, 14px);
  color: var(--gold);
  margin-top: 30px;
  text-shadow: 0 0 12px var(--gold);
}

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.tiny-label {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 1.5px;
  color: rgba(244, 239, 255, 0.65);
  margin-bottom: 10px;
}

.story-text {
  font-family: var(--retro);
  font-size: clamp(19px, 3.4vw, 24px);
  line-height: 1.5;
  margin-top: 10px;
}

.dim { color: rgba(244, 239, 255, 0.55); }
.hot { color: var(--hot-pink); text-shadow: 0 0 14px var(--hot-pink); }

/* ============================ itinerary ============================ */

.world-tag {
  display: inline-block;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--bg);
  background: linear-gradient(160deg, var(--cyan), #2fb3ff);
  padding: 8px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 16px rgba(70, 243, 255, 0.35);
}

.tag-2 { background: linear-gradient(160deg, var(--hot-pink), var(--violet)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 16px rgba(255, 79, 216, 0.35); }

.itin-list { list-style: none; text-align: left; }

.itin-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.14);
  font-size: clamp(17px, 3vw, 21px);
  line-height: 1.35;
}

.itin-list li:last-child { border-bottom: none; }

.itin-time {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--gold);
  white-space: nowrap;
  min-width: 64px;
  text-shadow: 0 0 8px rgba(255, 217, 59, 0.5);
}

.itin-what b { color: var(--cyan); }
.itin-what em { color: var(--hot-pink); font-style: normal; }

/* ============================ games grid ============================ */

.games-head { margin-bottom: 16px; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.game-card {
  padding: 16px 10px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  font-size: 15px;
  line-height: 1.25;
}

.game-card b { font-family: var(--pixel); font-size: 9px; line-height: 1.6; color: var(--ink); }
.game-card span:last-child { color: rgba(244, 239, 255, 0.6); font-size: 15px; }
.game-emoji { font-size: 30px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }

/* ============================ scoreboard ============================ */

.score-inner { max-height: calc(100dvh - 80px); }

.score-card {
  text-align: center;
  max-height: calc(100dvh - 90px);
  overflow-y: auto;
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

.score-block { margin-top: 20px; text-align: left; }

.score-h3 {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(70, 243, 255, 0.5);
}

.add-row { display: flex; gap: 8px; }

.retro-input {
  flex: 1;
  min-width: 0;
  font-family: var(--retro);
  font-size: 20px;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(255,255,255,0.08);
  outline: none;
}

.retro-input:focus { border-color: var(--cyan); box-shadow: inset 0 2px 6px rgba(0,0,0,0.6), 0 0 0 3px rgba(70, 243, 255, 0.25); }
.retro-input::placeholder { color: rgba(244, 239, 255, 0.35); }

/* -------- skeuomorphic buttons -------- */

.skeuo-btn {
  font-family: var(--pixel);
  font-size: 10px;
  color: #3a0b2e;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #ff8ae4;
  background: linear-gradient(180deg, #ffc1ef 0%, #ff4fd8 55%, #d81fae 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.75),
    inset 0 -3px 0 rgba(90, 0, 70, 0.45),
    0 6px 14px rgba(255, 79, 216, 0.35);
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
  white-space: nowrap;
}

.skeuo-btn:hover { filter: brightness(1.08); }

.skeuo-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(90, 0, 70, 0.5), 0 2px 6px rgba(255, 79, 216, 0.25);
}

.skeuo-btn.danger {
  margin-top: 22px;
  color: #3d0505;
  border-color: #ff9d8a;
  background: linear-gradient(180deg, #ffc9b8 0%, #ff6b4f 55%, #d8341f 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.75), inset 0 -3px 0 rgba(90, 10, 0, 0.45), 0 6px 14px rgba(255, 107, 79, 0.3);
}

.skeuo-btn.big { font-size: 12px; padding: 16px 24px; margin-top: 20px; }

/* -------- player chips -------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

.chip button {
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

/* -------- leaderboard -------- */

.leaderboard { list-style: none; }

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 14px;
  font-size: 21px;
  background: linear-gradient(160deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.leaderboard li.rank-1 {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(255, 217, 59, 0.22), rgba(255, 217, 59, 0.05));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 0 24px rgba(255, 217, 59, 0.25);
}

.lb-rank { font-family: var(--pixel); font-size: 12px; width: 34px; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { font-family: var(--pixel); font-size: 12px; color: var(--gold); }
.lb-empty { color: rgba(244,239,255,0.5); font-size: 19px; padding: 8px 2px; }

/* -------- game result rows -------- */

.game-row {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.game-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  margin-bottom: 8px;
}

.game-row-head .del-game {
  border: none;
  background: none;
  color: rgba(244,239,255,0.4);
  cursor: pointer;
  font-size: 16px;
}

.podium-row { display: flex; gap: 8px; }

.podium-slot { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.podium-slot label { font-size: 14px; color: rgba(244,239,255,0.6); }

.podium-slot select {
  width: 100%;
  font-family: var(--retro);
  font-size: 17px;
  color: var(--ink);
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(10, 4, 30, 0.85);
  outline: none;
}

/* ============================ finale ============================ */

.finale-title { font-size: clamp(18px, 5vw, 40px); margin: 14px 0; }

/* ============================ responsive ============================ */

@media (max-width: 760px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .glass-card { padding: 20px 14px; border-radius: 20px; }
  .itin-list li { gap: 9px; padding: 7px 0; }
  .podium-row { flex-direction: column; }
  .hud-chip { font-size: 8px; padding: 9px 10px; }
  #jump-scores { display: none; }
  .ov-inner { margin-top: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .glass-card::before, .glitch-title, .blink { animation: none; }
}
