:root {
  --bg: #0e0f12;
  --panel: #1a1c20;
  --text: #f2f2f2;
  --muted: #9a9ea6;
  --green: #34c759;
  --yellow: #ffcc00;
  --red: #ff3b30;
  --accent: #4da3ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

.screen.active { display: flex; }

h1 { font-size: 1.4rem; margin: 0 0 8px; }

label { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

input[type="text"], input[type="number"] {
  background: var(--panel);
  border: 1px solid #2c2f36;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
}

button {
  background: var(--accent);
  color: #041018;
  border: none;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

button:disabled {
  background: #2c2f36;
  color: var(--muted);
  cursor: not-allowed;
}

#btn-finish { background: var(--red); color: white; }
#btn-pause { background: var(--panel); color: var(--text); border: 1px solid #2c2f36; }

.hint { color: var(--muted); font-size: 0.85rem; }

.ranges-row {
  display: flex;
  gap: 10px;
}
.ranges-row > div {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border-radius: 10px;
  padding: 6px 8px;
}
.ranges-row input {
  background: transparent;
  border: none;
  padding: 6px;
  text-align: center;
}

.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }

/* --- pantalla principal --- */

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.timer-block {
  flex: 1;
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
}
.timer-label { display: block; font-size: 0.75rem; color: var(--muted); }
.timer-value { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; font-weight: 700; }

.gauge-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

#gauge-svg { width: 100%; max-width: 420px; }

.indicator {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ind-shape {
  font-size: 1.6rem;
  line-height: 1;
  opacity: 0.15;
  transition: opacity 0.15s ease, color 0.15s ease;
  color: var(--muted);
}

.ind-shape.active-up { opacity: 1; color: var(--yellow); }
.ind-shape.active-circle { opacity: 1; color: var(--green); }
.ind-shape.active-down { opacity: 1; color: var(--accent); }
.ind-shape.blink { animation: blink 0.5s step-start infinite; color: var(--red) !important; opacity: 1 !important; }

@keyframes blink {
  50% { opacity: 0.15; }
}

.bpm-readout {
  position: absolute;
  top: 78%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.bpm-readout #bpm-value { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bpm-readout .bpm-unit { display: block; font-size: 0.8rem; color: var(--muted); }

.alert-banner {
  background: var(--red);
  color: white;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  animation: blink 0.5s step-start infinite;
}
.alert-banner.hidden { display: none; }

.phase-message {
  text-align: center;
  font-size: 1rem;
  min-height: 1.4em;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: auto;
}
.controls button { flex: 1; }

#summary-series {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-row {
  background: var(--panel);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}
