
  :root {
    --gold: #C9A84C;
    --gold-light: #E8C96A;
    --dark: #0A0A0A;
    --dark2: #111111;
    --dark3: #1A1A1A;
    --dark4: #222222;
    --light: #E8E8E8;
    --mid: #888888;
    --red: #C0392B;
    --red-bright: #E74C3C;
    --green: #27AE60;
    --blue: #2980B9;
    --radius: 8px;
    --font-head: 'Georgia', serif;
    --font-body: 'Arial', sans-serif;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
  }

  /* Utility classes for the most-repeated inline style="" strings in index.html —
     each of these replaced dozens of byte-for-byte duplicate inline attributes. */
  .muted-note { font-size: 0.85rem; color: var(--mid); margin-bottom: 10px; }
  .hidden { display: none; }
  .text-gold { color: var(--gold); }
  .text-light-sm { font-size: 0.87rem; color: #CCC; }
  .text-muted-sm { font-size: 0.85rem; color: var(--mid); }
  .list-note { color: #CCC; font-size: 0.87rem; padding-left: 18px; line-height: 1.8; }
  .mb-16 { margin-bottom: 16px; }
  .text-muted-xs { font-size: 0.78rem; color: var(--mid); }
  .text-dim { color: #888; }
  .text-green { color: var(--green); }
  .text-red-bright { color: var(--red-bright); }
  .mb-20 { margin-bottom: 20px; }

  body {
    background: var(--dark);
    color: var(--light);
    font-family: var(--font-body);
    line-height: 1.6;
  }

  /* ===== TOP NAV ===== */
  #topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.97);
    border-bottom: 1px solid #2A2A2A;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 44px;
    gap: 8px;
  }
  #topnav .logo {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--gold);
    font-weight: bold;
    letter-spacing: 1px;
  }
  .nav-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--mid);
    padding: 5px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
    white-space: nowrap;
  }
  .nav-btn:hover, .nav-btn.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(201,168,76,0.08);
  }

  /* ===== HERO ===== */
  #hero {
    margin-top: 44px;
    background: linear-gradient(135deg, #0A0A0A 0%, #1A1200 50%, #0A0A0A 100%);
    border-bottom: 1px solid var(--gold);
    padding: 64px 32px 48px;
    text-align: center;
  }
  #hero h1 {
    font-family: var(--font-head);
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--gold);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 12px;
  }
  #hero .subtitle {
    font-size: 1.1rem;
    color: var(--mid);
    max-width: 700px;
    margin: 0 auto 32px;
  }
  #hero .quote-box {
    max-width: 700px;
    margin: 0 auto;
    background: rgba(201,168,76,0.06);
    border-left: 4px solid var(--gold);
    padding: 18px 24px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--light);
    font-size: 1.05rem;
  }
  #hero .quote-attr { color: var(--gold); font-style: normal; font-size: 0.85rem; margin-top: 6px; }

  /* ===== CYCLE SELECTOR ===== */
  #cycle-bar {
    position: sticky;
    top: 44px;
    z-index: 900;
    background: var(--dark2);
    border-bottom: 2px solid var(--gold);
    padding: 0;
  }
  .cycle-row {
    display: flex;
    gap: 8px;
    padding: 8px 20px;
    flex-wrap: wrap;
    align-items: center;
  }
  .section-row {
    border-top: 1px solid #1A1A1A;
    padding: 6px 20px;
    gap: 4px;
    background: rgba(0,0,0,0.3);
  }
  #cycle-bar label { color: var(--mid); font-size: 0.82rem; margin-right: 2px; }

  /* ===== CONTEXT BADGE (collapses cycle/week/mode behind one control on mobile) ===== */
  .context-badge {
    display: none;
  }
  .context-badge-chevron {
    display: inline-block;
    transition: transform 0.2s;
  }
  .context-badge[aria-expanded="true"] .context-badge-chevron {
    transform: rotate(180deg);
  }
  @media (max-width: 600px) {
    #context-controls {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    #context-controls.expanded {
      display: flex;
      flex-direction: column;
      width: 100%;
      background: var(--dark2);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
      padding: 8px 20px;
      gap: 8px;
    }
    .context-badge {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      background: var(--dark3);
      border: 1px solid var(--gold);
      color: var(--gold);
      padding: 8px 14px;
      border-radius: 20px;
      font-size: 0.85rem;
      cursor: pointer;
    }
    .nav-btn,
    .cycle-btn,
    .week-btn,
    .mode-btn {
      min-height: 44px;
      min-width: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
  }

  /* ===== CALORIE TRACKER ===== */
  .macro-bar-wrap { margin: 6px 0; }
  .macro-bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 3px; color: #CCC; }
  .macro-bar-track { background: #222; border-radius: 4px; height: 10px; overflow: hidden; }
  .macro-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }
  .bar-protein { background: linear-gradient(90deg, #2980B9, #6BB6E8); }
  .bar-carbs { background: linear-gradient(90deg, #C9A84C, #E8C96A); }
  .bar-fat { background: linear-gradient(90deg, #C0392B, #E74C3C); }
  .bar-calories { background: linear-gradient(90deg, #27AE60, #82E0AA); }
  .food-log-row { font-size: 0.84rem; color: #CCC; }
  .food-log-row td { padding: 7px 8px; border-bottom: 1px solid #1E1E1E; vertical-align: middle; }
  .food-log-row:last-child td { border-bottom: none; }
  .fl-name { font-weight: 500; color: var(--light); }
  .fl-macro { text-align: right; color: var(--mid); font-size: 0.78rem; white-space: nowrap; }
  .fl-remove { color: var(--red); cursor: pointer; font-size: 0.9rem; padding: 2px 6px; border: none; background: none; border-radius: 4px; }
  .fl-remove:hover { background: rgba(192,57,43,0.15); color: #E74C3C; }
  .tracker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
  @media (max-width: 600px) { .tracker-grid { grid-template-columns: 1fr; } }
  .tracker-box { background: var(--dark4); border: 1px solid #2A2A2A; border-radius: var(--radius); padding: 14px 16px; }
  .tracker-box h4 { font-size: 0.85rem; margin-bottom: 12px; color: var(--gold-light); }
  .suggestion-item { padding: 8px 10px; background: var(--dark3); border-radius: var(--radius); margin-bottom: 6px; font-size: 0.83rem; border-left: 3px solid var(--gold); }
  .suggestion-item .s-name { color: var(--light); font-weight: 500; }
  .suggestion-item .s-macro { color: var(--mid); font-size: 0.78rem; margin-top: 2px; }
  .food-search-wrap { display: block; position: relative; margin: 10px 0; }
  .food-search-wrap input::placeholder { color: var(--mid); }
  #food-autocomplete { position: absolute; z-index: 500; background: var(--dark3); border: 1px solid #333; border-radius: var(--radius); max-height: 240px; overflow-y: auto; width: 100%; top: 100%; left: 0; box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
  #food-autocomplete div { padding: 9px 14px; cursor: pointer; font-size: 0.88rem; color: #CCC; border-bottom: 1px solid #1a1a1a; }
  #food-autocomplete div:last-child { border-bottom: none; }
  #food-autocomplete div:hover, #food-autocomplete div:focus-visible { background: rgba(201,168,76,0.1); color: var(--gold); outline: none; }
  .timer-minimized #timer-display, .timer-minimized #timer-controls, .timer-minimized #timer-label, .timer-minimized #rest-panel, .timer-minimized #hiit-panel, .timer-minimized .timer-mode-row { display: none; }
  .timer-minimized { min-width: auto; padding: 8px 12px; }
  #timer-toggle { position: absolute; top: 6px; right: 8px; background: none; border: none; color: #555; cursor: pointer; font-size: 0.85rem; line-height: 1; padding: 2px; }
  #timer-toggle:hover { color: var(--gold); }
  #timer-widget { position: relative; }
  .target-input-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
  .target-input-row label { color: var(--mid); font-size: 0.82rem; }
  .target-input-row input, .target-input-row select { background: var(--dark4); border: 1px solid #333; color: var(--light); padding: 6px 10px; border-radius: var(--radius); font-size: 0.85rem; width: 80px; }
  .target-input-row select { width: auto; }
  .remaining-positive { color: var(--green); }
  .remaining-negative { color: var(--red); }
  .cycle-btn, .week-btn, .mode-btn {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid #444;
    background: transparent;
    color: var(--mid);
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s;
  }
  .cycle-btn.active { background: var(--gold); color: var(--dark); border-color: var(--gold); font-weight: bold; }
  .week-btn.active { background: var(--dark4); color: var(--light); border-color: #666; }
  /* Darker than --blue specifically here — white label text needs 4.5:1 contrast against this background */
  .mode-btn.active { background: #1F6391; color: #fff; border-color: #1F6391; }
  .sep { color: #444; margin: 0 4px; }

  /* ===== WEEK DROPDOWN ===== */
  .week-select {
    background: var(--dark4);
    border: 1px solid #444;
    color: var(--light);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    cursor: pointer;
  }
  .week-select:hover { border-color: var(--gold); }

  /* ===== HOME/GYM SEGMENTED TOGGLE ===== */
  .mode-toggle-group {
    display: inline-flex;
    border: 1px solid #444;
    border-radius: 20px;
    overflow: hidden;
  }
  .mode-toggle-group .mode-btn {
    border: none;
    border-radius: 0;
    margin: 0;
  }
  .mode-toggle-group .mode-btn + .mode-btn { border-left: 1px solid #444; }
  .mode-toggle-group .mode-btn.active { border-color: transparent; }

  /* ===== MAIN LAYOUT ===== */
  #main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 80px;
  }

  /* ===== SECTIONS ===== */
  .section { display: none; scroll-margin-top: 96px; }
  .section.active { display: block; }

  /* ===== CARDS ===== */
  .card {
    background: var(--dark3);
    border: 1px solid #2A2A2A;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
  }
  .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
  }
  .card-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
  }
  .icon-gold { background: rgba(201,168,76,0.15); border: 1px solid var(--gold); color: var(--gold); }
  .icon-red { background: rgba(192,57,43,0.15); border: 1px solid var(--red); color: var(--red); }
  .icon-green { background: rgba(39,174,96,0.15); border: 1px solid var(--green); color: var(--green); }
  .icon-blue { background: rgba(41,128,185,0.15); border: 1px solid var(--blue); color: var(--blue); }
  .card-title { font-size: 1.15rem; font-weight: bold; color: var(--light); }
  .card-sub { font-size: 0.8rem; color: var(--mid); }

  /* ===== WORKOUT TABLE ===== */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .workout-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 12px 0;
  }
  @media (max-width: 600px) {
    .meas-table { min-width: 420px; }
  }
  .workout-table th {
    background: var(--dark4);
    color: var(--gold);
    padding: 8px 12px;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .workout-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #2A2A2A;
    vertical-align: top;
  }
  .workout-table tr:hover td { background: rgba(255,255,255,0.02); }
  .workout-table .ex-name { color: var(--light); font-weight: 500; }
  .workout-table .ex-link { color: var(--gold); text-decoration: none; font-size: 0.78rem; }
  .workout-table .ex-link:hover { text-decoration: underline; }
  .workout-table .sets { color: var(--gold); font-weight: bold; }
  .workout-table .reps { color: var(--light); }
  .workout-table .effort-cell { color: var(--gold); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
  .workout-table .note { color: var(--mid); font-size: 0.82rem; }
  .alt-toggle {
    display: inline-block;
    background: none;
    border: 1px dashed #444;
    color: var(--mid);
    font-size: 0.72rem;
    padding: 2px 9px;
    border-radius: 12px;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
  }
  .alt-toggle:hover, .alt-toggle[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }
  .alt-box {
    display: none;
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(201,168,76,0.06);
    border-left: 3px solid var(--gold);
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    color: #CCC;
    max-width: 420px;
  }
  .alt-box.open { display: block; }
  .mentor-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: bold;
    letter-spacing: 0.3px;
  }
  .tag-ohearn { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid var(--gold); }
  .tag-mentzer { background: rgba(192,57,43,0.15); color: #E74C3C; border: 1px solid #C0392B; }
  .tag-rashid { background: rgba(41,128,185,0.15); color: #3498DB; border: 1px solid #2980B9; }

  /* ===== QUOTE BLOCKS ===== */
  .quote-mid {
    border-left: 3px solid var(--gold);
    background: rgba(201,168,76,0.04);
    padding: 14px 20px;
    margin: 20px 0;
    font-style: italic;
    font-size: 1rem;
    color: var(--light);
    border-radius: 0 var(--radius) var(--radius) 0;
  }
  .quote-mid .q-attr { color: var(--gold); font-style: normal; font-size: 0.82rem; margin-top: 6px; }

  /* ===== TABS ===== */
  .tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid #333;
    padding-bottom: 0;
    margin-bottom: -1px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tab-bar .tab-btn { flex: 0 0 auto; white-space: nowrap; }
  .tab-btn {
    padding: 8px 18px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--mid);
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.2s;
  }
  .tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
  }
  .tab-content { display: none; }
  .tab-content.active { display: block; }

  /* ===== GRID ===== */
  .grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

  /* ===== STAT BOXES ===== */
  .stat-box {
    background: var(--dark4);
    border: 1px solid #333;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
  }
  .stat-num { font-size: 2rem; font-weight: bold; color: var(--gold); }
  .stat-label { font-size: 0.8rem; color: var(--mid); margin-top: 4px; }

  /* ===== HEADINGS ===== */
  h2 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    color: var(--gold);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2A2A2A;
    letter-spacing: 1px;
  }
  h3 { font-size: 1.1rem; color: var(--light); margin: 20px 0 12px; }
  h4 { font-size: 0.95rem; color: var(--gold-light); margin: 14px 0 8px; }
  /* Same visual weight as h4, for places that need an h3 for heading-level
     correctness but should keep the smaller h4 look (e.g. Log tab subheads) */
  h3.subhead { font-size: 0.95rem; color: var(--gold-light); margin: 14px 0 8px; }
  p { color: #CCC; font-size: 0.92rem; margin-bottom: 10px; }

  /* ===== BADGES ===== */
  .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
  }
  .badge-gold { background: var(--gold); color: var(--dark); }
  .badge-blue { background: var(--blue); color: #fff; }
  .badge-green { background: var(--green); color: #fff; }
  .badge-red { background: var(--red); color: #fff; }

  /* ===== TIMER ===== */
  #timer-widget {
    position: fixed;
    bottom: 20px; right: 20px;
    background: var(--dark3);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 12px 18px;
    z-index: 800;
    min-width: 160px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(201,168,76,0.2);
  }
  #timer-display {
    font-size: 2rem;
    font-weight: bold;
    color: var(--gold);
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
  }
  #timer-label { font-size: 0.72rem; color: var(--mid); margin-bottom: 8px; }
  #timer-controls { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
  .t-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #444;
    background: transparent;
    color: var(--mid);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
  }
  .t-btn:hover { border-color: var(--gold); color: var(--gold); }
  .t-btn.go { background: var(--gold); color: var(--dark); border-color: var(--gold); font-weight: bold; }

  /* ===== GLOSSARY ===== */
  .glossary-item {
    background: var(--dark4);
    border-left: 3px solid var(--gold);
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: 0 var(--radius) var(--radius) 0;
  }
  .glossary-term { color: var(--gold); font-weight: bold; font-size: 1rem; margin-bottom: 6px; }
  .glossary-def { color: #CCC; font-size: 0.88rem; }
  .glossary-link { color: var(--gold); text-decoration: none; font-size: 0.82rem; display: inline-block; margin-top: 6px; }
  .glossary-link:hover { text-decoration: underline; }

  /* ===== ACCORDION ===== */
  .accordion-item {
    background: var(--dark4);
    border-left: 3px solid var(--gold);
    margin-bottom: 10px;
    border-radius: 0 var(--radius) var(--radius) 0;
    overflow: hidden;
  }
  .accordion-item.cat-yoga { border-left-color: #8E44AD; }
  .accordion-item.cat-qigong { border-left-color: var(--green); }
  .accordion-item.cat-strength { border-left-color: var(--gold); }
  .accordion-item.cat-cardio { border-left-color: #E67E22; }
  .accordion-item.cat-concept { border-left-color: var(--blue); }
  .accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
  }
  .accordion-header:hover { background: rgba(201,168,76,0.04); }
  .accordion-header:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
  .accordion-header-left { display: flex; align-items: center; gap: 12px; }
  .accordion-title { color: var(--light); font-weight: bold; font-size: 0.98rem; }
  .cat-yoga .accordion-title { color: #C39BD3; }
  .cat-qigong .accordion-title { color: #82E0AA; }
  .cat-strength .accordion-title { color: var(--gold); }
  .cat-cardio .accordion-title { color: #F0A500; }
  .cat-concept .accordion-title { color: #85C1E9; }
  .accordion-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    color: #888;
    background: var(--dark3);
    border: 1px solid #333;
  }
  .accordion-arrow { color: var(--gold); font-size: 1.2rem; transition: transform 0.25s; line-height: 1; }
  .accordion-header.open .accordion-arrow { transform: rotate(45deg); }
  .accordion-body {
    display: none;
    padding: 14px 18px 18px;
    border-top: 1px solid #2A2A2A;
    animation: fadeIn 0.2s ease;
  }
  .accordion-body.open { display: block; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

  .step-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    counter-reset: step-counter;
  }
  .step-list li {
    counter-increment: step-counter;
    padding: 7px 0 7px 36px;
    position: relative;
    color: #CCC;
    font-size: 0.87rem;
    border-bottom: 1px solid #1E1E1E;
  }
  .step-list li:last-child { border-bottom: none; }
  .step-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 7px;
    width: 24px;
    height: 24px;
    background: rgba(201,168,76,0.12);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-size: 0.72rem;
    font-weight: bold;
    color: var(--gold);
  }
  .cat-qigong .step-list li::before { background: rgba(39,174,96,0.12); border-color: rgba(39,174,96,0.3); color: var(--green); }
  .cat-yoga .step-list li::before { background: rgba(142,68,173,0.12); border-color: rgba(142,68,173,0.3); color: #C39BD3; }

  .tip-box {
    background: rgba(39,174,96,0.06);
    border: 1px solid rgba(39,174,96,0.2);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 10px 0;
    font-size: 0.84rem;
    color: #CCC;
  }
  .tip-box strong { color: var(--green); }
  .warn-box {
    background: rgba(230,126,34,0.06);
    border: 1px solid rgba(230,126,34,0.2);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 10px 0;
    font-size: 0.84rem;
    color: #CCC;
  }
  .warn-box strong { color: #E67E22; }
  .feel-box {
    background: rgba(41,128,185,0.06);
    border: 1px solid rgba(41,128,185,0.2);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 10px 0;
    font-size: 0.84rem;
    color: #CCC;
  }
  .feel-box strong { color: #85C1E9; }
  .ex-video-btn {
    display: inline-block;
    margin-top: 10px;
    margin-right: 8px;
    padding: 6px 16px;
    background: rgba(201,168,76,0.1);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 20px;
    color: var(--gold);
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.2s;
  }
  .ex-video-btn:hover { background: rgba(201,168,76,0.2); text-decoration: none; }
  .cat-label {
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--mid);
    text-transform: uppercase;
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2A2A2A;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin: 10px 0;
  }
  .mod-card {
    background: var(--dark3);
    border: 1px solid #333;
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #CCC;
  }
  .mod-card strong { color: var(--gold); display: block; margin-bottom: 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }

  /* ===== PROGRESS BAR ===== */
  .progress-track {
    background: #2A2A2A;
    border-radius: 4px;
    height: 6px;
    margin: 8px 0;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 4px;
    transition: width 0.5s;
  }

  /* ===== ALERT ===== */
  .alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 16px 0;
    font-size: 0.88rem;
  }
  .alert-gold { background: rgba(201,168,76,0.08); border: 1px solid rgba(201,168,76,0.3); color: var(--light); }
  .alert-red { background: rgba(192,57,43,0.08); border: 1px solid rgba(192,57,43,0.3); color: var(--light); }
  .alert-green { background: rgba(39,174,96,0.08); border: 1px solid rgba(39,174,96,0.3); color: var(--light); }

  /* ===== FOOTER ===== */
  footer {
    background: var(--dark2);
    border-top: 1px solid #222;
    text-align: center;
    padding: 24px;
    color: var(--mid);
    font-size: 0.82rem;
    margin-top: 40px;
  }

  /* ===== RESPONSIVE ===== */
  @media (max-width: 768px) {
    #topnav { padding: 0 10px; height: 44px; }
    #hero { padding: 28px 14px 20px; }
    #hero h1 { font-size: 1.3rem; }
    .cycle-row { padding: 6px 12px; gap: 4px; flex-wrap: wrap; }
    #main { padding: 16px 12px 60px; }
    .cycle-btn, .week-btn, .mode-btn { padding: 4px 10px; font-size: 0.72rem; }
    .nav-btn { padding: 4px 8px; font-size: 0.7rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    .section-row {
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
      gap: 3px;
    }
    .section-row .nav-btn { flex: 0 0 auto; padding: 4px 12px; }
    .workout-table { min-width: 320px; font-size: 0.78rem; }
    .log-set-inputs { flex-wrap: wrap; gap: 4px; }
    .log-set-inputs input { width: 70px !important; font-size: 0.78rem; }
    .card { padding: 12px; }
    .tab-bar { flex-wrap: nowrap; overflow-x: auto; gap: 2px; }
    .tab-bar .tab-btn { white-space: nowrap; font-size: 0.74rem; padding: 5px 10px; }
    #timer-widget { max-width: 200px; bottom: 8px; right: 8px; }
    .tracker-grid { grid-template-columns: 1fr !important; }
    .stat-box { padding: 10px; }
    .quote-mid { font-size: 0.82rem; }
    .alert { font-size: 0.82rem; padding: 8px 12px; }
    .home-alt, .gym-alt { font-size: 0.78rem; }
    .deload-banner { font-size: 0.78rem; }
  }

  @media (max-width: 600px) {
    #topnav { padding: 0 12px; height: 40px; }
    #cycle-bar { top: 40px; }
    #hero { padding: 32px 12px 24px; }
    .cycle-row { padding: 6px 12px; }
    #main { padding: 16px 10px 60px; }
    #timer-widget { bottom: 10px; right: 10px; }
    .cycle-btn, .week-btn, .mode-btn { padding: 5px 12px; font-size: 0.74rem; }
    .nav-btn { padding: 4px 9px; font-size: 0.72rem; }
    .section-row {
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .section-row .nav-btn { flex: 0 0 auto; }
  }

  /* ===== DESKTOP LEFT SIDEBAR (section nav) =====
     Cycle/Week/Mode stay as a slim top bar (#context-controls).
     Section nav (.section-row) detaches from the sticky top bar and
     becomes a fixed left sidebar so it's not all crammed into one row. */
  @media (min-width: 901px) {
    #context-controls { padding: 10px 24px; margin-left: 210px; }
    .section-row {
      position: fixed;
      top: 100px;
      left: 0;
      bottom: 0;
      width: 210px;
      flex-direction: column;
      align-items: stretch;
      flex-wrap: nowrap;
      overflow-y: auto;
      border-top: none;
      border-right: 1px solid #2A2A2A;
      background: var(--dark2);
      padding: 18px 14px;
      gap: 6px;
      z-index: 850;
    }
    .section-row .nav-btn {
      width: 100%;
      text-align: left;
      padding: 9px 14px;
    }
    #hero, #main, footer { margin-left: 210px; }
  }

  /* ===== SEARCH ===== */
  #search-btn { background: none; border: 1px solid #333; color: var(--mid); padding: 5px 10px; border-radius: var(--radius); cursor: pointer; font-size: 0.85rem; margin-left: auto; }
  #search-btn:hover { border-color: var(--gold); color: var(--gold); }
  #search-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; background: rgba(0,0,0,0.95); display: none; flex-direction: column; padding: 60px 20px 20px; }
  #search-overlay.active { display: flex; }
  #search-input-wrap { max-width: 700px; margin: 0 auto; width: 100%; position: relative; }
  #search-input { width: 100%; padding: 14px 20px; background: #1a1a1a; border: 1px solid var(--gold); border-radius: 8px; color: white; font-size: 1.1rem; }
  #search-input:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
  #search-close { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--mid); font-size: 1.4rem; cursor: pointer; line-height: 1; }
  #search-close:hover { color: var(--gold); }
  #search-results { max-width: 700px; margin: 16px auto 0; width: 100%; overflow-y: auto; max-height: 60vh; }
  .search-result-item { padding: 12px 16px; background: #1a1a1a; border-radius: 8px; margin-bottom: 8px; cursor: pointer; border-left: 3px solid transparent; }
  .search-result-item:hover { border-left-color: var(--gold); background: #222; }
  .search-result-section { font-size: 0.72rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
  .search-result-title { color: var(--light); font-weight: bold; font-size: 0.9rem; margin-bottom: 3px; }
  .search-result-excerpt { color: var(--mid); font-size: 0.82rem; }
  #search-hint { color: var(--mid); font-size: 0.85rem; text-align: center; margin-top: 40px; }

  /* ===== STREAK ===== */
  .streak-card { background: var(--dark4); border: 1px solid #333; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
  .streak-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  .streak-fire { font-size: 2rem; }
  .streak-num { font-size: 2.5rem; font-weight: bold; color: var(--gold); line-height: 1; }
  .streak-label { font-size: 0.78rem; color: var(--mid); }
  .streak-circles { display: flex; gap: 8px; margin-top: 12px; }
  .streak-circle { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #444; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--mid); font-weight: bold; }
  .streak-circle.done { background: var(--gold); border-color: var(--gold); color: var(--dark); }

  /* ===== HIIT TIMER ===== */
  #hiit-panel { padding: 8px 0 0; display: none; }
  #rest-panel { }
  .hiit-phase { font-size: 1rem; font-weight: bold; margin: 4px 0; }
  .hiit-phase.work { color: var(--red); }
  .hiit-phase.rest { color: var(--green); }
  .hiit-round { font-size: 0.78rem; color: var(--mid); margin-bottom: 6px; }
  .hiit-input-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
  .hiit-input-row label { font-size: 0.7rem; color: var(--mid); }
  .hiit-input-row input { width: 44px; background: var(--dark4); border: 1px solid #444; color: var(--light); padding: 3px 6px; border-radius: 4px; font-size: 0.8rem; text-align: center; }
  .timer-mode-row { display: flex; gap: 4px; justify-content: center; margin-bottom: 6px; }
  .tm-btn { padding: 3px 10px; border-radius: 5px; border: 1px solid #444; background: transparent; color: var(--mid); cursor: pointer; font-size: 0.72rem; }
  .tm-btn.active { background: var(--dark4); border-color: var(--gold); color: var(--gold); }

  /* ===== LOG SECTION ===== */
  .log-day-select { width: 100%; padding: 10px 14px; background: var(--dark4); border: 1px solid #333; border-radius: var(--radius); color: var(--light); font-size: 0.95rem; margin-bottom: 16px; }
  .log-exercise-row { background: var(--dark4); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; border-left: 3px solid var(--gold); }
  .log-ex-name { color: var(--gold); font-weight: bold; font-size: 0.9rem; margin-bottom: 8px; }
  .log-sets-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .log-set-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
  .log-set-label { font-size: 0.65rem; color: var(--mid); text-transform: uppercase; }
  .log-set-inputs { display: flex; gap: 4px; }
  .log-set-inputs input { width: 54px; background: #111; border: 1px solid #333; color: var(--light); padding: 5px 7px; border-radius: 4px; font-size: 0.82rem; text-align: center; }
  .log-done-btn { padding: 5px 12px; border-radius: 20px; border: 1px solid #444; background: transparent; color: var(--mid); cursor: pointer; font-size: 0.75rem; margin-left: 8px; align-self: flex-end; }
  .log-done-btn.done { background: var(--green); border-color: var(--green); color: #fff; }
  .save-workout-btn { background: var(--gold); color: var(--dark); border: none; padding: 10px 28px; border-radius: var(--radius); font-size: 0.95rem; font-weight: bold; cursor: pointer; margin-top: 8px; }
  .save-workout-btn:hover { background: var(--gold-light); }
  .recent-workout-card { background: var(--dark4); border: 1px solid #2A2A2A; border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
  .recent-workout-header { padding: 12px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
  .recent-workout-header:hover { background: rgba(255,255,255,0.02); }
  .recent-workout-body { display: none; padding: 0 16px 14px; border-top: 1px solid #222; }
  .recent-workout-body.open { display: block; }
  .meas-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.84rem; margin-top: 14px; }
  .meas-table th { background: var(--dark4); color: var(--gold); padding: 7px 10px; text-align: left; font-size: 0.75rem; text-transform: uppercase; }
  .meas-table td { padding: 7px 10px; border-bottom: 1px solid #1E1E1E; color: #CCC; }
  .meas-table td button { background: none; border: none; color: var(--red); cursor: pointer; font-size: 0.85rem; padding: 2px 6px; }
  .meas-table td button:hover { background: rgba(192,57,43,0.15); border-radius: 4px; }
  #measurements-chart { display: block; margin: 16px 0; border-radius: var(--radius); }
  .rm-result { font-size: 2.5rem; font-weight: bold; color: var(--gold); text-align: center; margin: 16px 0 4px; }
  .rm-label { text-align: center; color: var(--mid); font-size: 0.82rem; margin-bottom: 16px; }
  .rm-input-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
  .rm-input-row > div { flex: 1; min-width: 120px; }
  .rm-input-row label { display: block; color: var(--mid); font-size: 0.8rem; margin-bottom: 5px; }
  .rm-input-row input { width: 100%; padding: 10px 12px; background: var(--dark4); border: 1px solid #333; border-radius: var(--radius); color: var(--light); font-size: 1rem; }

  /* ===== SLEEP LOG ===== */
  .sleep-input-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
  .sleep-input-row > div { flex: 1; min-width: 120px; }
  .sleep-input-row label { display: block; color: var(--mid); font-size: 0.8rem; margin-bottom: 5px; }
  .sleep-input-row input, .sleep-input-row select { width: 100%; padding: 8px 10px; background: var(--dark4); border: 1px solid #333; border-radius: var(--radius); color: var(--light); font-size: 0.9rem; }
  .stars-select option { font-size: 1rem; }
  .sleep-stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
  .sleep-stat { flex: 1; min-width: 100px; background: var(--dark4); border: 1px solid #333; border-radius: var(--radius); padding: 12px; text-align: center; }
  .sleep-stat .num { font-size: 1.6rem; font-weight: bold; color: var(--gold); }
  .sleep-stat .lbl { font-size: 0.75rem; color: var(--mid); margin-top: 2px; }

  /* ===== PRINT ===== */
  .section-heading-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
  .week-effort-badge { background: var(--gold, #f5a623); color: #111; font-weight: 700; font-size: 0.85rem; padding: 4px 12px; border-radius: 6px; white-space: nowrap; }
  .print-btn { background: var(--dark4); border: 1px solid #444; color: var(--mid); padding: 6px 16px; border-radius: var(--radius); cursor: pointer; font-size: 0.82rem; flex: 0 0 auto; }
  .print-btn:hover { border-color: var(--gold); color: var(--gold); }
  /* ===== DAY TICK SYSTEM ===== */
  .day-tick {
    margin-left: auto; cursor: pointer; font-size: 1.6rem; line-height: 1;
    color: #555; transition: color 0.2s, transform 0.15s; user-select: none;
    padding: 4px; border-radius: 50%; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  }
  .day-tick:hover { color: var(--green); background: rgba(46,204,113,0.1); }
  .day-tick.done { color: var(--green); }
  .day-tick.done:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }
  .week-progress {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; background: var(--dark4); border-radius: var(--radius);
    margin: 10px 0 0; font-size: 0.85rem; border: 1px solid #333;
  }
  .week-progress .tick-count { color: var(--gold); font-weight: bold; }
  .week-progress .tick-total { color: var(--mid); }
  .week-progress .progress-bar {
    flex: 1; height: 6px; background: #333; border-radius: 3px;
    overflow: hidden; max-width: 120px;
  }
  .week-progress .progress-fill {
    height: 100%; background: var(--green); border-radius: 3px;
    transition: width 0.3s; width: 0%;
  }
  .reset-tick-btn {
    background: none; border: 1px solid #444; color: var(--mid);
    padding: 3px 10px; border-radius: var(--radius); cursor: pointer;
    font-size: 0.78rem; margin-left: auto;
    transition: border-color 0.2s, color 0.2s;
  }
  .reset-tick-btn:hover { border-color: var(--gold); color: var(--gold); }
  @media print { .day-tick, .week-progress { display: none !important; } }
  
  /* ===== PRINT HEADER (hidden on screen) ===== */
  #print-header { display: none; }
  @media print {
    @page { margin: 15mm 18mm; }
    html { font-size: 10pt; }
    body { background: #fff !important; color: #000 !important; line-height: 1.4; }
    #topnav, #cycle-bar, #timer-widget, footer, .nav-btn, .mode-btn, .cycle-btn, .week-btn, .print-btn, #search-btn, #search-overlay, .section-heading-row, .cycle-desc, #cycle-description, .mentor-tag, .card-sub { display: none !important; }
    #main { padding: 0 !important; max-width: 100% !important; }
    #section-program.section { display: block !important; padding: 0 !important; }
    #section-program .card { display: none !important; }
    #section-program .card:first-of-type { display: block !important; }
    .cycle-content { display: block !important; }
    .cycle-content > .card { display: block !important; page-break-before: always; }
    .cycle-content > .card:first-of-type { page-break-before: avoid; }
    .card { background: #fff !important; border: none !important; border-bottom: 1px solid #ddd !important; margin: 0 0 10px !important; padding: 0 0 10px !important; border-radius: 0 !important; box-shadow: none !important; }
    .card-header { padding: 0 0 4px !important; }
    .card-icon { display: none !important; }
    .card-title { font-size: 13pt !important; color: #000 !important; }
    .workout-table { border-collapse: collapse !important; width: 100% !important; font-size: 9pt !important; margin: 4px 0 !important; }
    .workout-table th, .workout-table td { border: 1px solid #444 !important; color: #000 !important; background: #fff !important; padding: 3px 6px !important; }
    .workout-table th { background: #e0e0e0 !important; font-weight: bold !important; font-size: 8.5pt !important; }
    h2, h3, h4 { color: #000 !important; margin: 8px 0 4px !important; }
    h4 { font-size: 10.5pt !important; }
    h3 { font-size: 12pt !important; }
    p, li, .card-sub { color: #333 !important; font-size: 9pt !important; }
    .quote-mid { display: none !important; }
    .alert-gold, .alert-green, .alert-red { border: 1px solid #999 !important; background: #f9f9f9 !important; color: #000 !important; font-size: 9pt !important; }
    a { color: #000 !important; text-decoration: none !important; }
    .table-scroll { overflow: visible !important; }
    .home-alt, .gym-alt { display: block !important; }
    #print-header {
      display: block !important;
      text-align: center;
      margin-bottom: 18px;
      padding-bottom: 10px;
      border-bottom: 2px solid #000;
    }
    #print-header h1 { font-size: 16pt; margin: 0 0 2px; color: #000; }
    #print-header .print-meta { font-size: 9pt; color: #555; }
    #print-header .print-footer { margin-top: 18px; padding-top: 8px; border-top: 1px solid #ccc; font-size: 8pt; color: #888; text-align: center; }
    #section-program h2 { display: none !important; }
    .deload-notice { border: 1px solid #000 !important; background: #f5f5f5 !important; padding: 8px !important; margin: 8px 0 !important; }
    .deload-notice strong { color: #000 !important; }
    .deload-notice span { color: #333 !important; }
    .cycle-content .home-alt { display: block !important; }
    .cycle-content .gym-alt { display: block !important; }
  }


/* Mode-aware alt-boxes: home visible, gym hidden by default */
.home-alt { display: block; }
.gym-alt { display: none; }


/* Single-day print button */
.day-print {
  cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 4px; opacity: 0.4; transition: opacity 0.2s; color: var(--mid);
}
.day-print:hover { opacity: 1; color: var(--gold); }
@media print {
  /* Print single day: show only .printing-day card */
  .printing-day .cycle-content > .card { display: none !important; }
  .printing-day .cycle-content > .card.print-target { display: block !important; page-break-after: avoid; }
}
