:root {
      --bg: #050508;
      --bg2: #0a0a12;
      --bg3: #11111e;
      --card: rgba(255, 255, 255, 0.03);
      --card2: rgba(255, 255, 255, 0.06);
      --acc: #c8ff00;
      --acc-rgb: 200, 255, 0;
      --acc-d: rgba(200, 255, 0, 0.1);
      --acc-soft: rgba(var(--acc-rgb), 0.12);
      --acc-glow: rgba(var(--acc-rgb), 0.24);
      --hm: #2ecc71;
      --hm-rgb: 46, 204, 113;
      --on-acc: #050508;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
      --border: rgba(255, 255, 255, 0.08);
      --rs: 14px;
      --red: #ff4444;
      --red-d: rgba(255, 68, 68, 0.1);
      --blue: #00aaff;
      --green: #39d353;
      --orange: #ff8c42;
      --purple: #b96fff;
      --FF: 'Outfit', sans-serif;
      --FD: 'JetBrains Mono', monospace;
      /* Style system variables */
      --anim: 0.2s;
      --anim-spring: cubic-bezier(0.18, 0.89, 0.32, 1.28);
      --density-pad: 16px;
      --density-gap: 12px;
      --density-pad-sm: 12px;
      --density-gap-sm: 8px;
      --card-shadow: none;
      --card-glass: rgba(255,255,255,0.03);
      --font-scale: 1;
      --hm-rgb: var(--acc-rgb);
      --hm-full: var(--acc);
    }

    body.theme-blue {
      --acc: #00aaff;
      --acc-rgb: 0, 170, 255;
      --acc-d: rgba(0, 170, 255, 0.1);
    }

    body.theme-cyan {
      --acc: #00e5ff;
      --acc-rgb: 0, 229, 255;
      --acc-d: rgba(0, 229, 255, 0.1);
    }

    body.theme-green {
      --acc: #00ff88;
      --acc-rgb: 0, 255, 136;
      --acc-d: rgba(0, 255, 136, 0.1);
    }

    body.theme-red {
      --acc: #ff4444;
      --acc-rgb: 255, 68, 68;
      --acc-d: rgba(255, 68, 68, 0.1);
      --on-acc: #ffffff;
    }

    body.theme-orange {
      --acc: #ff8c42;
      --acc-rgb: 255, 140, 66;
      --acc-d: rgba(255, 140, 66, 0.1);
    }

    body.theme-purple {
      --acc: #b96fff;
      --acc-rgb: 185, 111, 255;
      --acc-d: rgba(185, 111, 255, 0.1);
      --on-acc: #ffffff;
    }

    body.theme-pink {
      --acc: #ff2d95;
      --acc-rgb: 255, 45, 149;
      --acc-d: rgba(255, 45, 149, 0.12);
      --on-acc: #ffffff;
    }

    body.theme-gold {
      --acc: #ffcc00;
      --acc-rgb: 255, 204, 0;
      --acc-d: rgba(255, 204, 0, 0.12);
    }

    body.theme-magenta {
      --acc: #ff00aa;
      --acc-rgb: 255, 0, 170;
      --acc-d: rgba(255, 0, 170, 0.12);
      --on-acc: #ffffff;
    }

    body.theme-teal {
      --acc: #00ffc8;
      --acc-rgb: 0, 255, 200;
      --acc-d: rgba(0, 255, 200, 0.1);
    }

    body.theme-lavender {
      --acc: #c9b1ff;
      --acc-rgb: 201, 177, 255;
      --acc-d: rgba(201, 177, 255, 0.14);
    }

    body.theme-coral {
      --acc: #ff6b6b;
      --acc-rgb: 255, 107, 107;
      --acc-d: rgba(255, 107, 107, 0.12);
      --on-acc: #ffffff;
    }

    body.theme-rose-gold {
      --acc: #e8b4b8;
      --acc-rgb: 232, 180, 184;
      --acc-d: rgba(232, 180, 184, 0.15);
    }

    body.theme-chartreuse {
      --acc: #d4ff00;
      --acc-rgb: 212, 255, 0;
      --acc-d: rgba(212, 255, 0, 0.12);
    }

    body.theme-ice {
      --acc: #7ecbff;
      --acc-rgb: 126, 203, 255;
      --acc-d: rgba(126, 203, 255, 0.12);
    }

    body.style-hm-crimson {
      --hm-full: #e74c3c;
      --hm-rgb: 231, 76, 60;
    }

    body.style-hm-cyber {
      --hm-full: #ff007f;
      --hm-rgb: 255, 0, 127;
    }

    body.style-hm-indigo {
      --hm-full: #9b59ff;
      --hm-rgb: 155, 89, 255;
    }

    body.style-hm-amber {
      --hm-full: #f1c40f;
      --hm-rgb: 241, 196, 15;
    }

    body.bg-amoled {
      --bg: #000000;
      --bg2: #050505;
      --bg3: #0a0a0a;
    }

    body.bg-navy {
      --bg: #050a1a;
      --bg2: #0a1228;
      --bg3: #101c38;
    }

    body.bg-forest {
      --bg: #050d08;
      --bg2: #0a1510;
      --bg3: #101f15;
    }

    body.bg-charcoal {
      --bg: #0d0d0d;
      --bg2: #1a1a1a;
      --bg3: #222222;
    }

    body.bg-slate {
      --bg: #080c12;
      --bg2: #10161f;
      --bg3: #18202d;
    }

    body.bg-wine {
      --bg: #120508;
      --bg2: #1e0a10;
      --bg3: #2a1018;
    }

    body.bg-midnight {
      --bg: #02040a;
      --bg2: #050814;
      --bg3: #0a0f20;
    }

    body.bg-deep_purple {
      --bg: #080410;
      --bg2: #10081a;
      --bg3: #180c25;
    }

    body.bg-sunset {
      --bg: #100505;
      --bg2: #1a0a0a;
      --bg3: #251010;
    }

    body.bg-snow {
      --bg: #f5f5f7;
      --bg2: #ffffff;
      --bg3: #e8e8ea;
      --text: #050508;
      --text2: #404050;
      --text3: #808090;
      --border: rgba(0, 0, 0, 0.1);
      --card: rgba(0, 0, 0, 0.04);
      --card2: rgba(0, 0, 0, 0.08);
    }

    body.bg-sky {
      --bg: #e3f2fd;
      --bg2: #f5fafd;
      --bg3: #d1e9f9;
      --text: #0d47a1;
      --text2: #1565c0;
      --text3: #1976d2;
      --border: rgba(13, 71, 161, 0.1);
      --card: rgba(13, 71, 161, 0.04);
      --card2: rgba(13, 71, 161, 0.08);
    }

    body.bg-mint {
      --bg: #e8f5e9;
      --bg2: #f1f8f1;
      --bg3: #d3e8d5;
      --text: #1b5e20;
      --text2: #2e7d32;
      --text3: #388e3c;
      --border: rgba(27, 94, 32, 0.1);
      --card: rgba(27, 94, 32, 0.04);
      --card2: rgba(27, 94, 32, 0.08);
    }

    body.bg-blood_moon {
      --bg: #140208;
      --bg2: #1f0510;
      --bg3: #2a0818;
    }

    body.bg-electric {
      --bg: #030814;
      --bg2: #06102a;
      --bg3: #0c1840;
    }

    body.bg-abyss {
      --bg: #020308;
      --bg2: #050a14;
      --bg3: #0a1220;
    }

    body.bg-cotton_candy {
      --bg: #fff0f8;
      --bg2: #f8f4ff;
      --bg3: #ffe8f0;
      --text: #2d0a20;
      --text2: #5a3048;
      --text3: #806070;
      --border: rgba(90, 48, 72, 0.12);
      --card: rgba(90, 48, 72, 0.05);
      --card2: rgba(90, 48, 72, 0.09);
    }

    body.bg-copper {
      --bg: #120805;
      --bg2: #1a1008;
      --bg3: #24180c;
    }

    /* ═══════════════════════════════════════════════════════
       MIDNIGHT MODE BACKGROUND THEMES
    ═══════════════════════════════════════════════════════ */
    body.style-bg-oled {
      --bg: #000000;
      --bg2: #060606;
      --bg3: #0c0c0c;
      --card: rgba(255,255,255,0.02);
      --border: rgba(255,255,255,0.06);
    }

    body.style-bg-cyberpunk {
      --bg: #0b071e;
      --bg2: #140d34;
      --bg3: #1e1450;
      --acc: #ff007f;
      --acc-rgb: 255, 0, 127;
      --acc-d: rgba(255, 0, 127, 0.12);
      --on-acc: #ffffff;
      --border: rgba(255, 0, 127, 0.15);
      --card: rgba(255, 0, 127, 0.04);
    }

    body.style-bg-slate {
      --bg: #11161d;
      --bg2: #18202b;
      --bg3: #1f2937;
      --border: rgba(255,255,255,0.07);
      --card: rgba(255,255,255,0.025);
    }

    body.style-bg-zen {
      --bg: #04100e;
      --bg2: #091a18;
      --bg3: #0e2420;
      --border: rgba(46, 204, 113, 0.1);
      --card: rgba(46, 204, 113, 0.03);
    }

    body.style-bg-sandstone {
      --bg: #14100c;
      --bg2: #1d1712;
      --bg3: #28201a;
      --border: rgba(210, 180, 140, 0.12);
      --card: rgba(210, 180, 140, 0.04);
    }

    /* ═══════════════════════════════════════════════════════
       CHART LINE STYLE THEMES
    ═══════════════════════════════════════════════════════ */
    body.style-chart-solid .ex-chart-line {
      filter: none;
      stroke-dasharray: none;
    }
    body.style-chart-dashed .ex-chart-line {
      stroke-dasharray: 8 4;
      filter: none;
    }
    body.style-chart-dashed .ex-chart-area {
      opacity: 0.15;
    }

    /* ═══════════════════════════════════════════════════════
       FONT FAMILY VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.font-inter { --FF: 'Inter', sans-serif; }
    body.font-space-grotesk { --FF: 'Space Grotesk', sans-serif; }
    body.font-oswald { --FF: 'Oswald', sans-serif; }
    body.font-bebas { --FF: 'Bebas Neue', cursive; }
    body.font-playfair { --FF: 'Playfair Display', serif; }
    body.font-pacifico { --FF: 'Pacifico', cursive; }
    body.font-exo { --FF: 'Exo 2', sans-serif; }

    /* ═══════════════════════════════════════════════════════
       FONT SCALE VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.scale-large {
      --font-scale: 1.1;
      font-size: 110%;
    }
    body.scale-xl {
      --font-scale: 1.2;
      font-size: 120%;
    }

    /* ═══════════════════════════════════════════════════════
       LAYOUT DENSITY VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.density-compact {
      --density-pad: 10px;
      --density-gap: 8px;
      --density-pad-sm: 8px;
      --density-gap-sm: 5px;
    }
    body.density-compact .card { padding: 10px; margin-bottom: 10px; }
    body.density-compact .sb { padding: 12px; }
    body.density-compact .hdr { min-height: 52px; }
    body.density-compact .ec { padding: 8px; margin-bottom: 8px; }
    body.density-compact .bnav { height: calc(56px + env(safe-area-inset-bottom, 0px)); }

    body.density-spacious {
      --density-pad: 22px;
      --density-gap: 18px;
      --density-pad-sm: 18px;
      --density-gap-sm: 14px;
    }
    body.density-spacious .card { padding: 22px; margin-bottom: 22px; }
    body.density-spacious .sb { padding: 28px; }
    body.density-spacious .hdr { min-height: 72px; }
    body.density-spacious .ec { padding: 18px; margin-bottom: 18px; gap: 18px; }

    /* ═══════════════════════════════════════════════════════
       BORDER RADIUS VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.radius-sharp {
      --rs: 6px;
    }
    body.radius-sharp .card, body.radius-sharp .inp, body.radius-sharp .btn,
    body.radius-sharp .ib, body.radius-sharp .ec, body.radius-sharp .hc,
    body.radius-sharp .modal, body.radius-sharp .bnav { border-radius: 6px; }
    body.radius-sharp .mov .modal { border-radius: 6px 6px 0 0; }
    body.radius-sharp .tag { border-radius: 3px; }

    body.radius-pill {
      --rs: 24px;
    }
    body.radius-pill .card, body.radius-pill .ec, body.radius-pill .hc { border-radius: 24px; }
    body.radius-pill .inp { border-radius: 50px; }
    body.radius-pill .btn { border-radius: 50px; }
    body.radius-pill .btn-sm { border-radius: 50px; }
    body.radius-pill .ib { border-radius: 50%; }
    body.radius-pill .tag { border-radius: 50px; }
    body.radius-pill .modal { border-radius: 28px 28px 0 0; }

    /* ═══════════════════════════════════════════════════════
       ANIMATION SPEED VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.anim-off {
      --anim: 0s;
    }
    body.anim-off *, body.anim-off *::before, body.anim-off *::after {
      transition-duration: 0ms !important;
      animation-duration: 0ms !important;
    }
    body.anim-fast { --anim: 0.1s; }
    body.anim-fast .card, body.anim-fast .btn, body.anim-fast .ib, body.anim-fast .screen,
    body.anim-fast .mov, body.anim-fast .modal { transition-duration: 0.1s !important; }
    body.anim-slow { --anim: 0.4s; }
    body.anim-slow .card, body.anim-slow .btn, body.anim-slow .ib, body.anim-slow .screen,
    body.anim-slow .mov, body.anim-slow .modal { transition-duration: 0.4s !important; }

    /* ═══════════════════════════════════════════════════════
       CARD STYLE VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.card-flat .card {
      background: var(--bg2);
      border-color: var(--border);
      box-shadow: none;
    }
    body.card-flat .card::before { display: none; }

    body.card-glass .card {
      background: rgba(255,255,255,0.05);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-color: rgba(255,255,255,0.12);
      box-shadow: 0 4px 24px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.08);
    }
    body.card-glass.bg-snow .card {
      background: rgba(255,255,255,0.7);
      border-color: rgba(0,0,0,0.08);
    }

    body.card-elevated .card {
      background: var(--bg2);
      border-color: transparent;
      box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
    }
    body.card-elevated .card::before { display: none; }

    /* ═══════════════════════════════════════════════════════
       NAV STYLE VARIANTS
    ═══════════════════════════════════════════════════════ */
    body.nav-minimal .bnav {
      background: rgba(var(--bg-rgb, 5,5,8), 0.7);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
    }
    body.nav-minimal .ni-ic { display: none; }
    body.nav-minimal .ni { font-size: 11px; padding: 8px 0; }
    body.nav-minimal .ni-mid { top: -5px; }

    /* ═══════════════════════════════════════════════════════
       STYLE SWATCH COMPONENT (used in settings)
    ═══════════════════════════════════════════════════════ */
    .style-option-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
      gap: 8px;
      margin-bottom: 8px;
    }
    .style-option {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      padding: 10px 8px;
      border-radius: 12px;
      background: var(--bg2);
      border: 2px solid transparent;
      cursor: pointer;
      transition: var(--anim);
      font-size: 11px;
      font-weight: 800;
      color: var(--text3);
      text-align: center;
    }
    .style-option:active { transform: scale(0.95); }
    .style-option.active {
      border-color: var(--acc);
      background: var(--acc-d);
      color: var(--acc);
    }
    .style-option .style-preview {
      width: 36px;
      height: 28px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }
    .font-preview {
      font-size: 15px;
      font-weight: 800;
      color: var(--text);
      line-height: 1;
    }
    .style-section-label {
      font-size: 11px;
      font-weight: 800;
      color: var(--text3);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 8px;
      margin-top: 4px;
    }

    * {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
      outline: none;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--FF);
      margin: 0;
      overflow: hidden;
      height: 100vh;
      height: 100dvh;
      position: fixed;
      width: 100%;
      user-select: none;
      -webkit-user-select: none;
    }

    .screen {
      position: absolute;
      inset: 0;
      display: none;
      flex-direction: column;
      background: var(--bg);
      z-index: 10;
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .screen.active {
      display: flex;
    }

    .sb {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
      scroll-behavior: smooth;
    }

    .hdr {
      display: flex;
      align-items: center;
      padding: 0 20px;
      padding-top: env(safe-area-inset-top, 0);
      min-height: 60px;
      height: calc(60px + env(safe-area-inset-top, 0));
      background: var(--bg);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid var(--border);
      z-index: 100;
      flex-shrink: 0;
    }

    .ht {
      font-size: 20px;
      font-weight: 800;
      letter-spacing: -0.5px;
    }

    .ib {
      width: 44px;
      height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 12px;
      background: var(--card);
      border: 1px solid var(--border);
      cursor: pointer;
      transition: 0.2s;
    }

    .ib:active {
      transform: scale(0.9);
      background: var(--card2);
    }

    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--rs);
      padding: 16px;
      margin-bottom: 16px;
      transition: 0.2s;
      position: relative;
      overflow: hidden;
    }

    .card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.02) 100%);
      pointer-events: none;
    }

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

    .col {
      display: flex;
      flex-direction: column;
    }

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

    .g3 {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 10px;
    }

    .st {
      font-size: 12px;
      font-weight: 800;
      color: var(--text3);
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .sl {
      height: 1px;
      flex: 1;
      background: var(--border);
    }

    .btn {
      border: none;
      border-radius: 12px;
      padding: 14px;
      font-weight: 800;
      font-family: var(--FF);
      cursor: pointer;
      transition: 0.2s;
      font-size: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .btn-p {
      background: var(--acc);
      color: var(--on-acc);
    }

    .btn-s {
      background: var(--card);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .btn-d {
      background: var(--red-d);
      color: var(--red);
      border: 1px solid rgba(255, 68, 68, 0.2);
    }

    .btn:active {
      transform: scale(0.96);
      opacity: 0.8;
    }

    .btn-sm {
      padding: 8px 14px;
      font-size: 12px;
      border-radius: 10px;
    }

    .btn-bl {
      width: 100%;
    }

    .inp {
      width: 100%;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
      color: var(--text);
      font-family: var(--FF);
      font-size: 16px;
      transition: 0.2s;
    }

    .inp:focus {
      border-color: var(--acc);
      background: var(--bg3);
    }

    .il {
      font-size: 11px;
      font-weight: 800;
      color: var(--text3);
      margin-bottom: 6px;
      margin-left: 2px;
      letter-spacing: 0.5px;
    }

    .ni-ic {
      font-size: 22px;
      margin-bottom: 4px;
    }

    .ni {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      font-size: 10px;
      font-weight: 800;
      color: var(--text3);
      transition: 0.2s;
      cursor: pointer;
    }

    .ni.on {
      color: var(--acc);
    }

    .ni-mid {
      width: 64px;
      height: 64px;
      position: relative;
      top: -15px;
      background: var(--bg);
      border-radius: 50%;
      padding: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
    }

    .ni-mid-btn {
      width: 48px;
      height: 48px;
      background: var(--acc);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      color: #000;
      box-shadow: 0 0 20px var(--acc-d);
      transition: 0.2s;
    }

    .ni-mid-btn:active {
      transform: scale(0.9);
    }

    .bnav {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      height: calc(65px + env(safe-area-inset-bottom, 0px));
      background: var(--bg);
      backdrop-filter: blur(15px);
      border-top: 1px solid var(--border);
      display: flex;
      align-items: center;
      padding: 0 10px;
      padding-bottom: env(safe-area-inset-bottom, 0px);
      z-index: 200;
    }

    .ec {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--rs);
      padding: 12px;
      display: flex;
      gap: 14px;
      margin-bottom: 12px;
      cursor: pointer;
      align-items: center;
    }

    .et {
      width: 54px;
      height: 54px;
      background: var(--bg3);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      border: 1px solid var(--border);
    }

    .ei {
      flex: 1;
    }

    .en {
      font-weight: 800;
      font-size: 15px;
      margin-bottom: 3px;
    }

    .ed2 {
      font-size: 12px;
      color: var(--text2);
      line-height: 1.3;
    }

    .fv {
      font-size: 20px;
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 10px;
      transition: 0.2s;
    }

    .lr {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 12px;
      background: var(--card2);
      border-radius: 12px;
      margin-bottom: 8px;
      border: 1px solid var(--border);
    }

    .ln {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--acc-d);
      color: var(--acc);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--FD);
      font-weight: 700;
      font-size: 18px;
      flex-shrink: 0;
      border: 1px solid var(--acc);
    }

    .lm {
      flex: 1;
    }

    .prb {
      background: var(--acc);
      color: var(--on-acc);
      font-size: 10px;
      font-weight: 800;
      padding: 2px 6px;
      border-radius: 4px;
      margin-left: 5px;
      vertical-align: middle;
    }

    .tag {
      font-size: 10px;
      font-weight: 800;
      padding: 3px 8px;
      border-radius: 6px;
      text-transform: uppercase;
      margin-right: 4px;
      letter-spacing: 0.5px;
    }

    .tg-m {
      background: var(--acc-d);
      color: var(--acc);
    }

    .tg-e {
      background: var(--card2);
      color: var(--text2);
    }

    .hc {
      background: var(--card);
      border-radius: 14px;
      border: 1px solid var(--border);
      padding: 14px;
      margin-bottom: 12px;
      cursor: pointer;
    }

    .tsm {
      font-size: 13px;
      color: var(--text);
    }

    .txs {
      font-size: 12px;
      color: var(--text2);
    }

    .mut {
      color: var(--text3);
    }

    #toast {
      position: fixed;
      top: 40px;
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      background: var(--text);
      color: var(--bg);
      padding: 12px 24px;
      border-radius: 30px;
      font-weight: 800;
      font-size: 14px;
      z-index: 9999;
      pointer-events: none;
      opacity: 0;
      transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
      white-space: nowrap;
    }

    #toast.on {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    .mov {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
      backdrop-filter: blur(8px);
      z-index: 1000;
      display: flex;
      align-items: flex-end;
      opacity: 0;
      pointer-events: none;
      transition: 0.3s;
    }

    .mov.open {
      opacity: 1;
      pointer-events: auto;
    }

    /* Stack share / PR-picker above chat so taps and scroll hit the top overlay */
    #prShareMov.mov.open,
    #shareMov.mov.open {
      z-index: 1100;
    }

    .modal-pr-share {
      max-height: min(88vh, 640px);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .modal-pr-share #prShareList {
      flex: 1 1 auto;
      min-height: 0;
      max-height: min(56vh, 420px);
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      touch-action: pan-y;
    }

    .modal-share {
      max-height: 88vh;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .modal-share .modal-share-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }

    .modal {
      width: 100%;
      background: var(--bg2);
      border-top: 1px solid var(--border);
      border-radius: 24px 24px 0 0;
      padding: 24px;
      padding-bottom: 40px;
      transform: translateY(100%);
      transition: 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
      max-height: 90vh;
      overflow-y: auto;
    }

    .mov.open .modal {
      transform: translateY(0);
    }

    .mhdl {
      width: 40px;
      height: 5px;
      background: var(--border);
      border-radius: 10px;
      margin: 0 auto 20px;
    }

    .mtt {
      font-size: 18px;
      font-weight: 800;
      text-align: center;
      margin-bottom: 24px;
    }

    /* Treadmill Specific */
    .t-v {
      font-family: var(--FD);
      font-size: 32px;
      color: var(--acc);
      text-shadow: 0 0 15px var(--acc-d);
    }

    .t-l {
      font-size: 10px;
      font-weight: 800;
      color: var(--text3);
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    /* Message Media Styles */
    .msg-img { max-width:220px; max-height:300px; border-radius:12px; margin-top:4px; border:1px solid var(--border); cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,0.2); transition:transform 0.2s; }
    .msg-img:active { transform:scale(0.98); }
    .voice-rec-dot { width:10px; height:10px; background:var(--red); border-radius:50%; display:inline-block; margin-right:6px; animation: blink 0.8s infinite; box-shadow: 0 0 8px var(--red); }
    .voice-message {
      width: min(260px, 68vw);
      display: grid;
      grid-template-columns: 34px 1fr auto;
      align-items: center;
      gap: 10px;
      padding: 4px 0;
    }
    .voice-play {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      background: var(--acc-d);
      color: var(--acc);
      font-weight: 900;
      line-height: 1;
      transition: 0.2s;
    }
    .msg-bubble.me .voice-play { background: rgba(0,0,0,0.12); color: inherit; }
    body.theme-blue .msg-bubble.me .voice-play, body.theme-red .msg-bubble.me .voice-play, 
    body.theme-purple .msg-bubble.me .voice-play, body.theme-pink .msg-bubble.me .voice-play, 
    body.theme-magenta .msg-bubble.me .voice-play, body.theme-coral .msg-bubble.me .voice-play {
       background: rgba(255,255,255,0.2);
    }
    .voice-track { display:flex; align-items:center; gap:3px; min-width:0; height:34px; }
    .voice-bar {
      width: 3px;
      border-radius: 999px;
      background: var(--acc);
      opacity: 0.8;
      transform-origin: center;
    }
    .msg-bubble.me .voice-bar { background: currentColor; }
    .voice-message.playing .voice-bar { animation: voicePulse 0.85s ease-in-out infinite; animation-delay: calc(var(--i) * 48ms); }
    .voice-time { font-size: 11px; font-weight: 800; opacity: 0.62; min-width: 34px; text-align:right; }
    .voice-message audio { display:none; }
    @keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
    @keyframes voicePulse { 0%,100% { transform: scaleY(0.65); opacity:0.42; } 50% { transform: scaleY(1.25); opacity:0.9; } }
    .cal-card { background:var(--bg3); border:1px solid var(--border); border-radius:16px; padding:16px; min-width:200px; max-width:260px; box-shadow:0 4px 15px rgba(0,0,0,0.15); }
    .cal-card-title { font-weight:800; font-size:16px; margin-bottom:4px; color:var(--text); }
    .cal-card-note { font-size:12px; color:var(--text2); margin-bottom:12px; line-height:1.4; }
    .cal-card-meta { font-size:9px; font-weight:800; color:var(--text3); text-transform:uppercase; letter-spacing:1.5px; margin-bottom:6px; }

    /* ═══ MODERN CHAT UI ═══ */
    #msgMov .modal,
    #grpMov .modal {
      height: 100dvh;
      max-height: 100dvh;
      border-radius: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      padding-bottom: 0;
    }
    .chat-header { 
      background: var(--bg); 
      backdrop-filter: blur(20px); 
      -webkit-backdrop-filter: blur(20px); 
      border-bottom: 1px solid var(--border); 
      min-height: 60px; 
      display: flex; 
      align-items: center; 
      z-index: 100; 
      flex: 0 0 auto; 
    }
    .chat-thread { padding: 15px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1 1 auto; min-height:0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    
    .msg-bubble-container { display: flex; flex-direction: column; width: 100%; margin: 4px 0; transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28); position: relative; }
    .msg-bubble { 
      max-width: 80%; padding: 10px 14px; font-size: 15px; line-height: 1.4; position: relative; 
      box-shadow: 0 4px 12px rgba(0,0,0,0.12); transition: 0.2s;
    }
    .msg-bubble-actions {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      align-items: center;
      gap: 6px;
      opacity: 0;
      pointer-events: none;
      transition: 0.18s;
    }
    .msg-bubble:hover .msg-bubble-actions,
    .msg-bubble:focus-within .msg-bubble-actions { opacity: 1; pointer-events: auto; }
    .msg-bubble.me .msg-bubble-actions { right: calc(100% + 8px); }
    .msg-bubble.them .msg-bubble-actions { left: calc(100% + 8px); }
    .msg-action-btn {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: var(--bg3);
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 8px 18px rgba(0,0,0,0.28);
      font-size: 14px;
    }
    
    .msg-bubble.me { 
      align-self: flex-end; 
      background: linear-gradient(135deg, var(--acc), var(--acc-d)); 
      color: #000; 
      border-radius: 18px 18px 4px 18px; 
      font-weight: 500;
      box-shadow: 0 4px 15px var(--acc-d);
      border: 1px solid rgba(255,255,255,0.1);
    }
    body.theme-blue .msg-bubble.me, body.theme-red .msg-bubble.me, body.theme-purple .msg-bubble.me,
    body.theme-pink .msg-bubble.me, body.theme-magenta .msg-bubble.me, body.theme-coral .msg-bubble.me {
      color: #fff;
    }

    .msg-bubble.them { 
      align-self: flex-start; 
      background: var(--card2); 
      color: var(--text); 
      border: 1px solid var(--border); 
      border-radius: 18px 18px 18px 4px; 
    }
    
    .msg-text { word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
    .msg-meta { font-size: 10px; margin-top: 4px; opacity: 0.6; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
    .msg-bubble.me .msg-meta { color: rgba(0,0,0,0.45); }
    body.theme-blue .msg-bubble.me .msg-meta, body.theme-red .msg-bubble.me .msg-meta, body.theme-purple .msg-bubble.me .msg-meta,
    body.theme-pink .msg-bubble.me .msg-meta, body.theme-magenta .msg-bubble.me .msg-meta, body.theme-coral .msg-bubble.me .msg-meta {
      color: rgba(255,255,255,0.6);
    }
    
    .msg-quote { 
      background: rgba(255,255,255,0.06); border-left: 3px solid var(--acc); padding: 6px 10px; 
      border-radius: 6px; margin-bottom: 6px; font-size: 12px; opacity: 0.9;
      max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    }
    .msg-bubble.me .msg-quote { background: rgba(0,0,0,0.08); border-left-color: rgba(0,0,0,0.3); }

    .msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
    .reaction-pill { 
      background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; 
      padding: 2px 8px; font-size: 11px; display: flex; align-items: center; gap: 4px; 
      cursor: pointer; transition: 0.2s; font-weight: 800;
    }
    .reaction-pill.mine { border-color: var(--acc); background: var(--acc-d); color: var(--acc); }
    
    .reaction-picker { 
      display: flex; gap: 12px; padding: 8px 16px; background: var(--bg2); border-radius: 30px; 
      border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.4); 
      position: fixed; transform: translateX(-50%); 
      z-index: 1000; animation: bounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
      max-width: 90vw;
    }
    .reaction-picker span { font-size: 24px; cursor: pointer; transition: 0.2s; }
    .reaction-picker span:hover { transform: scale(1.3); }

    .chat-composer { 
      background: var(--bg); 
      backdrop-filter: blur(20px); 
      border-top: 1px solid var(--border); 
      padding: 10px; 
      padding-bottom: calc(10px + env(safe-area-inset-bottom, 0)); 
      flex: 0 0 auto;
    }
    .composer-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 24px; display: flex; align-items: center; padding: 4px 12px; flex: 1; gap: 8px; min-height: 44px; }
    .composer-wrap:focus-within { border-color: var(--acc); background: var(--bg2); }
    
    .msg-reply-preview { 
      background: var(--bg3); border-left: 4px solid var(--acc); border-radius: 12px; 
      padding: 12px 40px 12px 16px; position: relative; margin: 0 0 10px; animation: slideUp 0.3s ease;
    }
    .msg-reply-preview .close { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 18px; opacity: 0.6; cursor: pointer; }

    /* Swipe Indicator */
    .swipe-reply-icon { position: absolute; left: -30px; top: 50%; transform: translateY(-50%); opacity: 0; transition: 0.2s; font-size: 16px; color: var(--acc); }

    .view-once-placeholder { background: rgba(200, 255, 0, 0.05); border: 1px dashed var(--acc); color: var(--acc); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; transition: 0.3s; font-weight: 800; font-size: 13px; }
    .view-once-destroyed { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; font-size: 11px; color: var(--text3); font-weight: 800; line-height: 1.4; opacity: 0.6; }

    .secure-viewer { position:fixed; top:0; left:0; width:100%; height:100%; background:black; z-index:9999; display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:0.3s; }
    .secure-viewer.open { opacity:1; pointer-events:all; }
    .secure-viewer img { max-width:100%; max-height:100%; transition:filter 0.3s; }
    .secure-viewer.blurred img { filter: blur(40px); }

    @keyframes slideUp { from { transform:translateY(10px); opacity:0; } to { transform:translateY(0); opacity:1; } }
    @keyframes bounceIn { 0% { transform:translateX(-50%) scale(0.5); opacity:0; } 70% { transform:translateX(-50%) scale(1.1); } 100% { transform:translateX(-50%) scale(1); opacity:1; } }
    @media (hover: none) {
      .msg-bubble-actions { opacity: 1; pointer-events: auto; }
      .msg-action-btn { width: 28px; height: 28px; font-size: 13px; }
    }

    /* Auth UI */
    .auth-box {
      width: 100%;
      max-width: 380px;
      margin: auto;
      padding: 30px;
      border-radius: 20px;
      background: var(--bg2);
      border: 1px solid var(--border);
    }

    .auth-title {
      font-family: 'Outfit', sans-serif;
      font-weight: 800;
      font-size: 42px;
      color: var(--acc);
      text-align: center;
      margin-bottom: 5px;
      letter-spacing: -1px;
    }

    .auth-sub {
      font-size: 11px;
      font-weight: 800;
      color: var(--text3);
      text-align: center;
      margin-bottom: 40px;
      letter-spacing: 4px;
    }

    /* Calendar */
    .cal-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 4px;
    }

    .ch {
      text-align: center;
      font-size: 10px;
      font-weight: 800;
      color: var(--text3);
      padding-bottom: 8px;
    }

    .cd {
      aspect-ratio: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      font-weight: 600;
      border-radius: 10px;
      cursor: pointer;
      background: var(--card);
      border: 1px solid var(--border);
    }

    .cd.tod {
      border-color: var(--acc);
      color: var(--acc);
    }

    .cd.hss {
      background: var(--acc);
      color: #000;
    }

    .cd.hpl {
      border: 1.5px solid var(--acc);
      color: var(--acc);
    }

    .cd.sel {
      background: var(--card2);
      transform: scale(1.1);
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
      z-index: 2;
    }

    .cd.emp {
      visibility: hidden;
    }

    /* Social */
    .friend-row {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 12px;
    }

    .avatar {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--bg3);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      flex-shrink: 0;
      color: var(--acc);
    }

    .social-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px;
      margin-bottom: 8px;
    }



    @media (max-width: 400px) {
      .sb {
        padding: 16px;
      }

      .g2,
      .g3 {
        grid-template-columns: 1fr;
      }

      .card {
        padding: 12px;
      }

      .ht {
        font-size: 18px;
      }

      .bnav {
        height: calc(60px + env(safe-area-inset-bottom, 0px));
      }

      .ni-ic {
        font-size: 20px;
      }

      .ni {
        font-size: 9px;
      }
    }

    /* Custom tab styles */
    .tab-nav {
      display: flex;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 3px;
      margin: 10px 0 15px 0;
    }
    .tab-nav-btn {
      flex: 1;
      text-align: center;
      padding: 8px 12px;
      font-size: 13px;
      font-weight: 700;
      border-radius: 17px;
      color: var(--text-mut, #888);
      cursor: pointer;
      transition: all 0.2s ease;
      border: 1px solid transparent;
    }
    .tab-nav-btn.active {
      background: var(--acc-d);
      border-color: var(--acc);
      color: var(--acc);
    }

    /* Heatmap Card Styles */
    .heatmap-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px;
      margin-bottom: 18px;
    }
    .heatmap-layout {
      display: flex;
      justify-content: space-around;
      align-items: center;
      margin: 15px 0;
    }
    .heatmap-svg {
      width: 42%;
      max-width: 140px;
      height: auto;
    }
    .heatmap-muscle-path {
      cursor: pointer;
      transition: fill 0.3s ease, filter 0.3s ease;
    }
    .heatmap-muscle-path:hover {
      filter: brightness(1.2) drop-shadow(0 0 4px var(--acc));
    }
    .heatmap-legend {
      display: flex;
      justify-content: center;
      gap: 12px;
      font-size: 10px;
      color: var(--text-mut, #888);
      margin-top: 10px;
    }
    .legend-item {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .legend-box {
      width: 12px;
      height: 12px;
      border-radius: 3px;
    }

    #workoutBodyHeatmap {
      border-color: rgba(var(--hm-rgb),0.22);
      background:
        radial-gradient(circle at 50% 0%, rgba(var(--hm-rgb),0.11), transparent 44%),
        linear-gradient(145deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
        var(--card);
    }
    #bodyHeatmapFront,
    #bodyHeatmapBack {
      filter: drop-shadow(0 16px 24px rgba(0,0,0,0.28));
    }
    #workoutBodyHeatmap .muscle-path {
      cursor: pointer;
      transition: fill 0.22s ease, stroke 0.22s ease, filter 0.22s ease, opacity 0.22s ease;
      outline: none;
    }
    #workoutBodyHeatmap .muscle-path:hover,
    #workoutBodyHeatmap .muscle-path:focus {
      filter: brightness(1.18) drop-shadow(0 0 7px rgba(var(--hm-rgb),0.72));
      stroke: rgba(var(--hm-rgb),0.95) !important;
    }
    #workoutBodyHeatmap .muscle-path[data-active="1"] {
      stroke: rgba(var(--hm-rgb),0.7);
      stroke-width: 1.4;
    }
    .body-heatmap-stat {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      background: rgba(255,255,255,0.025);
      padding: 7px 10px;
      border-radius: 8px;
      border: 1px solid var(--border);
      min-width: 0;
    }
    .body-heatmap-stat strong {
      color: var(--text);
      font-weight: 850;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .body-heatmap-stat span {
      color: var(--hm-full);
      font-weight: 950;
      font-size: 12px;
      font-family: var(--FD);
      white-space: nowrap;
    }
    .body-heatmap-stat.is-empty span {
      color: var(--text3);
    }

    /* Chip buttons */
    .chip {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 6px 14px;
      font-size: 12px;
      font-weight: 800;
      color: var(--text2);
      cursor: pointer;
      white-space: nowrap;
      transition: 0.2s;
    }

    .chip.on {
      background: var(--acc-d);
      border-color: var(--acc);
      color: var(--acc);
    }

    /* Session bar offset — screens that need top padding when sbar is visible */
    body.sess-active .screen:not(#sc-wk):not(#sc-tread) {
      padding-top: 40px;
    }

    body.sess-active .sb {
      padding-top: 20px;
    }

    body.sess-active #sc-wk .hdr {
      margin-top: 0;
    }

    /* wk hides sbar, no offset needed */

    /* PR Board */
    .pr-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      margin-bottom: 8px;
    }

    .pr-ex {
      flex: 1;
      font-weight: 700;
      font-size: 14px;
    }

    .pr-val {
      font-family: var(--FD);
      font-size: 13px;
      color: var(--acc);
      font-weight: 700;
    }

    .pr-date {
      font-size: 11px;
      color: var(--text3);
    }

    .msg-pr-wrap {
      display: flex;
      width: 100%;
      margin-bottom: 10px;
    }

    .msg-pr-card {
      max-width: 92%;
      padding: 14px 16px;
      border-radius: 14px;
      border: 2px solid var(--acc);
      background: linear-gradient(145deg, var(--bg3), var(--card));
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }

    .msg-pr-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.12em;
      color: var(--acc);
      margin-bottom: 6px;
    }

    .msg-pr-name {
      font-weight: 800;
      font-size: 15px;
      margin-bottom: 4px;
    }

    .msg-pr-stats {
      font-family: var(--FD);
      font-size: 18px;
      font-weight: 800;
      color: var(--acc);
    }

    .msg-pr-date {
      font-size: 11px;
      margin: 8px 0 10px;
    }

    .msg-pr-actions {
      gap: 8px;
      flex-wrap: wrap;
    }

    .msg-forge-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.1em;
      color: var(--acc);
      margin-bottom: 8px;
      padding: 4px 10px;
      border-radius: 999px;
      background: var(--acc-d);
      border: 1px solid var(--acc);
    }

    .msg-read-bar {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 6px;
      text-align: center;
      font-size: 11px;
      color: var(--text3);
      padding: 8px 4px 4px;
      border-top: 1px solid var(--border);
      margin-top: 6px;
      letter-spacing: 0.02em;
    }

    .msg-read-ticks {
      color: var(--blue);
      font-size: 12px;
      font-weight: 800;
      line-height: 1;
    }

    #msgPresence {
      text-align: center;
      font-size: 12px;
      color: var(--text3);
      margin: -2px 0 10px;
      min-height: 16px;
    }

    .unread-dot {
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 999px;
      background: var(--blue);
      color: #fff;
      font-size: 10px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin-left: auto;
    }

    /* Streak */
    .streak-card {
      background: linear-gradient(135deg, var(--acc-d), transparent);
      border: 1px solid var(--acc);
      border-radius: 14px;
      padding: 14px;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      gap: 14px;
    }

    /* Quick-log hint */
    .ql-hint {
      background: var(--bg3);
      border: 1px dashed var(--acc);
      border-radius: 10px;
      padding: 10px 14px;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13px;
    }
    #offline-banner {
      position: fixed; top: 0; left: 0; right: 0;
      background: color-mix(in srgb, var(--red) 92%, #000); color: #fff;
      padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
      text-align: center; font-size: 13px; font-weight: 900;
      z-index: 9999; display: none;
      box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    body.is-offline .hdr { padding-top: calc(env(safe-area-inset-top, 0px) + 28px); height: calc(88px + env(safe-area-inset-top, 0px)); }
    body.is-offline #offline-banner { display: block; }
    .msg-seen-inline {
      font-size: 10px;
      font-weight: 800;
      color: var(--text3);
      margin-top: 2px;
      opacity: 0.8;
      text-transform: uppercase;
      letter-spacing: 0.8px;
    }
    .msg-seen-inline.is-seen { color: var(--acc); opacity: 1; }

    /* Today highlight */
    .cd.today {
      background: var(--acc);
      color: #000 !important;
      font-weight: 800;
      border-color: var(--acc);
    }

    /* Calendar event card in chat */
    .msg-cal-card {
      background: linear-gradient(135deg, var(--card2), var(--card));
      border: 1.5px solid var(--acc);
      border-radius: 16px;
      padding: 14px 16px;
      min-width: 220px;
      max-width: 280px;
    }
    .msg-cal-label { font-size: 10px; font-weight: 800; color: var(--acc); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 4px; }
    .msg-cal-date { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
    .msg-cal-notes { font-size: 12px; color: var(--text2); margin-bottom: 10px; }

    /* Group chat styles */
    .grp-sender-label {
      font-size: 10px;
      font-weight: 800;
      color: var(--acc);
      margin-bottom: 3px;
      padding-left: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .grp-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px 14px;
      margin-bottom: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 12px;
      transition: 0.15s;
    }
    .grp-card:active { transform: scale(0.98); background: var(--card2); }
    .grp-avatar {
      width: 44px; height: 44px; border-radius: 50%;
      background: linear-gradient(135deg, var(--acc), var(--acc-d));
      display: flex; align-items: center; justify-content: center;
      font-size: 20px; flex-shrink: 0; font-weight: 800; color: #000;
    }
    .seen-by-row {
      font-size: 10px;
      color: var(--text3);
      margin-top: 4px;
      text-align: right;
      font-weight: 800;
      opacity: 0.8;
      text-transform: uppercase;
      letter-spacing: 0.8px;
    }
    .seen-by-row.is-seen { color: var(--acc); opacity: 1; }
    .member-check { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
    .member-check:last-child { border-bottom: none; }
    .member-check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acc); cursor: pointer; }

    /* FORGE pro refresh */
    body {
      background:
        radial-gradient(circle at 20% -10%, rgba(var(--acc-rgb),0.12), transparent 30%),
        radial-gradient(circle at 90% 0%, rgba(0,209,255,0.08), transparent 24%),
        linear-gradient(180deg, #090b10 0%, var(--bg) 48%, #050609 100%);
    }
    body.bg-snow,
    body.bg-sky,
    body.bg-mint,
    body.bg-cotton_candy {
      background:
        radial-gradient(circle at 18% -10%, rgba(var(--acc-rgb),0.14), transparent 30%),
        linear-gradient(180deg, var(--bg2) 0%, var(--bg) 62%, var(--bg3) 100%);
    }
    .screen { animation: screenFade 0.22s ease both; }
    .sb { scrollbar-width: thin; scrollbar-color: var(--acc) transparent; }
    .card, .hc, .ec, .social-card, .grp-card, .pr-row, .cal-card {
      border-color: rgba(255,255,255,0.09);
      background: linear-gradient(145deg, rgba(255,255,255,0.062), rgba(255,255,255,0.028));
      box-shadow: 0 18px 45px rgba(0,0,0,0.22);
    }
    .card, .hc, .ec, .social-card, .grp-card, .btn, .ib, .chip, .inp { transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease; }
    .card:hover, .hc:hover, .ec:hover, .social-card:hover, .grp-card:hover {
      transform: translateY(-2px);
      border-color: rgba(var(--acc-rgb),0.28);
      box-shadow: 0 24px 60px rgba(0,0,0,0.32), 0 0 0 1px rgba(var(--acc-rgb),0.04) inset;
    }
    .btn:active, .ib:active, .chip:active, .ec:active, .social-card:active { transform: scale(0.97); }
    .hdr {
      background: linear-gradient(180deg, rgba(9,11,16,0.96), rgba(9,11,16,0.72));
      backdrop-filter: blur(16px);
      border-bottom: 1px solid rgba(255,255,255,0.07);
    }
    .ht, .st, .mtt { letter-spacing: 0; }
    .st { color: var(--text); opacity: 0.96; }
    .inp {
      background: rgba(255,255,255,0.045);
      border-color: rgba(255,255,255,0.09);
    }
    .inp:focus { box-shadow: 0 0 0 3px var(--acc-d); }
    .bnav {
      background: rgba(7,8,12,0.88);
      backdrop-filter: blur(22px);
      border-top: 1px solid rgba(255,255,255,0.08);
    }
    .ni.active { transform: translateY(-2px); }
    .modal { background: var(--bg); box-shadow: 0 -20px 80px rgba(0,0,0,0.45); color: var(--text); }
    .mov.open .modal { animation: sheetRise 0.28s cubic-bezier(.2,.9,.2,1) both; }
    .toast-pro, #toast { max-width: min(92vw, 520px); white-space: normal; text-align:center; }

    .exercise-visual {
      position: relative;
      overflow: hidden;
      width: 100%;
      height: 100%;
      min-height: 54px;
      border-radius: 12px;
      background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    }
    .exercise-visual img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      filter: saturate(1.08) contrast(1.05);
    }
    .exercise-visual.duo { display:grid; grid-template-columns:1fr 1fr; gap:1px; }
    .exercise-visual:after {
      content:'';
      position:absolute; inset:0;
      background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,0.5));
      pointer-events:none;
    }
    .exercise-visual.fallback { padding: 6px; }
    .exercise-hero {
      height: 300px;
      border-radius: 18px;
      border: 1px solid rgba(255,255,255,0.09);
      overflow: hidden;
      background: #080a0e;
      margin-bottom: 14px;
      box-shadow: 0 24px 70px rgba(0,0,0,0.35);
    }
    .exercise-detail-grid { display:grid; gap:10px; margin-top:12px; }
    .exercise-info-card {
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.045);
      border-radius: 14px;
      padding: 12px;
    }
    .exercise-info-card h4 { margin:0 0 6px; font-size:11px; color:var(--acc); text-transform:uppercase; letter-spacing:1px; }
    .muscle-chip {
      display:inline-flex; align-items:center; gap:5px;
      padding:5px 9px; border-radius:999px; margin:3px 4px 3px 0;
      border:1px solid rgba(var(--acc-rgb),0.24); color:var(--acc); background:rgba(var(--acc-rgb),0.08);
      font-size:11px; font-weight:800; text-transform:uppercase;
    }
    .muscle-chip.secondary { color:var(--text2); border-color:rgba(255,255,255,0.11); background:rgba(255,255,255,0.045); }
    .anatomy-fallback {
      width:100%; height:100%; min-height:120px;
      display:grid; place-items:center;
      background:
        linear-gradient(145deg, rgba(var(--acc-rgb),0.08), transparent),
        radial-gradient(circle at 50% 25%, rgba(255,255,255,0.1), transparent 35%);
    }
    .anatomy-fallback svg { width: 86%; height: 86%; filter: drop-shadow(0 12px 20px rgba(0,0,0,0.35)); }

    .chat-status-row, .typing-row {
      font-size: 11px;
      color: var(--text3);
      padding: 2px 16px 8px;
      min-height: 18px;
      font-weight: 700;
    }
    .msg-status { font-size:10px; opacity:0.62; margin-left:4px; text-transform:uppercase; font-weight:800; }
    .msg-deleted {
      font-style: italic;
      opacity: 0.58;
      border: 1px dashed rgba(255,255,255,0.15);
      padding: 8px 10px;
      border-radius: 12px;
    }
    .mention-hit {
      background: rgba(var(--acc-rgb),0.18);
      color: var(--acc);
      border-radius: 8px;
      padding: 0 4px;
      font-weight: 900;
    }
    .upload-progress {
      height: 4px;
      overflow: hidden;
      border-radius: 999px;
      background: rgba(255,255,255,0.08);
      margin-top: 6px;
    }
    .upload-progress span { display:block; height:100%; background:var(--acc); width:0%; transition: width 0.2s ease; }
    .media-viewer-content {
      width:100%;
      max-height:86vh;
      display:flex;
      align-items:center;
      justify-content:center;
      padding: 18px;
    }
    .media-viewer-content img, .media-viewer-content video {
      max-width:100%;
      max-height:78vh;
      border-radius: 16px;
      box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    }
    .recap-card {
      border-radius: 18px;
      padding: 18px;
      background: linear-gradient(145deg, rgba(var(--acc-rgb),0.16), rgba(255,255,255,0.04));
      border: 1px solid rgba(var(--acc-rgb),0.28);
      animation: popIn 0.38s cubic-bezier(.2,1.2,.2,1) both;
    }
    @keyframes screenFade { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }
    @keyframes sheetRise { from { transform: translateY(100%); } to { transform: translateY(0); } }
    @keyframes popIn { from { opacity:0; transform: scale(0.94) translateY(10px); } to { opacity:1; transform:none; } }

    /* Premium interaction layer */
    .screen.active { animation: screenFade 0.26s cubic-bezier(.2,.8,.2,1) both; }
    .card, .ec, .hc, .btn, .ib, .chip, .ni, .ni-mid-btn {
      will-change: transform, box-shadow, border-color, background;
      transition:
        transform 0.18s cubic-bezier(.2,.8,.2,1),
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        opacity 0.18s ease;
    }
    @media (hover: hover) and (pointer: fine) {
      .card:hover, .ec:hover, .hc:hover {
        transform: translateY(-3px) scale(1.01);
        border-color: color-mix(in srgb, var(--acc) 38%, rgba(255,255,255,0.12));
        box-shadow: 0 26px 70px rgba(0,0,0,0.36), 0 0 28px var(--acc-d);
      }
      .btn:hover, .ib:hover, .chip:hover, .ni:hover, .ni-mid-btn:hover {
        transform: translateY(-1px) scale(1.02);
      }
    }
    .card:active, .ec:active, .hc:active, .btn:active, .ib:active, .chip:active, .ni:active, .ni-mid-btn:active {
      transform: scale(0.97);
    }
    .hdr, .bnav {
      background: color-mix(in srgb, var(--bg) 72%, transparent);
      -webkit-backdrop-filter: blur(18px) saturate(1.25);
      backdrop-filter: blur(18px) saturate(1.25);
      box-shadow: 0 18px 50px rgba(0,0,0,0.26);
    }
    .bnav {
      border-top-color: rgba(255,255,255,0.10);
      box-shadow: 0 -18px 52px rgba(0,0,0,0.34);
    }
    .mov {
      background: color-mix(in srgb, var(--bg) 28%, rgba(0,0,0,0.72));
      -webkit-backdrop-filter: blur(16px) saturate(1.18);
      backdrop-filter: blur(16px) saturate(1.18);
    }
    .inp {
      box-shadow: 0 0 0 0 transparent;
      transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    }
    .inp:focus {
      border-color: var(--acc);
      box-shadow: 0 0 0 3px var(--acc-d), 0 0 28px color-mix(in srgb, var(--acc) 18%, transparent);
    }
    .view-all-link {
      appearance: none;
      border: 1px solid color-mix(in srgb, var(--acc) 28%, transparent);
      background: color-mix(in srgb, var(--acc) 10%, transparent);
      color: var(--acc);
      border-radius: 999px;
      cursor: pointer;
      flex-shrink: 0;
      font: 800 11px var(--FF);
      letter-spacing: 0;
      line-height: 1;
      padding: 7px 10px;
      text-transform: none;
      transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    }
    .view-all-link::after { content: " ->"; }
    .view-all-link:hover { transform: translateY(-1px); box-shadow: 0 0 22px var(--acc-d); }
    .btn-p, .ni-mid-btn, .ln[style*="background:var(--acc)"] { color: var(--on-acc) !important; }
    .session-mini {
      background: rgba(0,0,0,0.72);
      background: color-mix(in srgb, var(--bg) 82%, transparent);
      -webkit-backdrop-filter: blur(18px) saturate(1.2);
      backdrop-filter: blur(18px) saturate(1.2);
      border-bottom: 1px solid rgba(var(--acc-rgb),0.18);
      box-shadow: 0 14px 36px rgba(0,0,0,0.28);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 9px 16px;
    }
    .session-mini-title {
      color: var(--text);
      font-size: 12px;
      font-weight: 900;
      letter-spacing: 0.3px;
      text-transform: uppercase;
    }
    .session-mini-meta {
      color: var(--text2);
      font-size: 11px;
      font-weight: 700;
      margin-top: 2px;
    }
    .session-ex-list { display: grid; gap: 8px; }
    .session-ex-row {
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) 34px auto;
      gap: 10px;
      align-items: center;
      min-height: 64px;
      padding: 10px;
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 12px;
      background: rgba(255,255,255,0.035);
      cursor: pointer;
    }
    .session-ex-row.is-current {
      border-color: rgba(var(--acc-rgb),0.42);
      background: linear-gradient(135deg, rgba(var(--acc-rgb),0.16), rgba(255,255,255,0.035));
      box-shadow: 0 0 0 1px rgba(var(--acc-rgb),0.08) inset, 0 12px 28px rgba(0,0,0,0.18);
    }
    .session-ex-thumb {
      width: 42px;
      height: 42px;
      overflow: hidden;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg3);
    }
    .session-ex-name {
      color: var(--text);
      font-size: 13px;
      font-weight: 900;
      line-height: 1.2;
    }
    .session-ex-meta {
      color: var(--text2);
      font-size: 11px;
      font-weight: 700;
      line-height: 1.35;
      margin-top: 4px;
    }
    .session-ex-stat {
      color: var(--acc);
      font-size: 11px;
      font-weight: 900;
      text-align: right;
      white-space: nowrap;
    }
    .session-ex-remove {
      width: 30px;
      height: 30px;
      border: 1px solid rgba(255,68,68,0.25);
      border-radius: 10px;
      background: var(--red-d);
      color: var(--red);
      font: 950 16px var(--FF);
      cursor: pointer;
      line-height: 1;
    }
    .set-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 7px;
      border-radius: 999px;
      background: rgba(var(--acc-rgb),0.10);
      border: 1px solid rgba(var(--acc-rgb),0.22);
      color: var(--text);
      font-size: 11px;
      font-weight: 800;
      margin: 3px 4px 0 0;
      white-space: nowrap;
    }
    .set-pill.fail { background: var(--red-d); border-color: rgba(255,68,68,0.26); color: var(--red); }
    .session-stat-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-top: 10px;
    }
    .session-stat {
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 12px;
      padding: 10px;
      background: rgba(255,255,255,0.035);
    }
    .session-stat strong {
      display: block;
      color: var(--acc);
      font: 900 16px var(--FD);
    }
    .session-stat span {
      color: var(--text3);
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
    }
    .lr {
      min-height: 64px;
      background: linear-gradient(135deg, rgba(255,255,255,0.055), rgba(255,255,255,0.022));
    }
    body.bg-snow .session-mini,
    body.bg-sky .session-mini,
    body.bg-mint .session-mini,
    body.bg-cotton_candy .session-mini {
      background: color-mix(in srgb, var(--bg2) 84%, rgba(255,255,255,0.72));
      box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    }

    /* Fit guards: keep dense workout data readable on narrow screens. */
    .row { min-width: 0; }
    .row > * { min-width: 0; }
    .btn {
      min-width: 0;
      max-width: 100%;
      white-space: normal;
      text-align: center;
      line-height: 1.15;
    }
    .chip,
    .tag,
    .prb,
    .set-pill,
    .muscle-chip {
      max-width: 100%;
      white-space: normal;
      overflow-wrap: anywhere;
      line-height: 1.25;
    }
    .st {
      flex-wrap: wrap;
      row-gap: 6px;
      line-height: 1.2;
    }
    .session-mini { min-width: 0; }
    .session-mini-title,
    .session-mini-meta,
    .session-ex-name,
    .session-ex-meta,
    .en,
    .ed2,
    .tsm,
    .txs {
      overflow-wrap: anywhere;
    }
    .session-ex-stat { white-space: normal; }
    .session-stat strong {
      overflow-wrap: anywhere;
      font-size: clamp(12px, 4vw, 16px);
    }
    #catChips,
    #edTgs,
    .heatmap-legend {
      max-width: 100%;
    }
    .hc .row,
    .pr-row,
    .set-edit-row {
      flex-wrap: wrap;
    }
    #setsLog .lr {
      align-items: flex-start;
    }
    @media (max-width: 430px) {
      .sb { padding-left: 14px; padding-right: 14px; }
      .hdr { padding-left: 12px; padding-right: 12px; }
      .ht { font-size: clamp(15px, 5vw, 20px); overflow-wrap: anywhere; }
      .card { padding: 13px; }
      .btn { padding: 11px 10px; font-size: 12px; }
      .btn-sm { padding: 7px 9px; font-size: 10px; }
      .ib { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
      .g2, .g3 { grid-template-columns: 1fr; }
      .session-ex-row {
        grid-template-columns: 38px minmax(0, 1fr) 32px auto;
        align-items: flex-start;
      }
      .session-ex-thumb { width: 38px; height: 38px; }
      .session-ex-stat {
        grid-column: 2;
        text-align: left;
        margin-top: -3px;
      }
      .session-stat-grid { grid-template-columns: 1fr; }
      .set-pill {
        display: flex;
        width: 100%;
        justify-content: flex-start;
        border-radius: 10px;
      }
      #tplQueueBar .row,
      #sessModeBanner .row {
        flex-wrap: wrap;
        align-items: stretch;
      }
      #tplQueueBar .btn,
      #sessModeBanner .btn {
        flex: 1 1 120px;
      }
      #sc-wk .card > .row:first-child {
        flex-direction: column;
        align-items: stretch;
      }
      #sc-wk .card > .row:first-child .col {
        width: 100%;
      }
      #sc-wk .inp {
        font-size: 18px !important;
      }
      #restB .row {
        flex-wrap: wrap;
      }
      #restN {
        width: auto !important;
        min-width: 44px;
      }
      .lr {
        gap: 9px;
        padding: 10px;
      }
      .ln {
        width: 34px;
        height: 34px;
        font-size: 14px;
      }
      .ec {
        gap: 10px;
        padding: 10px;
      }
      .et {
        width: 46px;
        height: 46px;
      }
      .bnav {
        padding-left: 4px;
        padding-right: 4px;
      }
      .ni {
        font-size: 9px;
        min-width: 0;
      }
      .ni-ic {
        font-size: 18px;
      }
      .ni-mid {
        width: 54px;
        flex-shrink: 0;
      }
      .ni-mid-btn {
        width: 44px;
        height: 44px;
      }
      .msg-pr-actions,
      .modal-share .row {
        flex-wrap: wrap;
      }
    }

    /* Mobile containment pass: override older inline widths that can push off-screen. */
    html, body {
      max-width: 100%;
      overflow-x: hidden;
    }
    img, video, canvas, svg {
      max-width: 100%;
    }
    .screen,
    .sb,
    .modal,
    .mov-c,
    .modal-share-body {
      max-width: 100vw;
      overflow-x: hidden;
    }
    .card,
    .ec,
    .hc,
    .lr,
    .pr-row,
    .grp-card,
    .social-card,
    .exercise-info-card {
      max-width: 100%;
      min-width: 0;
    }
    .modal {
      width: min(100vw, 560px);
    }
    .exercise-visual,
    .exercise-hero {
      max-width: 100%;
    }
    .en,
    .ht,
    .mtt,
    .pr-ex,
    .msg-bubble,
    .msg-text,
    .msg-reply,
    .grp-card,
    .friend-row,
    .cal-card-title,
    .cal-card-meta {
      overflow-wrap: anywhere;
      word-break: normal;
    }
    .inp,
    textarea,
    select {
      min-width: 0;
      max-width: 100%;
    }
    @media (max-width: 520px) {
      body { width: 100%; }
      .screen { width: 100vw; }
      .sb {
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
      }
      .hdr {
        gap: 8px;
        min-width: 0;
      }
      .hdr .ht {
        min-width: 0;
        flex: 1 1 auto;
        text-align: center;
      }
      .hdr .ib {
        width: 38px !important;
        min-width: 38px;
        height: 38px !important;
        padding: 0 !important;
      }
      .card,
      .modal {
        border-radius: 12px;
      }
      .modal {
        max-height: 92vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
      }
      .row {
        flex-wrap: wrap;
      }
      .row[style*="justify-content:space-between"],
      .row[style*="justify-content: space-between"] {
        row-gap: 8px;
      }
      .btn,
      button,
      .ib,
      .btn-i {
        flex-shrink: 0;
      }
      .btn {
        min-height: 38px;
      }
      .btn-bl,
      .modal .btn,
      #shareMov .btn,
      #prShareMov .btn {
        width: 100%;
      }
      .bnav {
        gap: 2px;
        justify-content: space-between;
      }
      .ni {
        flex: 1 1 0;
        padding: 4px 2px;
        overflow: hidden;
      }
      .ni-ic {
        margin-bottom: 2px;
      }
      .ni-mid {
        flex: 0 0 54px;
      }
      .exercise-hero {
        height: min(260px, 68vw) !important;
      }
      .exercise-hero .exercise-visual {
        height: 100% !important;
      }
      .exercise-visual.duo {
        grid-template-columns: 1fr 1fr;
      }
      #edTgs,
      #catChips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }
      #edTgs .tag,
      #catChips .chip {
        flex: 0 0 auto;
      }
      #sessModeBanner {
        padding: 10px 12px !important;
      }
      #sessModeBanner > .row {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 10px;
      }
      #sessModeBanner .row .row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
      }
      #sessModeBanner .btn {
        width: 100%;
      }
      #tplQueueBar {
        padding: 10px 12px !important;
      }
      #tplQueueBar > .row:nth-child(2) {
        display: grid !important;
        grid-template-columns: 1fr;
      }
      #tplQueueBar .btn {
        width: 100%;
      }
      #sc-wk .card > .row:first-child {
        display: grid !important;
        grid-template-columns: 1fr;
      }
      #sc-wk .card > .row:first-child .row {
        display: grid !important;
        grid-template-columns: 38px minmax(0, 1fr) 38px;
      }
      #sc-wk .card > .row:first-child .ib {
        width: 38px !important;
        height: 38px !important;
      }
      #qlHint {
        flex-wrap: wrap;
      }
      #qlHint .btn {
        width: 100%;
      }
      #restB > .row:first-child {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) 34px 34px;
      }
      #restB .row:last-child {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      #restB .btn {
        width: 100%;
      }
      .session-ex-row {
        width: 100%;
      }
      .session-stat-grid {
        gap: 6px;
      }
      .hc > .row:last-child {
        align-items: flex-start !important;
      }
      .hc > .row:last-child > .row {
        flex: 1 1 100%;
      }
      .hc .chip {
        flex: 1 1 auto;
      }
      .pr-row {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 10px;
      }
      .pr-row > .row,
      .pr-row > .pr-val {
        grid-column: 1 / -1;
      }
      .pr-row .btn {
        flex: 1 1 120px;
      }
      .set-edit-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
      }
      .set-edit-row > * {
        width: 100% !important;
        min-width: 0 !important;
      }
      .set-edit-row label {
        grid-column: 1 / -1;
      }
      .msg-composer,
      .composer-wrap {
        min-width: 0;
      }
      .msg-img {
        max-width: min(220px, 72vw);
      }
      .cal-card {
        min-width: min(200px, 82vw);
        max-width: 100%;
      }
      .theme-swatch {
        width: 32px !important;
        height: 32px !important;
      }
    }
    @media (max-width: 360px) {
      .sb { padding-left: 10px; padding-right: 10px; }
      .card { padding: 11px; }
      .btn { font-size: 11px; padding: 10px 8px; }
      .ht { font-size: 15px; }
      .st { font-size: 10px; }
      .session-mini {
        padding-left: 10px;
        padding-right: 10px;
      }
      .session-mini-title { font-size: 10px; }
      .session-mini-meta { font-size: 10px; }
      .session-ex-row {
        grid-template-columns: 36px minmax(0, 1fr) 32px;
      }
      .session-ex-stat { grid-column: 2 / -1; text-align: left; }
      .session-ex-thumb {
        display: none;
      }
      .session-ex-stat {
        grid-column: 1;
      }
      #restB > .row:first-child {
        grid-template-columns: 1fr 34px 34px;
      }
      #restN {
        grid-column: 1 / -1;
      }
      .bnav {
        height: calc(60px + env(safe-area-inset-bottom, 0px));
      }
      .ni {
        font-size: 8px;
      }
      .ni-mid {
        flex-basis: 48px;
      }
      .ni-mid-btn {
        width: 40px !important;
        height: 40px !important;
      }
    }
    .chart-card {
      padding: 12px;
      overflow: hidden;
      background:
        linear-gradient(145deg, color-mix(in srgb, var(--acc) 9%, transparent), rgba(255,255,255,0.035)),
        var(--card);
    }
    #edExChart { min-height: 164px; }

    .workout-topbar {
      background: color-mix(in srgb, var(--bg2) 88%, transparent) !important;
      -webkit-backdrop-filter: blur(18px) saturate(1.2);
      backdrop-filter: blur(18px) saturate(1.2);
    }
    .workout-topbar .ib:last-child {
      width: auto;
      min-width: 58px;
      padding: 0 10px;
      border-radius: 12px;
      overflow-wrap: normal;
    }
    .workout-scroll {
      padding-top: 0;
      padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    }
    .workout-sticky {
      position: sticky;
      top: 0;
      z-index: 30;
      margin: 0 -2px 14px;
      padding: 12px;
      border: 1px solid rgba(var(--acc-rgb),0.22);
      border-radius: 0 0 16px 16px;
      background:
        linear-gradient(135deg, rgba(var(--acc-rgb),0.13), rgba(255,255,255,0.035)),
        color-mix(in srgb, var(--bg2) 88%, transparent);
      -webkit-backdrop-filter: blur(18px) saturate(1.25);
      backdrop-filter: blur(18px) saturate(1.25);
      box-shadow: 0 18px 40px rgba(0,0,0,0.22);
    }
    .workout-focus-row {
      display: grid;
      grid-template-columns: 58px minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
    }
    .workout-focus-art {
      width: 58px;
      height: 58px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--bg3);
      overflow: hidden;
    }
    .workout-focus-main { min-width: 0; }
    .workout-kicker {
      color: var(--text3);
      font-size: 10px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.8px;
    }
    .workout-focus-name {
      color: var(--text);
      font-size: 18px;
      font-weight: 950;
      line-height: 1.1;
      overflow-wrap: anywhere;
    }
    .workout-focus-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 6px;
    }
    .workout-focus-meta span {
      display: inline-flex;
      align-items: center;
      min-height: 22px;
      padding: 3px 7px;
      border: 1px solid rgba(var(--acc-rgb),0.22);
      border-radius: 999px;
      background: rgba(var(--acc-rgb),0.09);
      color: var(--text);
      font-size: 11px;
      font-weight: 850;
      line-height: 1.1;
    }
    .workout-focus-meta span:first-child {
      color: var(--acc);
      font-family: var(--FD);
    }
    .workout-swap-btn {
      width: 42px;
      height: 42px;
      color: var(--acc);
      border-color: rgba(var(--acc-rgb),0.35);
      font-size: 20px;
      font-weight: 900;
    }
    .workout-timeline {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      margin-top: 12px;
      padding-bottom: 2px;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .workout-timeline::-webkit-scrollbar { display: none; }
    .timeline-chip {
      flex: 0 0 auto;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      grid-template-rows: auto auto;
      gap: 2px 7px;
      align-items: center;
      max-width: min(220px, 74vw);
      min-width: 128px;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: rgba(255,255,255,0.045);
      color: var(--text);
      font-family: var(--FF);
      text-align: left;
      cursor: pointer;
    }
    .timeline-chip span {
      grid-row: 1 / span 2;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      background: var(--card2);
      color: var(--text2);
      font: 900 11px var(--FD);
    }
    .timeline-chip strong {
      min-width: 0;
      color: var(--text);
      font-size: 12px;
      font-weight: 900;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .timeline-chip small {
      color: var(--text3);
      font-size: 10px;
      font-weight: 850;
    }
    .timeline-chip.is-current {
      border-color: rgba(var(--acc-rgb),0.46);
      background: rgba(var(--acc-rgb),0.14);
      box-shadow: 0 0 0 1px rgba(var(--acc-rgb),0.08) inset;
    }
    .timeline-chip.is-current span {
      background: var(--acc);
      color: var(--on-acc);
    }
    .timeline-empty {
      width: 100%;
      padding: 10px;
      border: 1px dashed var(--border);
      border-radius: 12px;
      color: var(--text3);
      font-size: 12px;
      text-align: center;
    }
    .workout-log-card {
      overflow: visible;
    }
    .workout-log-top {
      align-items: stretch;
      margin-bottom: 12px !important;
    }
    .plate-jumps {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 7px;
      margin: 0 0 14px;
    }
    .plate-jump-side {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 7px;
      min-width: 0;
    }
    .plate-jump-minus {
      justify-self: stretch;
    }
    .plate-jump-plus {
      justify-self: stretch;
    }
    .plate-jumps button {
      min-height: 34px;
      border: 1px solid rgba(var(--acc-rgb),0.18);
      border-radius: 10px;
      background: rgba(var(--acc-rgb),0.08);
      color: var(--text);
      font: 850 11px var(--FF);
      cursor: pointer;
    }
    .quick-log-actions {
      display: grid;
      grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.85fr) minmax(0, 0.95fr) minmax(0, 1.05fr);
      gap: 10px;
      margin-top: 15px;
    }
    .set-card {
      margin-bottom: 10px;
      padding: 12px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background:
        linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025)),
        var(--card);
      box-shadow: 0 12px 26px rgba(0,0,0,0.12);
    }
    .set-card.is-pr {
      border-color: rgba(var(--acc-rgb),0.45);
      background: linear-gradient(135deg, rgba(var(--acc-rgb),0.15), rgba(255,255,255,0.035));
    }
    .set-card.is-failure {
      border-color: rgba(255,68,68,0.26);
    }
    .set-card-head {
      display: grid;
      grid-template-columns: 38px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
    }
    .set-index {
      width: 38px;
      height: 38px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 12px;
      background: var(--acc);
      color: var(--on-acc);
      font: 950 17px var(--FD);
    }
    .set-title {
      min-width: 0;
      color: var(--text);
      font-weight: 950;
      line-height: 1.2;
    }
    .set-title span {
      display: block;
      margin-top: 3px;
      color: var(--text2);
      font-size: 12px;
      font-weight: 750;
      overflow-wrap: anywhere;
    }
    .set-delete {
      border: 1px solid rgba(255,68,68,0.24);
      border-radius: 10px;
      background: var(--red-d);
      color: var(--red);
      padding: 8px 10px;
      font: 850 11px var(--FF);
      cursor: pointer;
    }
    .set-metrics {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      margin-top: 12px;
    }
    .set-metrics div {
      min-width: 0;
      padding: 9px;
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 12px;
      background: rgba(0,0,0,0.12);
    }
    .set-metrics span {
      display: block;
      color: var(--text3);
      font-size: 10px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }
    .set-metrics strong {
      display: block;
      margin-top: 2px;
      color: var(--text);
      font-size: 13px;
      font-weight: 950;
      overflow-wrap: anywhere;
    }
    .set-note {
      margin-top: 10px;
      padding: 9px 10px;
      border-left: 3px solid var(--acc);
      border-radius: 10px;
      background: rgba(var(--acc-rgb),0.08);
      color: var(--text2);
      font-size: 12px;
      font-weight: 700;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }
    .finish-session-modal {
      max-height: 88vh;
    }
    .finish-summary-grid,
    .sync-status-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
      margin-bottom: 12px;
    }
    .finish-summary-grid div,
    .sync-status-item {
      min-width: 0;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: rgba(255,255,255,0.04);
    }
    .finish-summary-grid strong,
    .sync-status-item strong {
      display: block;
      color: var(--acc);
      font: 950 15px var(--FD);
      overflow-wrap: anywhere;
    }
    .finish-summary-grid span,
    .sync-status-item span {
      display: block;
      color: var(--text3);
      font-size: 10px;
      font-weight: 900;
      text-transform: uppercase;
    }
    .finish-ex-list {
      display: grid;
      gap: 9px;
      max-height: min(330px, 45vh);
      overflow-y: auto;
      margin-bottom: 14px;
    }
    .finish-ex-row {
      padding: 11px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: rgba(255,255,255,0.035);
    }
    .finish-ex-row strong {
      display: block;
      color: var(--text);
      font-size: 14px;
      font-weight: 950;
    }
    .finish-ex-row small {
      display: block;
      margin-top: 3px;
      color: var(--text2);
      font-size: 11px;
      font-weight: 800;
    }
    .finish-set-list {
      display: grid;
      gap: 4px;
      margin-top: 8px;
    }
    .finish-set-list span {
      color: var(--text2);
      font-size: 11px;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }
    .finish-session-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }
    .sync-status-card .g2 {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      margin-top: 12px;
    }
    .sync-status-item strong.is-ok { color: var(--green); }
    .sync-status-item strong.is-bad { color: var(--red); }
    .sync-status-item strong.is-warn { color: var(--orange); }
    .sync-install-status {
      padding: 10px 12px;
      border: 1px solid rgba(var(--acc-rgb),0.18);
      border-radius: 12px;
      background: rgba(var(--acc-rgb),0.07);
      color: var(--text2);
      font-size: 12px;
      font-weight: 800;
      line-height: 1.35;
      text-align: center;
    }
    .sync-queue-list {
      display: grid;
      gap: 8px;
      margin-top: 10px;
    }
    .sync-queue-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      padding: 9px 10px;
      border: 1px solid rgba(var(--acc-rgb),0.18);
      border-radius: 12px;
      background: rgba(var(--acc-rgb),0.06);
    }
    .sync-queue-row strong {
      display: block;
      color: var(--text);
      font-size: 12px;
      font-weight: 950;
      overflow-wrap: anywhere;
    }
    .sync-queue-row span {
      display: block;
      margin-top: 2px;
      color: var(--text2);
      font-size: 11px;
      font-weight: 750;
      overflow-wrap: anywhere;
    }
    .sync-queue-row small,
    .sync-queue-more {
      color: var(--orange);
      font-size: 10px;
      font-weight: 950;
      text-transform: uppercase;
    }
    .sync-queue-more {
      text-align: center;
      padding: 4px;
    }

    body.bg-snow .workout-sticky,
    body.bg-sky .workout-sticky,
    body.bg-mint .workout-sticky,
    body.bg-cotton_candy .workout-sticky {
      background:
        linear-gradient(135deg, rgba(var(--acc-rgb),0.12), rgba(255,255,255,0.58)),
        color-mix(in srgb, var(--bg2) 88%, rgba(255,255,255,0.8));
      box-shadow: 0 14px 32px rgba(0,0,0,0.12);
    }

    @media (max-width: 430px) {
      .workout-sticky {
        margin-left: -14px;
        margin-right: -14px;
        border-left: none;
        border-right: none;
        border-radius: 0 0 14px 14px;
      }
      .workout-focus-row {
        grid-template-columns: 50px minmax(0, 1fr) 38px;
        gap: 9px;
      }
      .workout-focus-art {
        width: 50px;
        height: 50px;
        border-radius: 12px;
      }
      .workout-focus-name { font-size: 16px; }
      .timeline-chip {
        min-width: 118px;
        max-width: 72vw;
      }
      .plate-jumps {
        grid-template-columns: 1fr;
      }
      .plate-jump-side {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
      .finish-session-actions {
        grid-template-columns: 1fr;
      }
      .quick-log-actions {
        grid-template-columns: 1fr;
      }
      .set-card-head {
        grid-template-columns: 34px minmax(0, 1fr);
      }
      .set-index {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 15px;
      }
      .set-delete {
        grid-column: 1 / -1;
        width: 100%;
      }
      .set-metrics,
      .finish-summary-grid,
      .sync-status-grid,
      .sync-status-card .g2 {
        grid-template-columns: 1fr 1fr;
      }
    }
    @media (max-width: 360px) {
      .workout-sticky {
        margin-left: -10px;
        margin-right: -10px;
      }
      .workout-focus-row,
      .set-card-head {
        grid-template-columns: 1fr;
      }
      .workout-focus-art,
      .workout-swap-btn {
        display: none;
      }
      .set-metrics,
      .finish-summary-grid,
      .sync-status-grid,
      .sync-status-card .g2 {
        grid-template-columns: 1fr;
      }
    }
    .ex-chart {
      width: 100%;
      display: block;
      overflow: visible;
    }
    .ex-chart-grid { stroke: rgba(255,255,255,0.08); stroke-width: 1; }
    .ex-chart-area { fill: url(#edChartGlow); opacity: 0.88; }
    .ex-chart-line {
      fill: none;
      stroke: var(--acc);
      stroke-width: 4;
      stroke-linecap: round;
      stroke-linejoin: round;
      filter: drop-shadow(0 8px 14px var(--acc-d));
      stroke-dasharray: 700;
      animation: chartDraw 0.75s cubic-bezier(.2,.8,.2,1) both;
    }
    .ex-chart-dot { fill: var(--bg); stroke: var(--acc); stroke-width: 4; cursor: pointer; }
    .ex-chart-label { fill: var(--text3); font: 800 10px var(--FF); }
    .ex-chart-value { fill: var(--text); font: 900 12px var(--FF); }
    .ex-chart-empty {
      min-height: 140px;
      display: grid;
      place-items: center;
      color: var(--text3);
      font-size: 12px;
      font-weight: 800;
      text-align: center;
    }
    @keyframes chartDraw { from { stroke-dashoffset: 700; opacity: 0.4; } to { stroke-dashoffset: 0; opacity: 1; } }

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   WORKOUT CONTRIBUTION CALENDAR (GitHub-style)
═══════════════════════════════════════════════════════ */
.contrib-calendar-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 14px 12px 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.contrib-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.contrib-cal-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.contrib-cal-stat {
  font-size: 11px;
  font-weight: 800;
  color: var(--acc);
}
.contrib-months {
  display: flex;
  gap: 0;
  margin-bottom: 4px;
  overflow: hidden;
}
.contrib-month-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.contrib-grid {
  display: flex;
  gap: 3px;
  overflow: hidden;
}
.contrib-day-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 5px;
  width: 17px;
  flex-shrink: 0;
}
.contrib-day-label {
  font-size: 8px;
  height: 11px;
  line-height: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
}
.contrib-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.contrib-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.contrib-cell:active { transform: scale(0.85); }
.contrib-cell[data-lvl="1"] {
  background: rgba(var(--acc-rgb), 0.2);
  border-color: rgba(var(--acc-rgb), 0.25);
}
.contrib-cell[data-lvl="2"] {
  background: rgba(var(--acc-rgb), 0.45);
  border-color: rgba(var(--acc-rgb), 0.5);
}
.contrib-cell[data-lvl="3"] {
  background: rgba(var(--acc-rgb), 0.72);
  border-color: rgba(var(--acc-rgb), 0.8);
}
.contrib-cell[data-lvl="4"] {
  background: var(--acc);
  border-color: var(--acc);
  box-shadow: 0 0 6px rgba(var(--acc-rgb), 0.5);
}
.contrib-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  justify-content: flex-end;
}
.contrib-legend-label {
  font-size: 9px;
  color: var(--text3);
  font-weight: 700;
}
.contrib-legend-cell {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.contrib-legend-cell[data-lvl="0"] { background: var(--bg3); border: 1px solid rgba(255,255,255,0.04); }
.contrib-legend-cell[data-lvl="1"] { background: rgba(var(--acc-rgb), 0.2); }
.contrib-legend-cell[data-lvl="2"] { background: rgba(var(--acc-rgb), 0.45); }
.contrib-legend-cell[data-lvl="3"] { background: rgba(var(--acc-rgb), 0.72); }
.contrib-legend-cell[data-lvl="4"] { background: var(--acc); }

/* ═══════════════════════════════════════════════════════
   STREAK CARD UPGRADE
═══════════════════════════════════════════════════════ */
.streak-card-v2 {
  background: linear-gradient(135deg, rgba(var(--acc-rgb), 0.1), rgba(var(--acc-rgb), 0.04));
  border: 1px solid rgba(var(--acc-rgb), 0.25);
  border-radius: var(--rs);
  padding: 16px;
  margin-bottom: 16px;
  display: none;
}
.streak-card-v2.visible { display: block; }
.streak-card-v2-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.streak-flame {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255,140,0,0.6));
}
.streak-numbers {
  flex: 1;
}
.streak-current-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--acc);
  font-family: var(--FD);
  line-height: 1;
}
.streak-current-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text2);
  margin-top: 2px;
}
.streak-badges {
  display: flex;
  gap: 8px;
}
.streak-badge {
  text-align: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
}
.streak-badge-num {
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  font-family: var(--FD);
}
.streak-badge-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.weekly-goal-bar-wrap {
  margin-top: 10px;
}
.weekly-goal-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.weekly-goal-bar-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text3);
}
.weekly-goal-bar-val {
  font-size: 11px;
  font-weight: 800;
  color: var(--acc);
}
.weekly-goal-bar-track {
  height: 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.weekly-goal-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--acc);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(var(--acc-rgb), 0.5);
}
.weekly-goal-dots {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: center;
}
.weekly-goal-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.3s;
}
.weekly-goal-dot.done {
  background: var(--acc);
  border-color: var(--acc);
  box-shadow: 0 0 8px rgba(var(--acc-rgb), 0.4);
}
.weekly-goal-dot.done::after { content: '✓'; font-size: 10px; font-weight: 900; color: var(--on-acc); }
.weekly-goal-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: conic-gradient(var(--acc) calc(var(--goal-pct) * 1%), rgba(255,255,255,0.08) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), 0.18);
}
.weekly-goal-ring-inner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.weekly-goal-ring-inner strong {
  color: var(--text);
  font-size: 13px;
  font-family: var(--FD);
  font-weight: 950;
  -webkit-text-stroke: 0.35px rgba(0,0,0,0.75);
  text-shadow:
    0 1px 0 rgba(0,0,0,0.8),
    0 0 8px rgba(var(--acc-rgb),0.45);
}
.weekly-goal-ring-inner span {
  margin-top: 3px;
  color: var(--text3);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════
   EXERCISE PROGRESS CHART CONTROLS
═══════════════════════════════════════════════════════ */
.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}
.chart-range-tabs {
  display: flex;
  background: var(--bg3);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.chart-range-tab {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
  font-family: var(--FF);
}
.chart-range-tab.active {
  background: var(--acc);
  color: var(--on-acc);
}
.chart-metric-tabs {
  display: flex;
  background: var(--bg3);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.chart-metric-tab {
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
  font-family: var(--FF);
  white-space: nowrap;
}
.chart-metric-tab.active {
  background: rgba(var(--acc-rgb), 0.2);
  color: var(--acc);
}
.chart-delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  margin-left: auto;
}
.chart-delta-badge.up {
  background: rgba(57, 211, 83, 0.15);
  color: #39d353;
}
.chart-delta-badge.down {
  background: rgba(255, 68, 68, 0.15);
  color: var(--red);
}
.chart-delta-badge.flat {
  background: rgba(255,255,255,0.06);
  color: var(--text3);
}
.chart-dot-tooltip {
  position: fixed;
  background: rgba(10, 10, 18, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--acc-rgb, 200, 255, 0), 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  pointer-events: none;
  z-index: 99999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  transform: translate(-50%, -110%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.19, 1, 0.22, 1), transform 0.2s cubic-bezier(0.19, 1, 0.22, 1);
}
.chart-dot-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, -125%);
}

/* ═══════════════════════════════════════════════════════
   SKELETON LOADING SHIMMER
═══════════════════════════════════════════════════════ */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, rgba(255,255,255,0.06) 50%, var(--bg3) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 14px;
  margin-bottom: 12px;
}
.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
  border-radius: 6px;
}
.skeleton-line.title { height: 16px; width: 60%; margin-bottom: 10px; }
.skeleton-line.sub { height: 10px; width: 80%; margin-bottom: 8px; }
.skeleton-line.sm { height: 10px; width: 40%; }
.skeleton-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   HISTORY LOAD MORE
═══════════════════════════════════════════════════════ */
.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 800;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
  font-family: var(--FF);
}
.load-more-btn:hover, .load-more-btn:active {
  background: var(--card2);
  color: var(--acc);
  border-color: rgba(var(--acc-rgb), 0.3);
  transform: translateY(-1px);
}
.load-more-btn .load-more-count {
  font-size: 11px;
  color: var(--text3);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════
   ANIMATED WORKOUT RECAP UPGRADE
═══════════════════════════════════════════════════════ */
.recap-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.recap-stat-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.recap-stat-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(var(--acc-rgb), 0.06), transparent);
  pointer-events: none;
}
.recap-stat-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--acc);
  font-family: var(--FD);
  line-height: 1;
  display: block;
}
.recap-stat-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.recap-pr-banner {
  background: linear-gradient(135deg, rgba(var(--acc-rgb), 0.15), rgba(var(--acc-rgb), 0.05));
  border: 1px solid rgba(var(--acc-rgb), 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.recap-pr-emoji {
  font-size: 24px;
  animation: prPulse 0.6s ease 0.3s both;
}
@keyframes prPulse {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.recap-stat-num { animation: countUp 0.4s ease both; }

/* ═══════════════════════════════════════════════════════
   RELIABILITY & OPTIMISTIC STATES UPGRADE
═══════════════════════════════════════════════════════ */
.ws-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text3, #888);
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
  transition: background-color 0.4s cubic-bezier(.2,.8,.2,1), box-shadow 0.4s ease;
  margin-left: 8px;
  margin-right: 8px;
  align-self: center;
  flex-shrink: 0;
  display: inline-block;
}
.ws-badge.connected {
  background-color: var(--green, #00ff88);
  box-shadow: 0 0 10px var(--green, #00ff88), 0 0 2px var(--green, #00ff88);
  animation: ws-connected-pulse 2s infinite ease-in-out;
}
@keyframes ws-connected-pulse {
  0% { opacity: 0.85; }
  50% { opacity: 1; filter: brightness(1.2); }
  100% { opacity: 0.85; }
}

#sync-error-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--orange, #ff8c42) 90%, #000);
  color: #000;
  font-weight: 900;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  text-align: center;
  font-size: 13px;
  z-index: 9998;
  display: none;
  box-shadow: 0 2px 14px rgba(0,0,0,0.45);
  cursor: pointer;
  letter-spacing: -0.2px;
  transition: background-color 0.18s ease;
}
#sync-error-banner:hover {
  background: var(--orange, #ff8c42);
}
body.is-offline #sync-error-banner {
  display: none !important; /* Hide sync warnings if fully offline */
}

/* Reaction pending state */
.reaction-pill.reaction-pending {
  animation: reaction-pulse 1.2s infinite ease-in-out;
  opacity: 0.7;
  pointer-events: none;
  border-color: rgba(var(--acc-rgb), 0.35);
  box-shadow: 0 0 8px rgba(var(--acc-rgb), 0.15);
}
@keyframes reaction-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 0.6; }
}

/* Favorite pending state */
.ec .fv.fav-pending, .hdr .ib#edFv.fav-pending {
  animation: fav-spin-pulse 1.0s infinite linear;
  opacity: 0.6;
  pointer-events: none;
}
.fav-pulse {
  display: inline-block;
  animation: fav-spin-pulse 1.0s infinite linear;
}
@keyframes fav-spin-pulse {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.18) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* Skeleton pulse loading states */
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rs, 14px);
  padding: var(--density-pad, 14px);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.skeleton {
  background: rgba(255, 255, 255, 0.05);
  background-image: linear-gradient(90deg, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.1) 40px, rgba(255,255,255,0.05) 80px);
  background-size: 200% 100%;
  animation: skeleton-pulse-shine 1.4s infinite ease-in-out;
  border-radius: 6px;
}
.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.skeleton-line {
  height: 12px;
  width: 100%;
}
.skeleton-line.title {
  width: 50%;
  height: 14px;
}
.skeleton-line.sub {
  width: 30%;
  height: 10px;
  margin-top: 4px;
}
.skeleton-line.sm {
  width: 70%;
}
@keyframes skeleton-pulse-shine {
  0% { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

/* Premium micro-interactions & glows */
.chip, .btn, .hc, .ec, .card {
  transition: all var(--anim, 0.2s) cubic-bezier(0.4, 0, 0.2, 1);
}
.chip:hover, .btn:hover {
  transform: translateY(-1px);
}
.hc:hover, .ec:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--acc-rgb), 0.35);
  box-shadow: 0 6px 20px rgba(var(--acc-rgb), 0.08), inset 0 0 0 1px rgba(var(--acc-rgb), 0.05);
}
.card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

/* Heatmap levels inside Month calendar */
.cd.heatmap-lvl-0 { background: rgba(255, 255, 255, 0.03); color: var(--text3); }
.cd.heatmap-lvl-1 { background: rgba(var(--hm-rgb), 0.18); color: var(--hm-full); font-weight: 700; border-color: rgba(var(--hm-rgb), 0.3); }
.cd.heatmap-lvl-2 { background: rgba(var(--hm-rgb), 0.38); color: #fff; font-weight: 800; border-color: rgba(var(--hm-rgb), 0.5); }
.cd.heatmap-lvl-3 { background: rgba(var(--hm-rgb), 0.68); color: #fff; font-weight: 800; border-color: rgba(var(--hm-rgb), 0.8); }
.cd.heatmap-lvl-4 { background: var(--hm-full); color: #fff; font-weight: 900; box-shadow: 0 0 12px rgba(var(--hm-rgb), 0.4); text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* Day plan dot on calendar heatmap */
.cd-plan-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 4px var(--blue);
}

/* Make sure calendar cells are position: relative for the plan dots */
.cd {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rs, 8px) !important;
  font-family: var(--FD);
  cursor: pointer;
  border: 1px solid var(--border);
}

/* Interactive muscle hover */
.muscle-path {
  transition: fill 0.2s, opacity 0.2s, filter 0.2s;
}
.muscle-path:hover {
  filter: brightness(1.3) drop-shadow(0 0 6px rgba(var(--hm-rgb), 0.5));
  opacity: 1 !important;
}

/* Hide exercise illustrations toggle */
body.hide-illustrations .exercise-visual,
body.hide-illustrations .et {
  display: none !important;
}
body.hide-illustrations .ec {
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════
   PROGRESSIVE OVERLOAD ASSISTANT
═══════════════════════════════════════════════════════ */
.overload-card {
  background: linear-gradient(135deg, rgba(var(--acc-rgb), 0.08), rgba(var(--acc-rgb), 0.02));
  border: 1px solid rgba(var(--acc-rgb), 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 15px;
}
.overload-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.overload-card-title {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--acc);
  text-transform: uppercase;
}
.overload-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.overload-target {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.overload-target-val {
  font-weight: 900;
  font-size: 22px;
  font-family: var(--FD);
  color: var(--acc);
  line-height: 1.1;
}
.overload-target-lbl {
  font-size: 10px;
  color: var(--text3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.overload-advice {
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  line-height: 1.5;
}
.overload-trend-up { color: #2ecc71; }
.overload-trend-flat { color: var(--acc); }
.overload-trend-new { color: var(--text3); }

/* ═══════════════════════════════════════════════════════
   AI WORKOUT GENERATOR WIZARD
═══════════════════════════════════════════════════════ */
.wizard-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.wizard-step {
  display: none;
}
.wizard-step.active {
  display: block;
}
.wizard-step-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 10px 0;
}
.wizard-step-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.wizard-step-title {
  font-weight: 900;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 4px;
}
.wizard-step-sub {
  font-size: 12px;
  color: var(--text3);
  font-weight: 600;
}
.wizard-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.wizard-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text2);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.wizard-chip.selected {
  border-color: var(--acc);
  background: rgba(var(--acc-rgb), 0.15);
  color: var(--acc);
}
.wizard-chip.solo {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 14px;
}
.wizard-duration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.wizard-duration-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  color: var(--text2);
}
.wizard-duration-btn.selected {
  border-color: var(--acc);
  background: rgba(var(--acc-rgb), 0.12);
  color: var(--acc);
}
.wizard-duration-num {
  font-size: 28px;
  font-weight: 900;
  font-family: var(--FD);
  display: block;
  color: var(--acc);
}
.wizard-duration-unit {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}
.wizard-nav {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.wizard-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}
.wizard-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s;
}
.wizard-dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--acc);
}
.ai-workout-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-ex-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ai-ex-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(var(--acc-rgb), 0.15);
  border: 1.5px solid rgba(var(--acc-rgb), 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  color: var(--acc);
  flex-shrink: 0;
}
.ai-ex-info { flex: 1; }
.ai-ex-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
}
.ai-ex-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.ai-ex-sets {
  font-weight: 800;
  font-size: 13px;
  color: var(--acc);
  font-family: var(--FD);
}

/* ═══════════════════════════════════════════════════════
   PREMIUM CUSTOM DESIGN OVERRIDES
   ═══════════════════════════════════════════════════════ */

/* Template Preview Thumb override for 24px visual size */
.template-preview-thumb .exercise-visual {
  min-height: unset !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 4px !important;
}
.template-preview-thumb .exercise-visual::after {
  display: none !important;
}
.template-preview-thumb .exercise-visual.fallback {
  padding: 2px !important;
}

/* Subtle transitions and hover scale up effect on cards */
.card, .session-ex-row, .template-card {
  transition: transform var(--anim) var(--anim-spring), box-shadow var(--anim) ease, border-color var(--anim) ease, background-color var(--anim) ease !important;
}
@media (hover: hover) {
  .card:hover, .session-ex-row:hover, .template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(var(--acc-rgb), 0.25);
  }
}
.card:active, .session-ex-row:active, .template-card:active {
  transform: translateY(1px) scale(0.99);
}

/* Smooth chart delta badge transition */
.chart-delta-badge {
  transition: transform var(--anim) ease, opacity var(--anim) ease;
  animation: fadeIn 0.35s ease both;
}

/* Keyframes for premium fade-in effects */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
