@font-face {
  font-family: Figtree;
  src: url("assets/fonts/Figtree-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: Figtree;
  src: url("assets/fonts/Figtree-SemiBold.ttf") format("truetype");
  font-weight: 700;
}

@font-face {
  font-family: Figtree;
  src: url("assets/fonts/Figtree-Bold.ttf") format("truetype");
  font-weight: 800;
}

:root {
  color-scheme: dark;
  --bg: #090e17;
  --panel: #101622;
  --panel-2: #161e2e;
  --panel-3: #1c273b;
  --ink: #f0f4fa;
  --muted: #8b99ae;
  --soft: #cbd4e1;
  --line: rgba(255, 255, 255, 0.06);
  --accent: #2c5ebb;
  --accent-2: #dca623;
  --accent-3: #c81528;
  --warn: #f2a93b;
  --danger: #ff5f5f;
  --radius: 14px;
  font-family: Figtree, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(47, 140, 255, 0.08), transparent 280px),
    var(--bg);
}

body.auth-required .app-shell {
  display: none;
}

button,
input {
  font: inherit;
}

input,
textarea {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 14px calc(96px + env(safe-area-inset-bottom));
}

.auth-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px;
  padding-top: calc(22px + env(safe-area-inset-top));
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 70% 8%, rgba(47, 140, 255, 0.22), transparent 32%),
    radial-gradient(circle at 20% 75%, rgba(73, 195, 139, 0.12), transparent 26%),
    radial-gradient(circle at 50% 50%, rgba(155, 124, 255, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 36%),
    var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-card {
  width: min(100%, 400px);
  display: grid;
  gap: 18px;
  padding: 24px 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background:
    linear-gradient(168deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.015) 100%),
    rgba(14, 18, 26, 0.92);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 20px 70px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  animation: authCardIn 600ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.auth-brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  animation: authFadeUp 500ms cubic-bezier(0.2, 0.9, 0.3, 1) 80ms both;
}

.auth-brand img {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: authLogoGlow 3s ease-in-out infinite alternate;
}

.auth-brand span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.6px;
}

.auth-brand span sup {
  color: var(--muted);
  font-size: 0.45rem;
  font-weight: 700;
  vertical-align: super;
  letter-spacing: 0.5px;
  margin-left: 2px;
}

.auth-brand h1 {
  margin: 2px 0 0;
  font-size: 1.5rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
  background: linear-gradient(135deg, var(--ink), var(--soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  font-size: 0.84rem;
  color: var(--muted);
  margin: -6px 0 2px;
  line-height: 1.4;
  animation: authFadeUp 500ms cubic-bezier(0.2, 0.9, 0.3, 1) 160ms both;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
  animation: authFadeUp 500ms cubic-bezier(0.2, 0.9, 0.3, 1) 240ms both;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-divider span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.auth-provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  animation: authFadeUp 500ms cubic-bezier(0.2, 0.9, 0.3, 1) 200ms both;
}

.provider-btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  color: var(--ink);
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.provider-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.06);
}

.provider-btn svg {
  width: 20px;
  height: 20px;
}

.provider-btn[data-auth-provider="google"] svg {
  color: #4285f4;
}

.provider-btn[data-auth-provider="whatsapp"] svg {
  color: #25d366;
}

.auth-form {
  display: grid;
  gap: 12px;
  animation: authFadeUp 500ms cubic-bezier(0.2, 0.9, 0.3, 1) 280ms both;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[name="code"] {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  outline: 0;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus,
.auth-form input[name="code"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.15);
  background: rgba(47, 140, 255, 0.04);
}

.auth-form input[name="code"] {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 8px;
  text-align: center;
  padding: 0 20px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--muted);
  -webkit-user-select: none;
  user-select: none;
}

.auth-remember input[type="checkbox"] {
  width: 18px !important;
  min-height: 18px !important;
  height: 18px;
  margin: 0;
  border-radius: 5px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-code {
  animation: authSlideDown 400ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.auth-status {
  min-height: 18px;
  margin: 0;
  font-size: 0.82rem;
  transition: color 200ms ease;
}

.auth-status:not(:empty) {
  color: var(--accent);
}

.auth-info-banner {
  background: rgba(47, 140, 255, 0.06);
  border: 1px solid rgba(47, 140, 255, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 2px 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  animation: authFadeUp 500ms cubic-bezier(0.2, 0.9, 0.3, 1) 360ms both;
}

.auth-info-banner strong {
  color: var(--accent);
  font-weight: 700;
}

.auth-info-banner .info-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
  color: var(--accent);
}

.auth-resend-btn {
  margin: 6px auto 0;
  font-size: 0.78rem;
  min-height: 34px;
  padding: 4px 14px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  transition: all 200ms ease;
}

.auth-resend-btn:disabled {
  color: var(--muted);
  opacity: 0.6;
}

.auth-resend-btn:not(:disabled):active {
  transform: scale(0.96);
  background: rgba(47, 140, 255, 0.08);
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes authFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes authSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
  }
}

@keyframes authLogoGlow {
  from {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }
  to {
    box-shadow: 0 4px 22px rgba(47, 140, 255, 0.18), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

@keyframes authPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-left: -14px;
  margin-right: -14px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 14px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: rgba(7, 9, 13, 0.75);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand,
.icon-btn,
.primary-btn,
.ghost-btn,
.danger-btn {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.brand:active,
.icon-btn:active,
.primary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.tabbar button:active,
.chip:active,
.check-set:active {
  transform: scale(0.96);
}

.brand {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 32px rgba(0, 0, 0, 0.22);
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.app-header p,
.metric span,
.muted,
.set-head,
.history-meta,
.exercise-subtitle {
  margin: 0;
  color: var(--muted);
}

.app-header p {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.58rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.28rem;
  line-height: 1.1;
}

h3 {
  margin-bottom: 5px;
  font-size: 1rem;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-btn {
  width: 46px;
  min-height: 46px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent), var(--panel-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.icon-btn.small {
  width: 38px;
  min-height: 38px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 44px;
  padding: 0 15px;
  font-weight: 800;
}

.primary-btn {
  background: linear-gradient(180deg, #4ea3ff, #1c6df0);
  color: #fff;
  box-shadow: 0 8px 24px rgba(47, 140, 255, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  border-radius: 16px;
}

.primary-btn.compact {
  min-height: 38px;
  padding: 0 13px;
}

.ghost-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent), rgba(255, 255, 255, 0.03);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.danger-btn {
  background: rgba(255, 95, 95, 0.14);
  color: #ff9a9a;
}

.screen {
  display: none;
  opacity: 0;
  transform: translateY(10px) scale(0.992);
}

.screen.active {
  display: block;
  animation: screenIn 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.stack {
  display: grid;
  gap: 10px;
}

.hero-card,
.panel,
.exercise-card,
.routine-card,
.history-card,
.metric,
.workout-exercise,
.picker-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.routine-card:active,
.exercise-card:active,
.history-card:active,
.picker-item:active {
  transform: translateY(1px) scale(0.992);
}

.hero-card {
  min-height: 172px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 14px;
  align-items: center;
  padding: 18px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(47, 140, 255, 0.16), transparent 46%),
    linear-gradient(315deg, rgba(73, 195, 139, 0.13), transparent 52%);
  opacity: 0.82;
}

.hero-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.9rem;
  line-height: 1;
}

.hero-card p {
  color: var(--muted);
  line-height: 1.38;
}

.hero-art {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  animation: logoFloat 4.2s ease-in-out infinite;
}

.hero-art img {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 12px 0;
}

.quick-nav-card {
  min-height: 82px;
  display: grid;
  place-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    var(--panel);
  color: var(--ink);
  font-weight: 850;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.quick-nav-card:active {
  transform: translateY(1px) scale(0.985);
}

.quick-nav-card svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

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

.metric {
  min-height: 88px;
  padding: 13px;
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 12px 10px 12px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.75;
  transform: scaleX(0.55);
  transform-origin: left;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
}

.section-row,
.routine-head,
.exercise-row,
.history-head,
.workout-top,
.set-row,
.screen-actions,
.rest-dock,
.dialog-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-row {
  margin: 18px 0 9px;
}

.section-row h2 {
  margin: 0;
}

.routine-card,
.exercise-card,
.history-card,
.panel {
  padding: 14px;
}

.routine-card {
  display: grid;
  gap: 12px;
}

.routine-media-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  min-height: 86px;
}

.routine-media-strip.single {
  grid-template-columns: 1fr;
}

.media-thumb {
  width: 100%;
  height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--panel-3);
}

.routine-main-media {
  height: 132px;
}

.routine-title,
.exercise-title {
  min-width: 0;
}

.routine-title h3,
.exercise-title h3 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.routine-meta,
.exercise-subtitle,
.history-meta {
  font-size: 0.88rem;
}

.routine-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.routine-actions .primary-btn {
  flex: 1;
}

.exercise-row {
  min-width: 0;
}

.exercise-row img,
.picker-item img,
.exercise-media {
  width: 58px;
  height: 58px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--panel-3);
}

.exercise-media,
.media-thumb {
  display: block;
  overflow: hidden;
}

video.exercise-media,
video.media-thumb {
  background: #05070b;
}

.exercise-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(47, 140, 255, 0.18), rgba(47, 140, 255, 0.08));
  color: #9cc9ff;
  font-size: 0.75rem;
  font-weight: 800;
}

.chip-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip,
.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.chip.active,
.segmented button.active {
  background: linear-gradient(180deg, #ffffff, #dbe7f7);
  color: #080b10;
  box-shadow: 0 10px 22px rgba(255, 255, 255, 0.08);
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.screen-actions {
  margin-bottom: 12px;
}

.routine-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: clamp(10px, 2.5vw, 14px);
}

#exerciseMount.stack {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.workout-top {
  position: sticky;
  top: 76px;
  z-index: 4;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    rgba(17, 21, 29, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
}

.workout-time {
  font-size: 1.45rem;
  font-weight: 800;
}

.workout-exercise {
  margin-bottom: 10px;
  overflow: hidden;
}

.workout-exercise header {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 38px;
  gap: 11px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.workout-exercise header img {
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  object-fit: cover;
}

.set-head,
.set-row {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 1fr 44px;
  gap: 7px;
  align-items: center;
  padding: 8px 12px;
}

.set-head {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.set-row input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: 0;
  background: var(--panel-2);
  color: var(--ink);
  text-align: center;
  font-weight: 800;
}

.set-row input:focus {
  border-color: rgba(47, 140, 255, 0.85);
}

.set-index {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.check-set {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: transparent;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.check-set::after {
  content: "\2713";
  color: currentColor;
  font-weight: 800;
}

.check-set.done {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: #061009;
  animation: donePop 220ms ease both;
}

.exercise-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
}

.history-card {
  display: grid;
  gap: 10px;
}

.history-head strong {
  display: block;
}

.mini-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  min-height: 96px;
  padding: 12px;
}

.bar {
  min-height: 10px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #49c38b, #2f8cff);
  transform-origin: bottom;
  animation: barGrow 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.insights-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.chart-card {
  position: relative;
  overflow: hidden;
  min-height: 196px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(47, 140, 255, 0.16), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    var(--panel);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.22);
}

.premium-chart::after {
  content: "";
  position: absolute;
  inset: auto -28px -44px 38%;
  height: 130px;
  background: radial-gradient(circle, rgba(73, 195, 139, 0.16), transparent 62%);
  pointer-events: none;
}

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

.chart-head h3 {
  margin: 0;
}

.chart-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.line-chart {
  width: 100%;
  height: 108px;
  overflow: visible;
  filter: drop-shadow(0 12px 18px rgba(47, 140, 255, 0.16));
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-area {
  opacity: 0.5;
}

.chart-line {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: drawLine 900ms ease forwards;
}

.chart-dot {
  fill: #f8fbff;
  stroke: #2f8cff;
  stroke-width: 3;
  animation: dotIn 420ms ease both;
}

.muscle-bars {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.muscle-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.muscle-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.muscle-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform-origin: left;
  animation: fillGrow 620ms ease both;
}

.ring-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.progress-ring {
  position: relative;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
}

.progress-ring svg {
  position: absolute;
  inset: 0;
  width: 112px;
  height: 112px;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 12;
}

.progress-ring .ring-track {
  stroke: rgba(255, 255, 255, 0.08);
}

.progress-ring .ring-value {
  stroke-linecap: round;
  stroke-dasharray: 302;
  transition: stroke-dashoffset 420ms ease;
}

.progress-ring strong {
  font-size: 1.32rem;
}

.spark-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  align-items: end;
  height: 54px;
  margin-top: 8px;
}

.spark {
  min-height: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  animation: barGrow 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.chart-label-row,
.chart-stat-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.chart-stat-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
  text-align: left;
}

.chart-stat-row span {
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.chart-stat-row strong {
  color: var(--ink);
  font-size: 1.18rem;
}

.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 16px;
  align-items: center;
}

.profile-hero img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.profile-actions {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.admin-panel {
  display: grid;
  gap: 12px;
}

.admin-media-form {
  display: grid;
  gap: 10px;
}

.admin-media-form label,
.choice-card {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.admin-media-form input,
.admin-media-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 0 12px;
  background: var(--panel-2);
  color: var(--ink);
}

.rest-dock {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: calc(85px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 400px);
  transform: translateX(-50%);
  padding: 8px 12px 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  background: rgba(14, 18, 26, 0.85);
  box-shadow: 
    0 4px 24px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  animation: dockIn 260ms ease both;
}

.rest-dock span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.rest-dock strong {
  font-size: 1.35rem;
}

.dock-actions {
  display: flex;
  gap: 8px;
}

.tabbar {
  position: fixed;
  z-index: 7;
  left: 50%;
  bottom: 0;
  width: min(100%, 860px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 9, 13, 0.75);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
}

.tabbar button {
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  gap: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.tabbar button.active {
  background: linear-gradient(180deg, rgba(47, 140, 255, 0.16), rgba(47, 140, 255, 0.05));
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(47, 140, 255, 0.15);
}

.tabbar svg {
  width: 21px;
  height: 21px;
}

dialog {
  width: min(calc(100% - 28px), 440px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}

body.dialog-fallback::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}

dialog[open] {
  animation: dialogIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

dialog.fallback-open {
  position: fixed;
  z-index: 20;
  top: 50%;
  left: 50%;
  display: block;
  transform: translate(-50%, -50%);
  animation: dialogFallbackIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dialog-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.dialog-card h2 {
  margin: 0;
}

.dialog-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.dialog-card input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 0 12px;
  background: var(--panel-2);
  color: var(--ink);
}

.choice-grid {
  display: grid;
  gap: 8px;
  max-height: min(44vh, 420px);
  overflow: auto;
}

.choice-card {
  grid-template-columns: 20px 58px minmax(0, 1fr);
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.choice-card input {
  min-height: auto;
  accent-color: var(--accent);
}

.choice-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.picker-list {
  display: grid;
  gap: 8px;
  max-height: min(62vh, 560px);
  overflow: auto;
}

.picker-item {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px;
  color: var(--ink);
  text-align: left;
}

.empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dialogFallbackIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes donePop {
  0% {
    transform: scale(0.82);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes dockIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes barGrow {
  from {
    transform: scaleY(0.18);
    opacity: 0.45;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes fillGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes dotIn {
  from {
    opacity: 0;
    transform: scale(0.65);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 720px) {
  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .insights-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }

  h1 {
    font-size: 1.85rem;
  }
}

@media (min-width: 431px) and (max-width: 719px) {
  .app-shell {
    padding-inline: clamp(14px, 3vw, 22px);
  }

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

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

  .insights-grid {
    grid-template-columns: 1fr;
  }

  .exercise-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .exercise-card .badge {
    grid-column: 2;
    width: fit-content;
  }


}

@media (max-width: 430px) {
  .auth-card {
    padding: 18px 14px;
  }

  .auth-brand {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .auth-brand img {
    width: 50px;
    height: 50px;
  }

  .auth-brand h1 {
    font-size: 1.42rem;
  }

  .hero-card {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .hero-art {
    display: none;
  }

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

  .ring-card {
    grid-template-columns: 1fr;
  }



  .exercise-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .exercise-card .badge {
    grid-column: 2;
    width: fit-content;
  }
}

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

  .hero-art,
  .screen.active,
  .bar,
  .spark,
  .muscle-fill,
  .chart-line,
  .chart-dot,
  .check-set.done,
  .rest-dock,
  dialog[open],
  dialog.fallback-open {
    animation: none !important;
  }

  .screen.active {
    opacity: 1;
    transform: none;
  }
}

.selected-exercise-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.selected-exercise-row img,
.selected-exercise-row video {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--panel-3);
}

.selected-exercise-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.selected-exercise-info strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-exercise-info small {
  font-size: 0.78rem;
}

.reorder-actions {
  display: flex;
  gap: 4px;
}

.ghost-btn.compact,
.danger-btn.compact {
  min-height: 32px;
  font-size: 0.82rem;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}



/* Premium Modal */
.premium-modal {
  width: min(calc(100% - 24px), 480px);
  padding: 0;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.premium-modal .modal-content {
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-header.transparent {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
}

.blur-btn {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.modal-media-hero {
  width: 100%;
  height: 280px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.modal-media-hero img,
.modal-media-hero video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.title-group h2 {
  margin: 0 0 10px 0;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}

.premium-badge {
  background: linear-gradient(135deg, var(--brand), #4b89ff);
  color: #fff;
  border: none;
  font-weight: 700;
}

.default-badge {
  background: var(--line);
  color: var(--text);
}

.ectomorph-intel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.intel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.intel-header svg {
  width: 18px;
  height: 18px;
}

.intel-tips {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.intel-tips .tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}
.intel-tips .tip strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}


.exercise-card {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.exercise-card:active {
  transform: scale(0.98);
}


.history-intel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border-left: 3px solid var(--brand);
}

.history-date {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.history-data {
  font-size: 0.95rem;
  color: var(--text);
}

