/* Lava Chase — style.css : DOM overlay UI over the WebGL canvas */

:root {
  --lava: #ff5522;
  --lava-bright: #ffb347;
  --ember: #ffcc66;
  --ink: #fff3e6;
  --panel: rgba(20, 8, 4, 0.86);
  --panel-border: rgba(255, 140, 60, 0.35);
  --danger: #ff3b3b;
  --gem: #66e0ff;
  --crystal: #ff5fb3;
  --coin: #ffcc33;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: #0e0402; color: var(--ink);
  font-family: 'Baloo 2', 'Poppins', system-ui, -apple-system, sans-serif;
  overflow: hidden; -webkit-tap-highlight-color: transparent;
  user-select: none;
}

[hidden] { display: none !important; }

#game-root {
  position: fixed; inset: 0; width: 100%; height: 100%;
  overflow: hidden; touch-action: none;
}

#game-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(12px + var(--safe-top)) 14px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; z-index: 20;
}
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.hud-right { align-items: flex-end; }
.hud-score {
  font-size: clamp(22px, 6vw, 34px); font-weight: 800; color: var(--ink);
  text-shadow: 0 0 10px rgba(255, 100, 30, 0.7), 0 2px 4px rgba(0, 0, 0, 0.6);
}
.hud-sub { font-size: 13px; opacity: 0.85; display: flex; gap: 10px; }
.hud-combo {
  font-size: 16px; font-weight: 700; color: var(--lava-bright);
  opacity: 0; transform: scale(0.8); transition: opacity 0.15s, transform 0.15s;
}
.hud-combo.show { opacity: 1; transform: scale(1); }
.hud-pickups { display: flex; gap: 12px; font-size: 14px; font-weight: 600; }
.hud-pickups span { display: flex; align-items: center; gap: 3px; }

.icon-btn {
  pointer-events: auto;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--panel-border); background: var(--panel);
  color: var(--ink); font-size: 18px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.hud-buttons { display: flex; gap: 8px; }

.lava-warning {
  position: absolute; left: 50%; top: 90px; transform: translateX(-50%);
  font-size: 15px; font-weight: 700; color: var(--danger);
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.7);
  opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 20;
  letter-spacing: 1px;
}
.lava-warning.show { opacity: 1; animation: pulseWarn 0.6s infinite alternate; }
@keyframes pulseWarn { from { opacity: 0.5; } to { opacity: 1; } }

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 20px calc(20px + var(--safe-bottom)) 20px;
  background: radial-gradient(ellipse at center, rgba(40, 12, 4, 0.7), rgba(6, 2, 1, 0.94));
  text-align: center;
}

.logo {
  font-size: clamp(38px, 11vw, 64px); font-weight: 900; letter-spacing: 1px;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(255, 100, 20, 0.9), 0 0 4px #fff, 0 4px 0 #7a1a02;
}
.tagline { font-size: 15px; opacity: 0.85; max-width: 320px; }

.btn {
  pointer-events: auto;
  font-family: inherit; font-weight: 800; font-size: 19px;
  padding: 14px 40px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(180deg, #ff8a3d, #d8420f);
  color: #fff3e6; box-shadow: 0 6px 0 #7a1a02, 0 10px 20px rgba(0,0,0,0.4);
  transition: transform 0.08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #7a1a02; }
.btn.secondary { background: linear-gradient(180deg, #3a3a44, #202028); box-shadow: 0 6px 0 #101014, 0 10px 20px rgba(0,0,0,0.4); }
.btn.small { font-size: 14px; padding: 9px 22px; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.panel {
  pointer-events: auto;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 20px; padding: 22px 24px; max-width: 420px; width: 92%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}

.countdown-num {
  font-size: clamp(80px, 25vw, 140px); font-weight: 900; color: var(--lava-bright);
  text-shadow: 0 0 40px rgba(255, 120, 30, 0.9);
  animation: pop 0.9s ease-out;
}
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 30% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.result-title { font-size: 26px; font-weight: 800; color: var(--danger); text-shadow: 0 0 12px rgba(255,0,0,0.6); }
.result-stat { font-size: 15px; opacity: 0.9; margin: 2px 0; }
.result-stat b { color: var(--lava-bright); font-size: 20px; }

.nickname-row { display: flex; gap: 8px; margin-top: 6px; align-items: stretch; }
.nickname-row input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 16px; padding: 0 14px;
  height: 48px; box-sizing: border-box;
  border-radius: 12px; border: 1px solid var(--panel-border);
  background: rgba(0,0,0,0.35); color: var(--ink);
}
/* Match the input's plain rectangular shape/height exactly — the default
   .btn.small pill shape + heavy 3D drop-shadow made this row look
   lopsided next to a plain text input, especially on narrow mobile
   widths (reported by the user from a real device screenshot). */
.nickname-row #btn-submit-score {
  height: 48px; box-sizing: border-box; flex: 0 0 auto;
  padding: 0 22px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 #7a1a02;
}
.nickname-row #btn-submit-score:active { box-shadow: 0 1px 0 #7a1a02; }
.submit-msg { font-size: 13px; min-height: 18px; opacity: 0.9; }

.leaderboard-list { list-style: none; margin: 8px 0; padding: 0; max-height: 40vh; overflow-y: auto; text-align: left; }
.leaderboard-list li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px;
}
.leaderboard-list li .rank { width: 28px; opacity: 0.7; font-weight: 700; }
.leaderboard-list li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-list li .val { font-weight: 700; color: var(--lava-bright); }
.leaderboard-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tab-btn {
  pointer-events: auto;
  flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--panel-border);
  background: transparent; color: var(--ink); font-family: inherit; font-weight: 700; cursor: pointer; font-size: 13px;
}
.tab-btn.active { background: var(--lava); border-color: var(--lava); }

.howto-list { text-align: left; font-size: 14px; line-height: 1.6; opacity: 0.92; }
.howto-list b { color: var(--lava-bright); }

.close-x {
  pointer-events: auto;
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--panel-border);
  background: rgba(0,0,0,0.4); color: var(--ink); font-size: 18px; cursor: pointer;
}

.float-text {
  position: absolute; z-index: 25; font-weight: 800; font-size: 16px;
  color: var(--ember); text-shadow: 0 0 6px rgba(0,0,0,0.8);
  pointer-events: none; transform: translate(-50%, -50%);
}
.float-text.combo { color: #fff; font-size: 20px; }
.float-text.gem { color: var(--gem); }
.float-text.crystal { color: var(--crystal); }
.float-text.nearmiss { color: #7dffb0; }

.touch-hint {
  position: absolute; bottom: calc(18px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  font-size: 12px; opacity: 0.6; z-index: 20; pointer-events: none;
}

.badge-surge {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
  font-size: clamp(28px, 8vw, 46px); font-weight: 900; color: var(--danger);
  text-shadow: 0 0 30px rgba(255,0,0,0.9); z-index: 22; opacity: 0; pointer-events: none;
  letter-spacing: 2px;
}
.badge-surge.show { animation: surgeShow 1.4s ease-out forwards; }
@keyframes surgeShow {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.screen-flash {
  position: absolute; inset: 0; background: #ff2200; opacity: 0; pointer-events: none; z-index: 40;
}

@media (prefers-reduced-motion: reduce) {
  .countdown-num, .badge-surge.show { animation: none; }
}

.seo-content {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.seo-content.visible-below {
  position: static; width: auto; height: auto; clip: auto; white-space: normal;
}
