@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0a0a0a;
  overflow: hidden;
  font-family: 'Chakra Petch', 'Segoe UI', Arial, sans-serif;
}

/* ── Ken Burns background ── */
#unity-container {
  position: fixed;
  width: 100%;
  height: 100%;
}

#ken-burns-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

#ken-burns-bg img,
#ken-burns-bg video {
  position: absolute;
  width: 120%;
  height: 120%;
  top: -10%;
  left: -10%;
  object-fit: cover;
  animation: kenBurns 20s ease-in-out infinite alternate;
  filter: brightness(0.5) saturate(1.05);
}

/* Poster jpg sits behind the video; video fades in over it once it can play */
#ken-burns-bg img { z-index: 0; }
#ken-burns-bg video {
  z-index: 1;
  opacity: 0;
  transition: opacity 0.8s ease;
}
#ken-burns-bg video.ready { opacity: 1; }

/* Amber vignette so edges read dark and the wordmark pops */
#ken-burns-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 35%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(10,8,4,0.35) 0%, rgba(10,8,4,0) 25%, rgba(10,8,4,0) 70%, rgba(10,8,4,0.5) 100%);
}

@keyframes kenBurns {
  0%   { transform: scale(1)    translate(0, 0); }
  30%  { transform: scale(1.08) translate(-1.5%, 1%); }
  60%  { transform: scale(1.12) translate(1%, -1.5%); }
  100% { transform: scale(1.15) translate(-0.5%, 2%); }
}

/* ── Canvas ── */
#unity-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Title ── */
#loading-title {
  font-family: 'Chakra Petch', 'Impact', 'Arial Black', sans-serif;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 40px;
  user-select: none;
  line-height: 1;
}

#loading-title .title-play {
  font-size: 0.7em;
  color: #ffb23e;
  text-shadow:
    0 0 28px rgba(255, 178, 62, 0.45),
    0 2px 4px rgba(0,0,0,0.85);
}

#loading-title .title-trenches {
  color: #ffb23e;
  text-shadow:
    0 0 28px rgba(255, 178, 62, 0.45),
    0 2px 4px rgba(0,0,0,0.85);
}

#loading-title .title-tld {
  color: #ffffff;
  text-shadow:
    0 0 20px rgba(255, 255, 255, 0.2),
    0 2px 4px rgba(0,0,0,0.8);
}

/* ── Tagline ── */
#loading-tagline {
  font-family: 'Chakra Petch', 'Segoe UI', Arial, sans-serif;
  font-size: clamp(11px, 1.5vw, 16px);
  font-weight: 700;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255, 178, 62, 0.92);
  margin: -26px 0 40px 0;
  padding-left: 0.42em;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.9em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
#loading-tagline::before,
#loading-tagline::after {
  content: '';
  width: clamp(22px, 5vw, 60px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,178,62,0.7));
}
#loading-tagline::after {
  background: linear-gradient(90deg, rgba(255,178,62,0.7), transparent);
}

/* ── Progress container ── */
#loading-progress {
  width: min(420px, 80vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ── Bar track ── */
#progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

/* ── Bar fill ── */
#progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff9a1e, #ffb23e 60%, #ffd27a);
  box-shadow: 0 0 14px rgba(255, 178, 62, 0.6);
  position: relative;
}

#progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.3) 50%,
    transparent 100%
  );
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Status text ── */
#loading-status {
  font-family: 'Chakra Petch', 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 178, 62, 0.82);
  text-shadow: 0 0 10px rgba(255,178,62,0.25), 0 1px 3px rgba(0,0,0,0.7);
  user-select: none;
  min-height: 1.2em;
}

/* ════════════════════════════════════════════
   Mode-select cards (FREE FIRE / PLAY FOR REAL)
   ════════════════════════════════════════════ */
.mode-cards {
  display: flex;
  gap: 26px;
  width: min(760px, 90vw);
  justify-content: center;
  align-items: stretch;
  margin: 8px 0 40px 0;
  pointer-events: auto; /* overlay itself is pointer-events:none */
}

.mode-card {
  flex: 1 1 0;
  min-width: 0;
  background: linear-gradient(180deg, rgba(18,22,28,0.94) 0%, rgba(10,12,15,0.96) 100%);
  border: 1px solid #2A323D;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  padding: 24px 24px 22px;
  text-align: left;
  font-family: 'Chakra Petch', 'Segoe UI', Arial, sans-serif;
  color: #F2F5F8;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.14s cubic-bezier(.34,1.56,.64,1), border-color 0.14s ease, box-shadow 0.14s ease;
}
.mode-card:hover { transform: translateY(-6px) scale(1.035); }
.mode-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: #FFB23E; opacity: 0; transition: opacity 0.14s ease; z-index: 3;
}
.mode-card:hover::before { opacity: 1; }

.mc-shine {
  position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.06), transparent);
  transform: skewX(-20deg); pointer-events: none; z-index: 2;
}
.mode-card:hover .mc-shine { animation: cardSweep 0.7s ease; }
@keyframes cardSweep { from { left: -70%; } to { left: 140%; } }

.mc-badge {
  align-self: flex-start;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 4px;
}
.mc-badge-free { background: rgba(255,178,62,0.10); color: #FFB23E; border: 1px solid rgba(255,178,62,0.35); }
.mc-badge-real { background: rgba(54,226,123,0.14); color: #36E27B; border: 1px solid rgba(54,226,123,0.45); }

.mc-kicker { display: flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.mc-glyph { font-size: 22px; line-height: 1; color: #FFB23E; }
.mc-sub { font-size: 14.5px; color: #F2F5F8; line-height: 1.55; }
.mc-tag { font-size: 12px; letter-spacing: 0.05em; color: #9AA7B4; margin-top: auto; }
.mc-tag::before { content: '▸ '; color: #FFB23E; }
.mc-cta {
  margin-top: 8px; border: none;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%);
  padding: 13px 16px; font-weight: 700; font-size: 14.5px;
  letter-spacing: 0.13em; text-transform: uppercase; text-align: center;
  position: relative; overflow: hidden;
}

/* FREE FIRE — inviting ghost */
.mode-card.free { border-color: rgba(255,178,62,0.30); }
.mode-card.free:hover { border-color: #FFB23E; box-shadow: 0 26px 60px -30px rgba(255,178,62,0.55); }
.mode-card.free .mc-cta { background: rgba(255,178,62,0.12); color: #FFB23E; border: 1.5px solid rgba(255,178,62,0.5); transition: background 0.14s ease; }
.mode-card.free:hover .mc-cta { background: rgba(255,178,62,0.22); }

/* PLAY FOR REAL — the hero: forward, glowing, shimmering CTA */
.mode-card.real {
  border-color: rgba(255,178,62,0.6);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 0 0 1px rgba(255,211,61,0.22), 0 28px 64px -30px rgba(255,178,62,0.7);
  animation: realPulse 2.8s ease-in-out infinite;
}
.mode-card.real:hover { transform: translateY(-9px) scale(1.05); animation: none; box-shadow: 0 0 0 1px rgba(255,211,61,0.5), 0 34px 80px -26px rgba(255,178,62,0.9); }
@keyframes realPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,211,61,0.20), 0 28px 64px -32px rgba(255,178,62,0.55); }
  50%      { box-shadow: 0 0 0 1px rgba(255,211,61,0.45), 0 32px 74px -26px rgba(255,178,62,0.85); }
}
.mode-card.real::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #FFD33D, #FFB23E, transparent); z-index: 3;
}
.mode-card.real .mc-sub b { color: #36E27B; font-weight: 700; }
.mc-payout { color: #FFD33D; font-weight: 700; }
.mode-card.real .mc-cta { background: #FFB23E; color: #0A0C0F; }
.mode-card.real:hover .mc-cta { background: #FFC766; }
.mode-card.real .mc-cta::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-20deg); animation: ctaShimmer 2.6s ease-in-out infinite; pointer-events: none;
}
@keyframes ctaShimmer { 0% { left: -60%; } 55%, 100% { left: 150%; } }

/* Grey "main menu" link — always visible from the start, centered just below the cards.
   Low-key escape hatch into the full Unity menu; the cards stay the primary choice. */
.menu-link {
  margin: -20px 0 32px 0;
  background: none; border: none;
  font-family: 'Chakra Petch', 'Segoe UI', Arial, sans-serif;
  font-size: 13px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: #6c7682; cursor: pointer; pointer-events: auto;
  transition: color 0.15s ease;
}
.menu-link:hover { color: #9AA7B4; text-decoration: underline; }

/* Cards stay hidden until the Photon lobby is connected & ready (TrenchesLobbyReady adds
   .cards-ready). Until then the themed loading bar carries the wait, so the first click always
   lands on a warm connection (instant drop-in) instead of a cold one mid-load. A JS fallback adds
   .cards-ready after a grace period so a failed/slow connection never hides the choice forever. */
#loading-overlay:not(.cards-ready) .mode-cards,
#loading-overlay:not(.cards-ready) .menu-link { display: none; }

/* Entering: a card was picked (or the menu link hit before ready). Hide the front-door panels
   and let the themed loading bar carry the transition — no black, no main-menu flash. */
#loading-overlay.entering .mode-cards,
#loading-overlay.entering .menu-link { display: none; }

/* Bundle failed to load: cards become an obvious tap-to-retry. */
#loading-overlay.load-failed .mode-cards { pointer-events: auto; }
#loading-overlay.load-failed .mode-card { opacity: 0.5; filter: grayscale(0.55); animation: none !important; transform: none !important; }
#loading-overlay.load-failed .mode-card:hover { opacity: 0.85; border-color: #FFB23E; }
#loading-overlay.load-failed .menu-link { display: none; }
#loading-overlay.load-failed #loading-status { color: #FF8A8A; }

@media (max-width: 640px) {
  .mode-cards { flex-direction: column; width: min(400px, 92vw); }
  .mode-card.real { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mode-card, .mode-card.real, .mode-card.real .mc-cta::after, .mc-shine { animation: none !important; transition: none !important; }
}

/* ════════════════════════════════════════════
   Socials footer (X / YouTube / Instagram)
   Pinned bottom-center of the overlay; muted grey → amber glow on hover.
   ════════════════════════════════════════════ */
.social-row {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 24px;
  pointer-events: auto; /* overlay itself is pointer-events:none */
}
.social-link {
  display: block;
  width: 22px;
  height: 22px;
  color: #6c7682;
  transition: color 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}
.social-link svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}
.social-link:hover {
  color: #FFB23E;
  transform: translateY(-2px);
  filter: drop-shadow(0 0 8px rgba(255, 178, 62, 0.55));
}

/* Vanish with the cards when a mode is picked or the bundle fails. */
#loading-overlay.entering .social-row,
#loading-overlay.load-failed .social-row { display: none; }

@media (prefers-reduced-motion: reduce) {
  .social-link { transition: color 0.15s ease !important; }
  .social-link:hover { transform: none; }
}

/* ── Warning banner ── */
#unity-warning {
  position: fixed;
  left: 50%;
  top: 5%;
  transform: translateX(-50%);
  z-index: 20;
  background: white;
  padding: 10px;
  display: none;
}
