/* ═══════════════════════════════════════════════════════════
   GYM-BUDDIES — Apple iOS Premium Design System
   Inspired by Apple Health, iOS Fitness, Activity Rings
════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ───────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Apple iOS Light Palette */
  --bg:            #F2F2F7;
  --surface:       #FFFFFF;
  --surface-soft:  rgba(120,120,128,0.12);
  --row:           rgba(120,120,128,0.08);
  --input:         #FFFFFF;
  --text:          #000000;
  --muted:         rgba(60,60,67,0.60);
  --muted-strong:  rgba(60,60,67,0.45);
  --line:          rgba(60,60,67,0.29);
  --line-strong:   rgba(60,60,67,0.18);
  --fill-1:        rgba(120,120,128,0.20);
  --fill-2:        rgba(120,120,128,0.16);
  --fill-3:        rgba(118,118,128,0.12);

  /* Accent Palette (Apple Activity) */
  --primary:        #007AFF;
  --primary-strong: #0040DD;
  --primary-dim:    rgba(0,122,255,0.12);
  --accent:         #FF9500;
  --accent-dim:     rgba(255,149,0,0.14);
  --success:        #34C759;
  --success-dim:    rgba(52,199,89,0.14);
  --warning:        #FFD60A;
  --danger:         #FF3B30;
  --danger-dim:     rgba(255,59,48,0.12);
  --ring-move:      #30D158;
  --ring-exercise:  #0A84FF;
  --ring-stand:     #FF9F0A;
  --ring-purple:    #BF5AF2;
  --ring-pink:      #FF375F;
  --ring-cyan:      #64D2FF;

  /* Glass / Surface */
  --nav-bg:        rgba(242,242,247,0.82);
  --topbar-bg:     rgba(255,255,255,0.82);
  --nav-blur:      20px;

  /* Shadows */
  --shadow:        0 2px 20px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lift:   0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-modal:  0 24px 80px rgba(0,0,0,0.18);

  /* Motion */
  --spring:        cubic-bezier(0.25, 1, 0.5, 1);
  --spring-fast:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration:      0.22s;

  /* Typography */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Radius */
  --r-card:  16px;
  --r-btn:   14px;
  --r-input: 12px;
  --r-pill:  999px;
  --r-sm:    10px;
}

/* ── DARK MODE ───────────────────────────────────────────── */
:root[data-theme='dark'] {
  color-scheme: dark;

  --bg:            #000000;
  --surface:       #1C1C1E;
  --surface-soft:  rgba(120,120,128,0.24);
  --row:           rgba(120,120,128,0.18);
  --input:         #2C2C2E;
  --text:          #FFFFFF;
  --muted:         rgba(235,235,245,0.60);
  --muted-strong:  rgba(235,235,245,0.45);
  --line:          rgba(84,84,88,0.65);
  --line-strong:   rgba(84,84,88,0.40);
  --fill-1:        rgba(120,120,128,0.36);
  --fill-2:        rgba(120,120,128,0.32);
  --fill-3:        rgba(118,118,128,0.24);

  --primary:        #0A84FF;
  --primary-strong: #64B5FF;
  --primary-dim:    rgba(10,132,255,0.18);
  --accent:         #FF9F0A;
  --accent-dim:     rgba(255,159,10,0.18);
  --success:        #30D158;
  --success-dim:    rgba(48,209,88,0.18);
  --warning:        #FFD60A;
  --danger:         #FF453A;
  --danger-dim:     rgba(255,69,58,0.16);
  --ring-move:      #30D158;
  --ring-exercise:  #0A84FF;
  --ring-stand:     #FF9F0A;

  --nav-bg:        rgba(28,28,30,0.88);
  --topbar-bg:     rgba(0,0,0,0.72);

  --shadow:        0 2px 20px rgba(0,0,0,0.40), 0 1px 4px rgba(0,0,0,0.24);
  --shadow-lift:   0 8px 40px rgba(0,0,0,0.55), 0 2px 12px rgba(0,0,0,0.30);
  --shadow-modal:  0 24px 80px rgba(0,0,0,0.55);
}

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

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background var(--duration) var(--spring), color var(--duration) var(--spring);
}

/* Gradient-tinted deep canvas in dark mode */
:root[data-theme='dark'] body {
  background: linear-gradient(160deg, #000000 0%, #040412 50%, #000000 100%);
  background-attachment: fixed;
}

html.is-scroll-locked,
body.is-scroll-locked { overflow: hidden; }

body.is-scroll-locked {
  position: fixed;
  left: 0; right: 0;
  width: 100%;
}

button, input, textarea, select { font: inherit; }
button { border: 0; }
h1, h2, h3, p { margin: 0; }

/* Eliminate browser default focus outlines everywhere */
*:focus { outline: none; }
*:focus-visible { outline: none; }

/* ── APP SHELL ───────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.main-panel { min-width: 0; }
.sidebar { display: none; }

/* ── MOBILE TOPBAR ───────────────────────────────────────── */
.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--topbar-bg);
  border-bottom: 0.5px solid var(--line);
  backdrop-filter: saturate(1.8) blur(var(--nav-blur));
  -webkit-backdrop-filter: saturate(1.8) blur(var(--nav-blur));
  transition: background var(--duration) var(--spring);
}

/* ── BRAND ───────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: opacity var(--duration) ease;
}

.brand:active { opacity: 0.7; }

.brand-mark {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  transition: transform var(--duration) var(--spring);
}
.brand:hover .brand-mark { transform: scale(1.07); }
.brand:active .brand-mark { transform: scale(0.94); }

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.74rem;
}

/* ── DESKTOP TOPBAR ──────────────────────────────────────── */
.topbar {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── ICON BUTTONS ────────────────────────────────────────── */
.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  color: var(--text);
  background: var(--fill-2);
  cursor: pointer;
  transition:
    transform var(--duration) var(--spring),
    background var(--duration) ease,
    color var(--duration) ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn svg { width: 18px; height: 18px; position: relative; z-index: 1; }
.icon-btn:active { transform: scale(0.88); }
.icon-btn:hover  { background: var(--fill-1); }

/* Soft ripple on tap */
.icon-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
}
.icon-btn:active::after {
  animation: gb-icon-ripple 0.42s var(--spring) forwards;
}

@keyframes gb-icon-ripple {
  0%   { transform: scale(0.2); opacity: 0.22; }
  60%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Custom focus-visible glow instead of browser square outline */
.icon-btn:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible,
.brand:focus-visible,
.sidebar-item:focus-visible,
.warmup-pause-btn:focus-visible,
.favorite-plan-icon:focus-visible,
.activity-card:focus-visible,
.bento-cell:focus-visible,
.text-link:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-dim), 0 0 0 1.5px color-mix(in srgb, var(--primary) 55%, transparent);
}

.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible,
.plan-search-input:focus-visible,
.exercise-editor-row input:focus-visible,
.exercise-editor-row select:focus-visible,
.gif-picker-search:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.icon-btn.is-authenticated { color: var(--primary); }
.icon-btn.primary-icon     { color: white; background: var(--primary); }
.icon-btn.remove           { color: var(--danger); }
.icon-btn.compact-icon     { width: 34px; height: 34px; }
.icon-btn:disabled         { cursor: not-allowed; opacity: 0.4; }

/* Gear / profile animation overrides */
.gear-core,
.profile-head,
.profile-shoulders {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.28s ease;
}

.icon-btn:hover .gear-core,
.icon-btn:active .gear-core,
.icon-btn.spin-settings .gear-core { transform: rotate(135deg); }

.icon-btn:hover .profile-head     { transform: translateY(-0.8px) scale(1.03); }
.icon-btn:hover .profile-shoulders{ transform: translateY(0.6px); }

.profile-status {
  fill: var(--success) !important;
  stroke: var(--surface) !important;
  stroke-width: 1.8 !important;
}
.profile-check { stroke: white !important; stroke-width: 1.5 !important; }
.profile-plus  { stroke: var(--accent) !important; }

/* ── MOBILE BOTTOM TAB BAR ───────────────────────────────── */
.mobile-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px max(10px, env(safe-area-inset-bottom));
  background: var(--nav-bg);
  border-top: 0.5px solid var(--line);
  backdrop-filter: saturate(1.8) blur(var(--nav-blur));
  -webkit-backdrop-filter: saturate(1.8) blur(var(--nav-blur));
  transition: background var(--duration) var(--spring);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1px;
  transition:
    color var(--duration) ease,
    background var(--duration) ease,
    transform 0.18s var(--spring-fast);
  -webkit-tap-highlight-color: transparent;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
}

.nav-svg {
  width: 22px;
  height: 22px;
  overflow: visible;
  transition: transform 0.22s var(--spring);
}

.nav-stroke,
.profile-svg path,
.profile-svg circle,
.settings-svg path,
.settings-svg circle {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.accent-stroke { transition: stroke var(--duration) ease; }

.nav-item:active {
  transform: scale(0.84);
  background: var(--fill-3);
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item.active .nav-svg   { transform: translateY(-1px); }
.nav-item.active .accent-stroke { stroke: var(--accent); }

/* ── CONTENT ─────────────────────────────────────────────── */
.content {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px 16px 100px;
}

.desktop-footer { display: none; }

/* ── PAGE LAYOUT ─────────────────────────────────────────── */
.page {
  display: grid;
  gap: 20px;
}

.section {
  display: grid;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.compact-section-head { align-items: center; }

.section-divider {
  height: 0.5px;
  background: var(--line);
  margin: 4px 0;
}

/* ── TYPOGRAPHY ──────────────────────────────────────────── */
h1 {
  max-width: 760px;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.05;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.muted { color: var(--muted); }

/* ── ENTRANCE ANIMATIONS ─────────────────────────────────── */
@keyframes gb-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes gb-scale-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes gb-ring-fill {
  from { stroke-dashoffset: var(--ring-circumference); }
}

/* ── RESUME BANNER ───────────────────────────────────────── */
.resume-banner {
  position: sticky;
  top: 62px;
  z-index: 40;
  width: calc(100% - 24px);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 12px 0;
  padding: 10px 14px;
  border: 0.5px solid color-mix(in srgb, var(--primary) 38%, var(--line));
  border-radius: var(--r-card);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 90%, var(--surface-soft));
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform var(--duration) var(--spring), box-shadow var(--duration) ease;
}

.resume-banner:active { transform: scale(0.98); }

.resume-banner span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.resume-banner strong,
.resume-banner small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-banner small   { color: var(--muted); font-size: 0.8rem; }
.resume-banner-action  { flex: 0 0 auto; color: var(--primary); font-weight: 700; font-size: 0.9rem; }

/* ── GREETING / HERO BAND ────────────────────────────────── */
.hero-band {
  display: grid;
  gap: 14px;
  padding: 20px 0 4px;
}

.hero-copy {
  max-width: 620px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

/* Premium greeting when logged in */
.greeting-band {
  padding: 20px 0 4px;
  display: grid;
  gap: 6px;
}

.greeting-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
  text-transform: uppercase;
}

.greeting-title {
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

.greeting-title .gradient-text {
  background: linear-gradient(120deg, var(--primary) 0%, var(--ring-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── FAVORITE PLANS ──────────────────────────────────────── */
.favorite-plans-band {
  display: grid;
  gap: 12px;
  padding: 16px 0 4px;
}

.favorite-plan-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 96px;
  justify-content: start;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.favorite-plan-grid::-webkit-scrollbar { display: none; }

.favorite-plan-icon {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  scroll-snap-align: start;
  transition: transform var(--duration) var(--spring), box-shadow var(--duration) ease;
  -webkit-tap-highlight-color: transparent;
}

.favorite-plan-icon:active { transform: scale(0.92); }

.favorite-plan-icon span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
}

.favorite-plan-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
  background: var(--row);
}

/* ── BENTO GRID SYSTEM ───────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bento-full  { grid-column: 1 / -1; }
.bento-tall  { grid-row: span 2; }

.bento-cell {
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  transition:
    transform var(--duration) var(--spring),
    box-shadow var(--duration) var(--spring),
    background var(--duration) var(--spring);
  -webkit-tap-highlight-color: transparent;
  animation: gb-fade-up 0.4s var(--spring) both;
}

.bento-cell:active { transform: scale(0.96); }

/* Stagger */
.bento-cell:nth-child(1) { animation-delay: 0.05s; }
.bento-cell:nth-child(2) { animation-delay: 0.10s; }
.bento-cell:nth-child(3) { animation-delay: 0.14s; }
.bento-cell:nth-child(4) { animation-delay: 0.18s; }
.bento-cell:nth-child(5) { animation-delay: 0.22s; }
.bento-cell:nth-child(6) { animation-delay: 0.26s; }

/* ── BENTO: STREAK CELL ──────────────────────────────────── */
.streak-cell {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 140px;
  background: linear-gradient(145deg, #0D2B1C, #071A14);
  cursor: pointer;
}

:root[data-theme='light'] .streak-cell {
  background: linear-gradient(145deg, #E3F9EB, #C8F0D6);
}

.streak-cell::before {
  content: '';
  position: absolute;
  top: -24px; right: -24px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(48,209,88,0.22) 0%, transparent 70%);
  pointer-events: none;
}

.streak-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ring-move);
  opacity: 0.9;
}

:root[data-theme='light'] .streak-label { color: #28A855; }

.streak-value {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -2.5px;
  line-height: 1;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

:root[data-theme='light'] .streak-value { color: #0D2B1C; }

.streak-sub {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  margin-bottom: auto;
}

:root[data-theme='light'] .streak-sub { color: rgba(13,43,28,0.5); }


/* ── BENTO: ACTIVITY RING CELL ───────────────────────────── */
.ring-cell {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 140px;
  cursor: pointer;
}

.ring-cell-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
}

.activity-ring-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  align-self: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-ring-wrap svg {
  width: 90px;
  height: 90px;
  transform: rotate(-90deg);
  overflow: visible;
}

.ring-track {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s var(--spring);
}

.ring-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-pct {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-unit {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

/* ── BENTO: PLAN HERO CARD ───────────────────────────────── */
.plan-hero-cell {
  padding: 0;
  min-height: 164px;
  cursor: pointer;
  border-radius: var(--r-card);
  overflow: hidden;
  position: relative;
}

.plan-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #0D2137 0%, #061220 60%, #0A1820 100%);
}

:root[data-theme='light'] .plan-hero-bg {
  background: linear-gradient(145deg, #0050C8 0%, #003A9A 100%);
}

.plan-hero-glow {
  position: absolute;
  top: -40px; right: -30px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10,132,255,0.28) 0%, transparent 70%);
  pointer-events: none;
}

.plan-hero-content {
  position: relative;
  z-index: 1;
  padding: 18px 18px 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ring-cyan);
  opacity: 0.9;
}

.plan-hero-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #FFFFFF;
  line-height: 1.15;
}

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

.plan-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 0.5px solid rgba(255,255,255,0.15);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
}

.plan-hero-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-hero-primary {
  flex: 1;
  min-height: 40px;
  border-radius: 12px;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(10,132,255,0.38);
  transition: transform var(--duration) var(--spring), opacity var(--duration) ease;
}

.btn-hero-primary:active { transform: scale(0.95); opacity: 0.9; }

.btn-hero-ghost {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0.5px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 600;
  transition: transform var(--duration) var(--spring), background var(--duration) ease;
}

.btn-hero-ghost:active { transform: scale(0.95); background: rgba(255,255,255,0.16); }

/* ── BENTO: STAT MINI CELLS ──────────────────────────────── */
.bento-stat-cell {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
  overflow: hidden;
}

.bento-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.bento-stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.bento-stat-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.bento-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  align-self: flex-start;
  margin-top: 3px;
}

.bento-stat-badge.up   { background: var(--success-dim); color: var(--success); }
.bento-stat-badge.warn { background: var(--accent-dim);  color: var(--accent);  }

.bento-stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.bento-cell-glow {
  position: absolute;
  bottom: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}

/* ── BENTO: WEEKLY BAR CHART ─────────────────────────────── */
.bento-chart-cell {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bento-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.bento-chart-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.bento-chart-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.bento-chart-total {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bento-chart-total-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.week-mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 72px;
}

.week-mini-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.week-mini-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.week-mini-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 5px 5px 3px 3px;
  transition: height 1.1s var(--spring);
  position: relative;
  overflow: hidden;
}

.week-mini-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: rgba(255,255,255,0.14);
  border-radius: inherit;
}

.week-mini-bar.wk-active {
  background: linear-gradient(180deg, var(--primary) 0%, #004DC4 100%);
  box-shadow: 0 0 10px rgba(10,132,255,0.35);
}

.week-mini-bar.wk-done {
  background: linear-gradient(180deg, var(--success) 0%, #1F9E3D 100%);
}

.week-mini-bar.wk-empty {
  background: var(--fill-3);
  height: 4px !important;
}

.week-mini-day {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.1px;
}

.week-mini-day.wk-today {
  color: var(--primary);
  font-weight: 700;
}

/* ── GRID ────────────────────────────────────────────────── */
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color var(--duration) ease,
    box-shadow var(--duration) ease,
    transform var(--duration) var(--spring);
}

.card:hover {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--line));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.plan-card { align-content: start; }

.plan-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(104px, 28%);
  gap: 10px 14px;
  align-items: start;
}

.plan-card-pills { grid-column: 1 / -1; justify-content: center; }
.plan-card-copy  { min-width: 0; display: grid; gap: 10px; }

.plan-card-cover {
  width: 100%;
  max-width: 190px;
  aspect-ratio: 4 / 3;
  justify-self: end;
  object-fit: contain;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--row);
}

.plan-cover-placeholder {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 900;
  border-radius: 12px;
  background: var(--primary-dim);
}

.plan-card .button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

/* ── PLAN ROULETTE ───────────────────────────────────────── */
.plan-roulette {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 82vw);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.plan-roulette::-webkit-scrollbar { display: none; }

.plan-roulette .plan-card-summary .muted {
  min-height: 2.8em;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.plan-roulette .plan-card-summary .muted.marquee-text {
  display: block;
  -webkit-box-orient: initial;
  -webkit-line-clamp: initial;
  line-clamp: initial;
}

/* ── PLANS SWIPEBAR ──────────────────────────────────────── */
.plans-swipebar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 100%);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scroll-snap-type: x mandatory;
  scroll-snap-stop: always;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}

.plans-swipebar::-webkit-scrollbar { display: none; }
.plans-swipebar .plan-card { scroll-snap-align: center; }

/* ── PUBLIC PLAN TILE ────────────────────────────────────── */
.public-plan-tile {
  min-height: 220px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-snap-align: start;
  transition:
    border-color var(--duration) ease,
    box-shadow var(--duration) ease,
    transform var(--duration) var(--spring);
}

.public-plan-tile:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

/* ── SWIPE HINT ──────────────────────────────────────────── */
.swipe-hint { height: 0; position: relative; pointer-events: none; }

.swipe-hint span {
  position: absolute;
  right: 8px; bottom: 8px;
  width: 38px; height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--primary), var(--line));
  opacity: 0;
  animation: swipe-hint 2.2s ease-out 0.35s 1 both;
}

@keyframes swipe-hint {
  0%  { transform: translateX(0);     opacity: 0; }
  20% { opacity: 1; }
  58% { transform: translateX(-30px); opacity: 0.9; }
  100%{ transform: translateX(-30px); opacity: 0; }
}

/* ── PLAN META & PILLS ───────────────────────────────────── */
.plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-dim);
  border: 0.5px solid rgba(0,122,255,0.15);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  align-self: start;
  justify-self: start;
}

/* ── EXERCISE LIST & ROW ─────────────────────────────────── */
.exercise-list  { display: grid; gap: 8px; }

.exercise-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: var(--row);
  transition:
    background var(--duration) ease,
    transform var(--duration) var(--spring-fast),
    box-shadow var(--duration) ease;
  -webkit-tap-highlight-color: transparent;
}

.exercise-row[style*="cursor:pointer"]:active,
.exercise-row[style*="cursor: pointer"]:active {
  transform: scale(0.985);
  box-shadow: var(--shadow);
}

.exercise-row.with-media {
  grid-template-columns: 68px minmax(0, 1fr) auto;
}

.exercise-plan-row        { grid-template-columns: minmax(0, 1fr); }
.exercise-plan-row.with-media { grid-template-columns: 68px minmax(0, 1fr); }

.exercise-row-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.exercise-row-main > strong { min-width: 0; }

.exercise-row-title {
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.18;
  font-weight: 600;
}

.exercise-gif-thumb {
  width: 68px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 0.5px solid var(--line);
  background: var(--surface);
}

.plan-list-row {
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
}

.plan-list-row .button-row {
  flex-wrap: nowrap;
  gap: 6px;
}

/* On very narrow viewports, wrap buttons beneath the plan title */
@media (max-width: 420px) {
  .plan-list-row {
    grid-template-columns: 68px minmax(0, 1fr);
    row-gap: 8px;
  }
  .plan-list-row .button-row {
    grid-column: 1 / -1;
  }
}

/* Ensure plan-list-row buttons have generous touch targets */
.plan-list-row .btn.compact {
  min-height: 44px;
  padding: 0 clamp(10px, 3.5vw, 16px);
  font-size: clamp(0.8rem, 3vw, 0.9rem);
}

.exercise-dose {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ── BUTTON ROW ──────────────────────────────────────────── */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.section-head > .button-row {
  flex-wrap: nowrap;
  align-items: center;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  min-width: 0;
  padding: 0 18px;
  border-radius: var(--r-btn);
  color: var(--text);
  background: var(--fill-2);
  font-weight: 700;
  letter-spacing: -0.1px;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    background var(--duration) ease,
    box-shadow var(--duration) ease,
    transform var(--duration) var(--spring),
    opacity var(--duration) ease;
  -webkit-tap-highlight-color: transparent;
}

/* Soft press-and-release ripple on primary buttons */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,0.18);
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
}
.btn:active::after {
  animation: gb-btn-ripple 0.4s var(--spring) forwards;
}
@keyframes gb-btn-ripple {
  0%   { transform: scale(0.3); opacity: 0.28; }
  60%  { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}

.btn > * { position: relative; z-index: 1; }

.btn:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.btn:active { transform: scale(0.96); box-shadow: none; }

.btn.compact {
  min-height: 42px;
  padding: 0 clamp(12px, 3vw, 18px);
  font-size: clamp(0.82rem, 3.2vw, 0.92rem);
}

.btn.primary {
  color: #FFFFFF;
  background: var(--primary);
  box-shadow: 0 4px 14px rgba(0,122,255,0.28);
}

.btn.primary:hover { box-shadow: 0 6px 20px rgba(0,122,255,0.38); }

.btn.accent  { color: #000000; background: var(--warning); }

.btn.ghost {
  border: 0.5px solid var(--line);
  background: transparent;
  color: var(--text);
}

.btn.ghost:hover { background: var(--fill-3); }

.btn.danger {
  color: #FFFFFF;
  background: var(--danger);
  box-shadow: 0 4px 14px rgba(255,59,48,0.22);
}

.btn.full     { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: 0.45; }

/* ── AD SLOTS ────────────────────────────────────────────── */
.ad-slot {
  min-height: 60px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
  color: var(--muted);
  background: rgba(120,120,128,0.04);
  font-size: 0.78rem;
}

.real-ad-slot  { overflow: hidden; }
.ad-blocked::after { content: "Anzeige blockiert oder noch nicht geladen"; }

/* ── PROFILE FORMS ───────────────────────────────────────── */
.profile-form,
.plan-form { display: grid; gap: 12px; }

.cover-editor {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.cover-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 800;
}

.cover-preview img { width: 100%; height: 100%; object-fit: contain; }

.cover-editor-actions,
.favorite-editor { min-width: 0; display: grid; gap: 8px; }

.cover-editor-actions strong { display: block; }

.favorite-editor {
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: end;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

/* ── PROFILE MODAL ───────────────────────────────────────── */
.profile-modal { gap: 16px; }

/* Full-width, generously padded submit/action buttons in the profile form */
.profile-modal > .btn,
.profile-modal > button {
  width: 100%;
  min-height: 52px;
  font-size: clamp(0.9rem, 3.5vw, 1.0rem);
  letter-spacing: -0.2px;
  padding: 0 clamp(16px, 4vw, 24px);
}

.profile-hero {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.profile-hero strong,
.profile-hero span { display: block; overflow-wrap: anywhere; }
.profile-hero span { margin-top: 2px; color: var(--muted); font-size: 0.88rem; }

.profile-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,0.4), transparent 26%),
    linear-gradient(145deg, var(--primary), var(--ring-purple));
  font-weight: 900;
  letter-spacing: 0;
  font-size: 1.1rem;
  box-shadow: inset 0 -8px 16px rgba(0,0,0,0.16);
}

.profile-readout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-readout {
  min-height: 100px;
  display: grid;
  align-content: space-between;
  gap: 6px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.profile-readout span,
.profile-detail-list span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.profile-readout strong { font-size: 1.35rem; line-height: 1.1; }
.profile-readout small  { color: var(--muted); line-height: 1.35; font-size: 0.82rem; }

.profile-section {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 0.5px solid var(--line);
}

.profile-detail-list { display: grid; gap: 8px; }

.profile-detail-list > div {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--row);
}

.profile-detail-list strong { min-width: 0; overflow-wrap: anywhere; }

/* ── FORM FIELDS ─────────────────────────────────────────── */
.field { display: grid; gap: 6px; }

.field label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-input);
  outline: none;
  background: var(--input);
  color: var(--text);
  transition: border-color var(--duration) ease, box-shadow var(--duration) ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.field input,
.field textarea,
.field select,
.exercise-editor-row input,
.exercise-editor-row select {
  background: var(--input);
  color: var(--text);
}

.field textarea { min-height: 100px; resize: vertical; }
.compact-note textarea { min-height: 60px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.checkbox-row input { width: 18px; height: 18px; flex: 0 0 auto; }

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.field-label-row small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: right;
}

.input-with-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
  gap: 8px;
}

.input-stepper { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
.stepper-buttons { display: grid; gap: 4px; }

.compact-stepper {
  width: 44px; height: 20px;
  min-height: 0;
  font-size: 0.66rem;
  line-height: 1;
}

.input-with-select select {
  min-height: 44px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-input);
  background: var(--input);
  color: var(--text);
}

/* ── STATS ───────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.stat {
  padding: 14px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 3px;
}

/* ── TRAINING MODE ───────────────────────────────────────── */
.training-mode {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-rows: auto auto auto minmax(140px, 1fr) auto auto;
  gap: 12px;
  padding: 18px 0;
}

.training-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.training-header-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.training-header-info strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.training-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
}

.training-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.training-ring-label span {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill-2);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--success), var(--ring-move));
  transition: width 0.3s var(--spring);
  border-radius: inherit;
}

.workout-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workout-title {
  font-size: clamp(1.8rem, 9vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -1.5px;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.workout-set {
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.set-progress-card,
.next-exercise-preview,
.resume-dialog-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.set-progress-card > div:first-child,
.next-exercise-preview > div,
.resume-dialog-current {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.set-progress-card span,
.next-exercise-preview span,
.resume-dialog-current span,
.training-overview-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.set-progress-card strong,
.next-exercise-preview strong,
.resume-dialog-current strong { min-width: 0; overflow-wrap: anywhere; }

.set-progress-card small,
.next-exercise-preview small,
.resume-dialog-current small { color: var(--muted); }

.set-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.set-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--fill-2);
}

.set-dots span.done    { background: var(--success); }
.set-dots span.skipped { background: var(--warning); }
.set-dots span.current { box-shadow: 0 0 0 2px var(--primary); }

.workout-gif {
  width: min(100%, 520px);
  height: clamp(160px, 32dvh, 380px);
  max-height: 36vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  justify-self: center;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.workout-gif.placeholder { display: none; }

.training-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.training-actions.paused { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.training-actions .btn {
  min-height: 56px;
  padding: 0 10px;
  font-size: 0.92rem;
  white-space: normal;
}

.training-actions .btn span { font-weight: 900; }

.warmup-pause-btn {
  min-height: 56px;
  display: inline-grid;
  grid-template-columns: 18px minmax(0, auto);
  grid-template-rows: auto auto;
  justify-content: center;
  align-items: center;
  gap: 1px 6px;
  padding: 8px 10px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--primary);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.08;
  cursor: pointer;
  transition: background var(--duration) ease, border-color var(--duration) ease;
}

.warmup-pause-btn.selected {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-dim);
}

.warmup-check-slot {
  width: 18px; height: 18px;
  display: grid;
  place-items: center;
  grid-row: 1 / span 2;
}

.warmup-check-slot .nav-svg { width: 18px; height: 18px; }

.warmup-pause-btn small {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.15;
}

/* ── TRAINING DASHBOARD ──────────────────────────────────── */
.training-dashboard { display: grid; gap: 12px; }

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.insight-card,
.chart-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: gb-fade-up 0.4s var(--spring) both;
}

.insight-card span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.insight-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.08;
}

.insight-card small { color: var(--muted); line-height: 1.35; font-size: 0.8rem; }

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

/* ── DONUT CHART ─────────────────────────────────────────── */
.donut-layout {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut-chart {
  width: min(190px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--donut));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.donut-center {
  width: 58%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
  box-shadow: 0 0 0 0.5px var(--line);
}

.donut-center strong,
.donut-center span { display: block; }
.donut-center strong { font-size: 1.45rem; line-height: 1; font-weight: 800; }
.donut-center span   { color: var(--muted); font-size: 0.75rem; font-weight: 700; }

/* ── CHART LEGEND ────────────────────────────────────────── */
.chart-legend { display: grid; gap: 7px; }

.legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--row);
}

.legend-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.legend-row span:last-child { color: var(--muted); font-weight: 700; font-size: 0.82rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--dot); }

/* ── WEEK CHART ──────────────────────────────────────────── */
.week-chart {
  min-height: 200px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.week-bar {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 5px;
  text-align: center;
}

.week-bar > div {
  height: 140px;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: var(--row);
}

.week-bar > div span {
  width: min(32px, 74%);
  height: var(--bar-height);
  min-height: 4px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--primary), var(--ring-purple));
  transition: height 0.3s var(--spring);
}

.week-bar strong { font-size: 0.92rem; font-weight: 700; }
.week-bar small  { color: var(--muted); font-size: 0.7rem; }

/* ── RANK BARS ───────────────────────────────────────────── */
.rank-bars { display: grid; gap: 10px; min-width: 0; overflow: hidden; }

.rank-row { display: grid; gap: 5px; min-width: 0; }
.rank-row-title { display: grid; min-width: 0; }

.rank-row strong {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 0.88rem;
  line-height: 1.18;
}

.rank-track {
  position: relative;
  min-width: 0;
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--row);
}

.rank-track .rank-fill {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: var(--rank-width);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--ring-cyan));
  transition: width 0.4s var(--spring);
}

.rank-track small {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 9px;
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

/* ── COMPLETION METER ────────────────────────────────────── */
.completion-meter {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.completion-ring {
  width: 120px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 58%, transparent 59%),
    conic-gradient(var(--success) var(--completion), var(--row) 0);
}

.completion-ring strong { font-size: 1.35rem; font-weight: 800; }

.completion-copy { display: grid; gap: 4px; }
.completion-copy span { color: var(--muted); }

/* ── TRACKING QUICK CARDS ────────────────────────────────── */
.tracking-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tracking-quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  padding: 14px 10px;
  border-radius: var(--r-card);
  border: 0.5px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition:
    transform var(--duration) var(--spring),
    box-shadow var(--duration) ease,
    border-color var(--duration) ease;
  -webkit-tap-highlight-color: transparent;
}

.tracking-quick-card:hover {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--line));
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.tracking-quick-card:active { transform: scale(0.94); box-shadow: none; }

.tracking-quick-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.tracking-quick-label {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: var(--text);
}

.tracking-quick-hint {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: -4px;
}

/* ── SESSION CARDS ───────────────────────────────────────── */
.training-session-card,
.training-list-card { align-content: start; }

.training-list-card > h2 { align-self: start; line-height: 1.2; }

.tracking-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* ── LIVE ACTIVITY DISPLAY ───────────────────────────────── */
.active-activity-live {
  display: grid;
  gap: 16px;
  padding: 0;
}

.live-activity-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px 28px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 0.5px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.live-activity-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,122,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}

:root[data-theme='dark'] .live-activity-hero::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(10,132,255,0.13) 0%, transparent 70%);
}

.live-activity-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.live-dot.is-live {
  background: var(--danger);
  animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

.live-activity-timer {
  font-size: clamp(3rem, 16vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.live-activity-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.live-activity-since {
  font-size: 0.82rem;
}

.live-activity-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 0.5px solid var(--line);
  box-shadow: var(--shadow);
}

.live-stat {
  text-align: center;
  min-width: 80px;
}

.live-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.live-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

.live-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--line);
  border-radius: 1px;
}

/* ── ACTIVITY GRID ───────────────────────────────────────── */
.activity-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(110px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.activity-grid::-webkit-scrollbar { display: none; }

.activity-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 0;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  scroll-snap-align: start;
  transition:
    transform var(--duration) var(--spring),
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.activity-card:active { transform: scale(0.95); }

.activity-card.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow);
}

.activity-card-cover {
  width: 70px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--row);
}

.activity-card span { font-weight: 700; font-size: 0.9rem; }
.activity-card small{ color: var(--muted); text-align: center; font-size: 0.8rem; }

.activity-last-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.activity-last-card span,
.activity-last-card small { color: var(--muted); }

.activity-start-card,
.active-activity-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.activity-active-head {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.active-activity-card .stats,
.active-activity-card .button-row { grid-column: 1 / -1; }

/* ── TRAINING SESSION CARD ACCENT ────────────────────────── */
.training-session-card {
  border-left: 3px solid var(--success);
}

/* ── SESSION HEAD ────────────────────────────────────────── */
.session-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.session-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--row);
}

.session-progress span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--ring-move));
}

.session-stats.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.session-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.session-exercises > span {
  max-width: 100%;
  min-width: 0;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-dim);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ── MARQUEE TEXT ────────────────────────────────────────── */
.marquee-text {
  min-width: 0;
  display: block;
  overflow: hidden;
  white-space: nowrap;
}

.marquee-text > span { display: inline-block; min-width: max-content; }

.marquee-text.is-overflowing > span {
  animation: marquee-scroll var(--marquee-duration, 6s) linear infinite alternate;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--marquee-distance, 0px))); }
}

/* ── SESSION DETAILS ─────────────────────────────────────── */
.session-detail-list,
.tracking-chart-stack { display: grid; gap: 10px; }

.session-detail-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.session-detail-row.skipped { opacity: 0.55; }

.session-detail-gif {
  width: 86px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.session-detail-gif.placeholder { display: block; }

.session-detail-main { min-width: 0; display: grid; gap: 6px; }

.session-detail-row span,
.session-detail-row small { color: var(--muted); }

.session-detail-main > span {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.session-detail-row strong,
.session-detail-row p { min-width: 0; overflow-wrap: anywhere; }

.session-detail-row p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.session-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(50px, auto));
  gap: 8px;
  text-align: right;
}

.metric-pair { display: grid; gap: 2px; }
.metric-pair span { color: var(--primary-strong); font-weight: 800; }

.session-set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
}

.session-set-detail {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.session-set-detail.skipped {
  background: color-mix(in srgb, var(--row) 72%, var(--surface));
  opacity: 0.7;
}

.session-set-detail span {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.session-set-detail strong { font-size: 0.92rem; font-weight: 700; }

/* ── SIMPLE CHART ────────────────────────────────────────── */
.simple-chart {
  min-height: 160px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(44px, 1fr);
  gap: 8px;
  align-items: end;
  overflow-x: auto;
  padding: 4px 2px 2px;
}

.simple-bar {
  min-width: 44px;
  display: grid;
  grid-template-rows: 104px auto auto;
  gap: 5px;
  text-align: center;
}

.calorie-balance-chart {
  min-height: 180px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(60px, 1fr);
  gap: 8px;
  align-items: end;
  overflow-x: auto;
  padding: 4px 2px 2px;
}

.calorie-balance-bar {
  min-width: 60px;
  display: grid;
  grid-template-rows: 110px auto auto auto;
  gap: 5px;
  text-align: center;
}

.calorie-bar-shell { position: relative; height: 110px; }

.calorie-intake {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: var(--intake-height);
  display: block;
  overflow: hidden;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 54%, var(--surface)));
}

.calorie-burned {
  position: absolute;
  left: 20%; right: 20%; bottom: 0;
  height: var(--burned-height);
  display: block;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--success));
}

.calorie-balance-bar strong { font-size: 0.72rem; line-height: 1.15; font-weight: 700; }
.calorie-balance-bar small  { color: var(--muted); font-size: 0.65rem; line-height: 1.1; }

.calorie-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.calorie-legend span { display: inline-flex; align-items: center; gap: 6px; }

.calorie-dot {
  width: 9px; height: 9px;
  display: inline-block;
  border-radius: 50%;
}

.calorie-dot.intake { background: var(--accent); }
.calorie-dot.burned { background: var(--primary); }

.simple-bar span {
  align-self: end;
  width: 100%;
  height: var(--bar-height);
  min-height: 6px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--ring-cyan));
}

.simple-bar strong { font-size: 0.72rem; line-height: 1.15; font-weight: 700; }
.simple-bar small  { color: var(--muted); font-size: 0.68rem; }

/* ── LINE CHART ──────────────────────────────────────────── */
.line-chart { display: grid; gap: 8px; }

.line-chart svg { width: 100%; min-height: 160px; overflow: visible; }
.line-chart line { stroke: var(--line); stroke-width: 1; }

.line-chart polyline {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart circle {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.line-chart-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.7rem;
}

.line-chart-labels span { display: grid; gap: 2px; min-width: 0; }

.line-chart-labels strong {
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.1;
  white-space: nowrap;
}

.line-chart-labels small { color: var(--muted); }

/* ── MODALS ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: end center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.48);
  animation: backdrop-in 0.2s ease both;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  width: min(620px, 100%);
  max-height: min(88vh, 780px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 20px 20px 16px 16px;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  animation: modal-in 0.24s var(--spring) both;
}

@keyframes backdrop-in { from { opacity: 0; } }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
}

.wide-modal { width: min(820px, 100%); }

.plan-detail-modal {
  max-height: min(88dvh, 780px);
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.modal-sticky-head {
  position: sticky;
  top: -20px;
  z-index: 2;
  align-items: center;
  padding: 0 0 10px;
  background: var(--surface);
}

.compact-actions {
  flex-wrap: nowrap;
  gap: 8px;
}
.compact-actions .btn {
  min-width: 0;
  flex-shrink: 1;
}

/* ── SETTINGS ────────────────────────────────────────────── */
.settings-group {
  display: grid;
  gap: 12px;
  padding: 12px 0;
  border-top: 0.5px solid var(--line);
}

.settings-group:first-of-type { border-top: 0; }

.switch-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.switch {
  position: relative;
  width: 50px;
  height: 30px;
  display: inline-flex;
  flex-shrink: 0;
}

.switch input { position: absolute; inset: 0; opacity: 0; }

.switch span {
  width: 100%;
  border-radius: 999px;
  background: var(--fill-1);
  transition: background 0.22s ease;
}

.switch span::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
  transition: transform 0.22s var(--spring);
}

.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(20px); }

.settings-links,
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── TEXT LINKS ──────────────────────────────────────────── */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0;
  color: var(--primary);
  background: transparent;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--duration) ease, opacity var(--duration) ease;
}

.text-link:hover  { opacity: 0.75; }
.text-link:active { opacity: 0.55; }

/* ── LEGAL COPY ──────────────────────────────────────────── */
.legal-copy {
  display: grid;
  gap: 10px;
  color: var(--muted);
  line-height: 1.58;
}

/* ── PLAN SEARCH ─────────────────────────────────────────── */
.plan-search-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--input);
  color: var(--text);
  transition: border-color var(--duration) ease, box-shadow var(--duration) ease;
}

.plan-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  outline: none;
}

.plan-search-results { display: grid; grid-template-columns: 1fr; gap: 16px; }
.plan-search-results section { display: grid; gap: 10px; }

.plan-search-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
}

.plan-search-item h4 { margin: 8px 0 4px; font-size: 1rem; }

/* ── PLAN DETAIL SWIPE ───────────────────────────────────── */
.plan-detail-swipe {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-snap-stop: always;
  padding-bottom: 8px;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.plan-detail-swipe::-webkit-scrollbar { display: none; }

.plan-detail-panel {
  position: relative;
  min-width: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.plan-detail-panel::before {
  content: '';
  position: sticky;
  top: 0;
  z-index: 2;
  height: 18px;
  margin: -14px -14px -18px;
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  pointer-events: none;
}

.plan-detail-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 34%);
  gap: 14px;
  align-items: center;
}

.plan-detail-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--row);
}

.plan-detail-title {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -14px -14px 0;
  padding: 12px 14px 10px;
  border-bottom: 0.5px solid var(--line);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  box-shadow: 0 14px 24px -22px rgba(0,0,0,0.52);
}

.plan-detail-title::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -26px;
  height: 26px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.18);
  -webkit-backdrop-filter: blur(14px) saturate(1.18);
  pointer-events: none;
}

.plan-detail-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.plan-detail-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: width var(--duration) ease, background var(--duration) ease;
}

.plan-detail-dots span.active {
  width: 18px;
  border-radius: 999px;
  background: var(--primary);
}

/* ── FAVORITE DIALOG ─────────────────────────────────────── */
.favorite-dialog-head {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.favorite-dialog-thumb {
  width: 106px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  background: var(--row);
}

.favorite-dialog-title { min-width: 0; display: grid; gap: 4px; }

.favorite-usage {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
  text-align: left;
}

.favorite-usage span,
.favorite-usage small { color: var(--muted); font-size: 0.78rem; }

/* ── TRAINING OVERVIEW ───────────────────────────────────── */
.training-overview-list { display: grid; gap: 7px; }

.training-overview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--row);
}

.training-overview-row.current {
  border-color: color-mix(in srgb, var(--primary) 44%, var(--line));
  background: var(--primary-dim);
}

.training-overview-row div { min-width: 0; display: grid; gap: 3px; }

.training-overview-row strong,
.training-overview-row small { min-width: 0; overflow-wrap: anywhere; }
.training-overview-row small { color: var(--muted); }

/* ── PLAN EDITOR ─────────────────────────────────────────── */
.editor-block  { display: grid; gap: 10px; }
.exercise-editor-list { display: grid; gap: 7px; }

.exercise-editor-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 44px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.exercise-editor-row input,
.exercise-editor-row select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-input);
  outline: none;
  transition: border-color var(--duration) ease;
}

.exercise-editor-row input:focus,
.exercise-editor-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.drag-handle {
  width: 36px; height: 42px;
  display: grid;
  place-items: center;
  border: 0.5px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  cursor: grab;
  font-weight: 900;
}

.drag-svg { width: 20px; height: 20px; }
.drag-handle:active { cursor: grabbing; }
.exercise-editor-row.is-dragging { opacity: 0.5; }

.exercise-editor-row.drop-before::before,
.exercise-editor-row.drop-after::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.exercise-editor-row.drop-before::before { top: -6px; }
.exercise-editor-row.drop-after::after   { bottom: -6px; }

.exercise-details-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 70px 78px minmax(86px, 0.7fr) minmax(120px, 0.8fr);
  gap: 8px;
  padding: 8px;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: var(--row);
}

.exercise-details-editor[hidden] { display: none; }

/* ── GIF SEARCH / PICKER ─────────────────────────────────── */
.gif-search { display: grid; gap: 10px; grid-template-columns: 1fr auto; }

.gif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.gif-picker-popover {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: end center;
  padding: 12px;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.gif-picker-panel {
  width: min(820px, 100%);
  max-height: min(88vh, 780px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.gif-picker-search {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--input);
  color: var(--text);
}

.gif-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--row);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--duration) ease,
    box-shadow var(--duration) ease,
    transform var(--duration) var(--spring);
}

.gif-card:hover      { border-color: color-mix(in srgb, var(--primary) 42%, var(--line)); transform: translateY(-1px); }
.gif-card.selected   { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.gif-card:active     { transform: scale(0.96); }

.gif-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.gif-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface);
}

.cover-card img { object-fit: contain; }

.gif-card code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.72rem;
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty {
  padding: 20px;
  border: 0.5px dashed var(--line);
  border-radius: var(--r-card);
  color: var(--muted);
  background: var(--fill-3);
  text-align: center;
  font-size: 0.9rem;
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  z-index: 500;
  width: max-content;
  max-width: min(400px, calc(100vw - 32px));
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 14px;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-soft));
  border: 0.5px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  box-shadow: var(--shadow-lift);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in 0.2s var(--spring) both;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
}

/* ── DESKTOP SIDEBAR ─────────────────────────────────────── */
.desktop-footer { display: none; }

/* ── TRAINING MODE SMALL SCREEN ──────────────────────────── */
@media (max-width: 859px) {
  .training-active-shell .content {
    padding: 0 12px max(18px, env(safe-area-inset-bottom));
  }

  .training-active-shell .desktop-footer,
  .training-active-shell + .mobile-nav,
  .training-active-shell ~ .mobile-nav { display: none; }

  .training-mode {
    min-height: 100dvh;
    overflow: visible;
    grid-template-rows: auto auto auto minmax(120px, 1fr) auto auto;
    gap: 7px;
    padding: max(12px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
  }

  .training-header { min-height: 52px; padding: 8px 0; }

  .workout-panel { min-height: 0; align-content: start; gap: 7px; padding: 10px; }

  .workout-title { font-size: clamp(1.35rem, 7.2vw, 2.55rem); }

  .field textarea { min-height: 60px; }

  .workout-gif { height: clamp(120px, 30dvh, 260px); max-height: 32dvh; }

  .training-actions .btn { min-height: 48px; padding: 0 8px; font-size: 0.82rem; }

  .warmup-pause-btn { min-height: 48px; padding: 6px 7px; font-size: 0.7rem; }

  .training-actions {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .training-actions.paused {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "skip note" "pause warmup";
  }

  .training-actions.paused .skip-action   { grid-area: skip; }
  .training-actions.paused .note-action   { grid-area: note; }
  .training-actions.paused .pause-action  { grid-area: pause; }
  .training-actions.paused .warmup-pause-btn { grid-area: warmup; }
  .training-actions.paused .pause-action span { display: block; margin-top: 2px; }
  .training-actions .btn.primary { grid-column: span 1; }

  .next-exercise-preview,
  .set-progress-card {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    padding: 9px;
  }

  .plans-swipebar .exercise-dose { display: none; }
  .plans-swipebar { grid-auto-columns: 100%; gap: 10px; padding: 2px 0 6px; }
}

@media (max-width: 859px) and (max-height: 760px) {
  .training-active-shell .content { padding-left: 8px; padding-right: 8px; }

  .training-mode { gap: 5px; padding-top: 6px; padding-bottom: 8px; }

  .training-header { min-height: 40px; padding: 4px 0; font-size: 0.84rem; }

  .progress { height: 5px; }

  .workout-panel { gap: 5px; padding: 8px; }

  .workout-title { font-size: clamp(1.15rem, 6.2vw, 2rem); line-height: 1; }

  .workout-set { font-size: 1rem; }

  .set-progress-card,
  .next-exercise-preview { gap: 6px; padding: 7px; }

  .set-progress-card span,
  .next-exercise-preview span { font-size: 0.66rem; }

  .set-progress-card strong,
  .next-exercise-preview strong,
  .next-exercise-preview small { font-size: 0.8rem; }

  .set-dots span { width: 8px; height: 8px; }

  .workout-gif { height: clamp(96px, 25dvh, 190px); max-height: 27dvh; }

  .training-actions .btn { min-height: 40px; font-size: 0.74rem; }

  .warmup-pause-btn { min-height: 40px; font-size: 0.66rem; padding: 5px; }
  .warmup-pause-btn small { font-size: 0.58rem; }
}

/* ── SMALL PHONES ────────────────────────────────────────── */
@media (max-width: 379px) {
  .content { padding-left: 12px; padding-right: 12px; overflow-x: hidden; }

  .training-dashboard,
  .training-history,
  .training-chart-grid,
  .training-chart-grid.compact,
  .chart-card,
  .insight-grid,
  .stats { min-width: 0; }

  .insight-grid,
  .stats { grid-template-columns: 1fr; }

  .chart-card { padding: 12px; }

  .donut-chart { width: min(150px, 100%); }

  .week-chart { gap: 5px; }
}

@media (max-width: 520px) {
  .mobile-topbar { padding: 8px 12px; }
  .brand-name { font-size: 0.92rem; letter-spacing: -0.4px; }

  .mobile-topbar .btn.compact { min-width: 0; padding: 0 10px; }

  .bento-grid { gap: 10px; }
  .bento-stat-value { font-size: 26px; }

  .exercise-editor-row { grid-template-columns: 36px minmax(0, 1fr) auto 44px; }

  .favorite-plan-grid { grid-auto-columns: 84px; }
  .favorite-plan-icon { padding: 7px; }

  .tracking-actions { grid-template-columns: 1fr; }

  .activity-start-card,
  .active-activity-card { grid-template-columns: 1fr; }

  .favorite-dialog-head { grid-template-columns: 80px minmax(0, 1fr); gap: 12px; }
  .favorite-dialog-thumb { width: 80px; }

  .cover-editor,
  .favorite-editor,
  .plan-detail-intro { grid-template-columns: 1fr; }

  .plan-detail-cover { width: min(190px, 100%); justify-self: start; }

  .exercise-details-editor { grid-template-columns: 64px 76px minmax(0, 1fr); }

  .exercise-details-editor input[name='exerciseTarget'],
  .exercise-details-editor .gif-picker-button { grid-column: 1 / -1; }

  .plans-swipebar .plan-card-summary {
    grid-template-columns: minmax(0, 1fr) 56px;
    align-items: start;
  }

  .plans-swipebar .plan-card-pills { grid-column: 1 / -1; }
  .plans-swipebar .plan-card-copy  { grid-column: 1; grid-row: 2; }

  .plans-swipebar .plan-card-cover {
    grid-column: 2; grid-row: 2;
    width: 56px; max-width: 56px;
    aspect-ratio: 1; justify-self: end;
    font-size: 1.1rem;
  }

  .gif-search { grid-template-columns: 1fr; }
  .gif-picker-popover { place-items: end center; }

  .exercise-row.with-media { grid-template-columns: 54px minmax(0, 1fr); }
  .exercise-gif-thumb { width: 54px; }

  .profile-readout-grid { grid-template-columns: 1fr; }

  .profile-detail-list > div { grid-template-columns: 1fr; gap: 4px; }

  .donut-layout,
  .completion-meter { grid-template-columns: 1fr; justify-items: center; }

  .chart-legend,
  .completion-copy { width: 100%; }

  .week-chart { gap: 6px; }

  .week-bar > div { height: 110px; padding: 6px 2px; }

  .session-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 8px;
  }

  .plans-swipebar .exercise-dose { display: none; }
  .plans-swipebar .exercise-row.with-media { grid-template-columns: 54px minmax(0, 1fr); }

  .session-detail-row { grid-template-columns: 68px minmax(0, 1fr); }

  .session-detail-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, auto));
    justify-content: start;
    text-align: left;
  }

  .session-detail-gif { width: 68px; }

  .plan-search-item { align-items: stretch; }

  .training-overview-row { grid-template-columns: 1fr; }
}

/* ── DESKTOP LAYOUT ──────────────────────────────────────── */
@media (min-width: 860px) {
  .app-shell { grid-template-columns: 256px 1fr; }

  .main-panel {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 24px;
    padding: 22px 16px;
    border-right: 0.5px solid var(--line);
    background: var(--surface);
    overflow-y: auto;
  }

  .sidebar-nav { display: grid; align-content: start; gap: 4px; }

  .sidebar-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: var(--r-btn);
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: -0.1px;
    transition:
      color var(--duration) ease,
      background var(--duration) ease,
      transform var(--duration) var(--spring);
  }

  .sidebar-item:hover {
    color: var(--text);
    background: var(--fill-3);
  }

  .sidebar-item.active {
    color: var(--primary);
    background: var(--primary-dim);
    font-weight: 700;
  }

  .sidebar-item.active .accent-stroke { stroke: var(--accent); }

  .sidebar-item .nav-svg { width: 20px; height: 20px; }

  .mobile-topbar,
  .mobile-nav { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 0 28px;
    border-bottom: 0.5px solid var(--line);
    background: var(--topbar-bg);
    backdrop-filter: saturate(1.8) blur(var(--nav-blur));
    -webkit-backdrop-filter: saturate(1.8) blur(var(--nav-blur));
    transition: background var(--duration) var(--spring);
  }

  .topbar strong { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.3px; }

  .resume-banner {
    top: 68px;
    width: calc(100% - 56px);
    max-width: 1120px;
    margin: 12px auto 0;
  }

  .content {
    flex: 1;
    padding: 24px 28px 60px;
  }

  .desktop-footer {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 20px 28px 32px;
    display: grid;
    grid-template-columns: minmax(160px, 0.6fr) minmax(280px, 1fr) auto;
    align-items: center;
    gap: 18px;
    border-top: 0.5px solid var(--line);
  }

  .footer-meta { display: grid; gap: 4px; }
  .footer-meta strong { font-weight: 700; }

  .footer-links {
    display: flex;
    justify-content: flex-end;
    gap: 18px;
  }

  .desktop-footer .ad-slot { min-height: 90px; }

  .grid.two {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  }

  .training-chart-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  }

  .training-chart-grid.compact {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  }

  .plan-roulette {
    grid-auto-columns: minmax(280px, 360px);
  }

  .plans-swipebar {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    grid-auto-columns: initial;
    overflow: visible;
    padding: 0;
    scroll-snap-type: none;
  }

  .stats { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

  .training-mode { min-height: calc(100vh - 118px); }

  .modal-backdrop { place-items: center; }

  .modal { border-radius: 20px; }

  .session-stats.stats { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

  .plan-search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  :root[data-theme='dark'] .topbar,
  :root[data-theme='dark'] .sidebar {
    border-color: var(--line);
  }
}

/* ── VIEW ENTRANCE ANIMATION ─────────────────────────────── */
@keyframes gb-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page {
  animation: gb-view-in 0.28s var(--spring) both;
}

/* ── DAILY SPLASH SCREEN ─────────────────────────────────── */
.gb-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #000000;
  pointer-events: all;
}

:root[data-theme='light'] .gb-splash {
  background: linear-gradient(160deg, #F2F2F7 0%, #E5E5EF 100%);
}

.gb-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: gb-splash-pop 0.65s var(--spring-fast) both;
}

.gb-splash-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: contain;
  box-shadow: 0 12px 40px rgba(10,132,255,0.22), 0 3px 12px rgba(0,0,0,0.22);
}

.gb-splash-wordmark {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.7px;
  color: #ffffff;
  line-height: 1;
}

:root[data-theme='light'] .gb-splash-wordmark {
  color: #000000;
}

.gb-splash-tagline {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-top: -6px;
}

:root[data-theme='light'] .gb-splash-tagline {
  color: rgba(0,0,0,0.38);
}

.gb-splash.is-exiting {
  animation: gb-splash-exit 0.52s var(--spring) forwards;
  pointer-events: none;
}

@keyframes gb-splash-pop {
  0%   { opacity: 0; transform: scale(0.72) translateY(10px); }
  70%  { transform: scale(1.04) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes gb-splash-exit {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.08); }
}

/* ── TRAINING MODE PREMIUM STYLES ────────────────────────── */
.workout-panel {
  position: relative;
  overflow: hidden;
}

.workout-panel::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,122,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}

:root[data-theme='dark'] .workout-panel::before {
  background: radial-gradient(circle, rgba(10,132,255,0.12) 0%, transparent 70%);
}

/* Animated number for workout set target */
.workout-set {
  animation: gb-fade-up 0.2s var(--spring-fast) both;
}

/* ── BRAND GRADIENT WORDMARK ─────────────────────────────── */
.brand-name {
  font-size: 1.0rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  background: linear-gradient(125deg, var(--text) 0%, color-mix(in srgb, var(--text) 50%, var(--primary)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── STREAK CHEVRON ──────────────────────────────────────── */
.streak-chevron {
  position: absolute;
  bottom: 14px;
  right: 14px;
  opacity: 0.4;
  color: rgba(255,255,255,0.9);
  transition: opacity var(--duration) ease, transform var(--duration) var(--spring);
}
.streak-cell:hover .streak-chevron,
.streak-cell:active .streak-chevron {
  opacity: 0.8;
  transform: translateX(3px);
}
:root[data-theme='light'] .streak-chevron { color: rgba(13,43,28,0.7); }

/* ── MUSCLE MAP ──────────────────────────────────────────── */
.muscle-map-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #09090f 0%, #070710 100%);
  overflow: hidden;
}
:root[data-theme='light'] .muscle-map-wrap {
  background: linear-gradient(145deg, #eeeef6 0%, #e4e4f0 100%);
}

.muscle-map-svg {
  width: 100%;
  height: 100%;
}

.mm-base {
  fill: rgba(150,150,180,0.14);
}
:root[data-theme='light'] .mm-base {
  fill: rgba(80,80,120,0.12);
}

/* Non-targeted: clean low-contrast translucent gray */
.mm-muscle {
  fill: #2C2C2E;
  transition: fill 0.38s ease, filter 0.38s ease, opacity 0.38s ease;
}
:root[data-theme='light'] .mm-muscle {
  fill: #E5E5EA;
}

/* Targeted muscles: vibrant gradient fill + neon glow + pulse */
.mm-muscle.is-targeted {
  animation: mm-pulse 2.8s ease-in-out infinite;
}
.muscle-map-wrap:hover .mm-muscle.is-targeted {
  animation-duration: 1.4s;
}

/* Per-muscle neon colors via data-muscle attribute */
.mm-muscle.is-targeted[data-muscle="chest"]      { fill: rgba(255,107,0,0.82);   filter: drop-shadow(0 0 7px rgba(255,107,0,0.72)); }
.mm-muscle.is-targeted[data-muscle="shoulders"]   { fill: rgba(255,159,10,0.82);  filter: drop-shadow(0 0 7px rgba(255,159,10,0.68)); }
.mm-muscle.is-targeted[data-muscle="biceps"]      { fill: rgba(48,209,88,0.85);   filter: drop-shadow(0 0 7px rgba(48,209,88,0.7)); }
.mm-muscle.is-targeted[data-muscle="triceps"]     { fill: rgba(52,199,89,0.78);   filter: drop-shadow(0 0 6px rgba(52,199,89,0.62)); }
.mm-muscle.is-targeted[data-muscle="back"]        { fill: rgba(10,132,255,0.82);  filter: drop-shadow(0 0 7px rgba(10,132,255,0.68)); }
.mm-muscle.is-targeted[data-muscle="core"]        { fill: rgba(255,107,0,0.80);   filter: drop-shadow(0 0 6px rgba(255,107,0,0.62)); }
.mm-muscle.is-targeted[data-muscle="quads"]       { fill: rgba(191,90,242,0.82);  filter: drop-shadow(0 0 7px rgba(191,90,242,0.68)); }
.mm-muscle.is-targeted[data-muscle="hamstrings"]  { fill: rgba(191,90,242,0.62);  filter: drop-shadow(0 0 6px rgba(191,90,242,0.52)); opacity: 0.72; }
.mm-muscle.is-targeted[data-muscle="glutes"]      { fill: rgba(255,159,10,0.80);  filter: drop-shadow(0 0 6px rgba(255,159,10,0.62)); }
.mm-muscle.is-targeted[data-muscle="calves"]      { fill: rgba(100,210,255,0.82); filter: drop-shadow(0 0 6px rgba(100,210,255,0.62)); }

@keyframes mm-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.68; }
}

.mm-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 22px 12px 9px;
  background: linear-gradient(transparent, rgba(0,0,0,0.58));
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.82);
  text-transform: uppercase;
  pointer-events: none;
}
:root[data-theme='light'] .mm-label {
  background: linear-gradient(transparent, rgba(0,0,0,0.28));
}

/* Hide label in mini/compact cover contexts — keeps layout clean */
.exercise-gif-thumb.muscle-map-wrap .mm-label,
.activity-card-cover.muscle-map-wrap .mm-label,
.plan-cover-placeholder.muscle-map-wrap .mm-label { display: none; }

/* ── STREAK ENERGY ICON ──────────────────────────────────── */
.streak-icon {
  width: 38px;
  height: 38px;
  margin-top: auto;
  display: block;
  overflow: visible;
  animation: streak-breathe 3.2s ease-in-out infinite;
}

.si-track {
  fill: none;
  stroke: rgba(48,209,88,0.2);
  stroke-width: 2.5;
}

.si-arc {
  fill: none;
  stroke: var(--ring-move);
  stroke-width: 2.5;
  stroke-linecap: round;
  transform-origin: 18px 18px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 3px rgba(48,209,88,0.6));
}

.si-bolt {
  fill: var(--ring-move);
  filter: drop-shadow(0 0 4px rgba(48,209,88,0.75));
}

@keyframes streak-breathe {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(48,209,88,0.35)); transform: scale(1); }
  50%       { filter: drop-shadow(0 0 9px rgba(48,209,88,0.8));  transform: scale(1.1); }
}

:root[data-theme='light'] .si-track  { stroke: rgba(0,120,60,0.18); }
:root[data-theme='light'] .si-arc    { stroke: #1A9E44; filter: drop-shadow(0 0 3px rgba(0,120,60,0.5)); }
:root[data-theme='light'] .si-bolt   { fill: #1A9E44; filter: drop-shadow(0 0 4px rgba(0,120,60,0.6)); }

/* ── PWA INSTALL BUTTON & MODAL ──────────────────────────── */
.pwa-install-btn {
  animation: pwa-pulse 2.8s ease-in-out infinite;
  color: var(--primary);
  background: var(--primary-dim);
}

@keyframes pwa-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,122,255,0.0); }
  50%       { box-shadow: 0 0 0 4px rgba(0,122,255,0.18); }
}

.pwa-modal { gap: 20px; }

.pwa-steps {
  display: grid;
  gap: 18px;
}

.pwa-step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.pwa-step-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--fill-2);
  color: var(--primary);
}

.pwa-step strong {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.pwa-step .muted {
  font-size: 0.84rem;
  line-height: 1.5;
}

.pwa-inline-icon {
  display: inline-block;
  font-style: normal;
  font-size: 1.1em;
  vertical-align: middle;
}

/* ── COOKIE CONSENT BANNER ───────────────────────────────── */
.gb-cookie-banner {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9000;
  width: min(480px, calc(100vw - 24px));
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.32s ease,
    transform 0.38s var(--spring);
}

.gb-cookie-banner.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.gb-cookie-banner.is-exiting {
  opacity: 0;
  transform: translateX(-50%) translateY(24px);
  animation: gb-cookie-exit 0.36s var(--spring) forwards;
}

@keyframes gb-cookie-exit {
  to { opacity: 0; transform: translateX(-50%) translateY(28px); }
}

.gb-cookie-inner {
  padding: 18px 20px;
  border-radius: 18px;
  border: 0.5px solid rgba(255,255,255,0.12);
  background: rgba(30,30,35,0.82);
  backdrop-filter: saturate(1.8) blur(22px);
  -webkit-backdrop-filter: saturate(1.8) blur(22px);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.38),
    0 1px 0 rgba(255,255,255,0.06) inset;
  display: grid;
  gap: 12px;
}
:root[data-theme='light'] .gb-cookie-inner {
  background: rgba(255,255,255,0.88);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14), 0 1px 0 rgba(255,255,255,0.9) inset;
}

.gb-cookie-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #FFFFFF;
}
:root[data-theme='light'] .gb-cookie-title { color: var(--text); }

.gb-cookie-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.65);
  margin: 0;
}
:root[data-theme='light'] .gb-cookie-desc { color: var(--muted); }

.gb-cookie-actions {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}

/* On desktop, banner sits above any topbar — adjust bottom anchor */
@media (min-width: 1024px) {
  .gb-cookie-banner {
    bottom: 28px;
    right: 28px;
    left: auto;
    transform: translateY(20px);
    width: min(400px, calc(100vw - 56px));
  }
  .gb-cookie-banner.is-visible {
    transform: translateY(0);
  }
  .gb-cookie-banner.is-exiting {
    transform: translateY(24px);
  }
  @keyframes gb-cookie-exit {
    to { opacity: 0; transform: translateY(28px); }
  }
}

/* ── DESKTOP LAYOUT: MAX-WIDTH + BENTO EXPANSION ─────────── */
@media (min-width: 1024px) {
  .content {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  .bento-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .bento-full { grid-column: 1 / -1; }

  /* Streak + Ring side by side, then stats fill remaining columns */
  .streak-cell { min-height: 160px; }
  .ring-cell   { min-height: 160px; }
}

/* ── SKELETON LOADERS ────────────────────────────────────── */
.gb-skeleton {
  border-radius: 8px;
  background: var(--fill-2);
  animation: gb-skeleton-pulse 1.6s ease-in-out infinite;
}

.gb-skeleton-text {
  height: 14px;
  border-radius: 4px;
  background: var(--fill-2);
  animation: gb-skeleton-pulse 1.6s ease-in-out infinite;
}

.gb-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fill-2);
  animation: gb-skeleton-pulse 1.6s ease-in-out infinite;
}

@keyframes gb-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.42; }
}

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