/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f0f;
  --bg2:       #1a1a1a;
  --bg3:       #252525;
  --border:    #2e2e2e;
  --text:      #e8e8e6;
  --muted:     #7a7a76;
  --accent:    #0084BD;       /* previously sharp acid-yellow — the signature #c8f03a */
  --accent-dk: #00608A;       /* previously darker version of accent for active states #9ab82a */
  --danger:    #e05252;
  --radius:    12px;
  --radius-sm: 8px;
  --header-h:  56px;
  --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Header ───────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#back-btn {
  position: absolute;
  left: 16px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  display: none;
}

#back-btn.visible { display: block; }

/* ── Screens ──────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding: calc(var(--header-h) + 24px) 20px 120px;
}

.screen.active { display: flex; }

/* ── Home screen ──────────────────────────────────────────── */
.home-hero {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 40px 0 20px;
}

.home-hero h1 {
  font-size: clamp(52px, 14vw, 80px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
}

.home-hero h1::after {
  content: '.';
  color: var(--accent);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 40px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:active { transform: scale(0.98); background: var(--accent-dk); }

.btn-secondary {
  width: 100%;
  padding: 16px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:active { background: var(--border); }

.btn-ghost {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
}

/* ── Labels ───────────────────────────────────────────────── */
.screen-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ── Pill grid (categories) ───────────────────────────────── */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.pill {
  padding: 12px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pill:active, .pill.selected {
  background: var(--accent);
  color: #0f0f0f;
  border-color: var(--accent);
}

/* ── Card list (exercises) ────────────────────────────────── */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.card:active { background: var(--bg3); border-color: var(--accent); }

.card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.card-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Previous session reference ───────────────────────────── */
.previous-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.previous-card h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.previous-set-row {
  font-size: 14px;
  color: var(--muted);
  padding: 3px 0;
}

.previous-set-row span {
  color: var(--text);
  font-weight: 500;
}

/* ── Sets logged this session ─────────────────────────────── */
.sets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.set-row-label {
  font-size: 14px;
  color: var(--muted);
}

.set-row-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ── Log inputs ───────────────────────────────────────────── */
.log-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.input-group input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  padding: 14px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button { -webkit-appearance: none; }

.input-group input:focus { border-color: var(--accent); }

/* ── History list ─────────────────────────────────────────── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-session {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.history-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
}

.history-set-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.history-set-row:last-child { border-bottom: none; }

.history-set-row span { color: var(--text); font-weight: 500; }

/* ── Bottom bar ───────────────────────────────────────────── */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 50;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  z-index: 200;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn-ghost { flex: 0; padding: 16px 20px; }
.modal-actions .btn-primary { flex: 1; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text);
  z-index: 300;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.toast.hidden { display: none; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  padding: 40px 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}