:root {
  color-scheme: dark;
  --bg:          #4944D9;
  --bg-elev:     #3D38C5;
  --bg-card:     rgba(255, 255, 255, 0.08);
  --line:        rgba(255, 255, 255, 0.14);
  --line-2:      rgba(255, 255, 255, 0.24);
  --fg:          #ffffff;
  --fg-dim:      rgba(255, 255, 255, 0.82);
  --muted:       rgba(255, 255, 255, 0.55);
  --lavender:    #C9C4F5;
  --accent:      #D4FF3D;
  --accent-2:    #E4FF75;
  --accent-soft: rgba(212, 255, 61, 0.16);
  --gold:        #FFE45C;
  --silver:      #EAEAF2;
  --bronze:      #FFB983;
  --radius:      18px;
  --radius-sm:   12px;
  --display:     "Monoton", ui-serif, Georgia, serif;
  --sans:        "DM Sans", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--fg);
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(212, 255, 61, 0.10), transparent 60%),
    radial-gradient(700px 500px at 108% 8%, rgba(255, 255, 255, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ============ Topbar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(73, 68, 217, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: block;
}
.brand-mark path { fill: var(--fg); }
.brand-word {
  width: 62px;
  height: auto;
  display: block;
}
.brand-word path { fill: var(--fg); }
.brand-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bg);
  padding: 3px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  margin-left: 4px;
  font-weight: 700;
}
.hello {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}
.hello span {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lavender);
}
.hello strong {
  font-weight: 500;
  font-size: 14px;
}

/* ============ Layout ============ */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 26px 22px 0;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
  font-weight: 700;
}
.h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 52px;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  margin: 0 0 18px;
}
.h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.15;
  margin: 32px 0 14px;
  letter-spacing: -0.015em;
}
.lede {
  color: var(--fg-dim);
  font-size: 15px;
  margin: 0 0 22px;
  max-width: 52ch;
}
.back {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lavender);
  font-weight: 600;
}
.back:hover { color: var(--accent); }

/* ============ Hero / page-head ============ */
.hero, .page-head { padding: 6px 0 8px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 80ms ease, background 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 0 0 0 rgba(212, 255, 61, 0);
}
.btn-primary:hover {
  background: var(--accent-2);
  box-shadow: 0 0 0 6px rgba(212, 255, 61, 0.18);
}
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ============ Stats row ============ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.stat-value {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* ============ Movers ============ */
.mover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mover-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}
.mover-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}
.mover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.mover-label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.mover-arrow { color: var(--lavender); font-size: 18px; font-weight: 700; }
.mover-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mover-list li {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-dim);
  padding: 6px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.mover-list li:first-child { border-top: none; }
.mover-rank {
  font-family: var(--display);
  color: var(--lavender);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.mover-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); font-weight: 500; }
.mover-score { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ============ Leaderboard ============ */
.segctl {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 8px -22px 22px;
  padding: 4px 22px 6px;
  scrollbar-width: none;
}
.segctl::-webkit-scrollbar { display: none; }
.seg {
  white-space: nowrap;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  transition: all 120ms ease;
}
.seg:hover { color: var(--accent); border-color: var(--accent); }
.seg.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}
.lb {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-row {
  display: grid;
  grid-template-columns: 52px 38px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.lb-row.podium { border-color: rgba(255, 228, 92, 0.32); }
.lb-row.me {
  background: linear-gradient(180deg, rgba(212, 255, 61, 0.18), rgba(212, 255, 61, 0.04));
  border-color: var(--accent);
}
.lb-rank {
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  color: var(--lavender);
  letter-spacing: 0.01em;
  line-height: 1;
}
.lb-row.podium .lb-rank { color: var(--gold); }
.lb-row.podium:nth-child(2) .lb-rank { color: var(--silver); }
.lb-row.podium:nth-child(3) .lb-rank { color: var(--bronze); }
.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}
.lb-row.me .lb-avatar { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.lb-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}
.lb-row.me .lb-score { color: var(--fg); }

/* ============ Pick grid (categories / exercises) ============ */
.pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: inherit;
  transition: all 140ms ease;
}
.pick:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}
.pick-label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.pick-desc {
  color: var(--lavender);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

/* ============ Session ============ */
.duration-pad {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  margin: 18px 0;
}
.big-num {
  font-family: var(--display);
  font-weight: 400;
  font-size: 96px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--accent);
}
.big-num .small {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  margin-left: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lavender);
  vertical-align: middle;
}
.dur-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 22px;
}
.dur-btn {
  padding: 14px 0;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--fg);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
}
.dur-btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.dur-btn:hover { border-color: var(--accent); color: var(--accent); }
.dur-btn.primary:hover { color: var(--bg); background: var(--accent-2); }
.hint {
  color: var(--lavender);
  font-size: 11px;
  margin: 18px 0 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.sets {
  list-style: none;
  margin: 18px 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.set {
  display: grid;
  grid-template-columns: 70px 1fr auto 32px;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.set-i {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.set-wr { font-weight: 600; }
.set-vol {
  font-variant-numeric: tabular-nums;
  color: var(--lavender);
  font-size: 13px;
  font-weight: 600;
}
.set-del {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--lavender);
  display: grid;
  place-items: center;
  line-height: 1;
}
.set-del:hover { color: var(--accent); border-color: var(--accent); }

.set-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 6px;
}
.set-form .btn-primary { padding: 12px 18px; height: 44px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field span {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lavender);
  font-weight: 700;
}
.field input {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 12px 12px;
  border-radius: 10px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.session-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}
.session-actions .btn-primary { flex: 1; justify-content: center; }

/* ============ Profile ============ */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 20px;
}
.rank-tile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rt-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.rt-rank {
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  color: var(--fg);
  letter-spacing: 0.01em;
  line-height: 1;
  margin-top: 4px;
}
.rt-score {
  font-size: 11.5px;
  color: var(--lavender);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.toast {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 4px 0 18px;
  font-size: 13px;
  font-weight: 600;
}

.name-edit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 6px;
}
.name-edit .btn-ghost { height: 44px; }

.empty {
  background: var(--bg-card);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  padding: 22px;
  color: var(--lavender);
  text-align: center;
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hist {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  align-items: center;
}
.hist-when {
  grid-row: 1 / 3;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.hist-name { font-weight: 600; }
.hist-detail { grid-column: 2; color: var(--lavender); font-size: 12.5px; }
.hist-add {
  grid-row: 1 / 3;
  grid-column: 3;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

/* ============ Tab bar ============ */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(61, 56, 197, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 12;
}
.tab {
  background: transparent;
  border: none;
  color: var(--lavender);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 10px;
}
.tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}
.tab span {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.tab.active { color: var(--accent); }
.tab.tab-cta {
  color: var(--bg);
  position: relative;
}
.tab.tab-cta svg { stroke: var(--bg); stroke-width: 2.2; }
.tab.tab-cta::before {
  content: "";
  position: absolute;
  inset: 4px 10%;
  background: var(--accent);
  border-radius: 14px;
  z-index: -1;
}
.tab.tab-cta.active { color: var(--bg); }
.tab.tab-cta.active::before { background: var(--accent-2); }

/* ============ Responsive ============ */
@media (max-width: 460px) {
  .h1 { font-size: 42px; }
  .big-num { font-size: 80px; }
  .stats-row { grid-template-columns: 1fr 1fr 1fr; }
  .lb-row { grid-template-columns: 40px 32px 1fr auto; padding: 10px 12px; gap: 10px; }
  .lb-rank { font-size: 18px; }
  .pick { padding: 16px; }
  .pick-label { font-size: 16px; }
  .mover-card { padding: 14px 12px 10px; }
}

@media (min-width: 720px) {
  .h1 { font-size: 64px; }
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
}
