/* ═══════════════════════════════════════════════
   TEMPLE RUN · OBI ENTERPRISES · ANMOL THAKUR
   ═══════════════════════════════════════════════ */

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Cinzel', serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
}

/* ── CANVAS ─────────────────────────────────── */
#gameCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block; z-index: 1;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════════════ */
#splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

#splashCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}

.splash-overlay {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0;
  padding: 20px;
  animation: splashIn 1s cubic-bezier(.22,1,.36,1) both;
}

@keyframes splashIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Brand bar */
.brand-bar {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.65rem; letter-spacing: 0.45em;
  color: #d4a850;
  margin-bottom: 24px;
  animation: fadeUp 0.8s 0.3s both;
}
.brand-gem { font-size: 0.5rem; color: #e8c060; }

/* Logo */
.logo-wrap {
  position: relative;
  margin-bottom: 16px;
  animation: logoReveal 1s 0.1s cubic-bezier(.22,1,.36,1) both;
}

@keyframes logoReveal {
  from { opacity: 0; transform: scale(1.15) translateY(-20px); filter: blur(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

.logo-fire-left, .logo-fire-right {
  position: absolute; top: -30px;
  width: 40px; height: 70px;
  pointer-events: none;
}
.logo-fire-left  { left: -10px; }
.logo-fire-right { right: -10px; }

.logo-fire-left::before, .logo-fire-right::before {
  content: '';
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 60px;
  background: radial-gradient(ellipse at 50% 90%, #fff5aa 0%, #ffcc00 20%, #ff6a00 50%, #ff000066 75%, transparent 90%);
  border-radius: 50% 50% 0 0;
  animation: torchFlicker 0.1s steps(1) infinite;
  filter: blur(1px);
}

@keyframes torchFlicker {
  0%   { transform: translateX(-50%) scaleX(1)    scaleY(1)    skewX(0deg); }
  10%  { transform: translateX(-48%) scaleX(0.92) scaleY(1.05) skewX(-3deg); }
  20%  { transform: translateX(-52%) scaleX(1.05) scaleY(0.97) skewX(2deg); }
  30%  { transform: translateX(-50%) scaleX(0.95) scaleY(1.03) skewX(-1deg); }
  40%  { transform: translateX(-47%) scaleX(1.08) scaleY(0.95) skewX(4deg); }
  50%  { transform: translateX(-50%) scaleX(1.0)  scaleY(1.0)  skewX(0deg); }
  60%  { transform: translateX(-53%) scaleX(0.93) scaleY(1.06) skewX(-3deg); }
  70%  { transform: translateX(-50%) scaleX(1.04) scaleY(0.98) skewX(2deg); }
  80%  { transform: translateX(-48%) scaleX(0.97) scaleY(1.04) skewX(-2deg); }
  90%  { transform: translateX(-51%) scaleX(1.03) scaleY(0.96) skewX(1deg); }
  100% { transform: translateX(-50%) scaleX(1)    scaleY(1)    skewX(0deg); }
}

.logo-stone {
  position: relative;
  background:
    linear-gradient(160deg, #3a1a06 0%, #1e0c02 40%, #0d0500 100%);
  border: 2px solid #7a4a18;
  border-radius: 6px;
  padding: 4px;
  box-shadow:
    0 0 60px #ff6a0055,
    0 0 120px #ff430022,
    inset 0 1px 0 #cc8030,
    inset 0 -1px 0 #3a1a06;
}

.logo-stone::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 4px;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 8px,
    rgba(255,180,60,0.03) 8px, rgba(255,180,60,0.03) 9px
  );
  pointer-events: none;
}

.logo-inner {
  padding: 16px 40px 20px;
  position: relative;
}

.logo-top {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(2.4rem, 9vw, 5.5rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  background: linear-gradient(180deg,
    #fff5cc 0%, #ffd060 20%, #f5a020 45%,
    #d46010 65%, #8b3508 85%, #4a1c04 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 8px #ff6a0088);
  line-height: 1;
}

.logo-divider-wrap {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0;
}
.logo-div-line {
  flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, #c8922a, transparent);
}
.logo-div-icon {
  color: #d4a040; font-size: 1.1rem;
  animation: runeGlow 2s ease-in-out infinite alternate;
}
@keyframes runeGlow {
  from { color: #d4a040; text-shadow: 0 0 6px #ff8c0066; }
  to   { color: #ffe080; text-shadow: 0 0 14px #ff8c00cc; }
}

.logo-bottom {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(3.5rem, 14vw, 8.5rem);
  font-weight: 900;
  letter-spacing: 0.3em;
  background: linear-gradient(180deg,
    #ffe066 0%, #f5a020 30%, #d4580a 60%, #8b2500 85%, #3a0e00 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 20px #ff4500aa);
  line-height: 1;
  text-indent: 0.3em;
}

/* Tagline */
.tagline {
  font-size: 0.7rem; letter-spacing: 0.35em;
  color: #cc6020;
  margin-bottom: 8px;
  animation: fadeUp 0.8s 0.6s both;
}

/* Founder */
.founder-tag {
  font-size: 0.6rem; letter-spacing: 0.3em;
  color: #7a4a1a;
  margin-bottom: 28px;
  animation: fadeUp 0.8s 0.7s both;
}

/* ── PLAY BUTTON ──────────────────────────── */
.play-btn {
  position: relative;
  border: none; cursor: pointer;
  background: transparent;
  padding: 0;
  animation: fadeUp 0.8s 0.9s both;
  -webkit-tap-highlight-color: transparent;
}

.play-btn-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg,
    #7a2e08 0%, #c04e12 25%, #e87820 50%, #c04e12 75%, #7a2e08 100%);
  border-radius: 50px;
  border: 2px solid #e8a030;
  box-shadow: 0 6px 30px #ff450055, inset 0 1px 0 #ffcc5544;
  transition: all 0.15s;
}

.play-btn-content {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 44px;
  font-family: 'Cinzel', serif;
  font-size: 1rem; font-weight: 700;
  letter-spacing: 0.2em;
  color: #fff5cc;
}

.play-icon {
  font-size: 0.9rem;
  animation: iconPulse 1.5s ease-in-out infinite;
}
@keyframes iconPulse {
  0%, 100% { transform: scale(1) translateX(0); }
  50%       { transform: scale(1.2) translateX(3px); }
}

.play-btn-glow {
  position: absolute; inset: -4px;
  border-radius: 54px;
  background: transparent;
  box-shadow: 0 0 30px #ff6a0066;
  animation: btnGlow 2s ease-in-out infinite alternate;
}
@keyframes btnGlow {
  from { box-shadow: 0 0 20px #ff6a0044; }
  to   { box-shadow: 0 0 50px #ff8c00aa, 0 0 80px #ff450055; }
}

.play-btn:active .play-btn-bg,
.play-btn.small:active .play-btn-bg {
  transform: scale(0.96);
  box-shadow: 0 2px 15px #ff450044;
}

.play-btn.small .play-btn-content {
  padding: 12px 32px;
  font-size: 0.85rem;
  gap: 8px;
}

/* Shimmer */
.play-btn::after {
  content: '';
  position: absolute; top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,200,0.25), transparent);
  transform: skewX(-20deg);
  border-radius: 50px;
  animation: shimmer 3s 2s infinite;
  z-index: 3;
}
@keyframes shimmer {
  0%   { left: -100%; }
  35%  { left: 150%; }
  100% { left: 150%; }
}

/* Hint bar */
.hint-bar {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.55rem; letter-spacing: 0.2em;
  color: #5a3510;
  margin-top: 20px;
  animation: fadeUp 0.8s 1.1s both;
}
.hint-sep { color: #3a2208; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-bottom-grad {
  position: absolute; bottom: 0; left: 0; right: 0; height: 80px;
  background: linear-gradient(to top, #000 0%, transparent 100%);
  z-index: 1;
}

/* ═══════════════════════════════════════════════
   HUD
   ═══════════════════════════════════════════════ */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 0;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex; flex-direction: column; gap: 6px;
}

.hud-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(200,140,40,0.3);
  border-radius: 20px;
  padding: 5px 12px;
  backdrop-filter: blur(4px);
}

.hud-label {
  font-size: 0.55rem; letter-spacing: 0.2em; color: #a07030;
}
.hud-val {
  font-size: 0.85rem; font-weight: 700; color: #f5e6c8;
  font-family: 'Cinzel', serif;
  min-width: 40px; text-align: right;
}
.coin-icon { font-size: 0.8rem; }
.score-pill { border-color: rgba(255,200,30,0.4); }
.coin-pill  { border-color: rgba(255,200,30,0.3); }
.spd-pill   { border-color: rgba(255,100,0,0.4); }

/* ═══════════════════════════════════════════════
   SWIPE ZONES (invisible tap areas)
   ═══════════════════════════════════════════════ */
.swipe-zone {
  position: fixed; z-index: 30;
  pointer-events: auto;
  background: transparent;
}
.swipe-l { left: 0; top: 20%; width: 25%; height: 60%; }
.swipe-r { right: 0; top: 20%; width: 25%; height: 60%; }
.swipe-u { left: 25%; top: 15%; width: 50%; height: 35%; }
.swipe-d { left: 25%; bottom: 5%; width: 50%; height: 35%; }

/* ═══════════════════════════════════════════════
   GAME OVER
   ═══════════════════════════════════════════════ */
#gameOverScreen {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
}

.go-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.go-panel {
  position: relative; z-index: 2;
  background: linear-gradient(160deg, #1e0c02 0%, #0d0500 60%, #05020a 100%);
  border: 1px solid #7a4010;
  border-radius: 12px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 0 80px #ff450030, inset 0 0 40px rgba(0,0,0,0.5);
  animation: panelIn 0.5s cubic-bezier(.22,1,.36,1) both;
  max-width: 360px; width: 90%;
}

@keyframes panelIn {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.go-demon-icon {
  font-size: 3rem; margin-bottom: 8px;
  animation: demonBounce 0.8s cubic-bezier(.36,0,.66,-.56) both;
  display: block;
}
@keyframes demonBounce {
  0%   { transform: scale(0) rotate(-20deg); }
  60%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.go-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 2rem;
  background: linear-gradient(to right, #ff6a00, #ee0979);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 4px;
}

.go-sub {
  font-size: 0.65rem; letter-spacing: 0.15em; color: #6a3a15;
  margin-bottom: 24px;
}

.go-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 24px;
}

.go-stat-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200,140,40,0.2);
  border-radius: 8px;
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 3px;
}
.go-stat-box.highlight {
  border-color: rgba(255,200,30,0.5);
  background: rgba(255,200,30,0.06);
}

.gs-label {
  font-size: 0.55rem; letter-spacing: 0.25em; color: #7a5025;
}
.gs-val {
  font-size: 1.4rem; font-weight: 700; color: #f5e6c8;
  font-family: 'Cinzel Decorative', cursive;
}
.go-stat-box.highlight .gs-val { color: #ffe066; }

.go-brand {
  font-size: 0.5rem; letter-spacing: 0.3em; color: #3a1e08;
  margin-top: 16px;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .hint-bar { display: none; }
  .go-panel { padding: 28px 24px; }
  .logo-inner { padding: 12px 24px 16px; }
}

@media (max-height: 600px) {
  .tagline, .founder-tag { display: none; }
  .brand-bar { margin-bottom: 12px; }
}
