/* ==========================================================================
   Shaadi Run — the arcade hidden behind the easter-egg hunt
   Same maroon / pearl / antique-gold palette as the invitation, plus the few
   arcade tones (neon gold, night indigo) the cabinet needs.

   This sheet loads with the page because the *locked* teaser has to be styled
   from the first paint. The game's JavaScript is fetched only when someone
   actually presses play — see loadGame() in script.js.
   ========================================================================== */

:root {
  --arc-night: #1a0a12;
  --arc-night-2: #2d1220;
  --arc-neon: #f3d489;
}

/* The hunt-complete toast is also the doorway to the game, so unlike every
   other toast this one has to be clickable. */
.egg-toast.finale {
  border-color: var(--marigold);
  border-left-color: var(--marigold);
  box-shadow: 0 18px 44px rgba(69, 8, 15, 0.34), 0 0 0 1px rgba(226, 192, 122, 0.55) inset;
}
.egg-toast.finale.on { pointer-events: auto; cursor: pointer; }
.egg-toast.finale.on:hover { transform: translate(-50%, -3px) scale(1.02); }
.egg-toast.finale .egg-toast-kicker { color: var(--marigold); }

/* ====================== THE TEASER SECTION (in the page) ====================== */
.arcade-section {
  position: relative;
  padding: 100px 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 16%, rgba(194, 147, 61, 0.12), transparent 46%),
    radial-gradient(circle at 12% 84%, rgba(123, 17, 32, 0.1), transparent 50%),
    linear-gradient(180deg, var(--shell), var(--petal));
}

.arcade-card {
  position: relative;
  max-width: 660px;
  margin: 0 auto;
  padding: 40px 32px 34px;
  text-align: center;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--paper), var(--shell));
  border: 1px solid rgba(123, 17, 32, 0.45);
  box-shadow: 0 22px 56px rgba(69, 8, 15, 0.12);
  transition: border-color 0.6s ease, box-shadow 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* --- locked state --- */
.arcade-card .arcade-unlocked { display: none; }
.arcade-card.is-unlocked .arcade-locked { display: none; }
.arcade-card.is-unlocked .arcade-unlocked { display: block; }

.arcade-card.is-unlocked {
  border-color: rgba(194, 147, 61, 0.9);
  box-shadow: 0 26px 70px rgba(69, 8, 15, 0.2), 0 0 0 1px rgba(226, 192, 122, 0.5) inset;
}

/* the moment it flips over, once */
.arcade-card.just-unlocked { animation: arcadeUnlock 1.1s cubic-bezier(0.34, 1.4, 0.64, 1); }
@keyframes arcadeUnlock {
  0%   { transform: scale(0.94) rotateX(18deg); }
  55%  { transform: scale(1.03) rotateX(-4deg); }
  100% { transform: none; }
}

.arcade-lock-icon {
  width: 74px; height: 74px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  border-radius: 50%;
  background: linear-gradient(160deg, rgba(226, 192, 122, 0.3), rgba(123, 17, 32, 0.18));
  border: 1px solid rgba(194, 147, 61, 0.55);
}
.arcade-card.is-unlocked .arcade-lock-icon {
  background: linear-gradient(160deg, var(--gold), var(--marigold));
  border-color: var(--marigold);
  box-shadow: 0 0 28px rgba(226, 192, 122, 0.7);
  animation: arcadeGlow 2.6s ease-in-out infinite;
}
@keyframes arcadeGlow {
  0%, 100% { box-shadow: 0 0 22px rgba(226, 192, 122, 0.45); }
  50%      { box-shadow: 0 0 40px rgba(226, 192, 122, 0.9); }
}

.arcade-kicker {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--blush-deep);
}
.arcade-card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 4.6vw, 2.2rem);
  color: var(--red);
  line-height: 1.16;
  margin: 10px 0 12px;
}
.arcade-card p {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 44ch;
  margin: 0 auto;
}

/* progress pips — one per easter egg */
.arcade-pips {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 22px 0 4px;
}
.arcade-pip {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: rgba(123, 17, 32, 0.14);
  border: 1px solid rgba(123, 17, 32, 0.3);
  transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.5, 0.64, 1);
}
.arcade-pip.on {
  background: linear-gradient(160deg, var(--gold), var(--marigold));
  border-color: var(--marigold);
  box-shadow: 0 0 12px rgba(226, 192, 122, 0.8);
  transform: scale(1.18);
}

.arcade-play-btn {
  position: relative;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red-deep);
  background: linear-gradient(180deg, var(--gold), var(--marigold));
  border: none;
  padding: 16px 38px;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 24px;
  box-shadow: 0 12px 30px rgba(194, 147, 61, 0.42);
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.22s ease;
}
.arcade-play-btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 18px 40px rgba(194, 147, 61, 0.55); }
.arcade-play-btn:active { transform: translateY(0) scale(0.98); }
.arcade-play-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.arcade-play-btn[disabled] { opacity: 0.6; cursor: wait; }

.arcade-meta {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 16px;
}
.arcade-meta b { color: var(--blush-deep); font-weight: 600; }

/* a row of who you'll be avoiding */
.arcade-cast {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.arcade-cast span {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--ink);
  background: rgba(226, 192, 122, 0.2);
  border: 1px solid rgba(194, 147, 61, 0.42);
  border-radius: 999px;
  padding: 5px 13px;
}

/* ====================== THE CABINET (fullscreen overlay) ====================== */
.arcade-stage {
  position: fixed;
  inset: 0;
  /* above the nav (10002), the music button (10003) and the egg toast (10004) */
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, var(--arc-night-2), var(--arc-night) 68%, #0a0408);
  opacity: 0;
  transition: opacity 0.45s ease;
  /* the game owns every gesture inside it */
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}
.arcade-stage.mounted { display: flex; }
.arcade-stage.on { opacity: 1; }

/* While the cabinet is open the invitation's own furniture gets out of the
   way: the game has its own sound button, and a nav bar or an easter-egg
   toast floating over a platformer is just noise. */
body.arcade-open { overflow: hidden; }
body.arcade-open .site-nav,
body.arcade-open .music-toggle,
body.arcade-open .egg-toast { display: none; }

.arcade-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#arcade-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* the art is drawn as smooth vectors, so no pixelated rendering here */
  image-rendering: auto;
}

/* gold vignette + faint scanlines: enough to feel like a cabinet, not enough
   to muddy the artwork */
.arcade-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(10, 4, 8, 0.55) 100%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.055) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* ====================== TOP-RIGHT CABINET BUTTONS ====================== */
.arcade-controls {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  z-index: 4;
}
.arcade-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--gold);
  background: rgba(26, 10, 18, 0.7);
  border: 1px solid rgba(226, 192, 122, 0.38);
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.arcade-btn:hover { background: rgba(123, 17, 32, 0.8); transform: translateY(-2px); }
.arcade-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.arcade-btn.off { color: rgba(226, 192, 122, 0.35); }

/* ====================== TOUCH CONTROLS ====================== */
.arcade-touch {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
  z-index: 3;
}
.arcade-stage.touch .arcade-touch { display: block; }

.tc-pad {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  gap: 12px;
  pointer-events: auto;
}
.tc-left  { left: max(18px, env(safe-area-inset-left)); }
.tc-right { right: max(18px, env(safe-area-inset-right)); }

.tc-key {
  width: 66px; height: 66px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px;
  background: rgba(45, 18, 32, 0.52);
  border: 1px solid rgba(226, 192, 122, 0.42);
  color: var(--gold);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.34);
  transition: background 0.09s ease, transform 0.09s ease;
  touch-action: none;
}
.tc-key svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tc-key.big { width: 78px; height: 78px; }
.tc-key.held {
  background: rgba(194, 147, 61, 0.78);
  color: var(--red-deep);
  transform: scale(0.94);
}
.tc-key { position: relative; }
.tc-key .tc-tag {
  position: absolute;
  bottom: 7px;
  font-family: var(--sans);
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.75;
}
/* a labelled key needs its glyph lifted clear of the label */
.tc-key:has(.tc-tag) svg { transform: translateY(-5px); }

/* the throw key only appears once the sherwani is on */
.tc-key.tc-throw { opacity: 0.25; transition: opacity 0.4s ease, background 0.09s ease, transform 0.09s ease; }
.arcade-stage.can-throw .tc-key.tc-throw { opacity: 1; }

@media (max-width: 420px) {
  .tc-key { width: 58px; height: 58px; }
  .tc-key.big { width: 68px; height: 68px; }
}

/* ====================== LOADING / ERROR SPLASH ====================== */
.arcade-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 6;
  color: var(--gold);
  text-align: center;
  padding: 24px;
  background: var(--arc-night);
  transition: opacity 0.4s ease;
}
.arcade-loading.gone { opacity: 0; pointer-events: none; }
.arcade-loading-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  color: var(--gold);
  letter-spacing: 0.02em;
}
.arcade-loading-sub {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(226, 192, 122, 0.6);
  max-width: 30ch;
  line-height: 1.9;
}
.arcade-bar {
  width: min(280px, 70vw);
  height: 3px;
  border-radius: 2px;
  background: rgba(226, 192, 122, 0.16);
  overflow: hidden;
}
.arcade-bar span {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: arcadeBar 1.25s ease-in-out infinite;
}
@keyframes arcadeBar {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(420%); }
}

/* ====================== REDUCED MOTION ====================== */
@media (prefers-reduced-motion: reduce) {
  .arcade-card.is-unlocked .arcade-lock-icon { animation: none; }
  .arcade-card.just-unlocked { animation: none; }
  .arcade-stage { transition: none; }
}
