:root{
  --bg:#0b1628;
  --surface:#132038;
  --muted:#8fa3bf;
  --text:#ffffff;
  --accent:#2ecc71;
  --border:#22324d;
  --max:744px;
  --sheet-blue:#7fa8ff;
}

*{box-sizing:border-box;margin:0;padding:0;}
html{height:100%;background:var(--bg);scroll-behavior:smooth;}
body{height:100%;background:var(--bg);}
body{
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display",system-ui,sans-serif;
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  overscroll-behavior-y:none;
}

/* ==============================
   APP SHELL
   ============================== */

.app{
  width:100%;
  max-width:var(--max);
  margin:0 auto;
  min-height:100vh;
  background:var(--bg);
  padding-bottom:env(safe-area-inset-bottom);
}

.sticky-nav{
  position:sticky;
  top:0;
  z-index:1000;
  background:rgba(11,22,40,0.85);
  -webkit-backdrop-filter:blur(20px);
  backdrop-filter:blur(20px);
  padding:calc(24px + env(safe-area-inset-top)) 16px 12px;
  border-bottom:1px solid var(--border);
}

.nav-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}

/* ---- Date Nav ---- */

.date-nav{
  display:flex;
  align-items:center;
  gap:10px;
}

.date-btn{
  width:28px;
  height:28px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  font-size:18px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  -webkit-user-select:none;
  user-select:none;
  transition:background 0.15s;
  font-family:inherit;
  padding:0;
}

.date-btn:active{
  background:rgba(255,255,255,0.16);
}

.date-label{
  font-size:16px;
  font-weight:600;
  min-width:80px;
  text-align:center;
}

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

.gear-btn{
  width:32px;
  height:32px;
  border-radius:50%;
  border:none;
  background:rgba(255,255,255,0.06);
  color:var(--muted);
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:background 0.15s;
  padding:0;
}

.gear-btn:active{
  background:rgba(255,255,255,0.14);
}

/* ---- Main Menu Dropdown ---- */

.main-menu{
  position:absolute;
  top:calc(100% + 8px);
  right:16px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:6px 0;
  min-width:220px;
  opacity:0;
  transform:translateY(-6px) scale(0.95);
  pointer-events:none;
  transition:opacity 0.15s, transform 0.15s;
  z-index:1100;
  box-shadow:0 8px 32px rgba(0,0,0,0.5);
}

.main-menu.active{
  opacity:1;
  transform:translateY(0) scale(1);
  pointer-events:auto;
}

.main-menu-item{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  padding:12px 16px;
  border:none;
  background:none;
  color:var(--text);
  font-size:15px;
  font-weight:600;
  font-family:inherit;
  text-align:left;
  cursor:pointer;
  transition:background 0.15s;
}

.main-menu-item:active{
  background:rgba(255,255,255,0.06);
}

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

.main-menu-profile{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
}

.main-menu-avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  overflow:hidden;
  background:var(--accent);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  color:var(--bg);
  font-size:14px;
  font-weight:700;
}

.main-menu-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.main-menu-name{
  font-size:14px;
  font-weight:600;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.main-menu-item.logout{
  color:#e74c3c;
}

/* ---- Auth UI ---- */

.auth-signin{
  padding:6px 14px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);
  color:var(--text);
  font-size:13px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  transition:background 0.15s;
}

.auth-signin:active{
  background:rgba(255,255,255,0.16);
}

.auth-avatar{
  position:relative;
  width:32px;
  height:32px;
  border-radius:50%;
  overflow:hidden;
  border:none;
  padding:0;
  background:var(--accent);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:inherit;
  color:var(--bg);
  font-size:14px;
  font-weight:700;
}

.auth-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.auth-menu{
  position:absolute;
  top:calc(100% + 8px);
  right:16px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 16px;
  min-width:180px;
  opacity:0;
  transform:translateY(-6px) scale(0.95);
  pointer-events:none;
  transition:opacity 0.15s, transform 0.15s;
  z-index:1100;
}

.auth-menu.active{
  opacity:1;
  transform:translateY(0) scale(1);
  pointer-events:auto;
}

.auth-menu-name{
  font-size:13px;
  color:var(--muted);
  margin-bottom:10px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.auth-menu-btn{
  display:block;
  width:100%;
  padding:8px 0;
  border:none;
  background:none;
  color:var(--text);
  font-size:14px;
  font-weight:600;
  font-family:inherit;
  text-align:left;
  cursor:pointer;
}

.auth-menu-btn:active{
  opacity:0.7;
}

.nav-row{
  display:flex;
  gap:8px;
  flex-wrap:nowrap;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
  scrollbar-width:none;
  -ms-overflow-style:none;
}

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

.nav-btn{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:8px 14px;
  border-radius:999px;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.08);
  font-size:14px;
  font-weight:600;
  min-width:110px;
  flex-shrink:0;
  scroll-snap-align:start;
  transition:background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-user-select:none;
  user-select:none;
  overflow:hidden;
}

.nav-btn:active{
  background:rgba(255,255,255,0.12);
  transform:scale(0.97);
}

.nav-btn.nav-complete{
  border-color:var(--accent);
  background:rgba(46,204,113,0.12);
}

.nav-progress{
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:3px;
  background:rgba(255,255,255,0.08);
  border-radius:0 0 999px 999px;
  overflow:hidden;
}

.nav-progress-fill{
  height:100%;
  background:var(--accent);
  border-radius:2px;
  transition:width 0.3s;
}

/* ==============================
   SECTIONS
   ============================== */

.section{
  padding:0 18px;
  animation:fadeIn 0.3s ease-out both;
}

.section:nth-child(1){animation-delay:0s;}
.section:nth-child(2){animation-delay:0.05s;}
.section:nth-child(3){animation-delay:0.1s;}
.section:nth-child(4){animation-delay:0.15s;}
.section:nth-child(5){animation-delay:0.2s;}

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

/* ---- Section Header (collapsed / expanded toggle) ---- */

.section-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 0;
  cursor:pointer;
  -webkit-user-select:none;
  user-select:none;
  border-bottom:1px solid var(--border);
  transition:padding 0.15s;
}

.section-header.expanded{
  padding:24px 0 12px;
  border-bottom:none;
}

.section-header-name{
  font-size:18px;
  font-weight:700;
  letter-spacing:-0.2px;
}

.section-header.expanded .section-header-name{
  font-size:32px;
  letter-spacing:-0.5px;
}

.section-header-meta{
  display:flex;
  align-items:center;
  gap:12px;
  font-size:13px;
  color:var(--muted);
}

.section-header-count{
  font-weight:600;
}

.section-header-duration{
  color:var(--sheet-blue);
}


/* ==============================
   EXERCISE ROWS
   ============================== */

.exercise{
  position:relative;
  overflow:hidden;
  padding:14px 0;
  border-bottom:1px solid var(--border);
}

.swipe-bg{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--accent);
  font-size:24px;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.15s;
}

.exercise-inner{
  display:flex;
  align-items:center;
  gap:14px;
  width:100%;
  position:relative;
  background:var(--bg);
  transition:transform 0.25s cubic-bezier(0.32,0.72,0,1);
}

.exercise.dragging,
.exercise.dragging *{
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}

.exercise.dragging .exercise-inner{
  touch-action:none;
}

.exercise.read-only{
  opacity:0.6;
}

.exercise-left{
  flex:1;
  min-width:0;
}

.exercise-header{
  display:flex;
  align-items:center;
  gap:12px;
}

.exercise-thumb{
  width:44px;
  height:44px;
  border-radius:10px;
  object-fit:cover;
  background:var(--surface);
  flex-shrink:0;
}

.exercise-title{
  font-size:16px;
  font-weight:600;
  margin-bottom:2px;
  cursor:pointer;
  letter-spacing:-0.2px;
}

.exercise-title:active{
  opacity:0.7;
}

.exercise-meta{
  font-size:13px;
  color:var(--muted);
}

.swap-btn{
  margin-left:auto;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.04);
  color:var(--muted);
  font-size:12px;
  font-weight:600;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex-shrink:0;
  transition:background 0.15s;
  font-family:inherit;
}

.swap-btn:active{
  background:rgba(255,255,255,0.12);
}

/* ==============================
   SET PILLS
   ============================== */

.sets{
  display:flex;
  gap:8px;
  flex-shrink:0;
}

.set-pill{
  width:40px;
  height:40px;
  border-radius:12px;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.08);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  transition:background 0.15s, border-color 0.15s, opacity 0.1s;
  -webkit-user-select:none;
  user-select:none;
  cursor:pointer;
  white-space:pre-line;
  text-align:center;
  line-height:1.1;
  font-variant-numeric:tabular-nums;
}

.set-pill:active{
  opacity:0.7;
}

.set-pill.completed{
  background:var(--accent);
  border-color:var(--accent);
  color:var(--bg);
  font-weight:700;
}

.read-only .set-pill{
  pointer-events:none;
}

/* ==============================
   SET ADJUSTER POPOVER
   ============================== */

.adjuster{
  z-index:3000;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  width:160px;
  box-shadow:0 8px 32px rgba(0,0,0,0.5);
}

.adjuster-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}

.adjuster-label{
  font-size:12px;
  font-weight:600;
  color:var(--muted);
  width:28px;
}

.adjuster-btn{
  width:32px;
  height:32px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  font-size:16px;
  font-weight:600;
  font-family:inherit;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  -webkit-user-select:none;
  user-select:none;
}

.adjuster-btn:active{
  background:rgba(255,255,255,0.14);
}

.adjuster-val{
  font-size:16px;
  font-weight:700;
  min-width:36px;
  text-align:center;
  font-variant-numeric:tabular-nums;
}

.adjuster-done{
  width:100%;
  padding:8px;
  border:none;
  border-radius:8px;
  background:var(--accent);
  color:var(--bg);
  font-size:14px;
  font-weight:700;
  font-family:inherit;
  cursor:pointer;
  margin-top:4px;
}

.adjuster-done:active{
  opacity:0.8;
}

/* Swipe shake when no candidates */
@keyframes swipeShake{
  0%,100%{transform:translateX(0);}
  20%{transform:translateX(-8px);}
  40%{transform:translateX(8px);}
  60%{transform:translateX(-4px);}
  80%{transform:translateX(4px);}
}

.exercise-inner.shake{
  animation:swipeShake 0.4s ease-out;
}

@keyframes slideInFromRight{
  from{transform:translateX(100%);opacity:0;}
  to{transform:translateX(0);opacity:1;}
}

@keyframes slideInFromLeft{
  from{transform:translateX(-100%);opacity:0;}
  to{transform:translateX(0);opacity:1;}
}

.exercise-inner.slide-in-right{
  animation:slideInFromRight 0.25s cubic-bezier(0.32,0.72,0,1);
}

.exercise-inner.slide-in-left{
  animation:slideInFromLeft 0.25s cubic-bezier(0.32,0.72,0,1);
}

/* ==============================
   DRAG AND DROP
   ============================== */

.drag-placeholder{
  opacity:0.3;
}

.drag-clone{
  position:fixed;
  z-index:3000;
  background:var(--surface);
  border-radius:12px;
  box-shadow:0 8px 32px rgba(0,0,0,0.5);
  pointer-events:none;
  padding:14px 12px;
  border:1px solid var(--accent);
  will-change:transform;
}

/* ==============================
   HISTORY
   ============================== */

.history-list{
  display:flex;
  flex-direction:column;
}

.history-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0;
  border-bottom:1px solid var(--border);
}

.history-item-info:active{
  background:rgba(255,255,255,0.04);
  border-radius:8px;
}

.history-date{
  font-size:15px;
  font-weight:600;
}

.history-sets{
  font-size:13px;
  color:var(--muted);
}

/* ==============================
   SWAP SHEET
   ============================== */

.swap-filter-label{
  font-size:13px;
  color:var(--muted);
  margin-bottom:12px;
}

.swap-list{
  display:flex;
  flex-direction:column;
}

.swap-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  transition:background 0.15s;
}

.swap-item:active{
  background:rgba(255,255,255,0.04);
}

.swap-item-info{
  flex:1;
  min-width:0;
}

.swap-item-name{
  font-size:15px;
  font-weight:600;
  margin-bottom:2px;
}

.swap-item-meta{
  font-size:12px;
  color:var(--muted);
  text-transform:capitalize;
}

/* ==============================
   TIMER OVERLAY
   ============================== */

.timer-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0);
  z-index:2500;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:background 0.3s;
}

.timer-overlay.active{
  background:rgba(0,0,0,0.85);
}

.timer-card{
  text-align:center;
  padding:40px 30px;
}

.timer-exercise{
  font-size:18px;
  font-weight:600;
  color:var(--muted);
  margin-bottom:32px;
}

.timer-ring-wrap{
  position:relative;
  width:200px;
  height:200px;
  margin:0 auto 32px;
}

.timer-ring{
  width:100%;
  height:100%;
  transform:rotate(-90deg);
}

.timer-ring-bg{
  fill:none;
  stroke:rgba(255,255,255,0.08);
  stroke-width:8;
}

.timer-ring-fg{
  fill:none;
  stroke:var(--accent);
  stroke-width:8;
  stroke-linecap:round;
  transition:stroke-dashoffset 0.05s linear;
}

.timer-display{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:56px;
  font-weight:700;
  font-variant-numeric:tabular-nums;
  color:var(--text);
}

.timer-btns{
  display:flex;
  gap:12px;
  justify-content:center;
}

.timer-btn{
  padding:12px 28px;
  border-radius:12px;
  border:none;
  font-size:16px;
  font-weight:700;
  font-family:inherit;
  cursor:pointer;
  transition:opacity 0.15s;
}

.timer-btn:active{
  opacity:0.7;
}

.timer-btn-start{
  background:var(--accent);
  color:var(--bg);
}

.timer-btn-cancel{
  background:rgba(255,255,255,0.1);
  color:var(--text);
}

.timer-btn-finish{
  background:#e74c3c;
  color:#fff;
}

.timer-adjust{
  display:flex;
  gap:8px;
  justify-content:center;
  margin-bottom:8px;
}

.timer-adj-btn{
  padding:6px 14px;
  border-radius:8px;
  border:none;
  background:rgba(255,255,255,0.1);
  color:var(--text);
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  transition:background 0.15s;
}

.timer-adj-btn:active{
  background:rgba(255,255,255,0.2);
  transform:scale(0.95);
}

/* ==============================
   EXERCISE DETAIL SHEET
   ============================== */

.sheet-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0);
  z-index:2000;
  transition:background 0.3s;
  display:flex;
  align-items:flex-end;
  justify-content:center;
}

.sheet-overlay.active{
  background:rgba(0,0,0,0.5);
}

.sheet{
  width:100%;
  max-width:var(--max);
  background:var(--surface);
  border-radius:16px 16px 0 0;
  padding:0 20px calc(20px + env(safe-area-inset-bottom));
  max-height:85vh;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  transform:translateY(100%);
  transition:transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet.active{
  transform:translateY(0);
}

.sheet-handle{
  width:36px;
  height:5px;
  border-radius:3px;
  background:rgba(255,255,255,0.2);
  margin:10px auto 16px;
}

.sheet-title{
  font-size:22px;
  font-weight:700;
  margin-bottom:10px;
}

.sheet-chips{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:16px;
}

.chip{
  padding:4px 10px;
  border-radius:999px;
  background:rgba(255,255,255,0.08);
  font-size:12px;
  font-weight:500;
  color:var(--muted);
  text-transform:capitalize;
}

.chip-muscle{
  color:var(--sheet-blue);
  background:rgba(127,168,255,0.12);
}

.chip-toggle{
  cursor:pointer;
  transition:background 0.15s, color 0.15s, border-color 0.15s;
  border:1px solid transparent;
}

.chip-toggle.chip-active{
  background:rgba(46,204,113,0.2);
  color:var(--accent);
  border-color:var(--accent);
}

.sheet-images{
  display:flex;
  gap:8px;
  margin-bottom:16px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x mandatory;
}

.sheet-images img{
  width:48%;
  min-width:140px;
  border-radius:12px;
  object-fit:cover;
  background:var(--bg);
  scroll-snap-align:start;
}

.sheet-info{
  font-size:15px;
  color:var(--muted);
  padding:12px 0;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
  margin-bottom:16px;
}

.sheet-section-title{
  font-size:13px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--muted);
  margin-bottom:8px;
}

.sheet-instructions{
  padding-left:20px;
  margin-bottom:20px;
}

.sheet-instructions li{
  font-size:14px;
  line-height:1.5;
  color:rgba(255,255,255,0.8);
  margin-bottom:8px;
}

/* ==============================
   WORKOUT TITLE
   ============================== */

.workout-title{
  font-size:28px;
  font-weight:700;
  letter-spacing:-0.5px;
  padding:20px 18px 4px;
  color:var(--text);
}

/* ==============================
   SETS GRID
   ============================== */

.sets-grid{
  margin-top:8px;
}

.sets-grid-title{
  font-size:14px;
  font-weight:700;
  color:var(--text);
  margin-bottom:8px;
}

.sets-grid-header{
  display:grid;
  gap:6px;
  padding:0 4px 6px;
}

.sets-grid-header.rep-header{
  grid-template-columns:48px 1fr 1fr 32px;
}

.sets-grid-header.rep-header.no-weight{
  grid-template-columns:48px 1fr 32px;
}

.sets-grid-header.timed-header{
  grid-template-columns:48px 1fr 32px;
}

.sets-grid-header span{
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--muted);
}

.sets-grid-row{
  display:grid;
  gap:6px;
  padding:4px;
  border-radius:12px;
  margin-bottom:4px;
  align-items:center;
  transition:background 0.15s;
}

.sets-grid-row.rep-row{
  grid-template-columns:48px 1fr 1fr 32px;
}

.sets-grid-row.rep-row.no-weight{
  grid-template-columns:48px 1fr 32px;
}

.sets-grid-row.timed-row{
  grid-template-columns:48px 1fr 32px;
}

.sets-grid-row.active{
  background:#ffffff;
}

.sets-grid-row:not(.active){
  background:#1a2744;
}

.sets-grid-row.set-done:not(.active){
  background:rgba(46,204,113,0.12);
}

.sets-grid-cell{
  padding:10px 8px;
  border-radius:8px;
  text-align:center;
  font-size:15px;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  cursor:pointer;
  -webkit-user-select:none;
  user-select:none;
  transition:background 0.15s;
}

.sets-grid-cell:active{
  opacity:0.7;
}

.sets-grid-row.active .sets-grid-cell{
  color:#0b1628;
  font-weight:700;
  font-size:16px;
}

.sets-grid-row:not(.active) .sets-grid-cell{
  color:#6b7a8d;
}

.sets-grid-row.set-done:not(.active) .sets-grid-cell{
  color:var(--accent);
}

.sets-grid-cell.set-num{
  cursor:pointer;
}

.sets-grid-row.active .sets-grid-cell.set-num{
  background:var(--accent);
  color:white;
  border-radius:8px;
  font-weight:700;
}

.sets-grid-row.set-done:not(.active) .sets-grid-cell.set-num{
  color:var(--accent);
}

.sets-grid-trash{
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  padding:4px;
  border:none;
  background:none;
  color:var(--muted);
  opacity:0.4;
  transition:opacity 0.15s;
}

.sets-grid-trash:active{
  opacity:1;
  color:#e74c3c;
}

.sets-grid-row.active .sets-grid-trash{
  color:#0b1628;
  opacity:0.3;
}

/* ==============================
   INSTRUCTION TRUNCATION
   ============================== */

.instructions-wrap{
  position:relative;
}

/* Section muscle pills */
.section-muscles{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:8px 16px;
}

.muscle-pill{
  background:#fff;
  color:#888;
  font-size:11px;
  padding:4px 10px;
  border-radius:12px;
  text-transform:capitalize;
}

/* Bonus exercise divider */
.bonus-divider{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
}

.bonus-divider::before,
.bonus-divider::after{
  content:'';
  flex:1;
  height:1px;
  background:rgba(255,255,255,0.1);
}

.bonus-divider span{
  font-size:10px;
  color:rgba(255,255,255,0.3);
  letter-spacing:2px;
  text-transform:uppercase;
}

/* Instructions toggle */
.instructions-toggle-wrap{
  padding:12px 0 4px;
}

.view-instructions-btn{
  color:var(--accent);
  font-size:13px;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}

.view-instructions-btn:active{
  opacity:0.7;
}

.instructions-content{
  padding-top:8px;
}

.instructions-truncated{
  max-height:3.2em;
  overflow:hidden;
}

.instructions-truncated::after{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:1.6em;
  background:linear-gradient(transparent, var(--bg));
  pointer-events:none;
}

.instructions-expanded{
  max-height:none;
}

.instructions-expanded::after{
  display:none;
}

.instructions-toggle{
  display:inline-block;
  margin-top:4px;
  font-size:13px;
  color:var(--sheet-blue);
  cursor:pointer;
  border:none;
  background:none;
  font-family:inherit;
  padding:0;
}

.instructions-toggle:active{
  opacity:0.7;
}

/* ==============================
   INLINE EXERCISE EXPANSION
   ============================== */

.exercise-expanded{
  border-bottom:none;
}

.exercise-detail-inline{
  padding:12px 0 16px;
  border-bottom:1px solid var(--border);
}

.inline-images{
  display:flex;
  gap:8px;
  margin-bottom:16px;
}

.inline-image-wrap{
  position:relative;
  flex:1;
  border-radius:12px;
  overflow:hidden;
}

.inline-image-wrap img{
  width:100%;
  display:block;
  border-radius:12px;
  background:var(--surface);
}

.yt-overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.5);
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
}

.yt-play-icon{
  font-size:36px;
  color:white;
}

.inline-yt-thumb{
  cursor:pointer;
}

.inline-yt-thumb:active .yt-overlay{
  background:rgba(0,0,0,0.65);
}

.inline-play-btn{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.4);
  border:none;
  color:white;
  font-size:32px;
  cursor:pointer;
  border-radius:12px;
  transition:background 0.15s;
}

.inline-play-btn:active{
  background:rgba(0,0,0,0.6);
}

.inline-sets{
  display:flex;
  flex-direction:column;
}

.inline-set-row{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,0.04);
  position:relative;
  overflow:hidden;
}

.inline-set-row.completed{
  opacity:0.6;
}

.inline-set-num{
  font-size:14px;
  font-weight:600;
  color:var(--muted);
  min-width:48px;
}

.inline-set-reps,
.inline-set-weight,
.inline-set-time{
  font-size:15px;
  font-weight:600;
  min-width:60px;
}

.inline-set-weight{
  color:var(--muted);
}

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

.inline-set-complete-btn{
  padding:6px 16px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  font-size:13px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  transition:background 0.15s, transform 0.1s;
}

.inline-set-complete-btn:active{
  transform:scale(0.97);
}

.inline-set-row.completed .inline-set-complete-btn{
  background:var(--accent);
  border-color:var(--accent);
  color:var(--bg);
}

.inline-set-check{
  color:var(--accent);
  font-size:18px;
  font-weight:700;
}

.inline-timer-btn{
  padding:6px 16px;
  border-radius:8px;
  border:none;
  background:var(--accent);
  color:var(--bg);
  font-size:13px;
  font-weight:700;
  font-family:inherit;
  cursor:pointer;
  transition:opacity 0.15s, transform 0.1s;
}

.inline-timer-btn:active{
  opacity:0.8;
  transform:scale(0.97);
}

.inline-add-set{
  width:100%;
  padding:10px;
  margin-top:4px;
  border:1px dashed rgba(255,255,255,0.1);
  border-radius:8px;
  background:none;
  color:var(--muted);
  font-size:13px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  transition:background 0.15s, transform 0.1s;
}

.inline-add-set:active{
  background:rgba(255,255,255,0.04);
  transform:scale(0.98);
}

/* Swipe-to-delete set row */
.inline-set-delete{
  position:absolute;
  right:0;
  top:0;
  bottom:0;
  width:60px;
  background:#e74c3c;
  display:flex;
  align-items:center;
  justify-content:center;
  color:white;
  font-size:18px;
  transform:translateX(100%);
  transition:transform 0.2s;
}

.inline-set-row.swiped .inline-set-delete{
  transform:translateX(0);
}

/* ==============================
   PHASE 6A: POLISH + ANIMATIONS
   ============================== */

/* Set pill completion bounce */
@keyframes pillPop{
  0%{transform:scale(1);}
  50%{transform:scale(1.2);}
  100%{transform:scale(1);}
}

.set-pill.just-completed{
  animation:pillPop 0.2s ease-out;
}

/* Timer final-seconds pulse */
@keyframes timerPulse{
  0%,100%{transform:scale(1);}
  50%{transform:scale(1.08);}
}

.timer-display.pulse{
  animation:timerPulse 0.5s ease-in-out infinite;
}

/* Touch feedback on interactive elements */
.swap-btn:active,
.gear-btn:active,
.date-btn:active,
.timer-btn:active,
.adjuster-btn:active{
  transform:scale(0.97);
}

.swap-btn,
.gear-btn,
.timer-btn{
  transition:background 0.15s, transform 0.1s;
}

/* Offline queue indicator */
.queue-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#f0ad4e;
  display:inline-block;
  margin-left:6px;
  animation:queuePulse 2s ease-in-out infinite;
}

@keyframes queuePulse{
  0%,100%{opacity:1;}
  50%{opacity:0.4;}
}

/* ==============================
   CUSTOM EXERCISE FORM (6c)
   ============================== */

.form-group{
  margin-bottom:16px;
}

.form-label{
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--muted);
  margin-bottom:6px;
  display:block;
}

.form-input{
  width:100%;
  height:44px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  font-size:15px;
  font-family:inherit;
  outline:none;
  transition:border-color 0.15s;
}

.form-input:focus{
  border-color:var(--accent);
}

.form-input::placeholder{
  color:rgba(255,255,255,0.25);
}

.form-number{
  width:100px;
}

.form-toggle-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.form-toggle{
  position:relative;
  width:44px;
  height:24px;
  border-radius:12px;
  background:rgba(255,255,255,0.12);
  border:none;
  cursor:pointer;
  transition:background 0.2s;
  padding:0;
  flex-shrink:0;
}

.form-toggle::after{
  content:'';
  position:absolute;
  top:2px;
  left:2px;
  width:20px;
  height:20px;
  border-radius:50%;
  background:var(--text);
  transition:transform 0.2s;
}

.form-toggle.active{
  background:var(--accent);
}

.form-toggle.active::after{
  transform:translateX(20px);
}

.chip-badge{
  font-size:10px;
  padding:2px 6px;
  border-radius:999px;
  background:rgba(46,204,113,0.2);
  color:var(--accent);
  font-weight:600;
  margin-left:6px;
}

.create-custom-btn{
  width:100%;
  padding:14px;
  margin-top:16px;
  border:1px dashed rgba(255,255,255,0.15);
  border-radius:12px;
  background:none;
  color:var(--muted);
  font-size:14px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  transition:background 0.15s, color 0.15s, transform 0.1s;
}

.create-custom-btn:active{
  background:rgba(255,255,255,0.06);
  color:var(--text);
  transform:scale(0.98);
}

/* ==============================
   LOGIN SCREEN
   ============================== */

.login-screen{
  position:fixed;
  inset:0;
  background:#FCFCFC;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.login-content{
  text-align:center;
  padding:40px 24px;
  max-width:360px;
  width:100%;
}

.login-logo{
  margin-bottom:8px;
}

.login-logo svg{
  width:100%;
  max-width:280px;
  height:auto;
}

.login-subtitle{
  font-size:16px;
  color:#6b7280;
  margin-bottom:48px;
}

.login-google-btn{
  width:100%;
  padding:14px 20px;
  border-radius:12px;
  border:1px solid #e5e7eb;
  background:#fff;
  color:#1f1f1f;
  font-size:16px;
  font-weight:600;
  font-family:inherit;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  cursor:pointer;
  transition:background 0.15s, transform 0.1s;
  margin-bottom:20px;
}

.login-google-btn:active{
  background:#f3f4f6;
  transform:scale(0.98);
}

.login-email-link{
  background:none;
  border:none;
  color:#6b7280;
  font-size:14px;
  font-family:inherit;
  cursor:pointer;
  text-decoration:underline;
  padding:8px;
  display:inline-block;
}

.login-email-link:active{
  opacity:0.7;
}

.login-email-input{
  margin-top:16px;
  margin-bottom:8px;
  background:#fff;
  border:1px solid #e5e7eb;
  color:#1f1f1f;
}

.login-email-input::placeholder{
  color:#9ca3af;
}

.login-email-send{
  width:100%;
  padding:12px;
  border:none;
  border-radius:10px;
  background:#1f1f1f;
  color:#fff;
  font-size:15px;
  font-weight:700;
  font-family:inherit;
  cursor:pointer;
  transition:opacity 0.15s, transform 0.1s;
}

.login-email-send:active{
  opacity:0.8;
  transform:scale(0.98);
}

.login-email-send:disabled{
  opacity:0.5;
}

.login-email-sent{
  color:#16a34a;
  font-size:14px;
  margin-top:12px;
}

/* ==============================
   FAVOURITE WORKOUTS (Phase 8)
   ============================== */

.favourite-section{
  padding:0 20px 12px;
  border-bottom:1px solid rgba(255,255,255,0.06);
  margin-bottom:12px;
}

.favourite-section-title{
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--muted);
  margin-bottom:10px;
  padding-top:4px;
}

.favourite-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,0.04);
}

.favourite-item:last-child{
  border-bottom:none;
}

.favourite-item-info{
  flex:1;
  min-width:0;
}

.favourite-item-name{
  font-size:15px;
  font-weight:600;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.favourite-item-meta{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

.favourite-item-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
  margin-left:12px;
}

.favourite-start-btn{
  background:var(--accent);
  color:var(--bg);
  border:none;
  border-radius:8px;
  padding:6px 14px;
  font-size:13px;
  font-weight:700;
  font-family:inherit;
  cursor:pointer;
  transition:opacity 0.15s;
}

.favourite-start-btn:active{
  opacity:0.7;
}

.favourite-start-btn:disabled{
  opacity:0.5;
}

.favourite-delete-btn{
  background:none;
  border:none;
  color:var(--muted);
  font-size:20px;
  line-height:1;
  padding:4px 6px;
  cursor:pointer;
  opacity:0.6;
  transition:opacity 0.15s;
}

.favourite-delete-btn:active{
  opacity:1;
  color:#e74c3c;
}

.fav-save-btn{
  width:100%;
  padding:14px;
  border:none;
  border-radius:12px;
  background:var(--accent);
  color:var(--bg);
  font-size:16px;
  font-weight:700;
  font-family:inherit;
  cursor:pointer;
  margin-top:16px;
  transition:opacity 0.15s, transform 0.1s;
}

.fav-save-btn:active{
  opacity:0.8;
  transform:scale(0.98);
}

.fav-save-btn:disabled{
  opacity:0.5;
}

/* History item with actions */

.history-item-info{
  flex:1;
  min-width:0;
  cursor:pointer;
}

.history-item-actions{
  display:flex;
  align-items:center;
  gap:6px;
  flex-shrink:0;
  margin-left:12px;
}

.history-start-btn{
  background:rgba(255,255,255,0.08);
  color:var(--text);
  border:none;
  border-radius:8px;
  padding:6px 12px;
  font-size:12px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  transition:opacity 0.15s;
}

.history-start-btn:active{
  opacity:0.7;
}

.history-start-btn:disabled{
  opacity:0.5;
}

.history-fav-btn{
  background:none;
  border:none;
  color:var(--muted);
  font-size:18px;
  padding:4px 6px;
  cursor:pointer;
  transition:color 0.15s;
}

.history-fav-btn:active{
  color:var(--accent);
}

/* ==============================
   EXERCISE FILTER SETTINGS
   ============================== */

.filter-section{
  margin-bottom:20px;
}

.filter-section-title{
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--muted);
  margin-bottom:8px;
}

.filter-list{
  display:flex;
  flex-direction:column;
}

.filter-row{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid rgba(255,255,255,0.04);
  transition:opacity 0.15s;
}

.filter-drag-handle{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:4px 2px;
  cursor:grab;
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
  flex-shrink:0;
}

.filter-drag-handle span{
  display:block;
  width:14px;
  height:2px;
  border-radius:1px;
  background:rgba(255,255,255,0.2);
}

.filter-checkbox{
  width:22px;
  height:22px;
  border-radius:6px;
  border:2px solid rgba(255,255,255,0.2);
  background:none;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex-shrink:0;
  transition:background 0.15s, border-color 0.15s;
  padding:0;
}

.filter-checkbox.checked{
  background:var(--accent);
  border-color:var(--accent);
}

.filter-check-mark{
  display:none;
  color:var(--bg);
  font-size:13px;
  font-weight:700;
  line-height:1;
}

.filter-checkbox.checked .filter-check-mark{
  display:block;
}

.filter-item-label{
  font-size:15px;
  font-weight:500;
  text-transform:capitalize;
  flex:1;
}

.filter-row.drag-placeholder{
  opacity:0.25;
}

.filter-sync-btn{
  width:100%;
  padding:12px;
  margin-top:8px;
  border:1px solid rgba(255,255,255,0.12);
  border-radius:10px;
  background:rgba(255,255,255,0.06);
  color:var(--muted);
  font-size:13px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  transition:background 0.15s, color 0.15s;
}

.filter-sync-btn:active{
  background:rgba(255,255,255,0.12);
  color:var(--text);
}

/* ==============================
   RESUME HIGHLIGHT
   ============================== */

@keyframes resumePulse{
  0%{border-left-color:var(--accent);box-shadow:inset 3px 0 0 var(--accent);}
  100%{border-left-color:transparent;box-shadow:none;}
}

.resume-here{
  animation:resumePulse 2s ease-out forwards;
}

/* ==============================
   ACCUMULATION HEADER (History)
   ============================== */

.accumulation-header{
  text-align:center;
  padding:16px 0;
  margin-bottom:8px;
}

.accumulation-number{
  font-size:36px;
  font-weight:700;
  color:var(--accent);
}

.accumulation-label{
  font-size:14px;
  color:var(--muted);
  display:block;
  margin-top:2px;
}

/* ==============================
   QUIET TOAST
   ============================== */

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

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

.quiet-toast{
  position:fixed;
  bottom:80px;
  left:50%;
  transform:translateX(-50%);
  max-width:280px;
  background:rgba(255,255,255,0.08);
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
  border-radius:12px;
  padding:10px 20px;
  color:var(--muted);
  font-size:14px;
  font-weight:500;
  text-align:center;
  z-index:2000;
  animation:toastIn 0.3s ease-out;
  pointer-events:none;
}

.quiet-toast.fade-out{
  animation:toastOut 0.3s ease-out forwards;
}
