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

:root {
  --aqua: #4dd8e6;
  --sand: #d8c08a;
  --bad: #ff5470;
  --dim: #5b7a8c;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #04101b;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #eef7ff;
  -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(--sand);
  text-shadow: 0 0 12px rgba(216,192,138,.45);
  font-variant-numeric: tabular-nums;
}

.small-v { font-size: 16px; color: var(--aqua); }

.bar {
  position: relative;
  width: 190px;
  height: 15px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.22);
  background: rgba(2,10,18,.6);
  overflow: hidden;
  margin-bottom: 6px;
}

.bar-fill {
  height: 100%;
  border-radius: 7px;
  transition: width .25s ease;
}

.bar-fill.pct {
  background: linear-gradient(90deg, #1d7f8f, var(--aqua));
  box-shadow: 0 0 12px rgba(77,216,230,.55);
  width: 0%;
}

.bar-txt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #eafcff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

.pips { display: flex; gap: 5px; }

.pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 9px rgba(77,216,230,.7);
}

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

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

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

.mini-btn:hover { background: rgba(77,216,230,.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; flex-direction: column; gap: 10px; align-items: center; pointer-events: auto; }
.tzone.left { flex-direction: row; }

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

.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(4,16,26,.88) 0%, rgba(3,10,17,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

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

.game-title span { color: var(--aqua); text-shadow: 0 0 28px var(--aqua), 0 0 70px rgba(77,216,230,.35); }

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

.rules p { margin: 4px 0; color: #b5cbd6; font-size: clamp(12.5px, 1.7vw, 15px); }
.rules strong { color: var(--aqua); }
.rules p:nth-child(2) strong { color: var(--sand); }
.rules p:nth-child(5) strong { color: var(--bad); }

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

.btn:hover {
  background: rgba(77,216,230,.12);
  box-shadow: 0 0 30px rgba(77,216,230,.42), inset 0 0 18px rgba(77,216,230,.1);
}

.btn.secondary {
  color: #93aec0;
  border-color: rgba(140,180,200,.5);
  box-shadow: none;
}

.btn.secondary:hover { background: rgba(140,180,200,.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(--bad);
  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: #7e95a4; font-size: 13.5px; letter-spacing: 1.5px; }

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