/* Fire — Thailand Edition — Game & Watch Fire reskin (coconut delivery) */
:root {
  --bg: #0d0a14;
  --panel: rgba(255,255,255,0.04);
  --panel-border: rgba(255,255,255,0.09);
  --text: #ffd23c;
  --dim: #8a5a2a;
  --accent: #ffb347;
  --accent2: #ff8a3c;
  --green: #2d7a3a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 800px at 20% -10%, #2b1d4e 0%, transparent 55%),
              radial-gradient(1000px 700px at 110% 110%, #3a2a00 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

#stage-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#stage {
  position: relative;
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(255,179,71,0.10), rgba(255,138,60,0.05));
  border: 1px solid rgba(255,179,71,0.25);
  box-shadow: 0 0 60px rgba(255,179,71,0.15), inset 0 0 30px rgba(0,0,0,0.35);
}

#game {
  display: block;
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}

/* Mobile: shrink canvas so controls fit */
@media (max-height: 700px) {
  #game { max-height: 55vh; width: auto; }
}

/* ================= HUD ================= */
#hud {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  pointer-events: none;
  z-index: 10;
}

.hud-top {
  display: flex;
  gap: 6px;
}

.pill {
  background: rgba(13,10,20,0.6);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  color: var(--dim);
  backdrop-filter: blur(4px);
}

.pill span {
  color: var(--accent2);
  font-size: 10px;
}

.pill-lives span {
  font-size: 11px;
  letter-spacing: 1px;
}

/* ================= Overlays ================= */
.overlay {
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(13,10,20,0.78);
  backdrop-filter: blur(6px);
  text-align: center;
  z-index: 20;
  transition: opacity 0.25s;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-sub {
  font-size: 18px;
  letter-spacing: 6px;
  vertical-align: middle;
}

.gameover-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent2);
}

.subtitle {
  font-size: 13px;
  color: var(--dim);
  line-height: 1.6;
  max-width: 280px;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  padding: 12px 34px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), #cf9c00);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,179,71,0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255,179,71,0.5);
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.hint {
  font-size: 11px;
  color: var(--dim);
  line-height: 1.6;
}

.hint.muted {
  opacity: 0.6;
}

kbd {
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  color: var(--text);
}

/* ================= Game over details ================= */
.medal {
  font-size: 36px;
  min-height: 40px;
}

.result-grid {
  display: flex;
  gap: 20px;
}

.result-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}

.result-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

/* ================= Touch bar ================= */
#touchbar {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 15;
  pointer-events: none;
}

.tbtn {
  pointer-events: auto;
  width: 44px;
  height: 36px;
  border-radius: 10px;
  background: rgba(13,10,20,0.45);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
  backdrop-filter: blur(4px);
}

.tbtn:active {
  transform: scale(0.94);
  background: rgba(255,179,71,0.25);
}

/* ================= Controls hint ================= */
#controls-hint {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 10px;
  color: var(--dim);
  pointer-events: none;
  z-index: 5;
}

#controls-hint span {
  display: flex;
  align-items: center;
  gap: 4px;
}
