:root {
  /* Brand: violet accent, athletic dark. Green = "beat last time" / PR. */
  --violet: #8b5cf6;
  --violet-bright: #a78bfa;
  --violet-dark: #7c3aed;
  --violet-soft: rgba(139, 92, 246, 0.14);
  --pr: #22c55e;
  --pr-soft: rgba(34, 197, 94, 0.14);
  --danger: #ef4444;

  --bg: #0b0b12;
  --surface: #14141f;
  --surface-2: #1c1c2b;
  --surface-3: #24243a;
  --text: #f1f1f7;
  --muted: #9a9ab5;
  --faint: #6c6c86;
  --border: #2a2a3d;

  /* Dense dashboard spacing scale (8/10). */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px;
  --radius: 12px;
  --radius-sm: 8px;

  --font-head: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(139,92,246,0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-transform: uppercase;
  margin: 0 0 var(--s3);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s6);
  padding: var(--s3) var(--s5);
  background: rgba(11, 11, 18, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--text);
}
.brand-mark.accent { color: var(--violet-bright); }
.topbar nav { display: flex; gap: var(--s4); }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--s1) var(--s2);
  border-radius: var(--radius-sm);
  transition: color 160ms ease, background 160ms ease;
}
.topbar nav a:hover { color: var(--text); background: var(--surface-2); }

.container { max-width: 860px; margin: 0 auto; padding: var(--s6) var(--s5) 96px; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: var(--s8) 0; }
.hero h1 { font-size: 3rem; margin-bottom: var(--s2); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.actions { display: flex; gap: var(--s3); justify-content: center; margin-top: var(--s6); flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s5);
  min-height: 44px;
  background: var(--violet);
  color: #fff;
  border: 1px solid var(--violet);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}
.btn:hover { background: var(--violet-dark); box-shadow: 0 6px 20px rgba(139,92,246,0.35); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--violet-bright); border-color: var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s4);
}

.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }

/* ---------- plan day / blocks ---------- */
.day { padding: var(--s5); }
.day h2 { font-size: 1.5rem; margin-bottom: var(--s4); color: var(--text); }

.block {
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s4);
  background: var(--surface);
}
.block-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.block-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--violet-bright);
  letter-spacing: 0.06em;
  background: var(--violet-soft);
  padding: 0 var(--s2);
  border-radius: 6px;
}
.scheme { color: var(--muted); font-size: 0.85rem; }

.pe-row { padding: var(--s3) 0; border-top: 1px dashed var(--border); }
.pe-row:first-of-type { border-top: none; }

.ex-name {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
}
.ex-name:hover { color: var(--violet-bright); }

.notes { color: var(--muted); font-size: 0.85rem; margin-top: var(--s1); }

/* ---------- tags / tempo ---------- */
.tag, .tempo {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px var(--s2);
  border-radius: 6px;
  text-transform: uppercase;
}
.tag { background: var(--surface-3); color: var(--muted); }
.tempo { background: var(--violet-soft); color: var(--violet-bright); }

/* ---------- session logging ---------- */
.exercise { padding: var(--s5) 0; border-top: 1px solid var(--border); }
.exercise:first-of-type { border-top: none; }
.exercise-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }

.last-hint {
  margin-top: var(--s2);
  color: var(--muted);
  font-size: 0.88rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3);
}
.last-hint b { color: var(--violet-bright); font-weight: 600; }

.set-form {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  flex-wrap: wrap;
}
.set-form .failure {
  display: flex;
  align-items: center;
  gap: var(--s1);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

input[type="number"], input[type="text"], input[type="date"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3);
  min-height: 44px;
  width: 5.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
input:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 1px;
  border-color: var(--violet);
}

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
th {
  color: var(--faint);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr:last-child td { border-bottom: none; }

.logged-sets { margin: var(--s3) 0; }
.logged-sets table { max-width: 340px; }

/* delete button */
.btn-del {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--faint);
  border-radius: var(--radius-sm);
  min-height: 36px;
  padding: var(--s1) var(--s3);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}
.btn-del:hover { border-color: var(--danger); color: var(--danger); }

code {
  background: var(--surface-2);
  padding: 1px var(--s2);
  border-radius: 5px;
  font-size: 0.9em;
}

/* ---------- motion: stagger entrance ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.day, .card, .exercise {
  animation: rise 320ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.day:nth-child(2)  { animation-delay: 40ms; }
.day:nth-child(3)  { animation-delay: 80ms; }
.day:nth-child(4)  { animation-delay: 120ms; }
.day:nth-child(5)  { animation-delay: 160ms; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .container { padding: var(--s4) var(--s4) 80px; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2.2rem; }
  .set-form input { width: 4.5rem; }
}
