:root {
      color-scheme: dark;
      --bg: #090a0f;
      --bg2: #121520;
      --bg3: #181d2c;
      --card: #121520;
      --card2: #181d2c;
      --acc: #c8ff00;
      --acc-text: #c8ff00;
      --acc-rgb: 200, 255, 0;
      --acc-d: rgba(200, 255, 0, 0.14);
      --acc-soft: rgba(var(--acc-rgb), 0.16);
      --acc-glow: rgba(var(--acc-rgb), 0.32);
      --hm: #10b981;
      --hm-rgb: 16, 185, 129;
      --on-acc: #090a0f;
      --text: #f3f4f6;
      --text2: #9ca3af;
      --text3: #64748b;
      --border: rgba(255, 255, 255, 0.08);
      --border-focus: rgba(var(--acc-rgb), 0.5);
      --rs: 16px;
      --red: #ef4444;
      --red-d: rgba(239, 68, 68, 0.12);
      --blue: #3b82f6;
      --green: #10b981;
      --orange: #f97316;
      --purple: #a855f7;
      --FF: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      --FD: 'JetBrains Mono', monospace;
      /* Style system variables */
      --anim: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      --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: 0 1px 3px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
      --card-glass: #121520;
      --font-scale: 1;
      --hm-rgb: var(--acc-rgb);
      --hm-full: var(--acc);
      --app-height: 100vh;
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-right: env(safe-area-inset-right, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-left: env(safe-area-inset-left, 0px);
      --nav-height: calc(62px + var(--safe-bottom));
      --scroll-bottom-space: calc(var(--nav-height) + 40px);
    }

    @supports (height: 100dvh) {
      :root { --app-height: 100dvh; }
    }

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

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

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

    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);
      --on-acc: #ffffff;
    }

    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);
      --on-acc: #090a0f;
    }

    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);
      --on-acc: #090a0f;
    }

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

    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);
      --on-acc: #090a0f;
    }

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

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

    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;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-navy {
      --bg: #050a1a;
      --bg2: #0a1228;
      --bg3: #101c38;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-forest {
      --bg: #050d08;
      --bg2: #0a1510;
      --bg3: #101f15;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-charcoal {
      --bg: #0d0d0d;
      --bg2: #1a1a1a;
      --bg3: #222222;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-slate {
      --bg: #080c12;
      --bg2: #10161f;
      --bg3: #18202d;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-wine {
      --bg: #120508;
      --bg2: #1e0a10;
      --bg3: #2a1018;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-midnight {
      --bg: #02040a;
      --bg2: #050814;
      --bg3: #0a0f20;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-deep_purple {
      --bg: #080410;
      --bg2: #10081a;
      --bg3: #180c25;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-sunset {
      --bg: #100505;
      --bg2: #1a0a0a;
      --bg3: #251010;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-snow {
      color-scheme: light;
      --bg: #f5f5f7;
      --bg2: #ffffff;
      --bg3: #e8e8ea;
      --text: #050508;
      --text2: #2d2d3a;
      --text3: #555566;
      --text-mut: #555566;
      --border: rgba(0, 0, 0, 0.12);
      --card: #ffffff;
      --card2: #f0f0f4;
      --card-glass: rgba(255, 255, 255, 0.94);
      --acc-text: #4d6800;
    }

    body.bg-sky {
      color-scheme: light;
      --bg: #e3f2fd;
      --bg2: #ffffff;
      --bg3: #d1e9f9;
      --text: #0a192f;
      --text2: #1e3a5f;
      --text3: #3b5998;
      --text-mut: #3b5998;
      --border: rgba(10, 25, 47, 0.14);
      --card: #ffffff;
      --card2: #eaf2fb;
      --card-glass: rgba(255, 255, 255, 0.94);
      --acc-text: #0284c7;
    }

    body.bg-mint {
      color-scheme: light;
      --bg: #e8f5e9;
      --bg2: #ffffff;
      --bg3: #d3e8d5;
      --text: #052010;
      --text2: #134e2a;
      --text3: #2d6a4f;
      --text-mut: #2d6a4f;
      --border: rgba(5, 32, 16, 0.14);
      --card: #ffffff;
      --card2: #e8f5ec;
      --card-glass: rgba(255, 255, 255, 0.94);
      --acc-text: #059669;
    }

    body.bg-blood_moon {
      --bg: #140208;
      --bg2: #1f0510;
      --bg3: #2a0818;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-electric {
      --bg: #030814;
      --bg2: #06102a;
      --bg3: #0c1840;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-abyss {
      --bg: #020308;
      --bg2: #050a14;
      --bg3: #0a1220;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    body.bg-cotton_candy {
      color-scheme: light;
      --bg: #fff0f8;
      --bg2: #ffffff;
      --bg3: #ffe8f0;
      --text: #200515;
      --text2: #4a1532;
      --text3: #702850;
      --text-mut: #702850;
      --border: rgba(32, 5, 21, 0.14);
      --card: #ffffff;
      --card2: #fdf0f6;
      --card-glass: rgba(255, 255, 255, 0.94);
      --acc-text: #c026d3;
    }

    body.bg-copper {
      --bg: #120805;
      --bg2: #1a1008;
      --bg3: #24180c;
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    /* ═══════════════════════════════════════════════════════
       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);
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

    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);
      --text: #ffffff;
      --text2: #a0a0b0;
      --text3: #606070;
    }

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

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

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

    /* ═══════════════════════════════════════════════════════
       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; }
    body.font-manrope { --FF: 'Manrope', sans-serif; }
    body.font-sora { --FF: 'Sora', sans-serif; }
    body.font-rajdhani { --FF: 'Rajdhani', sans-serif; }
    body.font-barlow-condensed { --FF: 'Barlow Condensed', sans-serif; }
    body.font-archivo-black { --FF: 'Archivo Black', sans-serif; }
    body.font-syne { --FF: 'Syne', 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; padding-bottom: var(--scroll-bottom-space) !important; }
    body.density-compact .hdr { min-height: 52px; }
    body.density-compact .ec { padding: 8px; margin-bottom: 8px; }
    body.density-compact { --nav-height: calc(56px + var(--safe-bottom)); }

    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; padding-bottom: var(--scroll-bottom-space) !important; }
    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: var(--bg);
    }
    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;
      touch-action: manipulation;
      -webkit-touch-callout: none;
    }

    html, body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--FF);
      margin: 0;
      padding: 0;
      width: 100%;
      height: var(--app-height);
      min-height: var(--app-height);
      overflow: hidden;
      user-select: none;
      -webkit-user-select: none;
    }

    .screen {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      width: 100%;
      height: var(--app-height);
      min-height: var(--app-height);
      display: none;
      flex-direction: column;
      background: var(--bg);
      z-index: 10;
      overflow: hidden;
      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: var(--scroll-bottom-space);
      scroll-behavior: smooth;
    }

    .screen > .sb {
      padding-bottom: var(--scroll-bottom-space) !important;
    }

    .hdr {
      display: flex;
      align-items: center;
      padding: 0 20px;
      padding-top: var(--safe-top);
      min-height: 56px;
      height: calc(56px + var(--safe-top));
      background: rgba(9, 10, 15, 0.88);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
      z-index: 100;
      flex-shrink: 0;
    }

    .ht {
      font-size: 18px;
      font-weight: 750;
      letter-spacing: -0.02em;
      color: var(--text);
    }

    .ib {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 10px;
      background: var(--bg3);
      border: 1px solid var(--border);
      color: var(--text2);
      cursor: pointer;
      transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .ib:hover {
      color: var(--text);
      border-color: rgba(255, 255, 255, 0.16);
    }

    .ib:active {
      transform: scale(0.92);
      background: var(--bg2);
    }

    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--rs);
      padding: 16px;
      margin-bottom: 14px;
      box-shadow: var(--card-shadow);
      transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
      position: relative;
    }

    .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: 11px;
      font-weight: 750;
      color: var(--text3);
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

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

    .btn {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px 18px;
      font-weight: 700;
      font-family: var(--FF);
      cursor: pointer;
      transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
      font-size: 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      user-select: none;
      box-sizing: border-box;
      background: var(--bg2);
      color: var(--text);
    }

    .btn-p,
    .btn.btn-p {
      background: var(--acc) !important;
      color: var(--on-acc) !important;
      border: none !important;
      font-weight: 750;
      box-shadow: 0 2px 12px rgba(var(--acc-rgb), 0.28);
      text-shadow: none !important;
    }

    .btn-p:hover,
    .btn.btn-p:hover {
      box-shadow: 0 4px 18px rgba(var(--acc-rgb), 0.4);
      filter: brightness(1.04);
    }

    .btn-s,
    .btn.btn-s {
      background: var(--bg3) !important;
      color: var(--text) !important;
      border: 1px solid var(--border) !important;
      font-weight: 600;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    .btn-s:hover,
    .btn.btn-s:hover {
      background: var(--bg2) !important;
      border-color: rgba(255, 255, 255, 0.16) !important;
    }

    .btn-d,
    .btn.btn-d {
      background: var(--red-d) !important;
      color: #f87171 !important;
      border: 1px solid rgba(239, 68, 68, 0.25) !important;
    }

    .btn-d:hover,
    .btn.btn-d:hover {
      background: rgba(239, 68, 68, 0.18) !important;
    }

    .btn:disabled,
    button:disabled {
      opacity: 0.65;
      cursor: not-allowed;
      filter: grayscale(0.2);
    }

    .btn:active {
      transform: scale(0.97);
    }

    .btn-sm {
      padding: 7px 12px;
      font-size: 12px;
      border-radius: 8px;
      min-height: 38px;
      min-width: 38px;
    }

    .btn-bl {
      width: 100%;
    }

    .inp {
      width: 100%;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
      color: var(--text);
      font-family: var(--FF);
      font-size: 15px;
      transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    }

    .inp:focus {
      border-color: var(--acc);
      background: var(--bg3);
      box-shadow: 0 0 0 3px rgba(var(--acc-rgb), 0.2);
    }

    .il {
      font-size: 11px;
      font-weight: 700;
      color: var(--text3);
      margin-bottom: 6px;
      margin-left: 2px;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .bnav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      width: 100%;
      height: var(--nav-height);
      background: rgba(9, 10, 15, 0.9);
      backdrop-filter: blur(20px) saturate(180%);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      border-top: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-around;
      padding: 0 8px;
      padding-bottom: var(--safe-bottom);
      box-sizing: border-box;
      z-index: 200;
    }

    .ni {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-width: 0;
      height: 50px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: var(--text3);
      transition: color 0.15s ease, transform 0.15s ease;
      cursor: pointer;
      overflow: hidden;
      white-space: nowrap;
      gap: 3px;
    }

    .ni:active {
      transform: scale(0.93);
    }

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

    .ni.on .ni-ic {
      color: var(--acc);
      filter: drop-shadow(0 0 8px rgba(var(--acc-rgb), 0.35));
    }

    .ni-ic {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      color: inherit;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .ni-mid {
      width: 54px;
      height: 54px;
      position: relative;
      top: -10px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 50%;
      padding: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }

    .ni-mid-btn {
      width: 44px;
      height: 44px;
      background: var(--acc);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--on-acc);
      box-shadow: 0 2px 12px rgba(var(--acc-rgb), 0.4);
      transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    }

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

    .ec {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px 14px;
      display: flex;
      gap: 14px;
      margin-bottom: 10px;
      cursor: pointer;
      align-items: center;
      transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .ec:hover {
      background: var(--card2);
      border-color: rgba(255, 255, 255, 0.14);
    }

    .ec:active {
      transform: scale(0.985);
    }

    .et {
      width: 48px;
      height: 48px;
      background: var(--bg3);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      border: 1px solid rgba(255, 255, 255, 0.06);
      font-size: 20px;
    }

    .ei {
      flex: 1;
      min-width: 0;
    }

    .en {
      font-weight: 700;
      font-size: 15px;
      color: var(--text);
      letter-spacing: -0.2px;
      margin-bottom: 3px;
    }

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

    .stat-icon-box {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: var(--bg3);
      border: 1px solid var(--border);
      color: var(--text2);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .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: max(20px, calc(10px + var(--safe-top)));
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      background: var(--text);
      color: var(--bg);
      padding: 8px 10px 8px 18px;
      border-radius: 30px;
      font-weight: 800;
      font-size: 13px;
      z-index: 9999;
      pointer-events: auto;
      opacity: 0;
      transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
      display: flex;
      align-items: center;
      gap: 10px;
      max-width: min(92vw, 480px);
      box-sizing: border-box;
    }

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

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 12px 20px;
      border-radius: 12px;
      font-family: var(--FF);
      font-size: 14px;
      font-weight: 800;
      cursor: pointer;
      transition: var(--anim);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
    }
    
    /* RTL button fixes */
    html[dir="rtl"] .btn {
      text-align: center;
      direction: rtl;
    }
    html[dir="rtl"] .btn.btn-bl {
      width: 100%;
      text-align: center;
    }
    html[dir="rtl"] .btn {
      word-break: break-word;
      hyphens: auto;
    }
    
    /* RTL general fixes */
    html[dir="rtl"] {
      direction: rtl;
    }
    html[dir="rtl"] .row {
      flex-direction: row-reverse;
    }
    html[dir="rtl"] .g2,
    html[dir="rtl"] .g3 {
      flex-direction: row-reverse;
    }
    html[dir="rtl"] .card {
      text-align: right;
    }
    html[dir="rtl"] .inp {
      text-align: right;
      direction: rtl;
    }
    html[dir="rtl"] select {
      text-align: right;
      direction: rtl;
    }
    html[dir="rtl"] textarea {
      text-align: right;
      direction: rtl;
    }

    .toast-x {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: rgba(0, 0, 0, 0.15);
      color: inherit;
      border: none;
      font-size: 13px;
      font-weight: 900;
      cursor: pointer;
      flex-shrink: 0;
      margin-left: auto;
      padding: 0;
      line-height: 1;
      transition: background 0.15s, transform 0.15s;
    }

    .toast-x:hover, .toast-x:active {
      background: rgba(0, 0, 0, 0.3);
      transform: scale(1.1);
    }

    .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(--card);
      border-top: 1px solid var(--border);
      border-radius: 24px 24px 0 0;
      padding: 20px 24px;
      padding-bottom: max(32px, calc(16px + var(--safe-bottom)));
      transform: translateY(100%);
      transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }

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

    .mhdl {
      width: 36px;
      height: 4px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 9999px;
      margin: 0 auto 18px;
    }

    .mtt {
      font-size: 17px;
      font-weight: 700;
      letter-spacing: -0.2px;
      color: var(--text);
      text-align: center;
      margin-bottom: 20px;
    }

    /* 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: var(--app-height);
      max-height: var(--app-height);
      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); 
      padding-top: var(--safe-top);
      min-height: calc(58px + var(--safe-top));
      box-sizing: border-box;
      display: flex; 
      align-items: center; 
      z-index: 100; 
      flex: 0 0 auto; 
    }
    .btn-i {
      min-width: 38px;
      min-height: 38px;
      width: 38px;
      height: 38px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      border-radius: 50%;
      background: var(--card);
      border: 1px solid var(--border);
      color: var(--text);
      transition: all 0.18s ease;
      flex-shrink: 0;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
    }
    .btn-i:active {
      transform: scale(0.92);
      background: var(--card2);
    }
    .chat-thread { padding: 15px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; min-height:0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    
    .msg-bubble-container { display: flex; flex-direction: column; width: 100%; max-width: 100%; margin: 4px 0; transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28); position: relative; overflow: visible; }
    .msg-bubble { 
      max-width: min(80%, calc(100% - 8px)); 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;
      box-sizing: border-box;
    }
    .msg-bubble-actions {
      position: absolute;
      top: -36px;
      transform: none;
      display: flex;
      align-items: center;
      gap: 6px;
      opacity: 0;
      pointer-events: none;
      transition: 0.18s;
      z-index: 3;
    }
    .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: 0; left: auto; }
    .msg-bubble.them .msg-bubble-actions { left: 0; right: auto; }
    .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: var(--on-acc);
      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; max-width: 100%; }
    .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;
      flex-shrink: 0;
    }
    .reaction-pill.mine { border-color: var(--acc); background: var(--acc-d); color: var(--acc); }
    
    .reaction-picker { 
      display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px; background: var(--bg2); border-radius: 18px; 
      border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.4); 
      position: fixed; transform: none; 
      z-index: 4000; animation: bounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
      max-width: min(340px, calc(100vw - 16px));
      max-height: min(40vh, 220px);
      overflow: auto;
      box-sizing: border-box;
    }
    .reaction-picker span { font-size: 24px; cursor: pointer; transition: 0.2s; }
    .reaction-picker span:hover { transform: none; }

    .chat-composer { 
      background: var(--bg); 
      backdrop-filter: blur(20px); 
      border-top: 1px solid var(--border); 
      padding: 10px; 
      padding-bottom: calc(10px + var(--safe-bottom)); 
      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; }
    }

    /* Universal Form & Autofill Contrast Hardening */
    input:-webkit-autofill,
    input:-webkit-autofill:hover, 
    input:-webkit-autofill:focus,
    textarea:-webkit-autofill,
    select:-webkit-autofill {
      -webkit-text-fill-color: var(--text) !important;
      -webkit-box-shadow: 0 0 0px 1000px var(--bg2) inset !important;
      box-shadow: 0 0 0px 1000px var(--bg2) inset !important;
      caret-color: var(--text) !important;
      transition: background-color 5000s ease-in-out 0s;
    }

    ::placeholder {
      color: var(--text3) !important;
      opacity: 0.85;
    }
    ::-webkit-input-placeholder {
      color: var(--text3) !important;
      opacity: 0.85;
    }
    ::-moz-placeholder {
      color: var(--text3) !important;
      opacity: 0.85;
    }
    :-ms-input-placeholder {
      color: var(--text3) !important;
      opacity: 0.85;
    }

    /* Auth UI */
    .auth-box {
      width: 100%;
      max-width: 380px;
      margin: auto;
      padding: 30px;
      border-radius: 20px;
      background: var(--card);
      border: 1px solid var(--border);
      box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    }

    #sc-auth {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
    }

    #sc-auth #auth-login {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 20px;
      box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    }

    .auth-title {
      font-family: 'Outfit', sans-serif;
      font-weight: 900;
      font-size: 44px;
      color: var(--acc-text, var(--acc));
      text-align: center;
      margin-bottom: 4px;
      letter-spacing: -0.5px;
    }

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

    #sc-auth .il {
      color: var(--text2);
      font-weight: 750;
      letter-spacing: 0.05em;
    }

    #sc-auth .txs.mut {
      color: var(--text2);
    }

    #sc-auth .inp {
      background: var(--bg2);
      color: var(--text);
      border: 1.5px solid var(--border);
    }

    #sc-auth .inp:focus {
      border-color: var(--acc-text, var(--acc));
      box-shadow: 0 0 0 3px var(--acc-d);
    }

    #sc-auth .btn-p,
    #sc-auth button.btn-p,
    #auth-btn,
    #auth-reset-req-btn,
    #auth-reset-conf-btn,
    #google-confirm-btn {
      background: var(--acc) !important;
      color: var(--on-acc) !important;
      border: none !important;
      font-weight: 800 !important;
      box-shadow: 0 4px 18px rgba(var(--acc-rgb), 0.35) !important;
      cursor: pointer;
    }

    #sc-auth .btn-p:hover,
    #auth-btn:hover,
    #auth-reset-req-btn:hover,
    #auth-reset-conf-btn:hover,
    #google-confirm-btn:hover {
      filter: brightness(1.06);
      box-shadow: 0 6px 22px rgba(var(--acc-rgb), 0.45) !important;
    }

    #sc-auth .btn-s,
    #sc-auth button.btn-s {
      background: var(--bg3) !important;
      color: var(--text) !important;
      border: 1px solid var(--border) !important;
    }

    /* Light Theme Auth & Input Overrides */
    body.bg-snow #sc-auth,
    body.bg-sky #sc-auth,
    body.bg-mint #sc-auth,
    body.bg-cotton_candy #sc-auth {
      color-scheme: light;
    }

    body.bg-snow #sc-auth #auth-login,
    body.bg-sky #sc-auth #auth-login,
    body.bg-mint #sc-auth #auth-login,
    body.bg-cotton_candy #sc-auth #auth-login {
      background: #ffffff !important;
      border: 1px solid rgba(0, 0, 0, 0.12) !important;
      box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    }

    body.bg-snow #sc-auth .inp,
    body.bg-sky #sc-auth .inp,
    body.bg-mint #sc-auth .inp,
    body.bg-cotton_candy #sc-auth .inp {
      background: #f8f9fa !important;
      color: #050508 !important;
      border: 1.5px solid rgba(0, 0, 0, 0.14) !important;
    }

    body.bg-snow #sc-auth .inp:focus,
    body.bg-sky #sc-auth .inp:focus,
    body.bg-mint #sc-auth .inp:focus,
    body.bg-cotton_candy #sc-auth .inp:focus {
      background: #ffffff !important;
      border-color: var(--acc-text, #4d6800) !important;
      box-shadow: 0 0 0 3px rgba(77, 104, 0, 0.15) !important;
    }

    body.bg-snow #sc-auth .auth-title,
    body.bg-sky #sc-auth .auth-title,
    body.bg-mint #sc-auth .auth-title,
    body.bg-cotton_candy #sc-auth .auth-title {
      color: var(--acc-text, #4d6800) !important;
    }

    body.bg-snow #sc-auth .auth-sub,
    body.bg-sky #sc-auth .auth-sub,
    body.bg-mint #sc-auth .auth-sub,
    body.bg-cotton_candy #sc-auth .auth-sub {
      color: #374151 !important;
    }

    body.bg-snow #sc-auth .il,
    body.bg-sky #sc-auth .il,
    body.bg-mint #sc-auth .il,
    body.bg-cotton_candy #sc-auth .il {
      color: #1f2937 !important;
      font-weight: 800 !important;
    }

    body.bg-snow #sc-auth .txs.mut,
    body.bg-sky #sc-auth .txs.mut,
    body.bg-mint #sc-auth .txs.mut,
    body.bg-cotton_candy #sc-auth .txs.mut {
      color: #4b5563 !important;
    }

    body.bg-snow #auth-forgot-link,
    body.bg-sky #auth-forgot-link,
    body.bg-mint #auth-forgot-link,
    body.bg-cotton_candy #auth-forgot-link,
    body.bg-snow #auth-toggle-btn,
    body.bg-sky #auth-toggle-btn,
    body.bg-mint #auth-toggle-btn,
    body.bg-cotton_candy #auth-toggle-btn {
      color: var(--acc-text, #4d6800) !important;
    }

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

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

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

    .cd.tod, .cd.today {
      border-color: var(--acc) !important;
      background: var(--acc) !important;
      color: var(--on-acc) !important;
      font-weight: 900;
    }

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

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

    .cd.sel {
      outline: 2.5px solid var(--text) !important;
      outline-offset: -1px;
      font-weight: 900 !important;
      z-index: 2;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
    }

    .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);
      overflow: hidden;
    }

    .avatar img, .avatar video, .avatar-img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
      object-fit: cover;
      display: block;
    }

    .profile-preview-card {
      text-align: center;
      border-color: rgba(var(--acc-rgb), 0.18);
    }

    .profile-name-preview {
      font-size: 26px;
      font-weight: 900;
      margin-top: 4px;
      line-height: 1.15;
      overflow-wrap: anywhere;
    }

    .profile-name-styled {
      font-weight: 900;
      line-height: 1.15;
      display: inline-block;
    }
    #socialName .profile-name-styled,
    #hg .profile-name-styled {
      font-size: inherit;
    }

    .profile-name-animated {
      background: linear-gradient(90deg, var(--acc), var(--blue), var(--purple), var(--acc));
      background-size: 260% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent !important;
      -webkit-text-fill-color: transparent !important;
      animation: profileNameShift 3s linear infinite;
    }

    @keyframes profileNameShift {
      from { background-position: 0% 50%; }
      to { background-position: 260% 50%; }
    }

    .profile-color-input {
      min-height: 45px;
      padding: 6px;
    }

    .profile-toggle {
      min-height: 45px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--bg2);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      color: var(--text);
      font-weight: 800;
      font-size: 13px;
      cursor: pointer;
    }

    .profile-toggle input {
      width: 18px;
      height: 18px;
      accent-color: var(--acc);
    }

    .avatar-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      gap: 6px;
      cursor: pointer;
      position: relative;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      user-select: none;
    }
    .avatar-card:hover {
      border-color: var(--text3);
      transform: none;
    }
    .avatar-card:active {
      transform: scale(0.96);
    }
    .avatar-card.active {
      border-color: var(--acc);
      background: rgba(var(--acc-rgb), 0.08);
      box-shadow: 0 0 12px rgba(var(--acc-rgb), 0.25);
    }
    .avatar-card.locked {
      opacity: 0.72;
      background: rgba(0, 0, 0, 0.25);
    }
    .avatar-card.locked:hover {
      border-color: var(--red);
    }
    .avatar-card-icon-wrap {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: var(--bg3);
      border: 2px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      position: relative;
      flex-shrink: 0;
    }
    .avatar-card.active .avatar-card-icon-wrap {
      border-color: var(--acc);
      box-shadow: 0 0 10px rgba(var(--acc-rgb), 0.4);
    }
    .avatar-card.locked .avatar-card-icon-wrap {
      filter: grayscale(0.5);
    }
    .avatar-card-badge {
      position: absolute;
      top: -3px;
      right: -3px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 800;
      border: 1px solid var(--bg);
    }
    .avatar-card-badge.badge-unlocked {
      background: var(--green);
      color: var(--on-acc);
    }
    .avatar-card-badge.badge-locked {
      background: var(--red);
      color: #fff;
    }
    .avatar-card-title {
      font-weight: 800;
      font-size: 12px;
      color: var(--text);
      line-height: 1.2;
    }
    .avatar-card-desc {
      font-size: 10px;
      color: var(--text3);
      line-height: 1.2;
      margin-top: 1px;
    }
    .avatar-progress-bar {
      width: 100%;
      height: 4px;
      background: rgba(255, 255, 255, 0.08);
      border-radius: 2px;
      overflow: hidden;
      margin-top: 4px;
    }
    .avatar-progress-fill {
      height: 100%;
      background: var(--acc);
      border-radius: 2px;
      transition: width 0.3s ease;
    }

    .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;
        padding-bottom: var(--scroll-bottom-space);
      }

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

      .card {
        padding: 12px;
      }

      .ht {
        font-size: 18px;
      }

      .bnav {
        height: calc(60px + var(--safe-bottom));
      }

      .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);
    }
    body.bg-snow .tab-nav-btn.active,
    body.bg-sky .tab-nav-btn.active,
    body.bg-mint .tab-nav-btn.active,
    body.bg-cotton_candy .tab-nav-btn.active {
      background: var(--text);
      border-color: var(--text);
      color: var(--bg2) !important;
    }

    /* ═══ Heatmap v2 ═══════════════════════════════════════ */
    #workoutBodyHeatmap {
      border-color: rgba(var(--hm-rgb),0.22);
      background:
        radial-gradient(circle at 50% 0%, rgba(var(--hm-rgb),0.12), transparent 55%),
        var(--card);
    }

    /* Period toggle buttons */
    .hm-period-btn {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 4px 10px;
      font-size: 10px;
      font-weight: 800;
      color: var(--text3);
      cursor: pointer;
      letter-spacing: 0.5px;
      transition: all 0.18s;
      white-space: nowrap;
    }
    .hm-period-btn.active {
      background: var(--hm-full);
      border-color: var(--hm-full);
      color: var(--on-acc, #0a0c12);
    }

    /* Large single body view: the original two tiny figures were hard to tap precisely. */
    .hm-body-selector {
      margin-top: 6px;
      border: 1px solid rgba(255,255,255,0.055);
      border-radius: 14px;
      background:
        radial-gradient(circle at 50% 35%, rgba(var(--hm-rgb),0.13), transparent 46%),
        var(--bg2);
      padding: 16px 14px 18px;
    }
    .hm-view-switch {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      max-width: 240px;
      margin: 0 auto 12px;
      padding: 4px;
      background: var(--bg);
      border: 1px solid rgba(255,255,255,0.07);
      border-radius: 10px;
    }
    .hm-view-btn {
      min-height: 34px;
      border: 0;
      border-radius: 7px;
      background: var(--bg2);
      color: var(--text3);
      font: inherit;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    }
    .hm-view-btn.active {
      color: var(--on-acc);
      background: var(--hm-full);
      box-shadow: 0 2px 12px rgba(var(--hm-rgb),0.3);
    }
    .hm-selector-hint {
      text-align: center;
      color: var(--text3);
      font-size: 10px;
      font-weight: 650;
      margin-bottom: 2px;
    }
    .hm-body-stage {
      position: relative;
      height: 320px;
      display: flex;
      justify-content: center;
      align-items: center;
      margin: 8px auto 22px;
    }
    .hm-body-view {
      width: 210px;
      height: 320px;
      filter: drop-shadow(0 15px 27px rgba(0,0,0,0.42));
    }
    .hm-body-view svg {
      overflow: visible;
    }
    .hm-body-selector[data-view="front"] #bodyHeatmapBack,
    .hm-body-selector[data-view="back"] #bodyHeatmapFront {
      display: none;
    }
    .hm-muscle-quick-pick {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 14px 14px;
      margin-top: 4px;
    }
    .hm-muscle-button {
      min-height: 44px;
      padding: 8px 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      border: 1px solid var(--border);
      border-radius: 9px;
      color: var(--text2);
      background: var(--bg2);
      background-image: none;
      font: inherit;
      font-size: 10px;
      font-weight: 800;
      cursor: pointer;
      touch-action: manipulation;
      transition: background 0.16s, border-color 0.16s, color 0.16s;
    }
    .hm-muscle-button:hover,
    .hm-muscle-button:focus-visible {
      border-color: rgba(var(--hm-rgb),0.75);
      background: var(--bg2);
      color: var(--text);
      outline: none;
      transform: none;
    }
    .hm-muscle-button:active {
      transform: none;
      background: var(--hm-full);
      color: var(--on-acc, #0a0c12);
    }
    .hm-muscle-button.group-on {
      background: var(--hm-full) !important;
      background-image: none !important;
      color: var(--on-acc, #0a0c12);
      border-color: var(--hm-full);
      box-shadow: none;
    }
    .hm-muscle-button .hm-muscle-dot {
      width: 8px;
      height: 8px;
      flex: 0 0 8px;
      border-radius: 50%;
      background: var(--hm-full);
    }
    .hm-muscle-button[data-active="0"] .hm-muscle-dot {
      opacity: 0.2;
    }
    .hm-intensity-scale {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px 9px;
      margin-top: 10px;
      color: var(--text3);
      font-size: 8px;
      font-weight: 700;
    }
    .hm-intensity-label {
      color: var(--text2);
      font-size: 8px;
      font-weight: 900;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    .hm-intensity-step {
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .hm-intensity-step i {
      width: 8px;
      height: 8px;
      border-radius: 3px;
      background: var(--hm-full);
      box-shadow: 0 0 6px rgba(var(--hm-rgb),0.35);
    }

    /* Muscle paths */
    #workoutBodyHeatmap .muscle-path {
      cursor: pointer;
      transition: fill 0.25s ease, stroke 0.25s ease, filter 0.25s ease;
      outline: none;
      touch-action: manipulation;
    }
    #workoutBodyHeatmap .muscle-path:focus,
    #workoutBodyHeatmap .muscle-path.group-on {
      filter: none;
      stroke: rgba(var(--hm-rgb),1) !important;
      stroke-width: 2.35 !important;
    }
    #workoutBodyHeatmap .muscle-path:hover {
      filter: none;
      transform: none;
    }
    #workoutBodyHeatmap .muscle-path[data-active="1"] {
      stroke: rgba(var(--hm-rgb),0.65);
      stroke-width: 1.2;
    }

    /* Pulsing glow for max-level muscles */
    @keyframes hm-pulse {
      0%, 100% { filter: drop-shadow(0 0 3px rgba(var(--hm-rgb),0.5)); }
      50%       { filter: drop-shadow(0 0 14px rgba(var(--hm-rgb),1)); }
    }
    #workoutBodyHeatmap .muscle-max {
      animation: hm-pulse 2.2s ease-in-out infinite;
    }
    #workoutBodyHeatmap .muscle-max:hover {
      animation: none;
    }

    /* Legend column */
    .hm-legend-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 5px;
      padding: 6px 0;
      min-width: 42px;
    }
    .hm-legend-title {
      font-size: 7px;
      font-weight: 800;
      letter-spacing: 0.7px;
      color: var(--text3);
      margin-bottom: 4px;
      text-align: center;
    }
    .hm-legend-items {
      display: flex;
      flex-direction: column;
      gap: 9px;
    }
    .hm-legend-row {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 8.5px;
      color: var(--text3);
      white-space: nowrap;
    }
    .hm-dot {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 3px;
      background: var(--hm-full);
      flex-shrink: 0;
    }

    /* Header stat chips */
    .hm-stat-chip {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      font-size: 11px;
      font-weight: 700;
      color: var(--text2);
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 7px;
      padding: 3px 8px;
    }
    .hm-stat-chip strong {
      color: var(--hm-full);
      font-weight: 900;
    }

    /* Stat rows (progress-bar layout) */
    .hm-stat-row {
      display: grid;
      grid-template-columns: 76px 1fr 52px;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      border-radius: 9px;
      background: var(--card);
      border: 1px solid var(--border);
      cursor: pointer;
      transition: background 0.18s, border-color 0.18s;
    }
    .hm-stat-row:hover {
      background: var(--card2);
      border-color: var(--border);
      transform: none;
    }
    .hm-stat-row.hm-stat-empty {
      opacity: 0.4;
    }
    .hm-stat-name {
      font-size: 11px;
      font-weight: 800;
      color: var(--text);
      white-space: normal;
      overflow-wrap: anywhere;
      word-break: break-word;
      min-width: 0;
    }
    .hm-stat-bar-wrap {
      height: 6px;
      background: var(--card2);
      border: 1px solid var(--border);
      border-radius: 4px;
      overflow: hidden;
    }
    .hm-stat-bar-fill {
      height: 100%;
      border-radius: 4px;
      background: linear-gradient(90deg, rgba(var(--hm-rgb),0.7), var(--hm-full));
      transition: width 0.45s cubic-bezier(0.34,1.56,0.64,1);
      min-width: 2px;
    }
    .hm-stat-val {
      font-size: 11px;
      font-weight: 900;
      color: var(--hm-full);
      font-family: var(--FD);
      text-align: right;
      white-space: normal;
      overflow-wrap: anywhere;
      min-width: 0;
    }
    .hm-stat-empty .hm-stat-val {
      color: var(--text3);
    }
    .hm-stats-grid {
      display: flex;
      flex-direction: column;
      gap: 5px;
      margin-top: 12px;
    }
    .hm-stats-section-label {
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.6px;
      color: var(--text3);
      padding: 4px 10px 2px;
    }

    /* Popup backdrop + popup */
    .hm-popup-backdrop {
      position: absolute;
      inset: 0;
      z-index: 9;
      border-radius: inherit;
    }
    .hm-muscle-popup {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 10;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px;
      min-width: 200px;
      max-width: 255px;
      color: var(--text);
      box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 20px rgba(var(--hm-rgb),0.15);
      animation: hmPopIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
    }
    @keyframes hmPopIn {
      from { opacity: 0; transform: translate(-50%, -50%) scale(0.88); }
      to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
    .hm-popup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }
    .hm-popup-title {
      font-size: 15px;
      font-weight: 900;
      color: var(--text);
    }
    .hm-popup-close {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: var(--card2);
      border: 1px solid var(--border);
      color: var(--text);
      cursor: pointer;
      font-size: 13px;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
    }
    .hm-popup-dots {
      display: flex;
      gap: 5px;
      margin-bottom: 8px;
    }
    .hm-popup-dot {
      flex: 1;
      height: 6px;
      border-radius: 4px;
      background: var(--border);
      border: none;
      transition: background 0.2s;
    }
    .hm-popup-dot.filled {
      background: var(--hm-full);
      box-shadow: 0 0 6px rgba(var(--hm-rgb),0.6);
    }
    .hm-popup-level {
      font-size: 9px;
      font-weight: 800;
      color: var(--text2);
      letter-spacing: 0.6px;
      margin-bottom: 12px;
    }
    .hm-popup-stats {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-bottom: 14px;
    }
    .hm-popup-stat {
      text-align: center;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 9px 4px;
    }
    .hm-popup-stat-val {
      font-size: 22px;
      font-weight: 900;
      color: var(--text);
      font-family: var(--FD);
      line-height: 1;
    }
    .hm-popup-stat-label {
      font-size: 8.5px;
      font-weight: 700;
      color: var(--text2);
      letter-spacing: 0.5px;
      margin-top: 3px;
    }
    .hm-popup-btn {
      width: 100%;
      padding: 10px;
      border-radius: 10px;
      border: none;
      background: var(--acc);
      color: var(--on-acc);
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      transition: opacity 0.18s;
      letter-spacing: 0.2px;
    }
    /* Split balance bar (Push / Pull / Legs / Core) */
    .hm-split-container {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px;
      margin-top: 10px;
    }
    .hm-split-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
      font-size: 10px;
      font-weight: 800;
      color: var(--text);
      letter-spacing: 0.5px;
    }
    .hm-split-bar {
      display: flex;
      height: 7px;
      border-radius: 4px;
      overflow: hidden;
      background: var(--border);
      gap: 2px;
    }
    .hm-split-seg {
      height: 100%;
      transition: width 0.4s ease;
      position: relative;
    }
    .hm-split-seg.push { background: #ff5722; }
    .hm-split-seg.pull { background: #3498db; }
    .hm-split-seg.legs { background: #2ecc71; }
    .hm-split-seg.core { background: #9b59b6; }
    .hm-split-legend {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }
    .hm-split-item {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 9.5px;
      font-weight: 700;
      color: var(--text);
    }
    .hm-split-item span.dot {
      width: 7px;
      height: 7px;
      border-radius: 2px;
      display: inline-block;
    }

    /* ═══ Heatmap Adaptive Light/Dark Theme Visibility ═══ */
    .hm-period-btn { color: var(--text); }
    .hm-view-btn { color: var(--text); }
    .hm-muscle-button { color: var(--text); }
    .hm-stat-name { color: var(--text); }
    .hm-stat-chip { color: var(--text); }

    body.bg-snow .hm-stat-val,
    body.bg-sky .hm-stat-val,
    body.bg-mint .hm-stat-val,
    body.bg-cotton_candy .hm-stat-val {
      color: var(--text) !important;
    }

    body.bg-snow .hm-stat-chip strong,
    body.bg-sky .hm-stat-chip strong,
    body.bg-mint .hm-stat-chip strong,
    body.bg-cotton_candy .hm-stat-chip strong {
      color: var(--text) !important;
    }

    body.bg-snow .hm-body-selector,
    body.bg-sky .hm-body-selector,
    body.bg-mint .hm-body-selector,
    body.bg-cotton_candy .hm-body-selector {
      background: var(--bg2);
      border-color: var(--border);
    }

    body.bg-snow .hm-view-switch,
    body.bg-sky .hm-view-switch,
    body.bg-mint .hm-view-switch,
    body.bg-cotton_candy .hm-view-switch {
      background: var(--bg3);
      border-color: var(--border);
    }

    body.bg-snow .hm-view-btn,
    body.bg-sky .hm-view-btn,
    body.bg-mint .hm-view-btn,
    body.bg-cotton_candy .hm-view-btn {
      background: var(--bg2);
      color: var(--text);
    }

    body.bg-snow .hm-period-btn,
    body.bg-sky .hm-period-btn,
    body.bg-mint .hm-period-btn,
    body.bg-cotton_candy .hm-period-btn {
      background: var(--card);
      color: var(--text);
      border-color: var(--border);
    }

    body.bg-snow .hm-muscle-button,
    body.bg-sky .hm-muscle-button,
    body.bg-mint .hm-muscle-button,
    body.bg-cotton_candy .hm-muscle-button {
      background: var(--card2);
      color: var(--text);
      border-color: var(--border);
    }

    body.bg-snow .hm-stat-bar-wrap,
    body.bg-sky .hm-stat-bar-wrap,
    body.bg-mint .hm-stat-bar-wrap,
    body.bg-cotton_candy .hm-stat-bar-wrap {
      background: var(--card2);
      border: 1px solid var(--border);
    }

    /* Muscle Recovery Badges */
    .hm-recovery-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 9.5px;
      font-weight: 800;
      letter-spacing: 0.3px;
    }
    .hm-recovery-badge.recovering {
      background: rgba(231, 76, 60, 0.15);
      color: #e74c3c;
      border: 1px solid rgba(231, 76, 60, 0.3);
    }
    .hm-recovery-badge.primed {
      background: rgba(241, 196, 15, 0.15);
      color: #f1c40f;
      border: 1px solid rgba(241, 196, 15, 0.3);
    }
    .hm-recovery-badge.fresh {
      background: rgba(46, 204, 113, 0.15);
      color: #2ecc71;
      border: 1px solid rgba(46, 204, 113, 0.3);
    }

    /* Session details target muscle pill */
    .sd-muscle-chip {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 8px;
      border-radius: 6px;
      background: rgba(var(--hm-rgb), 0.12);
      border: 1px solid rgba(var(--hm-rgb), 0.3);
      color: var(--hm-full);
      font-size: 11px;
      font-weight: 800;
    }

    /* Keep old class names working (compat) */
    .body-heatmap-stat { display: none; }

    /* Chip buttons */
    .chip {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 9999px;
      padding: 6px 14px;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: -0.1px;
      color: var(--text2);
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
      min-height: 36px;
      display: inline-flex;
      align-items: center;
      box-sizing: border-box;
    }

    .chip:hover {
      background: var(--card2);
      color: var(--text);
      border-color: rgba(255, 255, 255, 0.16);
    }

    .chip.on {
      background: var(--acc);
      border-color: var(--acc);
      color: var(--on-acc) !important;
      font-weight: 750;
      box-shadow: 0 2px 10px rgba(var(--acc-rgb), 0.28);
    }

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

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

    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: 16px;
      border-radius: 16px;
      border: 2px solid var(--acc);
      background: linear-gradient(145deg, rgba(var(--acc-rgb), 0.08), var(--card));
      box-shadow: 0 4px 20px rgba(var(--acc-rgb), 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
      position: relative;
      overflow: hidden;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .msg-pr-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 25px rgba(var(--acc-rgb), 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .msg-pr-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--acc), rgba(var(--acc-rgb), 0.5), var(--acc));
    }

    .msg-pr-card.workout-card {
      border-color: rgba(16, 185, 129, 0.6);
      background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), var(--card));
      box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .msg-pr-card.workout-card:hover {
      box-shadow: 0 6px 25px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .msg-pr-card.workout-card::before {
      background: linear-gradient(90deg, #10b981, #059669, #10b981);
    }

    .msg-pr-card.template-card {
      border-color: rgba(139, 92, 246, 0.6);
      background: linear-gradient(145deg, rgba(139, 92, 246, 0.08), var(--card));
      box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .msg-pr-card.template-card:hover {
      box-shadow: 0 6px 25px rgba(139, 92, 246, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    }

    .msg-pr-card.template-card::before {
      background: linear-gradient(90deg, #8b5cf6, #7c3aed, #8b5cf6);
    }

    .msg-pr-label {
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.15em;
      color: var(--acc);
      margin-bottom: 8px;
      text-transform: uppercase;
    }

    .msg-pr-card.workout-card .msg-pr-label {
      color: #10b981;
    }

    .msg-pr-card.template-card .msg-pr-label {
      color: #8b5cf6;
    }

    .msg-pr-name {
      font-weight: 800;
      font-size: 16px;
      margin-bottom: 6px;
      line-height: 1.3;
    }

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

    .msg-pr-card.workout-card .msg-pr-stats {
      color: #10b981;
    }

    .msg-pr-card.template-card .msg-pr-stats {
      color: #8b5cf6;
    }

    .msg-pr-date {
      font-size: 11px;
      margin: 6px 0 12px;
      color: var(--text2);
    }

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

    /* ═══ RICH WORKOUT SHARE CARD ═══ */
    .msg-pr-card.workout-card-rich {
      max-width: 95%;
      padding: 14px 16px;
    }
    .workout-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .workout-card-date {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-mut);
    }
    .workout-card-stats-banner {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
      gap: 6px;
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 8px 10px;
      margin-bottom: 10px;
      text-align: center;
    }
    .workout-card-stat .stat-num {
      font-family: var(--FD);
      font-size: 15px;
      font-weight: 800;
      color: var(--text);
      line-height: 1.15;
    }
    .workout-card-stat .stat-lbl {
      font-size: 9px;
      font-weight: 700;
      color: var(--text-mut);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-top: 2px;
    }
    .workout-card-exercises-container {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: none;
      overflow-y: visible;
      padding-right: 0;
    }
    .workout-card-ex {
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 10px;
    }
    .workout-card-ex-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
    }
    .workout-card-ex-name {
      font-size: 13px;
      font-weight: 800;
      color: var(--text);
      white-space: normal;
      word-break: break-word;
    }
    .workout-card-ex-count {
      font-size: 10px;
      font-weight: 700;
      color: var(--text-mut);
      flex-shrink: 0;
      margin-left: 8px;
    }
    .workout-card-sets-vertical {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    .workout-card-set-row-v {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 5px 8px;
      font-size: 11px;
    }
    .workout-card-set-left {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 1;
      min-width: 0;
    }
    .workout-card-set-right {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
    }
    .workout-card-sets-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
    }
    .workout-card-set-row {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 3px 6px;
      font-size: 11px;
    }
    .workout-card-set-num {
      font-weight: 800;
      color: var(--text-mut);
      font-size: 10px;
    }
    .workout-card-set-val {
      font-weight: 600;
      color: var(--text);
    }
    .workout-card-set-val strong {
      color: var(--acc-text, var(--acc));
    }
    .workout-card-badge {
      font-size: 9px;
      font-weight: 800;
      padding: 1px 4px;
      border-radius: 4px;
      line-height: 1;
    }
    .workout-card-badge.pr {
      background: rgba(255, 180, 0, 0.2);
      color: #ffb400;
      border: 1px solid rgba(255, 180, 0, 0.4);
    }
    .workout-card-badge.fail {
      background: rgba(255, 59, 48, 0.2);
      color: #ff3b30;
    }
    .workout-card-note {
      font-size: 10px;
      cursor: help;
    }
    .workout-share-preview {
      max-height: 280px;
      overflow-y: auto;
      border-radius: 8px;
      border: 1px solid var(--border);
    }
    .share-text-pre {
      white-space: pre-wrap;
      font-size: 12px;
      line-height: 1.45;
      color: var(--text);
      background: var(--bg3);
      padding: 12px;
      border-radius: 8px;
      font-family: var(--FF);
      margin: 0;
    }

    .msg-pr-card-icon {
      position: absolute;
      top: 12px;
      right: 12px;
      font-size: 28px;
      opacity: 0.12;
      filter: blur(1px);
      pointer-events: none;
    }

    /* Make PR cards stand out more in message bubbles */
    .msg-bubble .msg-pr-card {
      margin: 4px 0;
    }

    /* Animation for when PR cards are received */
    @keyframes cardPopIn {
      0% {
        transform: scale(0.95);
        opacity: 0;
      }
      100% {
        transform: scale(1);
        opacity: 1;
      }
    }

    .msg-pr-card {
      animation: cardPopIn 0.3s ease-out;
    }

    /* Loading skeleton for share cards */
    .share-card-skeleton {
      background: linear-gradient(90deg, var(--bg3) 25%, var(--card) 50%, var(--bg3) 75%);
      background-size: 200% 100%;
      animation: skeleton-pulse-shine 1.4s infinite ease-in-out;
      border-radius: 16px;
      padding: 16px;
      min-height: 120px;
    }

    /* Touch feedback for share cards */
    .msg-pr-card:active {
      transform: scale(0.98);
    }

    /* Focus styles for accessibility */
    .msg-pr-card:focus-within {
      outline: 2px solid var(--acc);
      outline-offset: 2px;
    }

    .msg-pr-card button:focus {
      outline: 2px solid var(--acc);
      outline-offset: 2px;
    }

    /* Swipe action indicators */
    .msg-pr-card.swipe-left {
      transform: translateX(-20px);
      opacity: 0.8;
    }

    .msg-pr-card.swipe-right {
      transform: translateX(20px);
      opacity: 0.8;
    }

    /* Keyboard navigation support */
    .msg-pr-card[tabindex="0"] {
      cursor: pointer;
    }

    .msg-pr-card[tabindex="0"]:focus {
      outline: 2px solid var(--acc);
      outline-offset: 2px;
    }

    /* Workout Comparison Modal Styles */
    #workoutComparisonModal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 1000;
      display: none;
    }

    #workoutComparisonModal.open {
      display: block;
    }

    #workoutComparisonModal .modal-backdrop {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(4px);
    }

    #workoutComparisonModal .modal-content {
      position: relative;
      background: var(--card);
      border-radius: 16px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
      margin: 50px auto;
      max-width: 90%;
      max-height: 90vh;
      overflow-y: auto;
    }

    #workoutComparisonModal .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 15px;
      border-bottom: 1px solid var(--border);
    }

    #workoutComparisonModal .modal-header h3 {
      margin: 0;
      font-size: 18px;
      font-weight: 800;
    }

    #workoutComparisonModal .btn-close {
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
      color: var(--text2);
      padding: 0;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
    }

    #workoutComparisonModal .btn-close:hover {
      background: var(--bg3);
      color: var(--text);
    }

    .comparison-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 15px;
      margin-bottom: 25px;
    }

    .comparison-stat {
      text-align: center;
      padding: 15px;
      background: var(--bg3);
      border-radius: 12px;
    }

    .comparison-stat .stat-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--text2);
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .comparison-stat .stat-value {
      font-size: 20px;
      font-weight: 800;
      font-family: var(--FD);
    }

    .comparison-stat .stat-value.positive {
      color: var(--green);
    }

    .comparison-stat .stat-value.negative {
      color: var(--red);
    }

    .comparison-exercises {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .comparison-section {
      background: var(--bg3);
      padding: 15px;
      border-radius: 12px;
    }

    .comparison-section .section-title {
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 12px;
      color: var(--text2);
    }

    .exercise-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .comparison-tag {
      padding: 6px 12px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
    }

    .comparison-tag.shared {
      background: rgba(var(--acc-rgb), 0.15);
      color: var(--acc);
      border: 1px solid rgba(var(--acc-rgb), 0.3);
    }

    .comparison-tag.unique-1 {
      background: rgba(59, 130, 246, 0.15);
      color: var(--blue);
      border: 1px solid rgba(59, 130, 246, 0.3);
    }

    .comparison-tag.unique-2 {
      background: rgba(16, 185, 129, 0.15);
      color: var(--green);
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    /* Mobile Experience Improvements */
    /* Better touch targets for mobile */
    @media (max-width: 768px) {
      .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
        font-size: 16px;
      }

      .card, .social-card {
        min-height: 48px;
        touch-action: manipulation;
      }

      input, select, textarea {
        min-height: 44px;
        font-size: 16px; /* Prevent iOS zoom */
      }

      /* Swipe actions for list items */
      .swipeable-item {
        position: relative;
        overflow: hidden;
        touch-action: pan-x;
      }

      .swipeable-item .swipe-actions {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        display: flex;
        transform: translateX(100%);
        transition: transform 0.3s ease;
      }

      .swipeable-item.swiped .swipe-actions {
        transform: translateX(0);
      }

      .swipe-action {
        width: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 700;
        font-size: 14px;
      }

      .swipe-action.delete {
        background: var(--red);
      }

      .swipe-action.archive {
        background: var(--blue);
      }

      .swipe-action.edit {
        background: var(--green);
      }

      /* Haptic feedback indicators */
      .haptic-feedback {
        transition: transform 0.1s ease;
      }

      .haptic-feedback:active {
        transform: scale(0.95);
      }

      /* One-handed mode optimizations */
      .one-handed-mode .bottom-nav {
        padding-bottom: 20px;
      }

      .one-handed-mode .floating-action {
        bottom: 100px;
        right: 20px;
      }
    }

    /* Touch feedback animations */
    @media (hover: none) and (pointer: coarse) {
      .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
      }

      .card:active {
        background: var(--bg4);
        transition: background 0.1s ease;
      }

      .social-card:active {
        background: var(--bg4);
        transition: background 0.1s ease;
      }
    }

    /* Streak Badge Styles */
    .streak-container {
      margin-top: 8px;
      display: flex;
      justify-content: center;
    }

    .streak-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 10px;
      background: linear-gradient(135deg, #f59e0b, #d97706);
      color: white;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
      animation: streakPulse 2s ease-in-out infinite;
    }

    @keyframes streakPulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.05); }
    }

    .streak-badge:hover {
      transform: scale(1.1);
      transition: transform 0.2s ease;
    }

    /* Template Suggestions Styles */
    .template-suggestions {
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px solid var(--border);
    }

    .suggestions-header {
      font-size: 11px;
      font-weight: 700;
      color: var(--text2);
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .suggestion-card {
      width: 100%;
      padding: 10px 12px;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 8px;
      text-align: left;
      cursor: pointer;
      transition: all 0.2s ease;
      margin-bottom: 6px;
    }

    .suggestion-card:hover {
      background: var(--bg4);
      border-color: var(--acc);
      transform: translateY(-1px);
    }

    .suggestion-name {
      font-weight: 700;
      font-size: 13px;
      color: var(--text);
    }

    .suggestion-meta {
      font-size: 11px;
      color: var(--text2);
      margin-top: 2px;
    }

    .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 + var(--safe-top)) 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(var(--safe-top) + 28px); height: calc(88px + var(--safe-top)); }
    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: var(--on-acc) !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: 13px;
      font-weight: 800;
      margin-bottom: 3px;
      padding-left: 4px;
      text-transform: none;
      letter-spacing: 0;
    }
    .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: var(--on-acc);
    }
    .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: 1px solid var(--border);
      background: var(--card);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.2);
    }
    .card, .hc, .ec, .social-card, .grp-card, .btn, .ib, .chip, .inp { transition: 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: none;
      border-color: rgba(255, 255, 255, 0.14);
      background: var(--card2);
    }
    .btn:active, .ib:active, .chip:active, .ec:active, .social-card:active { transform: scale(0.97); }
    .hdr {
      background: color-mix(in srgb, var(--bg) 90%, transparent);
      backdrop-filter: blur(20px) saturate(180%);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      border-bottom: 1px solid var(--border);
    }
    .ht, .st, .mtt { letter-spacing: -0.2px; }
    .st { color: var(--text3); font-weight: 700; }
    .inp {
      background: var(--bg2);
      border: 1px solid var(--border);
      color: var(--text);
    }
    .inp:focus {
      border-color: var(--acc);
      background: var(--bg3);
      box-shadow: 0 0 0 3px rgba(var(--acc-rgb), 0.2);
    }
    .bnav {
      background: color-mix(in srgb, var(--bg) 92%, transparent);
      backdrop-filter: blur(20px) saturate(180%);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      border-top: 1px solid var(--border);
    }
    body.bg-snow .hdr, body.bg-sky .hdr, body.bg-mint .hdr, body.bg-cotton_candy .hdr {
      background: color-mix(in srgb, var(--bg2) 94%, transparent);
      border-bottom-color: rgba(0, 0, 0, 0.1);
      color: #050508;
    }
    body.bg-snow .bnav, body.bg-sky .bnav, body.bg-mint .bnav, body.bg-cotton_candy .bnav {
      background: color-mix(in srgb, var(--bg2) 96%, transparent);
      border-top-color: rgba(0, 0, 0, 0.1);
    }
    body.bg-snow .ni.on, body.bg-sky .ni.on, body.bg-mint .ni.on, body.bg-cotton_candy .ni.on {
      color: var(--acc-text, #4d6800);
    }
    body.bg-snow .ni.on .ni-ic, body.bg-sky .ni.on .ni-ic, body.bg-mint .ni.on .ni-ic, body.bg-cotton_candy .ni.on .ni-ic {
      color: var(--acc-text, #4d6800);
      filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.15));
    }
    .ni.active { transform: translateY(-1px); }
    .modal {
      background: var(--card);
      box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
      color: var(--text);
    }
    .mov.open .modal { animation: sheetRise 0.28s cubic-bezier(0.16, 1, 0.3, 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-hero .exercise-visual.form-demo.duo {
      display: block;
      position: relative;
    }
    .exercise-hero .exercise-visual.form-demo.duo img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      animation: formDemoSwap 2.6s steps(1, end) infinite;
    }
    .exercise-hero .exercise-visual.form-demo.duo img:last-child {
      animation-delay: 1.3s;
    }
    @keyframes formDemoSwap {
      0%, 49.9% { opacity: 1; }
      50%, 100% { opacity: 0; }
    }
    .form-demo-labels {
      position: absolute;
      left: 10px;
      bottom: 10px;
      z-index: 2;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.6px;
      text-transform: uppercase;
      color: var(--text);
      background: rgba(0,0,0,0.45);
      padding: 3px 8px;
      border-radius: 99px;
    }
    .diff-badge {
      font-size: 9px;
      font-weight: 800;
      padding: 1px 6px;
      border-radius: 99px;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .diff-beginner { color: #7dcea0; background: rgba(46,204,113,0.14); }
    .diff-intermediate { color: #f5b041; background: rgba(241,196,15,0.14); }
    .diff-advanced { color: #ec7063; background: rgba(231,76,60,0.14); }
    .exercise-visual:after {
      content:'';
      position:absolute; inset:0;
      background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,0.3));
      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: var(--bg3);
      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:color-mix(in srgb, var(--text) 11%, transparent); background:color-mix(in srgb, var(--text) 4.5%, transparent); }
    .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 {
      transition:
        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: none;
        border-color: color-mix(in srgb, var(--acc) 38%, rgba(255,255,255,0.12));
      }
      .btn:hover, .ib:hover, .chip:hover, .ni:hover, .ni-mid-btn:hover {
        transform: none;
      }
    }
    .card:active, .ec:active, .hc:active, .btn:active, .ib:active, .chip:active, .ni:active, .ni-mid-btn:active {
      transform: scale(0.97);
    }
    .hdr {
      background: color-mix(in srgb, var(--bg) 85%, 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 {
      background: var(--bg);
      border-top-color: color-mix(in srgb, var(--text) 10%, transparent);
      box-shadow: 0 -8px 30px rgba(0,0,0,0.45);
    }
    .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: none; }
    .btn-p, .ni-mid-btn, .ln[style*="background:var(--acc)"] { color: var(--on-acc) !important; text-shadow: none !important; font-weight: 750; }
    .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: calc(9px + var(--safe-top)) 16px 9px;
    }
    .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 var(--border);
      border-radius: 12px;
      background: var(--bg2);
      cursor: pointer;
    }
    .session-ex-row.is-current {
      border-color: var(--acc);
      background: var(--card2);
      box-shadow: 0 0 0 1px var(--acc) inset, 0 4px 16px rgba(0, 0, 0, 0.35);
    }
    .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;
      overflow-wrap: anywhere;
      word-break: normal;
      min-width: 0;
    }
    .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: normal;
      overflow-wrap: anywhere;
      max-width: 100%;
    }
    .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 var(--border);
      border-radius: 12px;
      padding: 10px;
      background: var(--card);
    }
    .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: var(--card2);
      border: 1px solid var(--border);
    }
    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 {
      white-space: nowrap;
      flex-shrink: 0;
    }
    .prb,
    .set-pill,
    .muscle-chip {
      max-width: 100%;
      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,
    #eqChips,
    #diffChips,
    #edTgs,
    .heatmap-legend {
      max-width: 100%;
      display: flex;
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
      -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    }
    #catChips .chip,
    #eqChips .chip,
    #diffChips .chip,
    #edTgs .tag {
      flex: 0 0 auto;
      white-space: nowrap;
    }
    .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: 9px 11px; font-size: 10px; min-height: 44px; min-width: 44px; }
      .ib { width: 44px; height: 44px; 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: 44px;
        height: 44px;
        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, var(--safe-left));
        padding-right: max(12px, var(--safe-right));
      }
      .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 1px;
        overflow: hidden;
        font-size: 9px;
      }
      .ni-ic {
        font-size: 20px;
        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,
      #eqChips,
      #diffChips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
      }
      #edTgs .tag,
      #catChips .chip,
      #eqChips .chip,
      #diffChips .chip {
        flex: 0 0 auto;
        white-space: nowrap;
      }
      #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;
      }
      .chat-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 + var(--safe-bottom));
      }
      .ni {
        font-size: 8px;
      }
      .ni-mid {
        flex-basis: 48px;
      }
      .ni-mid-btn {
        width: 40px !important;
        height: 40px !important;
      }
    }
    .chart-card {
      padding: 14px;
      overflow: hidden;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    #edExChart { min-height: 164px; }

    .workout-topbar {
      background: rgba(9, 10, 15, 0.9) !important;
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      backdrop-filter: blur(20px) saturate(180%);
      border-bottom: 1px solid var(--border);
    }
    .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 + var(--safe-bottom));
    }
    .workout-sticky {
      position: sticky;
      top: 0;
      z-index: 30;
      margin: 0 -2px 14px;
      padding: 12px 14px;
      border: 1px solid var(--border);
      border-top: none;
      border-radius: 0 0 16px 16px;
      background: rgba(18, 21, 32, 0.94);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      backdrop-filter: blur(20px) saturate(180%);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    .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: 8px;
      margin: 0 0 14px;
    }
    .plate-jump-side {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      min-width: 0;
    }
    .plate-jump-minus {
      justify-self: stretch;
    }
    .plate-jump-plus {
      justify-self: stretch;
    }
    .plate-jumps button {
      min-height: 36px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg3);
      color: var(--text2);
      font: 700 12px var(--FD);
      font-variant-numeric: tabular-nums;
      cursor: pointer;
      transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .plate-jumps button:hover {
      background: var(--bg2);
      color: var(--text);
      border-color: rgba(255, 255, 255, 0.18);
    }
    .plate-jumps button:active {
      transform: scale(0.95);
    }
    .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: 8px;
      padding: 12px 14px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--bg2);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
      transition: border-color 0.2s ease, background 0.2s ease;
    }
    .set-card.is-pr {
      border-color: rgba(var(--acc-rgb), 0.4);
      background: rgba(var(--acc-rgb), 0.04);
    }
    .set-card.is-failure {
      border-color: rgba(239, 68, 68, 0.3);
      background: rgba(239, 68, 68, 0.04);
    }
    .set-card-head {
      display: grid;
      grid-template-columns: 32px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
    }
    .set-index {
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      background: var(--bg3);
      border: 1px solid var(--border);
      color: var(--text2);
      font: 700 13px var(--FD);
    }
    .set-card.is-pr .set-index {
      background: var(--acc);
      color: var(--on-acc);
      border-color: transparent;
      font-weight: 800;
    }
    .set-title {
      min-width: 0;
      color: var(--text);
      font-weight: 700;
      font-size: 13px;
      line-height: 1.25;
    }
    .set-title span {
      display: block;
      margin-top: 2px;
      color: var(--text2);
      font-size: 12px;
      font-weight: 500;
      overflow-wrap: anywhere;
    }
    .set-delete {
      border: 1px solid rgba(239, 68, 68, 0.2);
      border-radius: 8px;
      background: var(--red-d);
      color: #f87171;
      padding: 6px 10px;
      font: 700 11px var(--FF);
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .set-delete:hover {
      background: rgba(239, 68, 68, 0.2);
    }
    .set-metrics {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      margin-top: 10px;
    }
    .set-metrics div {
      min-width: 0;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg3);
    }
    .set-metrics span {
      display: block;
      color: var(--text3);
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    .set-metrics strong {
      display: block;
      margin-top: 2px;
      color: var(--text);
      font-size: 14px;
      font-weight: 700;
      font-family: var(--FD);
      font-variant-numeric: tabular-nums;
      overflow-wrap: anywhere;
    }
    .set-note {
      margin-top: 8px;
      padding: 8px 10px;
      border-left: 3px solid var(--acc);
      border-radius: 6px;
      background: var(--bg3);
      color: var(--text2);
      font-size: 12px;
      font-weight: 500;
      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: var(--card);
    }
    .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: var(--card);
    }
    .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) auto;
        gap: 9px;
      }
      .workout-focus-art {
        width: 50px;
        height: 50px;
        border-radius: 12px;
      }
      .workout-focus-name { font-size: 16px; overflow-wrap: anywhere; }
      .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: repeat(auto-fit, minmax(130px, 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: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  display: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.2);
}
.streak-card-v2.visible { display: block; }
.streak-card-v2-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.streak-flame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.25);
  flex-shrink: 0;
}
.streak-numbers {
  flex: 1;
}
.streak-current-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  font-family: var(--FM);
  letter-spacing: -0.5px;
  line-height: 1;
}
.streak-current-num span {
  color: #f97316;
}
.streak-current-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.streak-badges {
  display: flex;
  gap: 8px;
}
.streak-badge {
  text-align: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.streak-badge-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--FM);
  letter-spacing: -0.3px;
}
.streak-badge-label {
  font-size: 9px;
  font-weight: 700;
  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(--FM);
  font-weight: 800;
  letter-spacing: -0.3px;
}
.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: var(--green);
}
.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 skeleton-pulse-shine {
  0% { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}
.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-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-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.skeleton-line {
  height: 12px;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 6px;
}
.skeleton-line.title {
  width: 50%;
  height: 14px;
  margin-bottom: 10px;
}
.skeleton-line.sub {
  width: 30%;
  height: 10px;
  margin-top: 4px;
}
.skeleton-line.sm {
  width: 70%;
}

/* ═══════════════════════════════════════════════════════
   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(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.recap-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  font-family: var(--FM);
  letter-spacing: -0.5px;
  line-height: 1;
  display: block;
}
.recap-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 6px;
}
.recap-pr-banner {
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--acc);
  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: max(12px, calc(8px + var(--safe-top)));
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 480px);
  background: color-mix(in srgb, var(--orange, #ff8c42) 92%, #000);
  color: #000;
  font-weight: 800;
  padding: 8px 10px 8px 14px;
  border-radius: 26px;
  font-size: 12px;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

#sync-error-banner .sync-banner-content {
  flex: 1;
  display: flex;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sync-error-banner .sync-banner-content:hover {
  text-decoration: underline;
}

.sync-banner-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: #000;
  border: none;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
}

.sync-banner-x:hover, .sync-banner-x:active {
  background: rgba(0, 0, 0, 0.4);
  transform: scale(1.1);
}

body.is-offline #sync-error-banner {
  display: none !important;
}

/* 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); }
}

/* Premium micro-interactions & glows */
.chip, .btn, .hc, .ec, .card {
  transition: border-color var(--anim, 0.2s) ease, background var(--anim, 0.2s) ease, box-shadow var(--anim, 0.2s) ease;
}
.chip:hover, .btn:hover {
  transform: none;
}
.hc:hover, .ec:hover {
  transform: none;
  border-color: rgba(var(--acc-rgb), 0.35);
}
.card:hover {
  transform: none;
}

/* Heatmap levels inside Month calendar */
.cd.heatmap-lvl-0 { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.cd.heatmap-lvl-1 { background: rgba(var(--hm-rgb), 0.22); color: var(--text); font-weight: 700; border-color: rgba(var(--hm-rgb), 0.4); }
.cd.heatmap-lvl-2 { background: rgba(var(--hm-rgb), 0.45); color: #fff; font-weight: 800; border-color: rgba(var(--hm-rgb), 0.6); }
.cd.heatmap-lvl-3 { background: rgba(var(--hm-rgb), 0.75); color: #fff; font-weight: 800; border-color: rgba(var(--hm-rgb), 0.85); }
.cd.heatmap-lvl-4 { background: var(--hm-full); color: var(--on-acc, #fff); font-weight: 900; box-shadow: 0 0 12px rgba(var(--hm-rgb), 0.4); }

/* In light themes, ensure all calendar heatmap text is dark/black for visibility */
body.bg-snow .cd.heatmap-lvl-0, body.bg-sky .cd.heatmap-lvl-0, body.bg-mint .cd.heatmap-lvl-0, body.bg-cotton_candy .cd.heatmap-lvl-0,
body.bg-snow .cd.heatmap-lvl-1, body.bg-sky .cd.heatmap-lvl-1, body.bg-mint .cd.heatmap-lvl-1, body.bg-cotton_candy .cd.heatmap-lvl-1,
body.bg-snow .cd.heatmap-lvl-2, body.bg-sky .cd.heatmap-lvl-2, body.bg-mint .cd.heatmap-lvl-2, body.bg-cotton_candy .cd.heatmap-lvl-2,
body.bg-snow .cd.heatmap-lvl-3, body.bg-sky .cd.heatmap-lvl-3, body.bg-mint .cd.heatmap-lvl-3, body.bg-cotton_candy .cd.heatmap-lvl-3 {
  color: var(--text) !important;
}
body.bg-snow .cd.heatmap-lvl-4, body.bg-sky .cd.heatmap-lvl-4, body.bg-mint .cd.heatmap-lvl-4, body.bg-cotton_candy .cd.heatmap-lvl-4 {
  color: var(--on-acc, #050508) !important;
  text-shadow: none !important;
}

/* 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: none;
}

/* 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: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--acc);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.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: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.overload-target-val {
  font-weight: 800;
  font-size: 20px;
  font-family: var(--FM);
  letter-spacing: -0.4px;
  color: var(--text);
  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: 4px;
}
.overload-advice {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  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,
  .social-card:hover, .ec:hover, .hc:hover, .grp-card:hover,
  .avatar-card:hover, .hm-stat-row:hover, .hm-muscle-button:hover {
    transform: none !important;
  }
}
.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); }
}

/* ═══════════════════════════════════════════════════════ */
/* LOW-PERFORMANCE MODE (.perf-low)                       */
/* Optimized for older devices: No blurs, flat shadows,  */
/* fast transitions, and low CPU/GPU overhead.           */
/* ═══════════════════════════════════════════════════════ */

body.perf-low,
body.perf-low *,
body.perf-low *::before,
body.perf-low *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.perf-low {
  --anim: 0.05s !important;
}

body.perf-low *,
body.perf-low *::before,
body.perf-low *::after {
  transition-duration: 0.05s !important;
}

/* Maintain essential loading spinner rotation */
body.perf-low .spinner,
body.perf-low .loading-spinner,
body.perf-low .spin {
  animation: spin 0.8s linear infinite !important;
}

/* Fallback solid backgrounds for blurred elements */
body.perf-low .hdr,
body.perf-low .nav-bar,
body.perf-low .mov-overlay,
body.perf-low .modal-overlay,
body.perf-low .mov,
body.perf-low .modal-box,
body.perf-low .toast,
body.perf-low #offline-banner {
  background-color: var(--bg2, #121218) !important;
  border-color: var(--border, rgba(255, 255, 255, 0.12)) !important;
}

body.perf-low .card,
body.perf-low .social-card,
body.perf-low .template-card,
body.perf-low .session-ex-row {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12)) !important;
  transform: none !important;
}

body.perf-low .card:hover,
body.perf-low .social-card:hover {
  transform: none !important;
}
body.lang-ar,
html[lang="ar-EG"] body {
  font-family: 'Cairo', 'Outfit', sans-serif;
}
html[dir="rtl"] .bnav .ni { text-align: center; }
html[dir="rtl"] .composer-wrap,
html[dir="rtl"] .row { direction: rtl; }
.suggested-next-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--acc);
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.grp-sender-label .profile-name-styled { font-size: 12px; }

/* Device notification & PWA install guide modal styling */
.device-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.device-guide-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--acc);
  color: var(--on-acc);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}
.device-guide-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.device-guide-text strong {
  color: var(--text);
}
.device-brand-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--card2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════
   SOCIAL ENHANCEMENTS: TABS, FEED, PROFILES, MODERATION
   ═══════════════════════════════════════════════════════ */

.social-subtabs {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin: 12px 0 16px;
}

.social-subtab {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-mut);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  font-family: var(--FF);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.social-subtab:hover {
  color: var(--text);
}

.social-subtab.active {
  background: var(--acc);
  color: var(--on-acc);
  box-shadow: 0 2px 8px rgba(var(--acc-rgb), 0.3);
}

/* Feed Composer */
.feed-composer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.feed-composer-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.feed-composer-textarea {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--FF);
  font-size: 14px;
  resize: none;
  min-height: 56px;
  outline: none;
  transition: border-color 0.2s;
}

.feed-composer-textarea:focus {
  border-color: var(--acc);
}

.feed-attached-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(var(--acc-rgb), 0.12);
  border: 1px solid rgba(var(--acc-rgb), 0.3);
  color: var(--acc);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 8px;
}

.feed-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Feed Post Card */
.feed-post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.feed-post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}

.feed-post-content {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.feed-post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.feed-post-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-mut);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: var(--FF);
}

.feed-post-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.feed-post-btn.liked {
  color: var(--red);
}

.feed-comments-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.feed-comment-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 10px;
  border-radius: 8px;
}

.feed-comment-author {
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}

.feed-comment-text {
  color: var(--text-mut);
  flex: 1;
  word-break: break-word;
}

/* Athlete Cards & Friend Requests */
.athlete-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.athlete-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* User Profile Modal */
.user-profile-header-card {
  text-align: center;
  padding: 24px 16px;
  background: linear-gradient(180deg, rgba(var(--acc-rgb), 0.15) 0%, transparent 100%);
  border-radius: 16px;
  margin-bottom: 16px;
}

.user-profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.user-profile-stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.user-profile-stat-box strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: var(--acc);
  font-family: var(--FD);
}

.user-profile-stat-box span {
  font-size: 11px;
  color: var(--text-mut);
  font-weight: 600;
}








