/* ============================================
   AMAGEZ WORKOUT — Modern Fitness Design System
   Light / Dark Mode · Barlow Condensed + Barlow
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* =============================================
   THEME TOKENS
   ============================================= */

/* --- Light Mode --- */
[data-theme="light"] {
  --c-bg:         #f2f2f7;
  --c-bg-raised:  #ffffff;
  --c-surface:    #ffffff;
  --c-surface2:   #f0f0f5;
  --c-surface3:   #e8e8f0;
  --c-border:     #dcdce4;
  --c-border-l:   #ececf0;
  --c-text:       #1a1a2e;
  --c-text2:      #555568;
  --c-text3:      #8e8ea0;
  --c-primary:    #dc2626;
  --c-primary-h:  #b91c1c;
  --c-primary-l:  #ef4444;
  --c-primary-bg: rgba(220,38,38,0.08);
  --c-primary-border: rgba(220,38,38,0.18);
  --c-accent:     #ea580c;
  --c-accent-bg:  rgba(234,88,12,0.08);
  --c-green:      #16a34a;
  --c-green-l:    #22c55e;
  --c-green-bg:   rgba(22,163,74,0.1);
  --c-green-border: rgba(22,163,74,0.2);
  --c-shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --c-shadow:     0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --c-shadow-lg:  0 12px 40px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
  --c-glass:      rgba(255,255,255,0.72);
  --c-glass-border: rgba(255,255,255,0.6);
  --sidebar-bg:   #ffffff;
  --sidebar-border: #e8e8f0;
  --header-glass: rgba(242,242,247,0.82);
  --overlay-bg:   rgba(0,0,0,0.3);
  --ring-track:   #e5e5ea;
  --fullscreen-bg: rgba(255,255,255,0.96);
  color-scheme: light;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --c-bg:         #0a0a12;
  --c-bg-raised:  #10101c;
  --c-surface:    #141422;
  --c-surface2:   #1c1c30;
  --c-surface3:   #24243a;
  --c-border:     #2a2a44;
  --c-border-l:   #1e1e36;
  --c-text:       #eeeef4;
  --c-text2:      #9298a8;
  --c-text3:      #5a6078;
  --c-primary:    #ef4444;
  --c-primary-h:  #dc2626;
  --c-primary-l:  #f87171;
  --c-primary-bg: rgba(239,68,68,0.1);
  --c-primary-border: rgba(239,68,68,0.2);
  --c-accent:     #fb923c;
  --c-accent-bg:  rgba(251,146,60,0.1);
  --c-green:      #22c55e;
  --c-green-l:    #4ade80;
  --c-green-bg:   rgba(34,197,94,0.1);
  --c-green-border: rgba(34,197,94,0.2);
  --c-shadow-sm:  0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --c-shadow:     0 4px 16px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.15);
  --c-shadow-lg:  0 12px 40px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.2);
  --c-glass:      rgba(20,20,34,0.72);
  --c-glass-border: rgba(42,42,68,0.6);
  --sidebar-bg:   #10101c;
  --sidebar-border: #1e1e36;
  --header-glass: rgba(10,10,18,0.82);
  --overlay-bg:   rgba(0,0,0,0.55);
  --ring-track:   #2a2a44;
  --fullscreen-bg: rgba(0,0,0,0.95);
  color-scheme: dark;
}

/* --- Design Tokens --- */
:root {
  --font-heading: 'Barlow Condensed', sans-serif;
  --font-body:    'Barlow', system-ui, sans-serif;
  --sidebar-w:    264px;
  --header-h:     60px;
  --radius:       16px;
  --radius-sm:    12px;
  --radius-xs:    8px;
  --ease:         cubic-bezier(.4,0,.2,1);
  --ease-bounce:  cubic-bezier(.34,1.56,.64,1);
}

/* --- Base --- */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text3); }

/* --- Theme Transition Helper --- */
.sidebar,
.mobile-header,
.workout-card,
.player-panel,
.media-box,
.ex-item,
.setting-row,
.btn-outline,
.ctrl-btn,
.run-btn,
.workout-time-bar,
.total-bar,
.exercise-sidebar {
  transition:
    background 0.35s var(--ease),
    border-color 0.35s var(--ease),
    color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
}

/* ======================
   THEME TOGGLE
   ====================== */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xs);
  background: var(--c-surface2);
  color: var(--c-text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  background: var(--c-surface3);
  border-color: var(--c-text3);
  color: var(--c-text);
}
.theme-toggle:active { transform: scale(0.92); }

/* Sun icon (shown in dark mode) */
.theme-toggle::before {
  content: '';
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  position: absolute;
  box-shadow:
    0 -10px 0 -6px currentColor,
    0 10px 0 -6px currentColor,
    10px 0 0 -6px currentColor,
    -10px 0 0 -6px currentColor,
    7px -7px 0 -6px currentColor,
    -7px 7px 0 -6px currentColor,
    7px 7px 0 -6px currentColor,
    -7px -7px 0 -6px currentColor;
  transition: transform 0.4s var(--ease), opacity 0.3s;
}

/* Moon icon (shown in light mode) */
.theme-toggle::after {
  content: '';
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  position: absolute;
  box-shadow: -5px -3px 0 -1px currentColor;
  transition: transform 0.4s var(--ease), opacity 0.3s;
}

[data-theme="dark"] .theme-toggle::before {
  transform: scale(1);
  opacity: 1;
}
[data-theme="dark"] .theme-toggle::after {
  transform: scale(0) rotate(-90deg);
  opacity: 0;
}
[data-theme="light"] .theme-toggle::before {
  transform: scale(0) rotate(90deg);
  opacity: 0;
}
[data-theme="light"] .theme-toggle::after {
  transform: scale(1);
  opacity: 1;
}

/* ======================
   LAYOUT — Desktop
   ====================== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  transition: margin-left 0.3s var(--ease);
}

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 40px;
}

/* Mobile header hidden on desktop */
.mobile-header { display: none; }
.sidebar-close { display: none; }
.overlay { display: none; }

/* Desktop: hide mobile theme toggle */
#themeToggleMobile { display: none; }

/* --- Sidebar Collapse (desktop only) --- */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--c-border-l);
  flex-shrink: 0;
}
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--c-text3);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.sidebar-collapse-btn:hover {
  background: var(--c-surface2);
  color: var(--c-text);
}
.sidebar-collapse-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s var(--ease);
}

.sidebar-expand-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 99;
  width: 42px;
  height: 42px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--c-shadow);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s,
              box-shadow 0.35s var(--ease);
}
.sidebar-expand-btn:hover {
  background: var(--c-surface2);
  color: var(--c-text);
  border-color: var(--c-text3);
}
.sidebar-expand-btn:active { transform: scale(0.92); }

/* Collapsed state */
.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}
.sidebar.collapsed ~ .sidebar-expand-btn {
  display: flex;
}
.sidebar.collapsed ~ .main {
  margin-left: 0;
}

/* ======================
   LAYOUT — Mobile (<1024)
   ====================== */
@media (max-width: 1023px) {
  .sidebar {
    width: 288px;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--c-shadow-lg);
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main {
    margin-left: 0;
    padding-top: var(--header-h);
  }

  .content { padding: 20px 16px; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    padding: 0 16px;
    background: var(--header-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--c-border-l);
    z-index: 90;
    transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
  }

  #themeToggleMobile {
    display: flex;
    width: 36px; height: 36px;
  }
  #themeToggleDesktop { display: none; }

  /* Hide desktop collapse on mobile */
  .sidebar-footer { display: none; }
  .sidebar-expand-btn { display: none !important; }
  .sidebar.collapsed { transform: translateX(-100%); }
  .sidebar.collapsed.open { transform: translateX(0); }

  .overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ======================
   SIDEBAR INNER
   ====================== */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 18px;
  border-bottom: 1px solid var(--c-border-l);
  flex-shrink: 0;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon, .brand-icon-sm {
  width: 38px; height: 38px;
  background: var(--c-primary);
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800; font-size: 17px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(220,38,38,0.3);
}
.brand-icon-sm {
  width: 34px; height: 34px;
  font-size: 15px;
  border-radius: 8px;
}
.brand-text, .brand-text-sm {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  color: var(--c-text);
}
.brand-text-sm { font-size: 15px; }

.mobile-header-brand { display: flex; align-items: center; gap: 10px; }

.sidebar-close, .mobile-menu-btn {
  width: 40px; height: 40px;
  border: none; background: none;
  color: var(--c-text2);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.sidebar-close:hover, .mobile-menu-btn:hover {
  background: var(--c-surface2);
  color: var(--c-text);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  overscroll-behavior: contain;
}

.nav-label {
  padding: 0 12px;
  margin: 18px 0 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--c-text3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--c-text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: var(--c-surface2);
  color: var(--c-text);
}
.nav-item.active {
  background: var(--c-primary-bg);
  color: var(--c-primary-l);
}

.nav-item-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: var(--c-border-l);
  margin: 14px 12px;
}

/* ======================
   DASHBOARD
   ====================== */
.hero-title {
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero-title span {
  color: var(--c-primary);
  position: relative;
}
.hero-desc {
  color: var(--c-text2);
  font-size: 16px;
  line-height: 1.65;
  margin-top: 12px;
  max-width: 520px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.workout-card {
  padding: 26px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease),
    transform 0.2s var(--ease),
    background 0.35s var(--ease);
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--c-shadow-sm);
}
.workout-card:hover {
  border-color: var(--c-primary-border);
  box-shadow: var(--c-shadow);
  transform: translateY(-3px);
}
.workout-card:active { transform: translateY(-1px); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.card-icon.red   { background: var(--c-primary-bg); color: var(--c-primary-l); }
.card-icon.orange { background: var(--c-accent-bg); color: var(--c-accent); }

.card-arrow {
  color: var(--c-text3);
  transition: color 0.25s, transform 0.25s;
}
.workout-card:hover .card-arrow {
  color: var(--c-primary-l);
  transform: translateX(4px);
}

.card-title {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 6px;
}
.card-desc {
  font-size: 13px;
  color: var(--c-text3);
  line-height: 1.55;
  margin-bottom: 18px;
}
.card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text2);
}
.card-meta svg { margin-right: 4px; vertical-align: -2px; }

/* ======================
   WORKOUT PAGE
   ====================== */
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text3);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin-bottom: 10px;
  transition: color 0.2s;
}
.page-back:hover { color: var(--c-text); }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.page-desc {
  font-size: 14px;
  color: var(--c-text3);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-outline {
  display: inline-flex;
  align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
  box-shadow: var(--c-shadow-sm);
}
.btn-outline:hover {
  border-color: var(--c-text3);
  color: var(--c-text);
  box-shadow: var(--c-shadow);
}

/* Workout Time Progress Bar */
.workout-time-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  box-shadow: var(--c-shadow-sm);
}
.workout-time-info {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
  font-family: var(--font-heading);
  font-variant-numeric: tabular-nums;
}
.workout-time-elapsed {
  font-weight: 700;
  font-size: 20px;
  color: var(--c-green-l);
}
.workout-time-sep {
  font-size: 14px;
  color: var(--c-text3);
  margin: 0 3px;
}
.workout-time-total {
  font-weight: 600;
  font-size: 15px;
  color: var(--c-text2);
}
.workout-time-track {
  flex: 1;
  height: 6px;
  background: var(--c-surface3);
  border-radius: 3px;
  overflow: hidden;
}
.workout-time-fill {
  height: 100%;
  background: var(--c-green);
  border-radius: 3px;
  transition: width 1s linear;
  min-width: 0;
}

/* Workout Layout */
.workout-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .workout-layout { grid-template-columns: 1fr; }
}

/* Media */
.media-box {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: zoom-in;
  box-shadow: var(--c-shadow);
}
.media-box img, .media-box video {
  width: 100%; height: 100%; object-fit: contain;
}
@media (max-width: 600px) {
  .media-box { aspect-ratio: 4/3; }
}

/* Zoom Button */
.zoom-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s, background 0.2s, transform 0.2s;
  z-index: 2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.media-box:hover .zoom-btn { opacity: 1; }
.zoom-btn:hover {
  background: var(--c-primary);
  transform: scale(1.05);
}

/* ======================
   FULLSCREEN OVERLAY
   ====================== */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.0);
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}
.fullscreen-overlay.active {
  opacity: 1;
  background: var(--fullscreen-bg);
}
.fullscreen-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--c-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  z-index: 1001;
}
.fullscreen-close:hover {
  background: var(--c-primary-bg);
  border-color: var(--c-primary-border);
}
.fullscreen-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 64px 24px 24px;
}
.fullscreen-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}
.fullscreen-media img,
.fullscreen-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}
.fullscreen-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  margin-top: 16px;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  box-shadow: var(--c-shadow);
}
.fullscreen-timer {
  flex-shrink: 0;
  transform: scale(0.5);
  transform-origin: center;
  margin: -28px -28px;
}
.fullscreen-info {
  flex: 1;
  min-width: 0;
}
.fullscreen-info .player-name {
  font-size: 16px;
  color: var(--c-text);
}
.fullscreen-info .player-meta {
  margin-top: 4px;
}
.fullscreen-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Fullscreen time bar */
.fullscreen-time-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  margin-top: 8px;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  font-family: var(--font-heading);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .fullscreen-body { padding: 56px 12px 12px; }
  .fullscreen-bar {
    gap: 10px;
    padding: 12px 16px;
  }
  .fullscreen-timer {
    transform: scale(0.45);
    margin: -32px -32px;
  }
  .fullscreen-time-bar {
    gap: 8px;
    padding: 8px 16px;
  }
}

/* ======================
   PLAYER PANEL
   ====================== */
.player-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-top: 16px;
  box-shadow: var(--c-shadow-sm);
}
@media (max-width: 600px) {
  .player-panel { gap: 14px; padding: 16px; }
}

/* Timer Ring */
.timer-ring { position: relative; flex-shrink: 0; }
.timer-ring svg { display: block; }
.timer-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-ring-num {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
  line-height: 1;
}
.timer-ring-num.warn { color: var(--c-primary-l); }
.timer-ring-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--c-text3);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.player-info { flex: 1; min-width: 0; }
.player-name {
  font-size: 19px;
  font-family: var(--font-heading);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-desc {
  font-size: 13px;
  color: var(--c-text2);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}
.player-meta {
  font-size: 12px;
  color: var(--c-text3);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.badge-auto {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--c-primary-bg);
  color: var(--c-primary-l);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ======================
   CONTROLS
   ====================== */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.ctrl-btn {
  width: 46px; height: 46px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  box-shadow: var(--c-shadow-sm);
}
.ctrl-btn:hover {
  color: var(--c-text);
  background: var(--c-surface2);
  border-color: var(--c-text3);
}
.ctrl-btn:active { transform: scale(0.94); }
.ctrl-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ctrl-btn:disabled:hover { transform: none; background: var(--c-surface); border-color: var(--c-border); color: var(--c-text2); }
.ctrl-btn.play {
  width: 58px; height: 58px;
  border-radius: 16px;
  background: var(--c-green-bg);
  border-color: var(--c-green-border);
  color: var(--c-green-l);
}
.ctrl-btn.play:hover {
  background: var(--c-green);
  color: #fff;
  border-color: var(--c-green);
}
.ctrl-btn.play.running {
  background: var(--c-primary-bg);
  border-color: var(--c-primary-border);
  color: var(--c-primary-l);
}
.ctrl-btn.play.running:hover {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/* Run Button */
.run-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-top: 18px;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.run-btn:active { transform: scale(0.98); }
.run-btn.go {
  background: var(--c-green);
  color: #fff;
  box-shadow: 0 4px 16px rgba(22,163,74,0.3);
}
.run-btn.go:hover {
  background: #15803d;
  box-shadow: 0 6px 24px rgba(22,163,74,0.35);
}
.run-btn.stop {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(220,38,38,0.3);
}
.run-btn.stop:hover {
  background: #b91c1c;
  box-shadow: 0 6px 24px rgba(220,38,38,0.35);
}

/* ======================
   EXERCISE LIST
   ====================== */
.exercise-list-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-text3);
  margin-bottom: 12px;
  padding: 0 2px;
}

.ex-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border-l);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}
.ex-item:hover {
  border-color: var(--c-border);
  background: var(--c-surface2);
  box-shadow: var(--c-shadow-sm);
}
.ex-item:active { transform: scale(0.99); }
.ex-item.active {
  border-color: var(--c-primary-border);
  background: var(--c-primary-bg);
  box-shadow: 0 0 0 1px var(--c-primary-border);
}

.ex-num {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  background: var(--c-surface2);
  color: var(--c-text3);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.ex-item.active .ex-num {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(220,38,38,0.3);
}

.ex-thumb {
  width: 44px; height: 44px;
  border-radius: var(--radius-xs);
  background: var(--c-surface2);
  overflow: hidden;
  flex-shrink: 0;
}
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; }

.ex-info { flex: 1; min-width: 0; }
.ex-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ex-item.active .ex-name { color: var(--c-primary-l); }
.ex-dur {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Exercise sidebar — scrollable fixed container */
.exercise-sidebar {
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  position: sticky;
  top: 20px;
  overscroll-behavior: contain;
}

/* Mobile exercise toggle */
.ex-toggle-btn { display: none; }
@media (max-width: 900px) {
  .ex-toggle-btn { display: inline-flex; }
  .exercise-sidebar {
    display: none;
    position: static;
    max-height: 280px;
  }
  .exercise-sidebar.show { display: block; margin-bottom: 16px; }
}

/* ======================
   SETTINGS PAGE
   ====================== */
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  flex-wrap: wrap;
  box-shadow: var(--c-shadow-sm);
}

.setting-info { flex: 1; min-width: 140px; }
.setting-name {
  font-weight: 600;
  font-size: 14px;
}
.setting-default {
  font-size: 11px;
  color: var(--c-text3);
  margin-top: 2px;
}

.setting-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.setting-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xs);
  background: var(--c-surface2);
  color: var(--c-text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.setting-btn:hover {
  background: var(--c-surface3);
  border-color: var(--c-text3);
  color: var(--c-text);
}

.setting-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  width: 80px;
  transition: border-color 0.2s, background 0.35s var(--ease);
}
.setting-input-wrap:focus-within {
  border-color: var(--c-primary);
}
.setting-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--c-text);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.setting-input::-webkit-outer-spin-button,
.setting-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.setting-unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text3);
}

.total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  margin-top: 22px;
  background: var(--c-primary-bg);
  border: 1px solid var(--c-primary-border);
  border-radius: var(--radius);
  box-shadow: var(--c-shadow-sm);
}
.total-label {
  font-weight: 600;
  color: var(--c-text2);
}
.total-value {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 26px;
  color: var(--c-primary-l);
}

/* ======================
   UTILITIES
   ====================== */
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
