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

:root {
  --bg: #1a1a2e;
  --card: #16213e;
  --card-hover: #1a2744;
  --accent: #e94560;
  --accent-dim: #c73a52;
  --text: #eee;
  --text-muted: #8892a4;
  --success: #4ecca3;
  --border: #2a3a5c;
  --input-bg: #0f1729;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

#day-info {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

#day-selector {
  margin-top: 8px;
}

#day-select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
}

/* Timer Bar */
#timer-bar {
  position: sticky;
  top: 90px;
  z-index: 9;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  transition: opacity 0.3s;
}

#timer-bar.hidden {
  display: none;
}

#timer-bar.done {
  animation: pulse 0.5s ease-in-out 3;
  background: var(--success);
}

#timer-display {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#timer-label {
  font-size: 12px;
  opacity: 0.8;
}

#timer-skip {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Main Content */
main {
  padding: 12px 16px;
}

/* Exercise Card */
.exercise-card {
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.exercise-card.expanded {
  border-color: var(--accent);
}

.card-header {
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.card-header:active {
  background: var(--card-hover);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-chevron {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.exercise-card.expanded .card-chevron {
  transform: rotate(90deg);
}

.card-body {
  display: none;
  padding: 0 16px 16px;
}

.exercise-card.expanded .card-body {
  display: block;
}

.exercise-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.form-cues {
  list-style: none;
  margin-bottom: 12px;
}

.form-cues li {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0 3px 16px;
  position: relative;
}

.form-cues li::before {
  content: '•';
  color: var(--accent);
  position: absolute;
  left: 0;
}

.rest-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Logged Sets */
.logged-sets {
  margin-bottom: 12px;
}

.logged-set {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--input-bg);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}

.logged-set .set-data {
  flex: 1;
}

.logged-set .delete-set {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Log Input Row */
.log-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.log-input-row input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 8px;
  font-size: 14px;
  min-height: 44px;
  width: 100%;
}

.log-input-row input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.log-input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-log {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.2s;
}

.btn-log:active {
  background: var(--accent-dim);
}

/* Progression hint */
.progression-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

/* Rest Day / Cardio */
#rest-message {
  padding: 40px 20px;
  text-align: center;
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
}

#rest-message.hidden {
  display: none;
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.btn-pdf {
  flex: 1;
  display: block;
  text-align: center;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  min-height: 44px;
  line-height: 20px;
}

.btn-pdf:active {
  background: var(--card-hover);
}

/* Cardio card non-loggable */
.cardio-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}
