/* ==========================================================================
   GymForge — design system
   ========================================================================== */

:root {
  --bg: #0a0c0f;
  --bg-glow: #0e1216;
  --surface: #12161c;
  --surface-2: #171d24;
  --surface-3: #1d242d;
  --line: #242c36;
  --line-soft: #1a2028;
  --text: #e9eef3;
  --muted: #8d9aa8;
  --faint: #5d6a77;
  --lime: #c9ff33;
  --lime-deep: #9fd017;
  --orange: #ff6a3d;
  --cyan: #43d9e0;
  --violet: #9b7dff;
  --danger: #ff4d5e;
  --radius: 18px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", ui-sans-serif, system-ui, sans-serif;
  --maxw: 1180px;
  --header-h: 68px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(201, 255, 51, 0.07), transparent 60%),
    radial-gradient(760px 500px at 92% 2%, rgba(67, 217, 224, 0.055), transparent 62%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
}

img, svg { display: block; max-width: 100%; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: rgba(201, 255, 51, 0.28);
  color: #fff;
}

/* Scrollbars ------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: #2b343f transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: #2b343f;
  border-radius: 99px;
  border: 3px solid var(--bg);
}

/* ==========================================================================
   Typography helpers
   ========================================================================== */

.display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 0.95;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--lime);
}

.lede {
  color: var(--muted);
  font-size: 15.5px;
  max-width: 52ch;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.hide { display: none !important; }

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 24px 90px;
}

.stack { display: grid; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(10, 12, 15, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--lime), #8fbf14);
  display: grid;
  place-items: center;
  color: #10140a;
  box-shadow: 0 6px 18px -6px rgba(201, 255, 51, 0.6);
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-name span { color: var(--lime); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.nav a {
  position: relative;
  padding: 8px 13px;
  border-radius: 99px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.18s, background 0.18s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] {
  color: #10140a;
  background: var(--lime);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--lime);
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s;
}
.avatar-btn:hover { border-color: var(--lime); transform: translateY(-1px); }

.nav-toggle { display: none; }

.mobile-nav {
  display: none;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.mobile-nav a {
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
}
.mobile-nav a[aria-current="page"] {
  color: #10140a;
  background: var(--lime);
  border-color: var(--lime);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  user-select: none;
}
.btn:hover { border-color: #35404d; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  --btn-bg: linear-gradient(150deg, #d4ff5c, var(--lime) 40%, #a8d920);
  --btn-fg: #10140a;
  --btn-bd: transparent;
  box-shadow: 0 10px 26px -12px rgba(201, 255, 51, 0.75);
}
.btn-primary:hover {
  box-shadow: 0 14px 32px -12px rgba(201, 255, 51, 0.9);
  border-color: transparent;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--muted);
  --btn-bd: transparent;
}
.btn-ghost:hover { --btn-fg: var(--text); background: var(--surface-2); }

.btn-outline {
  --btn-bg: transparent;
  --btn-bd: #2f3a46;
}

.btn-danger {
  --btn-bg: rgba(255, 77, 94, 0.1);
  --btn-fg: #ff8894;
  --btn-bd: rgba(255, 77, 94, 0.28);
}
.btn-danger:hover { --btn-bg: rgba(255, 77, 94, 0.18); --btn-bd: rgba(255, 77, 94, 0.5); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 13px; }
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.btn-icon:hover { color: var(--text); background: var(--surface-3); }

/* ==========================================================================
   Cards & surfaces
   ========================================================================== */

.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 42%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card-tight { padding: 16px; }
.card-flat { background: var(--surface-2); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.pill-lime {
  color: var(--lime);
  border-color: rgba(201, 255, 51, 0.28);
  background: rgba(201, 255, 51, 0.08);
}
.pill-orange {
  color: var(--orange);
  border-color: rgba(255, 106, 61, 0.28);
  background: rgba(255, 106, 61, 0.08);
}
.pill-cyan {
  color: var(--cyan);
  border-color: rgba(67, 217, 224, 0.28);
  background: rgba(67, 217, 224, 0.08);
}
.pill-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--muted);
}
.badge-lime { background: rgba(201, 255, 51, 0.14); color: var(--lime); }
.badge-orange { background: rgba(255, 106, 61, 0.14); color: var(--orange); }
.badge-cyan { background: rgba(67, 217, 224, 0.14); color: var(--cyan); }
.badge-violet { background: rgba(155, 125, 255, 0.14); color: var(--violet); }

.divider {
  height: 1px;
  background: var(--line-soft);
  margin: 4px 0;
  border: 0;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(420px 260px at 88% 10%, rgba(201, 255, 51, 0.12), transparent 70%),
    linear-gradient(140deg, #14181e, #0d1116 55%);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.022) 0 1px,
    transparent 1px 9px
  );
  pointer-events: none;
  mask-image: radial-gradient(70% 90% at 100% 0%, #000 0%, transparent 75%);
}

.hero-copy { position: relative; z-index: 1; display: grid; gap: 16px; align-content: center; }

.hero h1 {
  font-size: clamp(40px, 6.4vw, 72px);
  margin-top: -4px;
}
.hero h1 .accent { color: var(--lime); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.hero-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  align-content: center;
}

.hero-session {
  background: rgba(8, 10, 13, 0.6);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.hero-session-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--faint);
}

.mini-ex {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line-soft);
}
.mini-ex:first-of-type { border-top: 0; }
.mini-ex-num {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.mini-ex-num svg { width: 13px; height: 13px; }
.mini-ex-name {
  font-size: 13.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-ex-spec {
  margin-left: auto;
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ring-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(201, 255, 51, 0.1), transparent);
  border: 1px solid rgba(201, 255, 51, 0.16);
}

.ring {
  --p: 0;
  position: relative;
  width: 74px;
  height: 74px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--p) * 1%), #222a33 0);
  display: grid;
  place-items: center;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #0e1216;
}
.ring span {
  position: relative;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

/* ==========================================================================
   Stats
   ========================================================================== */

.stat {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--faint);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.stat-value small {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.02em;
}
.stat-foot { font-size: 12px; color: var(--muted); }
.stat-accent { color: var(--lime); }

/* ==========================================================================
   Week strip
   ========================================================================== */

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.daypill {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
  min-width: 0;
}
.daypill:hover { border-color: #38434f; transform: translateY(-2px); }
.daypill-name {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.daypill-plan {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.daypill-rest { color: var(--faint); font-weight: 500; }

.daypill.is-today {
  border-color: var(--lime);
  background: linear-gradient(160deg, rgba(201, 255, 51, 0.13), rgba(201, 255, 51, 0.02));
}
.daypill.is-today .daypill-name { color: var(--lime); }

.daypill.is-done::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 255, 51, 0.16);
}

/* ==========================================================================
   Exercise preview list
   ========================================================================== */

.ex-list { display: grid; }

.ex-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}
.ex-row:first-child { border-top: 0; padding-top: 4px; }

.ex-idx {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.ex-main { min-width: 0; flex: 1; display: grid; gap: 1px; }
.ex-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ex-sub { font-size: 11.5px; color: var(--faint); }
.ex-spec {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed #2a333e;
  border-radius: 14px;
  color: var(--muted);
}
.empty svg { width: 30px; height: 30px; color: var(--faint); }
.empty h3 { font-size: 15px; font-weight: 650; color: var(--text); }
.empty p { font-size: 13px; max-width: 38ch; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: grid; gap: 6px; }
.field-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}

.input, .select, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0f1318;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.18s, background 0.18s;
  appearance: none;
}
.input:hover, .select:hover { border-color: #333e4a; }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--lime);
  background: #11161b;
  box-shadow: 0 0 0 3px rgba(201, 255, 51, 0.12);
}
.input::placeholder { color: #55616e; }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238d9aa8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.input-sm { padding: 7px 9px; font-size: 13px; border-radius: 8px; }

.search-wrap { position: relative; flex: 1 1 240px; min-width: 180px; }
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-wrap .input { padding-left: 36px; }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: #0f1318;
  border: 1px solid var(--line);
}
.segmented button {
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--lime);
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.16s;
  white-space: nowrap;
}
.chip:hover { border-color: #3a4652; color: var(--text); }
.chip[aria-pressed="true"] {
  background: rgba(201, 255, 51, 0.12);
  border-color: rgba(201, 255, 51, 0.4);
  color: var(--lime);
}

/* ==========================================================================
   Planner
   ========================================================================== */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.day-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%), var(--surface);
  min-height: 210px;
  transition: border-color 0.18s;
}
.day-card:hover { border-color: #2f3a45; }
.day-card.is-today {
  border-color: rgba(201, 255, 51, 0.42);
  box-shadow: 0 0 0 1px rgba(201, 255, 51, 0.12), 0 18px 40px -30px rgba(201, 255, 51, 0.5);
}

.day-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-card-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 7px;
}
.day-card-name .today-tag {
  color: var(--lime);
  background: rgba(201, 255, 51, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.day-card-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.day-card-title.rest { color: var(--faint); }

.day-card-list { display: grid; gap: 2px; flex: 1; }

.plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.plan-item:hover { background: var(--surface-3); }
.plan-item-name {
  font-size: 12.8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #cfd8e1;
}
.plan-item-spec {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.plan-item-actions {
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.15s;
}
.plan-item:hover .plan-item-actions,
.plan-item:focus-within .plan-item-actions { opacity: 1; }
.plan-item-actions .btn-icon { width: 24px; height: 24px; border-radius: 6px; }
.plan-item-actions svg { width: 13px; height: 13px; }

.day-card-foot { display: flex; gap: 6px; margin-top: auto; }

/* ==========================================================================
   Exercise library
   ========================================================================== */

.lib-toolbar {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.ex-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
.ex-card:hover {
  border-color: #35404c;
  transform: translateY(-2px);
  background: var(--surface-2);
}
.ex-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ex-card h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.005em; }
.ex-card-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.ex-cues {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ex-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

/* ==========================================================================
   Workout session
   ========================================================================== */

.session-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(14, 18, 23, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px -26px #000;
}

.timer {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--lime);
  min-width: 88px;
}
.timer.is-paused { color: var(--muted); }

.session-bar-meta { display: grid; gap: 0; }
.session-bar-meta strong { font-size: 13.5px; font-weight: 650; }
.session-bar-meta span { font-size: 11.5px; color: var(--faint); }

.work-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.work-block.is-open { border-color: #35404c; }

.work-block-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.16s;
}
.work-block-head:hover { background: var(--surface-2); }

.work-block-title { min-width: 0; flex: 1; }
.work-block-title h3 { font-size: 14.5px; font-weight: 650; }
.work-block-title p { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.work-block-caret { color: var(--faint); transition: transform 0.2s; }
.work-block.is-open .work-block-caret { transform: rotate(180deg); }
.work-block-caret svg { width: 16px; height: 16px; }

.work-body {
  display: none;
  padding: 0 16px 16px;
}
.work-block.is-open .work-body { display: block; }

.set-table { display: grid; gap: 6px; }

.set-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}
.set-row-head {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 2px 4px;
}
.set-idx {
  display: grid;
  place-items: center;
  height: 38px;
  border-radius: 8px;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.set-row.is-done .set-idx {
  background: rgba(201, 255, 51, 0.15);
  color: var(--lime);
}
.set-row input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f1318;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.16s;
}
.set-row input:focus { outline: none; border-color: var(--lime); }
.set-row.is-done input { color: var(--faint); border-color: var(--line-soft); background: #0c0f13; }

.set-check {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f1318;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s;
}
.set-check:hover { border-color: var(--lime); color: var(--lime); }
.set-check svg { width: 16px; height: 16px; }
.set-row.is-done .set-check {
  background: var(--lime);
  border-color: var(--lime);
  color: #10140a;
}

.set-note { font-size: 11.5px; color: var(--faint); padding: 4px 2px; }

/* "Done" tick on each exercise */
.ex-done {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  flex-shrink: 0;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.ex-done svg { width: 14px; height: 14px; }
.ex-done:hover { border-color: var(--lime); color: var(--lime); }
.ex-done:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.work-block.is-complete { border-color: rgba(201, 255, 51, 0.32); }
.work-block.is-complete .ex-done {
  background: var(--lime);
  border-color: var(--lime);
  color: #10140a;
}
.work-block.is-complete .ex-idx { background: var(--lime); color: #10140a; }
.work-block.is-complete .ex-idx svg { width: 14px; height: 14px; }
.work-block.is-complete .work-block-title h3 { color: var(--muted); }

/* Rest timer */
.rest-timer {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(201, 255, 51, 0.35);
  background: rgba(16, 21, 14, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -20px #000;
  animation: pop-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.rest-timer.over { border-color: rgba(255, 106, 61, 0.5); }
.rest-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--faint);
}
.rest-time {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--lime);
}
.rest-timer.over .rest-time { color: var(--orange); }
.rest-bar { width: 120px; height: 4px; border-radius: 99px; background: #2a3324; overflow: hidden; }
.rest-bar i { display: block; height: 100%; background: var(--lime); transition: width 0.9s linear; }

/* ==========================================================================
   Charts
   ========================================================================== */

.chart-card { display: grid; gap: 14px; }
.chart {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart text {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--faint);
}
.chart .grid-line { stroke: #1e252d; stroke-width: 1; }
.chart .bar { fill: url(#barGrad); }
.chart .bar-idle { fill: #232b34; }
.chart .line { fill: none; stroke: var(--lime); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#areaGrad); }
.chart .point { fill: #0e1216; stroke: var(--lime); stroke-width: 2; }
.chart .value-label { fill: var(--text); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ==========================================================================
   Tables / history
   ========================================================================== */

.pr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pr-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
}
.pr-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.pr-table tr:last-child td { border-bottom: 0; }
.pr-table .num { text-align: right; }
.pr-table .rank {
  width: 24px;
  color: var(--faint);
  font-weight: 700;
  font-size: 11px;
}
.pr-table tr:hover td { background: rgba(255, 255, 255, 0.018); }

.history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.history-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.16s;
}
.history-head:hover { background: var(--surface-2); }
.history-date {
  width: 44px;
  flex-shrink: 0;
  text-align: center;
  line-height: 1.1;
}
.history-date strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
}
.history-date span {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}
.history-body {
  display: none;
  padding: 0 14px 14px;
  gap: 4px;
  grid-template-columns: 1fr;
}
.history-item.is-open .history-body { display: grid; }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 6, 8, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in 0.18s ease;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: min(86vh, 860px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid #2b3540;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: modal-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.modal.modal-wide { max-width: 700px; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.modal-head p { font-size: 12.5px; color: var(--faint); margin-top: 2px; }

.modal-body {
  padding: 4px 20px 20px;
  overflow-y: auto;
  display: grid;
  gap: 14px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.14);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Day picker in modal */
.pick-list { display: grid; gap: 6px; }
.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.pick-item:hover { border-color: var(--lime); background: rgba(201, 255, 51, 0.07); }
.pick-item strong { font-size: 13.5px; font-weight: 600; }
.pick-meta { margin-left: auto; font-size: 11.5px; color: var(--faint); white-space: nowrap; }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 44px));
  pointer-events: none;
  transition: bottom 0.2s ease;
}

/* Lift toasts above the rest timer while it is on screen */
body.has-rest .toast-stack { bottom: 116px; }

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid #2d3843;
  background: rgba(20, 26, 33, 0.97);
  box-shadow: 0 20px 44px -22px #000;
  font-size: 13px;
  font-weight: 500;
  animation: toast-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: auto;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast-ok svg { color: var(--lime); }
.toast-err svg { color: var(--danger); }
.toast-info svg { color: var(--cyan); }
.toast.is-out { animation: toast-out 0.2s ease forwards; }

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(6px); }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.reveal { animation: rise 0.4s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 24px 40px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--faint);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 22px; padding: 24px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .mobile-nav { display: flex; }
  .header-inner { gap: 12px; }
}

@media (max-width: 720px) {
  .page { padding: 22px 16px 80px; }
  .header-inner { padding: 0 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-strip {
    grid-template-columns: repeat(7, minmax(58px, 1fr));
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .hero h1 { font-size: clamp(36px, 11vw, 54px); }
  .set-row { grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 40px; }
  .toast-stack { right: 12px; bottom: 12px; }
  /* Rest timer: a compact pill centred at the bottom, not edge to edge */
  .rest-timer {
    left: 0;
    right: 0;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    margin: 0 auto;
    width: max-content;
    max-width: calc(100% - 24px);
    gap: 10px;
    padding: 8px 10px 8px 14px;
    border-radius: 14px;
  }
  .rest-time { font-size: 22px; }
  .rest-bar { width: 56px; }
  body.has-rest .toast-stack { bottom: 86px; }
  /* Workout bar: one tidy row */
  .session-bar {
    border-radius: 0; margin: 0 -16px 16px; border-left: 0; border-right: 0;
    flex-wrap: nowrap; gap: 10px; padding: 8px 16px;
  }
  .timer { font-size: 22px; min-width: 0; }
  .session-bar-meta { min-width: 0; flex: 1; }
  .session-bar-meta strong, .session-bar-meta span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .session-bar .row { flex-shrink: 0; }
  #btn-pause .btn-label { display: none; }
  #btn-pause { padding: 7px 9px; }
  .work-block-head { gap: 10px; padding: 12px 14px; }
  .ex-done { padding: 0 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { max-height: 90vh; }
  .pr-table .hide-sm { display: none; }
}

@media (max-width: 460px) {
  .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 20px; border-radius: 18px; }
  .hero-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Accounts: header slot, menu, guest banner
   ========================================================================== */

.account-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: 236px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #2c3641;
  background: rgba(18, 22, 28, 0.98);
  box-shadow: var(--shadow);
  animation: modal-in 0.16s ease;
}

.account-menu-head {
  display: grid;
  gap: 1px;
  padding: 10px 11px 8px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.account-menu-head strong {
  font-size: 13.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-head .tiny {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.account-menu-item:hover { background: var(--surface-2); color: var(--text); }
.account-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.account-menu-item.is-danger { color: var(--danger); }
.account-menu-item.is-danger:hover { background: rgba(255, 77, 94, 0.1); color: var(--danger); }
.account-menu .divider { margin: 5px 8px; }

.guest-banner {
  border-bottom: 1px solid rgba(201, 255, 51, 0.16);
  background: linear-gradient(90deg, rgba(201, 255, 51, 0.09), rgba(67, 217, 224, 0.05));
}
.guest-banner-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.guest-banner-icon svg { width: 16px; height: 16px; color: var(--lime); }
.guest-banner p {
  flex: 1 1 auto;
  font-size: 12.5px;
  color: var(--muted);
}
.guest-banner .btn-icon { color: var(--faint); }

/* ==========================================================================
   Auth modal
   ========================================================================== */

.auth-shell { display: grid; gap: 14px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.auth-tab {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab[aria-pressed="true"] {
  background: var(--lime);
  color: #10140a;
}

.auth-form { display: grid; gap: 12px; }
.auth-form .btn { justify-content: center; }

.auth-error {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 77, 94, 0.35);
  background: rgba(255, 77, 94, 0.1);
  color: #ffb3ba;
  font-size: 12.5px;
}

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 255, 51, 0.24);
  background: rgba(201, 255, 51, 0.07);
  font-size: 12.5px;
  color: var(--text);
}
.auth-note svg { width: 16px; height: 16px; color: var(--lime); flex-shrink: 0; margin-top: 1px; }

.auth-link {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--lime);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }

/* Account block inside Settings */
.account-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.account-block-head { display: flex; align-items: center; gap: 11px; }
.account-block-head strong { display: block; font-size: 13.5px; font-weight: 650; }
.account-block-head .tiny { display: block; }

.account-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(201, 255, 51, 0.14);
  color: var(--lime);
  font-size: 13px;
  font-weight: 700;
}
.account-avatar.guest { background: var(--surface-3); color: var(--faint); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}
.switch-row > span { display: grid; gap: 1px; }
.switch-row strong { font-size: 13px; font-weight: 600; }
.switch-row input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.switch-row input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--faint);
  transition: transform 0.18s, background 0.18s;
}
.switch-row input:checked {
  background: rgba(201, 255, 51, 0.22);
  border-color: rgba(201, 255, 51, 0.45);
}
.switch-row input:checked::after { transform: translateX(16px); background: var(--lime); }

/* ==========================================================================
   Tabs, leaderboard, plan library
   ========================================================================== */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--lime); border-bottom-color: var(--lime); }

.tab-panel { animation: fade-in 0.2s ease; }
.tab-panel[hidden] { display: none; }

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 26px 2px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--lime);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.board-card { padding: 18px; }
.board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.board { display: grid; gap: 3px; }

.board-row {
  display: grid;
  grid-template-columns: 30px 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
}
.board-row:hover { background: var(--surface-2); }
.board-row.is-me {
  border-color: rgba(201, 255, 51, 0.28);
  background: rgba(201, 255, 51, 0.06);
}

.board-rank {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  color: var(--faint);
}
.board-row:first-child .board-rank { color: var(--lime); }

.board-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.board-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
}
.board-name > span, .board-name { overflow: hidden; }

.you-tag {
  font-style: normal;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(201, 255, 51, 0.16);
  color: var(--lime);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.board-meta { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.board-stat { font-size: 13px; font-weight: 700; white-space: nowrap; }
.board-foot { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.lib-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
.lib-top { display: flex; align-items: center; gap: 10px; }
.lib-title { min-width: 0; flex: 1; }
.lib-title h3 {
  font-size: 15px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.lib-title .tiny { display: block; margin-top: 2px; }
.lib-desc { font-size: 13px; color: var(--muted); }
.lib-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-actions { margin-top: auto; display: flex; gap: 8px; padding-top: 4px; }

.share-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

/* ==========================================================================
   Landing page
   ========================================================================== */

.landing {
  display: flex;
  flex-direction: column;
  gap: clamp(30px, 5vw, 58px);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: center;
  padding-top: clamp(6px, 2vw, 26px);
}

.landing-title { font-size: clamp(48px, 9vw, 92px); }
.landing-title span { color: var(--lime); }

.landing-lede {
  margin-top: 18px;
  max-width: 52ch;
  font-size: clamp(15px, 1.5vw, 17px);
  color: var(--muted);
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.landing-hero-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(201, 255, 51, 0.09), transparent 46%),
    var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(-1deg);
}

.mock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.mock-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.2);
}
.mock-row strong { display: block; font-size: 13px; }
.mock-row .tiny { display: block; margin-top: 1px; }
.mock-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--line);
}
.mock-dot.is-done {
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(201, 255, 51, 0.14);
}
.mock-tag { margin-left: auto; font-size: 11px; color: var(--faint); }
.mock-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.mock-foot strong { font-family: var(--font-display); font-size: 20px; }

.landing-features .feature {
  display: grid;
  gap: 7px;
  padding: 20px;
}
.feature-icon {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--lime);
}
.feature h3 { font-size: 16px; }
.feature p { font-size: 13.5px; color: var(--muted); }

.landing-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(22px, 4vw, 44px);
  align-items: start;
}

.landing-h2 { font-size: clamp(30px, 4.4vw, 46px); }

.steps {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.steps li { display: flex; align-items: flex-start; gap: 14px; }
.step-num {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 255, 51, 0.35);
  background: rgba(201, 255, 51, 0.1);
  color: var(--lime);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}
.steps strong { display: block; font-size: 14px; }
.steps p { margin-top: 2px; }

.landing-board { padding: 20px; }

.landing-final {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: clamp(22px, 4vw, 34px);
  border-color: rgba(201, 255, 51, 0.2);
  background:
    linear-gradient(150deg, rgba(201, 255, 51, 0.1), transparent 55%),
    var(--surface);
}
.landing-final .landing-h2 { font-size: clamp(26px, 4vw, 40px); margin-top: 6px; }

.reset-card {
  max-width: 470px;
  margin: 6vh auto 0;
  padding: clamp(22px, 4vw, 30px);
}

@media (max-width: 900px) {
  .landing-hero,
  .landing-split { grid-template-columns: 1fr; }
  .landing-hero-card { transform: none; }
}

@media (max-width: 640px) {
  .board-row { grid-template-columns: 26px 32px minmax(0, 1fr) auto; }
  .board-meta { display: none; }
  .landing-cta .btn { flex: 1 1 auto; justify-content: center; }
  .guest-banner-inner { padding: 9px 16px; flex-wrap: wrap; gap: 8px; }
  .guest-banner p { flex-basis: 100%; order: 3; }
}

/* ==========================================================================
   Custom exercises, next-weight coach, plate calculator, plan social
   ========================================================================== */

.pick-row { display: flex; align-items: stretch; gap: 6px; }
.pick-row .pick-item { flex: 1; min-width: 0; }
.pick-row .btn-icon { align-self: center; color: var(--faint); }
.pick-row .btn-icon:hover { color: var(--danger); }
.pick-item .badge { vertical-align: 2px; margin-left: 4px; }

/* Next-weight suggestion */
.coach-tip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(67, 217, 224, 0.28);
  background: linear-gradient(120deg, rgba(67, 217, 224, 0.1), transparent 70%);
}
.coach-tip p { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.coach-tip p strong { color: var(--text); }
.coach-tip .btn { flex-shrink: 0; }
.coach-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--cyan);
  background: rgba(67, 217, 224, 0.14);
}
.coach-icon svg { width: 16px; height: 16px; }
.coach-tip.coach-up {
  border-color: rgba(201, 255, 51, 0.32);
  background: linear-gradient(120deg, rgba(201, 255, 51, 0.12), transparent 70%);
}
.coach-tip.coach-up .coach-icon { color: var(--lime); background: rgba(201, 255, 51, 0.14); }
.coach-tip.coach-hold {
  border-color: rgba(255, 106, 61, 0.3);
  background: linear-gradient(120deg, rgba(255, 106, 61, 0.1), transparent 70%);
}
.coach-tip.coach-hold .coach-icon { color: var(--orange); background: rgba(255, 106, 61, 0.14); }

/* Plate calculator */
.plate-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  padding: 6px 10px;
}
.plate-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  margin: 6px 0 4px;
  padding: 10px;
  border-radius: 14px;
  background: radial-gradient(60% 80% at 50% 50%, rgba(255, 255, 255, 0.04), transparent), var(--surface-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.plate-sleeve { display: flex; align-items: center; gap: 2px; }
.plate-sleeve:first-child { justify-content: flex-end; }
.plate-bar {
  width: clamp(60px, 22vw, 120px);
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, #e2e7ec, #8d9aa8);
}
.plate-collar {
  width: 8px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(180deg, #c7ced6, #6b7480);
}
.plate {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 3px 0 0 rgba(255, 255, 255, 0.18);
  animation: plate-on 0.35s var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1)) both;
}
.plate b {
  font-size: 9px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.7);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
@keyframes plate-on { from { opacity: 0; transform: scaleY(0.6); } }
.plate-summary { display: grid; gap: 2px; text-align: center; margin-top: 8px; }
.plate-text {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--lime);
  line-height: 1.1;
}
.plate-note {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--orange);
  background: rgba(255, 106, 61, 0.08);
  border: 1px solid rgba(255, 106, 61, 0.25);
}
.plate-avail summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
}
.plate-avail summary:hover { color: var(--text); }

/* Likes and comments */
.lib-social { display: flex; flex-wrap: wrap; gap: 6px; }
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}
.like-btn svg { width: 15px; height: 15px; }
.like-btn:hover:not(:disabled) { color: var(--text); border-color: #3a4652; }
.like-btn:disabled { cursor: default; opacity: 0.6; }
.like-btn[aria-pressed="true"] {
  color: #ff5d8f;
  border-color: rgba(255, 93, 143, 0.4);
  background: rgba(255, 93, 143, 0.1);
}
.like-btn[aria-pressed="true"] svg { fill: currentColor; }
.like-btn.is-popping svg { animation: like-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes like-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.plan-peek {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.plan-peek-day strong { font-size: 12.5px; }
.plan-peek-day p { margin-top: 2px; }

.comment-list { display: grid; gap: 4px; max-height: 38vh; overflow: auto; }
.comment {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid var(--line-soft);
}
.comment:first-child { border-top: 0; }
.comment p { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .btn-icon { color: var(--faint); }
.comment .btn-icon:hover { color: var(--danger); }
.comment-form { display: grid; gap: 8px; margin-top: 4px; }

@media (max-width: 720px) {
  .coach-tip { flex-wrap: wrap; }
  .coach-tip .btn { flex: 1 1 100%; justify-content: center; }
  .lib-head .segmented { overflow-x: auto; max-width: 100%; }
}

/* --------------------------------------------------------------------------
   Installable app + offline status
   -------------------------------------------------------------------------- */

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid rgba(255, 106, 61, 0.35);
  background: rgba(255, 106, 61, 0.1);
  color: #ffb199;
  font: 600 12px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s, border-color 0.18s;
}
.sync-chip[hidden] { display: none; }
.sync-chip svg { width: 15px; height: 15px; flex: none; }
.sync-chip:hover { background: rgba(255, 106, 61, 0.18); }
.sync-chip.sync-syncing {
  border-color: rgba(67, 217, 224, 0.35);
  background: rgba(67, 217, 224, 0.1);
  color: var(--cyan);
}
.sync-chip.sync-syncing svg { animation: sync-spin 1s linear infinite; }
.sync-chip.sync-error {
  border-color: rgba(255, 77, 94, 0.4);
  background: rgba(255, 77, 94, 0.1);
  color: #ff8a96;
}
@keyframes sync-spin { to { transform: rotate(360deg); } }

.install-btn[hidden] { display: none; }

.install-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.install-row-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  background: rgba(201, 255, 51, 0.12);
  color: var(--lime);
}
.install-row-icon svg { width: 20px; height: 20px; }
.install-row p { margin: 2px 0 0; }

.install-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 12px;
}
.install-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: center;
  line-height: 1.45;
}
.install-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--lime);
  color: #10140a;
  font-weight: 800;
  font-size: 14px;
}
.inline-icon { width: 17px; height: 17px; vertical-align: -3px; color: var(--cyan); }

/* Phones and tablets: iPhone zooms in on any field under 16px and never zooms
   back out, so typing or picking from a list left the page enlarged. */
@media (pointer: coarse) {
  input, select, textarea,
  .input, .select, .input-sm, .set-row input { font-size: 16px !important; }
}

/* Installed app: no rubber-band refresh while logging sets, no tap flash */
@media (display-mode: standalone) {
  html, body { overscroll-behavior-y: none; }
  body { -webkit-tap-highlight-color: transparent; }
}

@media (max-width: 720px) {
  .install-btn span { display: none; }
  .install-btn { padding: 0 9px; }
  .sync-chip { padding: 0 9px; }
}
@media (max-width: 420px) {
  .sync-chip span { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  .sync-chip.sync-syncing svg { animation: none; }
}

/* ==========================================================================
   Muscle map
   ========================================================================== */
.mm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.mm-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 360px; margin: 0 auto; }
.mm-figure { margin: 0; display: grid; gap: 6px; justify-items: center; }
.mm-figure svg { width: 100%; height: auto; display: block; overflow: visible; }
.mm-figure path[data-muscle] { transition: fill 0.3s ease, opacity 0.16s; }
.mm-figure path[data-muscle]:hover { opacity: 0.8; }
.mm-figure figcaption {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
}
.mm-legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px;
  margin-top: 12px; font-size: 11.5px; color: var(--muted);
}
.mm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mm-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid rgba(255,255,255,0.06); }
.mm-rows { display: grid; gap: 2px; }
.mm-row {
  display: grid; grid-template-columns: 1fr auto 88px; gap: 10px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 13px;
}
.mm-row:first-child { border-top: 0; }
.mm-row strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.mm-status {
  justify-self: end; font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 99px;
  background: var(--surface-3); color: var(--faint); white-space: nowrap;
}
.mm-status.mm-under { background: rgba(201, 255, 51, 0.1); color: #a9cf45; }
.mm-status.mm-good { background: rgba(201, 255, 51, 0.18); color: var(--lime); }
.mm-status.mm-high { background: rgba(255, 138, 76, 0.16); color: #ff8a4c; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Share card preview */
.share-preview {
  display: grid; place-items: center;
  min-height: 240px;
}
.share-preview img {
  display: block;
  height: min(58vh, 620px);
  width: auto;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -24px #000;
}
.share-loading { color: var(--faint); font-size: 13px; padding: 40px 0; }

/* Swap exercise */
.swap-plan {
  display: flex; align-items: center; gap: 9px;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.swap-plan input { width: 17px; height: 17px; accent-color: var(--lime); }

@media (max-width: 720px) {
  .mm-layout { grid-template-columns: 1fr; gap: 16px; }
  .mm-figures { max-width: 300px; }
  /* Exercise footer: tip on top, buttons on their own row so none get squeezed */
  .work-body > .spread { flex-wrap: wrap; gap: 8px; }
  .work-body > .spread > .row { flex-shrink: 0; margin-left: auto; }
}

/* ==========================================================================
   Exercise cards: animated target muscles
   ========================================================================== */
.ex-anatomy {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background:
    radial-gradient(120px 90px at 22% 50%, rgba(201, 255, 51, 0.07), transparent 70%),
    #0d1115;
  border: 1px solid var(--line-soft);
}
.ex-anatomy-figs { display: flex; gap: 4px; flex-shrink: 0; }
.ex-anatomy-figs svg { width: 46px; height: 90px; display: block; overflow: visible; }
.ex-anatomy-info { display: grid; gap: 2px; min-width: 0; }
.ex-anat-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
}
.ex-anat-label + .ex-anat-main, .ex-anat-label + .ex-anat-also { margin-bottom: 5px; }
.ex-anat-main { font-size: 13px; font-weight: 650; color: var(--lime); }
.ex-anat-also { font-size: 12px; color: var(--muted); }

.ex-anatomy .an-n { fill: #262e37; }
.ex-anatomy .an-o { fill: #1a2027; }
.ex-anatomy .an-s { fill: rgba(201, 255, 51, 0.34); }
.ex-anatomy .an-p { fill: #c9ff33; }

/* The worked muscle "flexes": swells and brightens, helpers glow in time */
.ex-anatomy .an-p,
.ex-anatomy .an-s {
  transform-box: fill-box;
  transform-origin: center;
  animation-duration: 1.9s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}
.ex-anatomy .an-p { animation-name: an-flex; }
.ex-anatomy .an-s { animation-name: an-assist; animation-delay: 0.18s; }
.ex-card.is-live .an-p,
.ex-card.is-live .an-s { animation-play-state: running; }
.ex-card:hover .an-p { fill: #d8ff66; }

@keyframes an-flex {
  0%, 100% { transform: scale(1); opacity: 0.78; }
  45% { transform: scale(1.09); opacity: 1; }
  60% { transform: scale(1.07); opacity: 1; }
}
@keyframes an-assist {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ex-anatomy .an-p, .ex-anatomy .an-s { animation: none; opacity: 1; }
}
@media (max-width: 720px) {
  .ex-anatomy { gap: 18px; padding: 12px 16px; }
  .ex-anatomy-figs svg { width: 58px; height: 114px; }
}

/* ==========================================================================
   Phone tab bar (bottom, in thumb reach)
   ========================================================================== */
.tabbar { display: none; }
.mobile-nav { display: none !important; }
.gb-short { display: none; }

@media (max-width: 980px) {
  :root { --tabbar-h: 62px; }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 5px max(4px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: rgba(10, 12, 15, 0.94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .tabbar a {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 2px 0;
    color: var(--faint);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .tab-ico {
    display: grid;
    place-items: center;
    width: 46px;
    height: 28px;
    border-radius: 99px;
    transition: background 0.18s, transform 0.12s;
  }
  .tab-ico svg { width: 21px; height: 21px; }
  .tab-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tabbar a[aria-current="page"] { color: var(--lime); }
  .tabbar a[aria-current="page"] .tab-ico { background: rgba(201, 255, 51, 0.14); }
  .tabbar a:active .tab-ico { transform: scale(0.9); }

  /* Room for the bar: page end, footer, rest timer and messages sit above it */
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  body.has-tabbar .rest-timer { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }
  body.has-tabbar .toast-stack { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
  body.has-tabbar.has-rest .toast-stack { bottom: calc(var(--tabbar-h) + 86px + env(safe-area-inset-bottom)); }

  /* Out of the way while the keyboard is up */
  body.is-typing .tabbar { transform: translateY(110%); opacity: 0; pointer-events: none; }
  body.has-tabbar.is-typing { padding-bottom: 0; }
}

@media (max-width: 380px) {
  .tab-label { font-size: 9.5px; }
  .tab-ico { width: 40px; }
}

/* Landscape iPhone: keep content clear of the notch */
@media (max-width: 980px) {
  .page { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* Guest banner: one short line on phones */
@media (max-width: 640px) {
  .gb-long { display: none; }
  .gb-short { display: inline; }
  .guest-banner-inner { flex-wrap: nowrap !important; padding: 7px 12px 7px 16px !important; }
  .guest-banner p { flex-basis: auto !important; order: 0 !important; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .guest-banner .btn-sm { padding: 6px 10px; flex-shrink: 0; }
}

/* ==========================================================================
   − / + steppers on sets
   ========================================================================== */
.stepper {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: stretch;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0f1318;
  overflow: hidden;
  transition: border-color 0.16s;
}
.stepper:focus-within { border-color: var(--lime); }
.set-row .stepper input {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 2px;
  text-align: center;
  font-weight: 600;
  -moz-appearance: textfield;
  appearance: textfield;
  min-width: 0;
}
.set-row .stepper input::-webkit-outer-spin-button,
.set-row .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-row .stepper input:focus { border: 0; }
.step-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s;
}
.step-btn svg { width: 15px; height: 15px; pointer-events: none; }
.step-btn:hover { color: var(--lime); }
.step-btn:active { background: var(--surface-3); color: var(--lime); }
.step-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
.set-row-head > div:nth-child(2),
.set-row-head > div:nth-child(3) { text-align: center; }
.set-row .set-check, .set-row .set-idx { height: 42px; }
.set-row .set-check { width: 100%; }
.set-row.is-done .stepper { background: #0c0f13; border-color: var(--line-soft); }
.set-row.is-done .stepper input { background: transparent; border: 0; }
.set-row.is-done .step-btn { color: var(--faint); }

@media (max-width: 720px) {
  .set-row { grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 6px; }
  .stepper { grid-template-columns: 28px minmax(0, 1fr) 28px; }
}

/* ==========================================================================
   Undo in messages
   ========================================================================== */
.toast.has-action { padding-right: 6px; }
.toast > span { flex: 1; min-width: 0; }
.toast-action {
  flex-shrink: 0;
  margin-left: 4px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: rgba(201, 255, 51, 0.14);
  color: var(--lime);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}
.toast-action:hover { background: rgba(201, 255, 51, 0.24); }

/* ==========================================================================
   Workout: last time, notes, warm-ups
   ========================================================================== */
.hx-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0d1115;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.hx-strip:hover { border-color: #35404c; background: var(--surface-2); }
.hx-strip > svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--faint); }
.hx-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-text b { color: var(--text); font-weight: 650; margin-right: 3px; }
.hx-text em { font-style: normal; color: var(--faint); }
.hx-more { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; color: var(--lime); font-weight: 650; }
.hx-more svg { width: 14px; height: 14px; }

.ex-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin: -2px 0 10px;
  padding: 8px 11px;
  border: 1px dashed rgba(201, 255, 51, 0.3);
  border-radius: 10px;
  background: rgba(201, 255, 51, 0.04);
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.ex-note svg { width: 14px; height: 14px; margin-top: 2px; flex-shrink: 0; color: var(--lime); }
.ex-note span { white-space: pre-wrap; overflow-wrap: anywhere; }

.set-row.is-warmup .set-idx { background: rgba(255, 138, 76, 0.12); color: #ff8a4c; font-size: 11px; letter-spacing: 0.04em; }
.set-row.is-warmup .stepper { border-style: dashed; }
.set-row.is-warmup.is-done .set-idx { background: rgba(255, 138, 76, 0.22); }

/* Exercise sheet: history, 1RM, note */
.chips.seg { margin-bottom: 14px; }
.sheet-pane[hidden] { display: none; }
.hx-chart-wrap { padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: #0d1115; margin-bottom: 12px; }
.hx-chart { display: block; width: 100%; height: 90px; margin-top: 6px; overflow: visible; }
.hx-line { fill: none; stroke: var(--lime); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.hx-area { fill: rgba(201, 255, 51, 0.1); }
.hx-chart circle { fill: var(--lime); stroke: #0d1115; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hx-list { display: grid; }
.hx-row {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.hx-row:first-child { border-top: 0; }
.hx-row > div { display: grid; }
.hx-row strong { font-size: 13px; font-weight: 650; }
.hx-sets { font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.max-head { display: grid; gap: 2px; margin-bottom: 12px; }
.max-big { font-family: var(--font-display); font-size: 46px; font-weight: 800; line-height: 1; color: var(--lime); }
.max-big small { font-size: 18px; color: var(--muted); }
.max-table { display: grid; gap: 4px; }
.max-row {
  display: grid;
  grid-template-columns: 44px 84px 64px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0d1115;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}
.max-row:hover { border-color: var(--lime); background: var(--surface-2); }
.max-pct { color: var(--faint); font-weight: 700; font-variant-numeric: tabular-nums; }
.max-row strong { font-variant-numeric: tabular-nums; }
.max-plates { font-size: 11.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-use { font-size: 11.5px; font-weight: 700; color: var(--lime); }

.new-badges { margin-top: 6px; display: grid; gap: 6px; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.badge-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #0d1115;
}
.badge-medal {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--faint);
  border: 1px solid var(--line);
}
.badge-medal svg { width: 20px; height: 20px; }
.badge-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.badge-body strong { font-size: 13.5px; font-weight: 650; }
.badge-body > span { font-size: 12px; color: var(--muted); }
.badge-state { font-style: normal; font-size: 11px; font-weight: 650; color: var(--faint); display: inline-flex; align-items: center; gap: 4px; }
.badge-state svg { width: 12px; height: 12px; }
.badge-bar { height: 5px; border-radius: 99px; background: #1e252d; overflow: hidden; margin-top: 4px; }
.badge-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8fbf14, #c9ff33); }
.badge-card.is-earned { border-color: rgba(201, 255, 51, 0.3); background: linear-gradient(135deg, rgba(201, 255, 51, 0.08), #0d1115 60%); }
.badge-card.is-earned .badge-medal {
  background: radial-gradient(circle at 35% 30%, #e4ff8a, #c9ff33 55%, #8fbf14);
  border-color: #c9ff33;
  color: #10140a;
  box-shadow: 0 0 0 3px rgba(201, 255, 51, 0.12), 0 8px 20px -10px rgba(201, 255, 51, 0.6);
}
.badge-card.is-earned .badge-state { color: var(--lime); }
.new-badges .badge-card.is-earned .badge-medal { animation: medal-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
@keyframes medal-pop { 0% { transform: scale(0.4) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ==========================================================================
   Training calendar and streaks
   ========================================================================== */
.streak-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.streak-tile {
  display: grid;
  gap: 1px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #0d1115;
}
.streak-tile strong { font-family: var(--font-display); font-size: 30px; font-weight: 800; line-height: 1.05; }
.pill svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; color: #ff8a4c; }
.cal { display: grid; gap: 4px; }
.cal-months, .cal-grid { display: grid; gap: 3px; }
.cal-months { font-size: 10.5px; color: var(--faint); height: 14px; }
.cal-months span { white-space: nowrap; }
.cal-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.cal-cell {
  display: block;
  aspect-ratio: 1;
  width: 100%;
  max-width: 18px;
  border-radius: 3px;
  background: #171d23;
}
.cal-cell.cal-1 { background: rgba(201, 255, 51, 0.3); }
.cal-cell.cal-2 { background: rgba(201, 255, 51, 0.6); }
.cal-cell.cal-3 { background: #c9ff33; }
.cal-cell.is-today { outline: 1.5px solid var(--text); outline-offset: 1px; }
.cal-cell.is-future { background: transparent; border: 1px dashed #1e252d; }
.cal-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 6px; font-size: 10.5px; color: var(--faint); }
.cal-legend .cal-cell { width: 11px; height: 11px; }
.cal-legend span { margin: 0 3px; }

/* ==========================================================================
   Dashboard: week in review
   ========================================================================== */
#recap.recap { margin-top: 18px; border-color: rgba(201, 255, 51, 0.22); background: linear-gradient(135deg, rgba(201, 255, 51, 0.06), var(--surface) 55%); }
.recap-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) 200px minmax(0, 1fr); gap: 18px; align-items: center; margin-top: 12px; }
.recap-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recap-stat { display: grid; gap: 1px; padding: 10px 12px; border-radius: 12px; background: #0d1115; border: 1px solid var(--line-soft); }
.recap-stat strong { font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1.05; }
.recap-stat strong small { font-family: var(--font-body, inherit); font-size: 13px; color: var(--muted); font-weight: 600; }
.recap-delta { font-size: 11px; color: var(--faint); }
.recap-delta.up { color: var(--lime); }
.recap-delta.down { color: #ff8a4c; }
.recap-map .mm-figures { max-width: 200px; }
.recap-notes { display: grid; gap: 3px; align-content: start; }
.recap-prs { list-style: none; margin: 2px 0 10px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.recap-prs em { font-style: normal; color: var(--muted); font-size: 12px; }
.recap-pr svg { width: 14px; height: 14px; color: var(--lime); vertical-align: -2px; margin-right: 6px; }

/* Progress history notes */
.history-note { display: flex; gap: 8px; margin: 0 0 6px; padding: 8px 10px; border-radius: 10px; background: rgba(201, 255, 51, 0.05); font-size: 12.8px; color: var(--text); }
.history-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; color: var(--lime); }
.history-note span { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .recap-grid { grid-template-columns: minmax(0, 1fr) 150px; }
  .recap-notes { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .streak-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recap-grid { grid-template-columns: 1fr; gap: 12px; }
  .recap-map .mm-figures { max-width: 210px; }
  .max-row { grid-template-columns: 38px 74px 54px 1fr auto; gap: 6px; padding: 9px 8px; }
  .hx-row { grid-template-columns: 1fr; gap: 2px; }
  .hx-sets { text-align: left; }
  .badge-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .new-badges .badge-card.is-earned .badge-medal { animation: none; }
}

/* Recap list, summary stats side by side on phones */
.recap-prs li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.recap-pr { display: inline-flex; }
.recap-pr svg { margin-right: 0; }
.modal .grid.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 720px) {
  /* Exercise tools: an even toolbar under the tip, labels under icons */
  .work-body > .spread > .row {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .work-body > .spread > .row > .btn {
    flex-direction: column;
    gap: 3px;
    min-height: 50px;
    padding: 6px 2px;
    font-size: 11px;
    justify-content: center;
  }
  .work-body > .spread > .row > .btn svg { width: 18px; height: 18px; }
  .work-body .btn-label { display: inline !important; }
  .max-row { grid-template-columns: 38px 70px 52px minmax(0, 1fr); }
  .max-use { display: none; }
}
@media (max-width: 720px) {
  .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .badge-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 11px; }
  .badge-medal { width: 38px; height: 38px; }
  .badge-medal svg { width: 18px; height: 18px; }
  .badge-body strong { font-size: 13px; }
  .badge-body > span { font-size: 11.5px; }
  .new-badges .badge-card { flex-direction: row; align-items: center; }
}
