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

:root {
  --mint: #35f0d0;
  --wood: #c9a86a;
  --bad: #ff5470;
  --dim: #62807a;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a1210;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #eafff9;
  -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(--mint);
  text-shadow: 0 0 12px rgba(53,240,208,.45);
  font-variant-numeric: tabular-nums;
}

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

.lvl-name {
  font-size: clamp(15px, 2.2vw, 19px);
  letter-spacing: 7px;
  color: var(--mint);
  text-shadow: 0 0 16px rgba(53,240,208,.5);
}

.mini-btn {
  margin-top: 6px;
  padding: 5px 14px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2px;
  font-family: inherit;
  color: #86d4c2;
  background: rgba(53,240,208,.07);
  border: 1px solid rgba(53,240,208,.4);
  border-radius: 12px;
  cursor: pointer;
  pointer-events: auto;
}

.mini-btn:hover { background: rgba(53,240,208,.18); }

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

/* ---------- Táctil ---------- */
#touchui {
  position: fixed;
  inset: auto 0 0 0;
  height: 150px;
  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; }

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

.tbtn.undo {
  width: 66px;
  height: 66px;
  color: var(--mint);
  border-color: var(--mint);
}

.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(6,15,12,.9) 0%, rgba(4,10,8,.98) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(46px, 9.5vw, 92px);
  font-weight: 800;
  letter-spacing: 14px;
  line-height: 1;
  color: #f2fff9;
  margin-left: 14px;
}

.game-title span { color: var(--mint); text-shadow: 0 0 28px var(--mint), 0 0 70px rgba(53,240,208,.35); }

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

.rules p { margin: 4px 0; color: #b2d1c8; font-size: clamp(12.5px, 1.7vw, 15px); }
.rules strong { color: var(--mint); }
.rules p:nth-child(4) strong { color: var(--gold, #ffd97a); }
.rules p:nth-child(5) strong { color: var(--gold, #ffd97a); }

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

.btn:hover {
  background: rgba(53,240,208,.12);
  box-shadow: 0 0 30px rgba(53,240,208,.42), inset 0 0 18px rgba(53,240,208,.1);
}

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