/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0a0a0a;
  --bg-card:     #141414;
  --bg-card2:    #1c1c1c;
  --border:      #2a2a2a;
  --primary:     #8BC34A;
  --primary-b:   #CDDC39;
  --text:        #f0f0f0;
  --text-muted:  #777;
  --red:         #f44336;
  --nav-h:       64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  height: 100%;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }
button { cursor: pointer; font-family: inherit; border: none; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

#main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: block; }

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: #111;
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding-top: 6px;
  transition: color 0.2s;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { stroke: var(--primary); }

/* ── Screen Header ────────────────────────────────────────────────────────── */
.screen-header {
  padding: 20px 16px 12px;
  background: linear-gradient(180deg, #111 0%, var(--bg) 100%);
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.header-day {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--primary-b);
}
.header-grupos {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
}
.header-user {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-b));
  border-radius: 2px;
  transition: width 0.5s ease;
}
.progress-text { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Section Label ────────────────────────────────────────────────────────── */
.section-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 12px 16px 6px;
}

/* ── Warm-up ──────────────────────────────────────────────────────────────── */
.warm-up-list { padding: 0 16px; display: flex; flex-direction: column; gap: 6px; }
.warm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}
.warm-item.done {
  border-color: var(--primary);
  background: rgba(139,195,74,0.08);
}
.warm-check {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--primary);
  flex-shrink: 0;
  transition: all 0.2s;
}
.warm-item.done .warm-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
}
.warm-name { flex: 1; font-weight: 500; font-size: 13px; }
.warm-dur { font-size: 12px; color: var(--text-muted); }

/* ── Exercise Card ────────────────────────────────────────────────────────── */
.exercise-card {
  margin: 6px 16px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s;
}
.exercise-card.all-done { border-color: var(--primary); }

.exercise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  cursor: pointer;
  user-select: none;
}
.exercise-meta { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.grupo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.exercise-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exercise-card.all-done .exercise-name { color: var(--text-muted); }

.exercise-status { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.status-check {
  font-size: 16px;
  color: var(--primary);
  font-weight: 700;
}
.status-sets { font-size: 12px; color: var(--text-muted); }
.exercise-chevron {
  font-size: 20px;
  color: var(--text-muted);
  transform: rotate(0deg);
  transition: transform 0.25s;
  display: inline-block;
}
.exercise-chevron.open { transform: rotate(90deg); }

/* ── Exercise Body ────────────────────────────────────────────────────────── */
.exercise-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 4px 0;
}
.exercise-body.open { display: block; }

/* ── Exercise Reference ───────────────────────────────────────────────────── */
.ej-ref {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.ej-ref-svg {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  background: #111;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ej-ref-svg svg {
  width: 100%;
  height: 100%;
}
.ej-ref-yt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  color: #f44336;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.ej-ref-yt:active {
  background: rgba(244,67,54,0.15);
  border-color: #f44336;
}

/* ── Set Row ──────────────────────────────────────────────────────────────── */
.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  transition: background 0.2s;
}
.set-row.set-done { background: rgba(139,195,74,0.06); }
.set-row + .set-row { border-top: 1px solid rgba(255,255,255,0.03); }

.set-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text-muted);
  width: 24px;
  flex-shrink: 0;
}
.set-row.set-done .set-num { color: var(--primary); }

.set-inputs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.input-unit {
  display: flex;
  align-items: center;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
}
.set-row.set-done .input-unit { border-color: rgba(139,195,74,0.2); }

.inp {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 7px 6px 7px 10px;
  width: 0;
  min-width: 0;
  text-align: right;
}
.inp:disabled { color: var(--text-muted); }
.inp::placeholder { color: #444; }

.unit {
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 8px 0 2px;
  white-space: nowrap;
}
.sep { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }

.btn-set {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-card2);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-set:active:not(:disabled) {
  transform: scale(0.92);
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
}
.btn-set.done {
  background: var(--primary);
  border-color: var(--primary);
  color: #000;
  font-weight: 700;
}

/* ── Timer Overlay ────────────────────────────────────────────────────────── */
.timer-overlay {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  left: 0; right: 0;
  background: #111;
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  z-index: 200;
  padding: 20px 24px 24px;
  transform: translateY(0);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
}
.timer-overlay.hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}
.timer-overlay.visible {
  transform: translateY(0);
  opacity: 1;
}

.timer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.timer-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-muted);
}
.timer-ring {
  position: relative;
  width: 110px; height: 110px;
}
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-bg { stroke: var(--border); fill: none; stroke-width: 7; }
.timer-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s;
}
.timer-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 44px;
  color: var(--text);
  letter-spacing: 2px;
}

.btn-skip-timer {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 8px 32px;
  border-radius: 20px;
  transition: all 0.2s;
}
.btn-skip-timer:active {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Rest Day ─────────────────────────────────────────────────────────────── */
.rest-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 32px 24px;
  text-align: center;
}
.rest-icon svg {
  width: 80px; height: 80px;
  stroke: var(--primary);
  opacity: 0.6;
  margin-bottom: 24px;
}
.rest-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 40px;
  letter-spacing: 3px;
  color: var(--primary-b);
  margin-bottom: 16px;
}
.rest-frase {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 280px;
  margin-bottom: 32px;
}
.rest-badge {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 6px 16px;
  border-radius: 20px;
  opacity: 0.7;
}

/* ── Agua Screen ──────────────────────────────────────────────────────────── */
.agua-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px 20px;
  gap: 4px;
}
.agua-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 64px;
  line-height: 1;
  color: var(--primary-b);
  letter-spacing: 2px;
}
.agua-count span { font-size: 36px; color: var(--text-muted); }
.agua-label { font-size: 12px; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 8px; }

.agua-progress-ring {
  position: relative;
  width: 90px; height: 90px;
  margin-top: 4px;
}
.agua-progress-ring svg { width: 100%; height: 100%; }
.agua-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  color: var(--primary);
}

.vasos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 4px 20px 16px;
}
.vaso {
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.vaso:active { transform: scale(0.9); }
.vaso svg { width: 100%; max-width: 60px; display: block; margin: auto; }
.vaso.lleno svg path:first-child { fill: rgba(139,195,74,0.15); stroke: var(--primary); }

.btn-reset-agua {
  display: block;
  margin: 0 auto 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  padding: 8px 24px;
  border-radius: 20px;
}
.agua-msg {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 24px 16px;
  line-height: 1.5;
}

/* ── Historial ────────────────────────────────────────────────────────────── */
.racha-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(205,220,57,0.08);
  border: 1px solid rgba(205,220,57,0.2);
  margin: 0 16px 12px;
  border-radius: 12px;
  padding: 10px 16px;
}
.racha-fire { font-size: 22px; }
.racha-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  color: var(--primary-b);
  line-height: 1;
}
.racha-text { font-size: 13px; color: var(--text-muted); }

.hist-card {
  margin: 6px 16px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.hist-card.open { border-color: rgba(139,195,74,0.3); }
.hist-card.empty { opacity: 0.5; }

.hist-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.hist-date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 38px;
}
.hist-etiqueta {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--primary);
}
.hist-fecha { font-size: 10px; color: var(--text-muted); }
.hist-info { flex: 1; min-width: 0; }
.hist-grupos {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-stats { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.hist-count { font-size: 12px; font-weight: 600; }
.hist-agua { font-size: 12px; color: var(--text-muted); }
.empty-text { font-size: 12px; color: var(--text-muted); }
.hist-pct {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  flex-shrink: 0;
}
.hist-empty-dot { font-size: 18px; color: var(--text-muted); flex-shrink: 0; }
.hist-chevron {
  font-size: 20px;
  color: var(--text-muted);
  transform: rotate(0deg);
  transition: transform 0.25s;
  display: inline-block;
  flex-shrink: 0;
}
.hist-chevron.open { transform: rotate(90deg); }

.hist-detalle {
  border-top: 1px solid var(--border);
  padding: 8px 14px 12px;
}
.hist-grupo-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 8px 0 4px;
}
.hist-ej-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  gap: 8px;
}
.hist-ej-name { font-size: 13px; flex: 1; min-width: 0; }
.hist-ej-row.done .hist-ej-name { color: var(--primary); }
.hist-ej-sets {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
  max-width: 160px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  font-size: 14px;
  line-height: 1.7;
}

/* ── Ajustes ──────────────────────────────────────────────────────────────── */
.settings-group {
  padding: 16px 16px 0;
}
.settings-group + .settings-group { margin-top: 4px; }
.settings-label {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.settings-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
  font-family: 'Inter', sans-serif;
}
.settings-input:focus { border-color: var(--primary); }

.radio-group {
  display: flex;
  gap: 10px;
}
.radio-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--text-muted);
  transition: all 0.2s;
  user-select: none;
}
.radio-opt.active {
  border-color: var(--primary);
  background: rgba(139,195,74,0.1);
  color: var(--primary);
}

.btn-action {
  width: 100%;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-align: left;
  transition: all 0.2s;
}
.btn-action:active { background: var(--bg-card2); }
.btn-action.danger { color: var(--red); }
.btn-action.danger:active { border-color: var(--red); }

.app-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 16px;
  gap: 4px;
}
.app-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--primary);
}
.app-sub { font-size: 12px; color: var(--text-muted); }
.app-version { font-size: 11px; color: #444; margin-top: 4px; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; }

/* ── Tap Highlight ────────────────────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }
