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

:root {
  --ember: #ffb347;
  --hot: #ff5470;
  --dim: #8c7a5e;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #100d0a;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #f5efe4;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
}

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

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

.hud-label { font-size: 10px; letter-spacing: 3px; color: var(--dim); }

.hud-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ember);
  text-shadow: 0 0 12px rgba(255,179,71,.45);
  font-variant-numeric: tabular-nums;
}

.small-v { font-size: 16px; }

.pips { display: flex; gap: 5px; margin-bottom: 6px; }

.pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 9px rgba(255,179,71,.7);
}

.pip.off { background: rgba(150,130,100,.18); box-shadow: none; }

.stats-row { display: flex; gap: 10px; font-size: 12.5px; letter-spacing: 1px; color: #cdbfa4; font-weight: 700; }
.stats-row b { color: var(--ember); }

.lvl-name {
  font-size: clamp(13px, 2vw, 17px);
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #d9cbb0;
}

.mini-btn {
  margin-top: 5px;
  padding: 4px 13px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2px;
  font-family: inherit;
  color: #d8b48f;
  background: rgba(255,179,71,.07);
  border: 1px solid rgba(255,179,71,.4);
  border-radius: 12px;
  cursor: pointer;
  pointer-events: auto;
}

.mini-btn:hover { background: rgba(255,179,71,.18); }

#hintbar {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  letter-spacing: 2px;
  color: #6e6250;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}

/* ---------- Táctil ---------- */
#touchui {
  position: fixed;
  inset: auto 0 0 0;
  height: 170px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px 18px;
  z-index: 4;
  pointer-events: none;
}

.tzone { display: flex; gap: 10px; align-items: center; pointer-events: auto; }
.tzone.left { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 56px); gap: 8px; }

.tbtn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  background: rgba(24,18,12,.55);
  color: #f5efe4;
  font-size: 19px;
  font-weight: 700;
  font-family: inherit;
}

.tbtn.bomb {
  width: 78px;
  height: 78px;
  font-size: 30px;
  color: var(--ember);
  border-color: var(--ember);
}

#t-up { grid-column: 2; grid-row: 1; }
#t-left { grid-column: 1; grid-row: 2; }
#t-down { grid-column: 2; grid-row: 2; }
#t-right { grid-column: 3; grid-row: 2; }

.tbtn:active { transform: scale(.93); filter: brightness(1.4); }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(16,12,8,.88) 0%, rgba(10,8,5,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(50px, 10vw, 98px);
  font-weight: 800;
  letter-spacing: 16px;
  line-height: 1;
  color: #faf3e6;
  margin-left: 16px;
}

.game-title span { color: var(--ember); text-shadow: 0 0 28px var(--ember), 0 0 70px rgba(255,179,71,.35); }

.tagline {
  font-size: clamp(13px, 2.1vw, 18px);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #cf9d5c;
}

.rules p { margin: 4px 0; color: #cfc2a8; font-size: clamp(12.5px, 1.7vw, 15px); }
.rules strong { color: var(--ember); }
.rules p:nth-child(3) strong { color: #ff5470; }
.rules p:nth-child(6) strong { color: #ff5470; }

.btn {
  margin-top: 6px;
  padding: 15px 40px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  font-family: inherit;
  color: var(--ember);
  background: transparent;
  border: 2px solid var(--ember);
  border-radius: 40px;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 0 18px rgba(255,179,71,.2), inset 0 0 14px rgba(255,179,71,.06);
}

.btn:hover {
  background: rgba(255,179,71,.12);
  box-shadow: 0 0 30px rgba(255,179,71,.42), inset 0 0 18px rgba(255,179,71,.1);
}

.btn.secondary {
  color: #b3a58a;
  border-color: rgba(200,175,130,.5);
  box-shadow: none;
}

.btn.secondary:hover { background: rgba(200,175,130,.1); box-shadow: none; }

.btn-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

.win-title {
  font-size: clamp(24px, 5vw, 42px);
  letter-spacing: 7px;
  color: var(--hot);
  text-shadow: 0 0 28px rgba(255,84,112,.45);
}

.final-wrap { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.final-label { font-size: 11px; letter-spacing: 4px; color: var(--dim); }

.final-score {
  font-size: clamp(40px, 8vw, 66px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 24px rgba(255,255,255,.35);
  font-variant-numeric: tabular-nums;
}

.dim { color: #97876c; font-size: 13.5px; letter-spacing: 1.5px; }

.best {
  min-height: 20px;
  font-size: 12.5px;
  letter-spacing: 2px;
  color: #ffd97a;
}
