/* ═══════════════════════════════════════════════════════════════
   GymGame — CYBER_HUD v3.0
   Theming: every color in this file resolves through the custom
   properties below. A theme is just a value swap on that same set
   of properties, keyed by [data-theme="..."] on <html> — see the
   "THEMES" section further down for the 5 available palettes.
   Composed properties (dim/med/border shades) are declared ONCE,
   built from the *-rgb triplets, and recompute automatically for
   whichever theme is active — only raw colors differ per theme.
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

/* Every theme here is dark (see surface colors below) — telling the browser
   this avoids mobile Safari/Chrome rendering native form-control chrome
   (autofill, number-input backgrounds) for light mode, which can leave
   light-on-light or invisible text in inputs that rely on inherited/
   transparent backgrounds, like the weight/reps steppers. */
:root { color-scheme: dark; }

:root,
[data-theme="cyber_hud"] {
  --cyan:        #00e5ff;
  --cyan-rgb:    0,229,255;
  --gold:        #ffc107;
  --gold-rgb:    255,193,7;
  --gold-bright: #ffd040;
  --red:         #ff2a4a;
  --red-rgb:     255,42,74;
  --red-bright:  #ff6080;
  --green:       #00ff8c;
  --green-rgb:   0,255,140;
  --orange:        #ff8c1a;
  --orange-rgb:    255,140,26;
  --orange-bright: #ffa64d;
  --bg:        #020408;
  --bg-rgb:    2,4,8;
  --surface:   #050b14;
  --surface-rgb: 5,11,20;
  --surface2:  #080f1c;
  --text:      #90cce4;
  --bright:    #dff2ff;
  --muted:     #4a8ca8;
  /* recolors static/muscles/*.png (source art is blue-grey) and the
     auth-page background photo to land on this theme's cyan hue */
  --icon-hue: 175deg;
  --auth-hue: 180deg;

  /* ── Composed shades — derived from the raw colors above, defined
     once; do not repeat inside other [data-theme] blocks ── */
  --cyan-dim:      rgba(var(--cyan-rgb),0.08);
  --cyan-med:      rgba(var(--cyan-rgb),0.22);
  --gold-dim:      rgba(var(--gold-rgb),0.08);
  --gold-med:      rgba(var(--gold-rgb),0.22);
  --red-dim:       rgba(var(--red-rgb),0.12);
  --orange-dim:    rgba(var(--orange-rgb),0.08);
  --orange-med:    rgba(var(--orange-rgb),0.22);
  --border:        rgba(var(--cyan-rgb),0.18);
  --border-hi:     rgba(var(--cyan-rgb),0.45);
  --border-gold:   rgba(var(--gold-rgb),0.35);
  --border-orange: rgba(var(--orange-rgb),0.35);
}

/* ═══════════════════════════════════════════════════════════════
   THEMES — raw color overrides only; composed shades above adapt
   automatically since they're all expressed in terms of *-rgb.
═══════════════════════════════════════════════════════════════ */

/* Amber CRT terminal — monochrome glow, single hot hue family */
[data-theme="terrain_amber"] {
  --cyan:        #ff9d1a;
  --cyan-rgb:    255,157,26;
  --gold:        #ffcf40;
  --gold-rgb:    255,207,64;
  --gold-bright: #ffe27a;
  --red:         #ff2a2a;
  --red-rgb:     255,42,42;
  --red-bright:  #ff7a6b;
  --green:       #b6ff4d;
  --green-rgb:   182,255,77;
  --orange:        #ff3b1a;
  --orange-rgb:    255,59,26;
  --orange-bright: #ff7a4d;
  --bg:        #0a0603;
  --bg-rgb:    10,6,3;
  --surface:   #120b04;
  --surface-rgb: 18,11,4;
  --surface2:  #1a1006;
  --text:      #c99a5a;
  --bright:    #ffe4b0;
  --muted:     #8a6a3a;
  --icon-hue: 5deg;
  --auth-hue: 60deg;
}

/* Dusty blue & cream retro-futurism — Cyber Drive / DeLorean */
[data-theme="synth_drive"] {
  --cyan:        #7ec8e8;
  --cyan-rgb:    126,200,232;
  --gold:        #f2d98a;
  --gold-rgb:    242,217,138;
  --gold-bright: #ffe9ad;
  --red:         #ff5566;
  --red-rgb:     255,85,102;
  --red-bright:  #ff96a3;
  --green:       #7de8b0;
  --green-rgb:   125,232,176;
  --orange:        #e8946a;
  --orange-rgb:    232,148,106;
  --orange-bright: #f2b48c;
  --bg:        #05070c;
  --surface:   #0b0f18;
  --surface-rgb: 11,15,24;
  --surface2:  #121826;
  --bg-rgb:    5,7,12;
  --text:      #9fb3c8;
  --bright:    #eef2ea;
  --muted:     #56698a;
  --icon-hue: 195deg;
  --auth-hue: 235deg;
}

/* Blood red on black — pixel horror */
[data-theme="blood_pixel"] {
  --cyan:        #ff2036;
  --cyan-rgb:    255,32,54;
  --gold:        #ff6a3d;
  --gold-rgb:    255,106,61;
  --gold-bright: #ff8f66;
  --red:         #ff0022;
  --red-rgb:     255,0,34;
  --red-bright:  #ff5c72;
  --green:       #39ff6a;
  --green-rgb:   57,255,106;
  --orange:        #c91f37;
  --orange-rgb:    201,31,55;
  --orange-bright: #ff5c72;
  --bg:        #050303;
  --bg-rgb:    5,3,3;
  --surface:   #0c0505;
  --surface-rgb: 12,5,5;
  --surface2:  #150808;
  --text:      #c98a8a;
  --bright:    #ffd9d9;
  --muted:     #6a3a3a;
  --icon-hue: 340deg;
  --auth-hue: 15deg;
}

/* Lavender schematic — Micrographics technical-diagram look */
[data-theme="mono_violet"] {
  --cyan:        #b9a6ff;
  --cyan-rgb:    185,166,255;
  --gold:        #e0d4ff;
  --gold-rgb:    224,212,255;
  --gold-bright: #f0e8ff;
  --red:         #ff6b8b;
  --red-rgb:     255,107,139;
  --red-bright:  #ff9db3;
  --green:       #7fe0c4;
  --green-rgb:   127,224,196;
  --orange:        #8f7fd6;
  --orange-rgb:    143,127,214;
  --orange-bright: #ad9fe0;
  --bg:        #08080d;
  --bg-rgb:    8,8,13;
  --surface:   #0e0e16;
  --surface-rgb: 14,14,22;
  --surface2:  #161622;
  --text:      #8f8ab0;
  --bright:    #ece8ff;
  --muted:     #55516f;
  --icon-hue: 245deg;
  --auth-hue: 285deg;
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes flicker {
  0%,89%,91%,93%,100% { opacity: 1; }
  90%,92%              { opacity: 0.88; }
}
@keyframes glow-pulse {
  0%,100% { box-shadow: 0 0 4px rgba(var(--cyan-rgb),0.25); }
  50%     { box-shadow: 0 0 12px rgba(var(--cyan-rgb),0.55), 0 0 24px rgba(var(--cyan-rgb),0.15); }
}
@keyframes blink-cursor {
  0%,49% { opacity: 1; } 50%,100% { opacity: 0; }
}

*, *::before, *::after { box-sizing: border-box; }

/* ── Scanlines overlay ──────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.10) 3px, rgba(0,0,0,0.10) 4px
  );
}

body {
  background: var(--bg);
  background-image:
    linear-gradient(rgba(var(--cyan-rgb),0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--cyan-rgb),0.022) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  animation: flicker 10s infinite;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  /* The off-canvas mobile nav sits at translateX(105%) when closed — some
     browsers still count a translated fixed element's post-transform box
     toward the document's scrollable width, which would otherwise expose
     a phantom horizontal scrollbar. */
  overflow-x: hidden;
}

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  /* position:sticky creates its own stacking context, so #navbarNav's
     z-index:2000 (it's a descendant) only ever gets compared against the
     mobile-nav-backdrop *within* this value — must clear the backdrop's
     1999 or the whole nav panel silently paints underneath it. */
  z-index: 2100;
  background: rgba(var(--surface-rgb),0.9) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-hi) !important;
  box-shadow: 0 1px 0 var(--border), 0 0 20px rgba(var(--cyan-rgb),0.06);
  padding-top: 8px;
  padding-bottom: 8px;
}
.navbar::before {
  content: '';
  position: absolute;
  bottom: -3px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--cyan) 30%, var(--gold) 70%, transparent 100%);
  background-size: 200% 100%;
  opacity: 0.3;
  pointer-events: none;
  animation: navbar-gradient-shift 8s ease-in-out infinite;
}
@keyframes navbar-gradient-shift {
  0%, 100% { background-position: 0% 0%; }
  50%      { background-position: 100% 0%; }
}
.navbar-brand {
  font-family: 'VT323', monospace !important;
  font-size: 24px !important;
  letter-spacing: 4px !important;
  color: var(--cyan) !important;
  text-shadow: 0 0 10px var(--cyan), 0 0 22px rgba(var(--cyan-rgb),0.35);
  text-decoration: none;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
}
.navbar-logo-img {
  /* Transparent PNG now, not an opaque square — drop-shadow (hugs the
     actual pixels) instead of box-shadow (would glow the whole invisible
     bounding box), no border-radius (nothing to clip). */
  width: 36px; height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(var(--cyan-rgb),0.4));
}
.nav-link {
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 11px !important;
  letter-spacing: 1.5px !important;
  color: var(--text) !important;
  text-transform: uppercase !important;
  padding: 4px 10px !important;
  border: 1px solid transparent !important;
  transition: all 0.15s !important;
  border-radius: 0 !important;
}
.nav-link:hover, .nav-link.active {
  color: var(--gold) !important;
  border-color: rgba(var(--gold-rgb),0.35) !important;
  background: var(--gold-dim) !important;
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.4) !important;
}
.dropdown-menu {
  background: var(--surface2) !important;
  border: 1px solid var(--border-hi) !important;
  border-radius: 0 !important;
}
.dropdown-item {
  color: var(--text) !important;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
}
.dropdown-item:hover { background: var(--cyan-dim) !important; color: var(--cyan) !important; }
.dropdown-item.text-danger { color: var(--red) !important; }

/* Hamburger */
.navbar-toggler {
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 3px 8px !important;
  color: var(--cyan) !important;
}
.navbar-toggler-icon {
  /* mask (not background-image) so the bars pick up var(--cyan) per theme */
  background-color: var(--cyan) !important;
  background-image: none !important;
  -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23000' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23000' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") center / 100% 100% no-repeat;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  background: var(--surface2) !important;
  border-radius: 0 !important;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.5px;
  border: 1px solid var(--border) !important;
  border-left-width: 3px !important;
}
.alert-success { border-left-color: var(--green) !important; color: var(--green) !important; }
.alert-danger  { border-left-color: var(--red) !important;   color: var(--red-bright) !important; }
.alert-warning { border-left-color: var(--gold) !important;  color: var(--gold) !important; }
.alert-info    { border-left-color: var(--cyan) !important;  color: var(--cyan) !important; }
.btn-close { filter: invert(1) sepia(1) saturate(0) brightness(1.8); }

/* ── Form controls ───────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  color: var(--bright) !important;
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 13px !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* iOS Safari zooms the page in if a focused input's font-size is under 16px —
   disruptive mid-workout. Bump it on small screens only. */
@media (max-width: 767px) {
  .form-control, .form-select { font-size: 16px !important; }
  .form-control.form-control-sm { font-size: 15px !important; }
}
.form-control:focus, .form-select:focus {
  border-color: var(--cyan) !important;
  box-shadow: 0 0 0 2px rgba(var(--cyan-rgb),0.08), 0 0 10px rgba(var(--cyan-rgb),0.12) !important;
  outline: none !important;
}
.form-control::placeholder { color: var(--muted) !important; font-size: 12px !important; }

/* Password field — show/hide toggle, wired in motion.js */
.password-field { position: relative; }
.password-field .form-control { padding-right: 40px !important; }
.password-toggle-btn {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.password-toggle-btn:hover { color: var(--cyan); }
.form-check-input {
  background-color: var(--surface2) !important;
  border-color: var(--border) !important;
  border-radius: 0 !important;
}
.form-check-input:checked {
  background-color: var(--cyan) !important;
  border-color: var(--cyan) !important;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  border-radius: 0 !important;
  font-family: 'Share Tech Mono', monospace !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  font-size: 11px !important;
  transition: all 0.15s !important;
}
.btn-warning {
  background: var(--gold) !important;
  border: 1px solid var(--gold) !important;
  color: #000 !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(var(--gold-rgb),0.18);
}
.btn-warning:hover, .btn-warning:focus {
  background: var(--gold-bright) !important;
  box-shadow: 0 0 18px rgba(var(--gold-rgb),0.4) !important;
}
.btn-warning:disabled { opacity: 0.3 !important; box-shadow: none !important; }
.btn-success {
  background: rgba(var(--green-rgb),0.12) !important;
  border: 1px solid rgba(var(--green-rgb),0.4) !important;
  color: var(--green) !important;
}
.btn-success:hover { background: rgba(var(--green-rgb),0.22) !important; box-shadow: 0 0 12px rgba(var(--green-rgb),0.2) !important; }
.btn-outline-danger {
  border: 1px solid rgba(var(--red-rgb),0.4) !important;
  color: var(--red-bright) !important;
  background: transparent !important;
}
.btn-outline-danger:hover { background: rgba(var(--red-rgb),0.12) !important; border-color: var(--red) !important; }
.btn-outline-cyan {
  border: 1px solid var(--border-hi) !important;
  color: var(--cyan) !important;
  background: transparent !important;
}
.btn-outline-cyan:hover {
  background: var(--cyan-dim) !important;
  border-color: var(--cyan) !important;
  box-shadow: 0 0 12px rgba(var(--cyan-rgb),0.25) !important;
}
.btn-outline-neutral {
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  background: transparent !important;
}
.btn-outline-neutral:hover {
  color: var(--cyan) !important;
  border-color: var(--cyan) !important;
  box-shadow: 0 0 10px rgba(var(--cyan-rgb),0.2) !important;
}
.btn-sm { font-size: 9px !important; padding: 3px 10px !important; }
@media (max-width: 767px) {
  .btn-sm { padding: 7px 12px !important; font-size: 10px !important; }
  .btn { min-height: 44px; }
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge { border-radius: 0 !important; font-family: 'Share Tech Mono', monospace; letter-spacing: 1px; font-size: 9px; }
.badge.bg-warning { color: #000 !important; }

/* ── Cards / Tables ──────────────────────────────────────────── */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
}
.table-dark {
  --bs-table-bg: var(--surface);
  --bs-table-hover-bg: var(--surface2);
  --bs-table-border-color: var(--border);
  font-family: 'Share Tech Mono', monospace;
}
.table-secondary {
  --bs-table-bg: var(--surface2);
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table-warning { --bs-table-bg: rgba(var(--gold-rgb),0.05) !important; }
.list-group-item-dark {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  border-radius: 0 !important;
}
.list-group-item-dark:hover { background: var(--surface); color: var(--gold); cursor: pointer; }

/* Exercise-name autocomplete — unbounded height let this cover the whole
   set-entry panel below it on short mobile viewports, silently swallowing
   taps meant for the weight/reps steppers and "+ Set" button underneath. */
#autocompleteDropdown {
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════════════════════════════
   STATUS PANEL
═══════════════════════════════════════════════════════════════ */
.status-panel {
  border: 1px solid var(--border-hi);
  background: var(--surface);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(var(--cyan-rgb),0.04);
}
/* Top-right corner cut */
.status-panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 5;
}

.status-inner {
  display: flex;
  flex-direction: column;
}

.status-stats {
  flex: 1; min-width: 0;
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  order: 1;
}

.status-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 5px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(var(--cyan-rgb),0.5);
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.status-label::before { content: '[ '; }
.status-label::after  { content: ' ]'; }

/* XP / Level */
.stat-title {
  font-family: 'VT323', monospace;
  font-size: 34px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(var(--gold-rgb),0.5);
  letter-spacing: 2px;
}
.stat-sub { font-size: 9px; color: var(--muted); letter-spacing: 1px; }

/* Segmented XP bar */
.xp-bar {
  height: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 5px;
}
.xp-fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--gold) 0px, var(--gold) 5px,
    rgba(var(--gold-rgb),0.15) 5px, rgba(var(--gold-rgb),0.15) 7px
  );
  box-shadow: 0 0 8px rgba(var(--gold-rgb),0.35);
  transition: width 0.35s ease;
}
.xp-sources {
  display: flex; gap: 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 0.5px;
}

/* Rank title chip — level-based honorific, next to "LV" */
.rank-title-chip {
  display: inline-block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border-gold);
  background: var(--gold-dim);
  padding: 2px 7px;
  margin-left: 6px;
  vertical-align: middle;
}
.rank-title-chip-owner {
  color: var(--red-bright);
  border-color: var(--red);
  background: var(--red-dim);
  text-shadow: 0 0 6px rgba(var(--red-rgb),0.6);
}

/* League title badges — one per LeagueSeasonWin */
.league-title-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
}
.league-title-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--gold);
  border: 1px solid var(--border-gold);
  background: var(--gold-dim);
  padding: 3px 8px;
  cursor: default;
}

/* Muscle grid — 2 columns */
.muscle-grid {
  display: grid;
  /* minmax(0, 1fr), not bare 1fr — a bare 1fr track's implicit minimum is
     "auto" (its content's natural width), so a tile that can't shrink
     enough pushes the whole grid wider than its container instead of
     actually shrinking. minmax(0, 1fr) lets the track go below content
     size, so overflow:hidden/ellipsis on the tile's own contents (see
     .muscle-name) does the truncating instead of the grid blowing out. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
/* Two columns don't leave enough room for the full muscle name on one line
   until the tile itself is fairly wide — full-width single column up to
   ~576px (covers virtually every phone in portrait, not just the very
   narrowest ones) gives names the space to stay on one line instead of
   wrapping or truncating. */
@media (max-width: 575.98px) {
  .muscle-grid { grid-template-columns: 1fr; }
}

.muscle-stat {
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--muted);
  padding: 7px 9px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.muscle-stat:hover { border-color: var(--border-hi); box-shadow: 0 0 8px rgba(var(--cyan-rgb),0.08); }

.cardio-stat-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 9px;
  background: var(--surface2);
  border: 1px solid var(--orange);
  box-shadow: 0 0 8px rgba(var(--orange-rgb),0.1);
}

.muscle-stat-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.muscle-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  image-rendering: pixelated;
  object-fit: contain;
  filter: hue-rotate(var(--icon-hue)) brightness(1.3) saturate(0.9);
}
.muscle-icon.icon-zero { opacity: 0.12; filter: grayscale(1); }

.muscle-info {
  flex: 1; min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.muscle-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text);
  text-transform: uppercase;
  /* Single line — the grid's single-column breakpoint (see .muscle-grid,
     575.98px) now gives the tile enough width for the longest translated
     name on one line at virtually every phone size. Ellipsis stays only
     as a last-resort safety net (e.g. extreme browser zoom), not the
     normal case. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-bar {
  height: 4px;
  background: var(--muted);
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--cyan) 0px, var(--cyan) 3px,
    rgba(var(--cyan-rgb),0.1) 3px, rgba(var(--cyan-rgb),0.1) 5px
  );
  box-shadow: 0 0 6px rgba(var(--cyan-rgb),0.3);
  transition: width 0.4s ease;
}
.stat-fill.fill-zero { background: var(--muted); box-shadow: none; }

.muscle-vol {
  flex-shrink: 0;
  font-family: 'VT323', monospace;
  font-size: 18px;
  line-height: 1;
  color: var(--cyan);
  min-width: 2.4em;
  text-align: right;
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.4);
}
.muscle-vol.val-zero { color: var(--muted); text-shadow: none; }

/* ── Character area ──────────────────────────────────────────── */
.character-area {
  order: 0;
  height: 200px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.char-bg {
  position: absolute;
  inset: 0;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}
.char-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, transparent 30%, rgba(var(--bg-rgb),0.55) 100%);
}
.char-sprite {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  height: 100%;
  display: flex;
  /* center, not flex-end — on mobile .char-img is taller than this box
     (see height:120% below) and overflows it; flex-end anchored that
     overflow entirely to the top (cropping the head) while the feet sat
     untouched at the bottom, reading as vertically off-center against
     the background. Centering crops evenly off both ends instead. */
  align-items: center;
  z-index: 2;
}
.char-img {
  /* Mobile only ("on top" stacked layout) — a real height (not 100%) so
     the sprite reads bigger while .character-area's box stays 200px.
     This has to be a layout size, not transform:scale — scale is
     paint-only and doesn't feed back into .char-sprite's shrink-to-fit
     width, so its centering (left:50% + translateX(-50%), sized off the
     unscaled img) drifted off-center. A real height keeps width:auto's
     computed width in sync with what's actually centered. Reset to 100%
     on the md+ side-by-side layout below, which sizes differently. */
  height: 120%; width: auto;
  max-width: none;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.9))
          drop-shadow(0 0 18px rgba(var(--cyan-rgb),0.25));
}
@media (min-width: 768px) {
  .char-img { height: 100%; }
}
.char-stats-overlay {
  position: absolute;
  bottom: 8px; right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 3;
}
.char-stat-chip {
  background: rgba(var(--bg-rgb),0.88);
  border: 1px solid var(--border-hi);
  padding: 2px 8px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.5);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.char-stat-chip-risk {
  color: var(--red-bright);
  border-color: var(--red);
  text-shadow: 0 0 6px rgba(var(--red-rgb),0.6);
  animation: streak-risk-blink 1.4s ease-in-out infinite;
}
@keyframes streak-risk-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

/* ── md: side-by-side ────────────────────────────────────────── */
@media (min-width: 768px) {
  .status-inner { flex-direction: row; min-height: 400px; }
  .status-stats {
    order: 0;
    border-top: none;
    border-right: 1px solid var(--border);
    padding: 18px 20px;
  }
  .character-area { order: 1; flex: 0 0 30%; height: auto; }
  .muscle-icon  { width: 48px; height: 48px; }
  .stat-title   { font-size: 42px; }
  .stat-sub     { font-size: 10px; }
  .xp-bar       { height: 11px; margin-top: 6px; }
  .xp-sources   { font-size: 10px; margin-top: 6px; }
  .status-label { font-size: 10px; margin-bottom: 14px; }
  .char-stat-chip { font-size: 11px; padding: 3px 10px; }
}

@media (min-width: 1024px) {
  .status-inner  { min-height: 460px; }
  .status-stats  { padding: 22px 24px; }
  .character-area { flex: 0 0 28%; }
  .muscle-grid   { gap: 8px; }
  .muscle-icon   { width: 52px; height: 52px; }
  .stat-title    { font-size: 48px; }
  .muscle-name   { font-size: 10px; }
  .muscle-vol    { font-size: 20px; }
  .stat-bar      { height: 5px; }
  .status-label  { font-size: 11px; }
}

/* Profile page's character panel reuses the dashboard's character-area,
   but has no status-stats sibling to sit next to — the dashboard's md+
   rules shrink it to a ~30% column assuming that sibling fills the rest.
   Keep it a full-width banner at every breakpoint instead. */
.profile-character-panel .status-inner  { flex-direction: column; }
.profile-character-panel .character-area { flex: 1 1 auto; height: 200px; }
@media (min-width: 768px) {
  .profile-character-panel .character-area { height: 260px; }
}

/* ═══════════════════════════════════════════════════════════════
   TODAY'S TRAINING CTA
═══════════════════════════════════════════════════════════════ */
.cta-today {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
  padding: 18px 16px;
  background: var(--gold);
  border: 1px solid var(--gold);
  color: #000 !important;
  text-decoration: none;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 0 18px rgba(var(--gold-rgb),0.3);
  transition: all 0.15s;
  min-height: 56px;
}
.cta-today i { font-size: 20px; }
.cta-today:hover, .cta-today:active {
  background: var(--gold-bright);
  color: #000 !important;
  box-shadow: 0 0 26px rgba(var(--gold-rgb),0.5);
}
@media (min-width: 768px) {
  .cta-today { padding: 20px 24px; font-size: 15px; }
}

/* ═══════════════════════════════════════════════════════════════
   IN-PROGRESS BANNER
═══════════════════════════════════════════════════════════════ */
.in-progress-banner {
  background: rgba(var(--gold-rgb),0.04);
  border: 1px solid rgba(var(--gold-rgb),0.4);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
}
.in-progress-banner::before {
  content: '⚠ ACTIVE SESSION';
  position: absolute;
  top: -8px; left: 12px;
  background: var(--bg);
  padding: 0 6px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.5);
}

/* ═══════════════════════════════════════════════════════════════
   WEEKLY CALENDAR
═══════════════════════════════════════════════════════════════ */
.weekly-section {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  overflow: hidden;
  position: relative;
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.week-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--text);
  text-align: center;
  flex: 1;
  padding: 0 6px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.week-range { display: none; }

.today-link {
  font-size: 9px;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid rgba(var(--gold-rgb),0.4);
  padding: 1px 5px;
  margin-left: 6px;
  letter-spacing: 1px;
}
.today-link:hover { background: var(--gold-dim); }

.week-nav-btn {
  color: var(--muted);
  text-decoration: none;
  width: 26px; height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  transition: border-color 0.15s, color 0.15s;
}
.week-nav-btn:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 6px rgba(var(--cyan-rgb),0.2); }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 90px;
}
.day-cell {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.day-cell:last-child { border-right: none; }

.day-header {
  padding: 4px 2px 3px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--surface2);
}

.day-name-long  { display: none; }
.day-name-short {
  font-family: 'Share Tech Mono', monospace;
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.day-num {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--text);
  line-height: 1;
}
.day-num-today {
  background: var(--gold);
  color: #000;
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: 'VT323', monospace;
  box-shadow: 0 0 8px rgba(var(--gold-rgb),0.5);
}
.day-today { background: rgba(var(--gold-rgb),0.025); }
.day-today .day-header { border-bottom-color: rgba(var(--gold-rgb),0.3); background: rgba(var(--gold-rgb),0.05); }
.day-missed .day-num        { color: var(--muted); }
.day-missed .day-name-short { opacity: 0.3; }

.day-body { flex: 1; padding: 2px; display: flex; flex-direction: column; gap: 2px; min-height: 50px; }

.day-workout-card {
  display: flex;
  flex-direction: column;
  background: rgba(var(--cyan-rgb),0.05);
  border: 1px solid rgba(var(--cyan-rgb),0.25);
  padding: 2px 3px;
  text-decoration: none;
  min-width: 0;
  transition: all 0.15s;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.day-workout-card:hover {
  background: rgba(var(--cyan-rgb),0.1);
  border-color: var(--cyan);
  box-shadow: 0 0 6px rgba(var(--cyan-rgb),0.15);
}
.day-workout-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 7px;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-workout-vol { display: none; }

.day-add-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 20px;
  color: var(--muted);
  border: 1px dashed var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
}
.day-add-btn-visible { display: flex; }
.day-cell:hover .day-add-btn { display: flex; }
.day-add-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-dim);
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.5);
}

.week-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Calendar breakpoints */
@media (min-width: 480px) {
  .week-range     { display: inline; }
  .week-title     { font-size: 11px; }
  .day-name-short { display: none; }
  .day-name-long  {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: 8px;
    letter-spacing: 0.5px;
    color: var(--muted);
  }
  .day-num        { font-size: 18px; }
  .day-num-today  { width: 22px; height: 22px; font-size: 16px; }
  .day-workout-name { font-size: 9px; }
  .day-body       { padding: 3px; min-height: 70px; }
}
@media (min-width: 768px) {
  .week-header    { padding: 10px 16px; }
  .week-title     { font-size: 12px; letter-spacing: 2px; }
  .week-grid      { min-height: 120px; }
  .day-num        { font-size: 20px; }
  .day-num-today  { width: 26px; height: 26px; font-size: 18px; }
  .day-workout-name { font-size: 10px; }
  .day-workout-vol  {
    display: block;
    font-size: 9px;
    color: var(--muted);
    font-family: 'Share Tech Mono', monospace;
  }
  .day-body       { padding: 4px; min-height: 90px; gap: 3px; }
  .week-footer    { padding: 10px 18px; }
  .week-nav-btn   { width: 30px; height: 30px; }
  .day-name-long  { font-size: 9px; letter-spacing: 1px; }
}
@media (min-width: 1024px) {
  .day-name-long  { font-size: 10px; }
  .day-num        { font-size: 22px; }
  .day-body       { padding: 5px; min-height: 110px; gap: 4px; }
  .day-workout-name { font-size: 11px; }
  .day-workout-vol  { font-size: 10px; }
  .week-title     { font-size: 13px; }
}

/* Progress chart 2-col */
@media (min-width: 768px) { .chart-grid { grid-template-columns: 1fr 1fr !important; } }

/* ═══════════════════════════════════════════════════════════════
   SHARED PAGE COMPONENTS
═══════════════════════════════════════════════════════════════ */

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1, .page-header h2 {
  margin: 0;
  font-family: 'VT323', monospace;
  font-size: 28px;
  font-weight: 400;
  color: var(--bright);
  letter-spacing: 2px;
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(var(--cyan-rgb),0.25);
}
.page-header .page-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2.5px;
  margin-top: 2px;
  text-transform: uppercase;
}
@media (min-width: 768px) {
  .page-header h1, .page-header h2 { font-size: 36px; }
}

/* Back button */
.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}
.btn-back:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 8px rgba(var(--cyan-rgb),0.2);
}

/* GG Panel — HUD box with corner cut */
.gg-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}
.gg-panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 18px 18px 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 5;
}

.gg-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}
.gg-panel-header::before {
  content: '▶';
  font-size: 8px;
  color: var(--cyan);
  opacity: 0.8;
  flex-shrink: 0;
}
.gg-panel-header i { color: var(--gold); }
.gg-panel-body { padding: 14px; }

/* Section label */
.gg-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Form label */
.gg-form-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

/* Stat pill */
.gg-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--text);
}
.gg-stat i { color: var(--cyan); }
.gg-stat strong { color: var(--gold); font-family: 'VT323', monospace; font-size: 16px; }

/* Exercise card */
.ex-card {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 10px;
}
.ex-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ex-name {
  font-family: 'VT323', monospace;
  font-size: 22px;
  line-height: 1;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(var(--gold-rgb),0.35);
  transition: color 0.15s, text-shadow 0.15s;
}
.ex-name:hover { color: var(--cyan); text-shadow: 0 0 8px rgba(var(--cyan-rgb),0.4); }
.ex-muscle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  text-transform: uppercase;
}
.ex-vol {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--cyan);
  text-shadow: 0 0 4px rgba(var(--cyan-rgb),0.3);
}

/* Autosave status — replaces the old per-card SAVE button */
.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  white-space: nowrap;
  color: var(--muted);
  transition: color 0.15s;
}
.autosave-status[data-state="saved"]   { color: var(--green); }
.autosave-status[data-state="saving"]  { color: var(--gold); }
.autosave-status[data-state="pending"] { color: var(--muted); }
.autosave-status[data-state="error"]   { color: var(--red-bright); }
.autosave-status[data-state="saving"] i { animation: spin 0.6s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.ex-notes {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* Set table */
.set-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: 'Share Tech Mono', monospace;
}
.set-table th {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
  padding: 6px 8px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.set-table td {
  text-align: center;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.set-table tr:last-child td { border-bottom: none; }
.set-table tr.set-best { background: rgba(var(--gold-rgb),0.04); }
.set-table td.set-num { color: var(--muted); font-size: 11px; }
.set-table td.set-weight {
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.3);
}
.set-table td.set-vol { color: var(--cyan); font-size: 11px; }

.rir-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-family: 'Share Tech Mono', monospace;
}
.rir-0   { background: rgba(var(--red-rgb),0.18);  color: var(--red-bright); border: 1px solid rgba(var(--red-rgb),0.4); }
.rir-low { background: rgba(var(--gold-rgb),0.12);  color: var(--gold); border: 1px solid rgba(var(--gold-rgb),0.4); }
.rir-ok  { background: rgba(var(--green-rgb),0.08);  color: var(--green);  border: 1px solid rgba(var(--green-rgb),0.3); }

/* Add exercise panel */
.add-ex-panel {
  background: var(--surface);
  border: 1px solid rgba(var(--cyan-rgb),0.3);
  overflow: hidden;
  margin-bottom: 14px;
  position: relative;
}
.add-ex-panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 14px 14px 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 5;
}
.add-ex-panel-header {
  padding: 9px 14px;
  background: rgba(var(--cyan-rgb),0.05);
  border-bottom: 1px solid rgba(var(--cyan-rgb),0.2);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.4);
  text-transform: uppercase;
}
.add-ex-panel-body { padding: 14px; }

/* Cardio panel — deliberately distinct (orange) from strength exercises (cyan) */
.cardio-panel {
  background: var(--surface);
  border: 1px solid var(--border-orange);
  overflow: hidden;
  margin-bottom: 14px;
  position: relative;
}
.cardio-panel::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 14px 14px 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 5;
}
.cardio-panel-header {
  padding: 9px 14px;
  background: var(--orange-dim);
  border-bottom: 1px solid var(--orange-med);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--orange);
  text-shadow: 0 0 6px rgba(var(--orange-rgb),0.4);
  text-transform: uppercase;
}
.cardio-panel-body { padding: 14px; }

.cardio-log-list { display: flex; flex-direction: column; gap: 6px; }
.cardio-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--orange);
  padding: 7px 10px;
}
.cardio-log-activity {
  flex: 1;
  min-width: 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cardio-log-detail {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--orange);
  flex-shrink: 0;
  white-space: nowrap;
}
.cardio-log-remove {
  background: none;
  border: none;
  color: var(--red-bright);
  cursor: pointer;
  font-size: 13px;
  padding: 2px;
  flex-shrink: 0;
}
.cardio-add-btn {
  background: var(--orange) !important;
  border: 1px solid var(--orange) !important;
  color: #000 !important;
  box-shadow: 0 0 10px rgba(var(--orange-rgb),0.18);
}
.cardio-add-btn:hover { background: var(--orange-bright) !important; box-shadow: 0 0 18px rgba(var(--orange-rgb),0.4) !important; }

/* Save panel */
.save-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
}
.save-panel .divider-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
}

/* ── AUTH PAGES ──────────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  position: relative;
}
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('/static/futuristic_landscape.jpg') center/cover no-repeat;
  image-rendering: pixelated;
  filter: brightness(0.2) hue-rotate(var(--auth-hue)) saturate(0.5);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(var(--surface-rgb),0.96);
  border: 1px solid var(--border-hi);
  padding: 32px 28px;
  backdrop-filter: blur(12px);
  position: relative;
  box-shadow: 0 0 40px rgba(var(--cyan-rgb),0.06), inset 0 0 30px rgba(0,0,0,0.5);
}
/* Top-right corner cut on auth card */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 26px 26px 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 5;
}
/* Bottom-left bracket */
.auth-card::after {
  content: '';
  position: absolute;
  bottom: -1px; left: -1px;
  width: 16px; height: 16px;
  border-left: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  box-shadow: -2px 2px 8px rgba(var(--cyan-rgb),0.3);
}

.auth-logo-img {
  display: block;
  width: 128px; height: 128px;
  margin: 0 auto 8px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(var(--cyan-rgb),0.35));
}
.auth-logo {
  font-family: 'VT323', monospace;
  font-size: 42px;
  line-height: 1;
  color: var(--cyan);
  letter-spacing: 6px;
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 0 0 14px var(--cyan), 0 0 30px rgba(var(--cyan-rgb),0.3);
  animation: flicker 10s infinite;
}
.app-version-tag {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  text-shadow: none;
  vertical-align: middle;
  border: 1px solid var(--border);
  padding: 1px 5px;
  margin-left: 4px;
  text-transform: none;
}
.navbar-brand .app-version-tag { font-size: 10px; }
.auth-logo .app-version-tag { font-size: 11px; letter-spacing: 2px; }
.auth-tagline {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 28px;
}

/* ── TEMPLATE CARDS ──────────────────────────────────────────── */
.template-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.template-card:hover {
  border-color: var(--cyan);
  background: var(--cyan-dim);
  color: var(--cyan);
  box-shadow: 0 0 8px rgba(var(--cyan-rgb),0.1);
}
.template-card.selected {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(var(--gold-rgb),0.15);
}
.template-card .tc-icon { color: var(--gold); margin-right: 6px; font-size: 10px; }

/* ── Misc overrides ──────────────────────────────────────────── */
.text-secondary  { color: var(--muted) !important; }
.text-warning    { color: var(--gold) !important; }
.text-danger     { color: var(--red) !important; }
small.text-secondary { color: var(--muted) !important; font-family: 'Share Tech Mono', monospace; font-size: 10px; }

/* ═══════════════════════════════════════════════════════════════
   SET ROWS — mobile-first live set entry (log_workout.html)
═══════════════════════════════════════════════════════════════ */
.set-rows { display: flex; flex-direction: column; gap: 14px; }

.set-row {
  /* Distinct from the panel it sits in (which is also --surface) — without
     this the card had nothing but a faint 18%-opacity border to read as a
     separate card at all. Lighter fill + shadow reads as "raised"; the
     stepper/RIR controls inside go the other way (recessed, --surface) so
     there's real depth instead of everything sitting at one flat tone. */
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  padding: 12px;
  display: grid;
  /* Mobile default: a compact header row (set number + delete), then
     weight/reps/rir each get the full card width. Cramming weight+reps
     side by side left ~114px per stepper — with two 44px +/- touch targets
     that's only ~24px for the number itself, unreadable. Stacked, each
     stepper gets the full card width instead. @media (min-width:560px)
     below recombines everything into one dense row once there's room. */
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "num    remove"
    "weight weight"
    "reps   reps"
    "rir    rir";
  gap: 10px;
  align-items: center;
}
.set-row-num {
  grid-area: num;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.3);
}
.set-row-num::before { content: 'SET '; color: var(--muted); text-shadow: none; }
.set-row-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.set-row-field label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
}
.set-row-weight { grid-area: weight; }
.set-row-reps   { grid-area: reps; }
.set-row-rir    { grid-area: rir; }

.stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  background: var(--surface);
  height: 40px;
}
.stepper-btn {
  width: 36px;
  flex-shrink: 0;
  background: var(--surface);
  border: none;
  color: var(--cyan);
  font-size: 20px;
  line-height: 1;
  font-family: 'Share Tech Mono', monospace;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.stepper-btn:active { background: var(--cyan-dim); }
.stepper-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  text-align: center;
  /* Explicit, not transparent — mobile Safari/Chrome can render a native
     (light) background on number inputs that ignores `transparent` and
     inheriting the parent's dark background, making the light --bright
     text invisible. Matches .stepper's own background either way. */
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--bright);
  font-family: 'VT323', monospace;
  font-size: 20px;
  padding: 0 2px;
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input { -moz-appearance: textfield; }
.stepper-input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cyan); }

.rir-chips { display: flex; gap: 4px; }
.rir-chip {
  flex: 1;
  min-height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.rir-chip.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.3);
}

/* REPS/SEC unit toggle — same look as the RIR chips, just two options */
.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
}
.unit-toggle-btn {
  min-height: 30px;
  padding: 4px 10px;
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.unit-toggle-btn:last-child { border-right: none; }
.unit-toggle-btn.active {
  background: var(--gold-dim);
  color: var(--gold);
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.3);
}

.set-row-remove-btn {
  grid-area: remove;
  background: none;
  border: 1px solid rgba(var(--red-rgb),0.4);
  color: var(--red-bright);
  width: 36px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.set-row-remove-btn:active { background: rgba(var(--red-rgb),0.12); }

/* These get tapped constantly mid-set with sweaty/gloved hands — worth the
   extra height even though it nudges past the row's compact desktop sizing. */
@media (max-width: 767px) {
  .stepper, .set-row-remove-btn { height: 44px; }
  .stepper-btn { width: 44px; }
  .set-row-remove-btn { width: 44px; }
  .rir-chip { min-height: 44px; }
}

@media (min-width: 560px) {
  .set-row {
    grid-template-columns: 26px 1fr 1fr 2fr 36px;
    grid-template-areas: "num weight reps rir remove";
  }
  /* Enough room for weight/reps/rir side by side now — back to a compact
     bare number instead of the mobile header's "SET " label. */
  .set-row-num {
    font-size: 20px;
    font-family: 'VT323', monospace;
    letter-spacing: normal;
    color: var(--muted);
    text-align: center;
    text-shadow: none;
  }
  .set-row-num::before { content: ''; }
}

/* ═══════════════════════════════════════════════════════════════
   WORKOUT PREVIEW POPOVER — hover (desktop) / long-press (mobile)
═══════════════════════════════════════════════════════════════ */
.workout-preview-popover {
  position: absolute;
  z-index: 2000;
  width: 240px;
  max-width: calc(100vw - 16px);
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  box-shadow: 0 8px 28px rgba(0,0,0,0.55), 0 0 20px rgba(var(--cyan-rgb),0.1);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.workout-preview-popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.wp-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.wp-title {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--gold);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.3);
}
.wp-date {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.wp-summary {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--cyan);
  letter-spacing: 0.5px;
}
.wp-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.wp-ex-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 10px;
}
.wp-ex-row:not(:last-child) { border-bottom: 1px solid rgba(var(--cyan-rgb),0.08); }
.wp-ex-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--bright);
}
.wp-ex-detail {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
}
.wp-empty, .wp-loading {
  padding: 12px 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   ARENA
═══════════════════════════════════════════════════════════════ */
.arena-stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .arena-stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .arena-stat-grid { grid-template-columns: repeat(3, 1fr); }
}
.arena-stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 8px 10px;
  transition: border-color 0.15s;
}
.arena-stat.stat-tooltip:hover,
.arena-stat.stat-tooltip:focus {
  border-color: var(--border-hi);
  outline: none;
}
.arena-stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-family: 'Share Tech Mono', monospace;
}
.arena-stat-label {
  flex: 1;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text);
  text-transform: uppercase;
}
.arena-stat-val {
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1;
  color: var(--bright);
}

/* ── Stat tooltip — CSS-only, hover/focus reveal. Works on any element
   carrying data-tooltip; tabindex makes it reachable by keyboard/tap. ── */
.stat-tooltip { position: relative; cursor: help; }
.stat-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: max-content;
  max-width: min(240px, 80vw);
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  color: var(--bright);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  text-transform: none;
  padding: 8px 10px;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 60;
}
.stat-tooltip:hover::after,
.stat-tooltip:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

.regen-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--orange);
  text-shadow: 0 0 8px rgba(var(--orange-rgb),0.4);
}
@media (min-width: 768px)  { .regen-icon { width: 48px; height: 48px; font-size: 24px; } }
@media (min-width: 1024px) { .regen-icon { width: 52px; height: 52px; font-size: 26px; } }

.arena-opponent-block { padding: 10px 14px; }
.arena-opponent-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.arena-opponent-border { border-bottom: 1px solid var(--border); }

.arena-win-meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.arena-win-meter-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--muted);
  flex-shrink: 0;
}
.arena-win-meter-pct {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}
.arena-opp-name {
  flex: 1;
  min-width: 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arena-opp-record {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  flex-shrink: 0;
}
.arena-opp-rating {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--cyan);
  min-width: 34px;
  text-align: right;
  flex-shrink: 0;
}

.arena-history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
}
.arena-hist-result {
  width: 44px;
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 1px;
}
.arena-hist-vs {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arena-hist-change {
  flex-shrink: 0;
  font-weight: 700;
}
.arena-win  { color: var(--green); }
.arena-loss { color: var(--red-bright); }

.battle-log-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  animation: log-row-in 0.2s ease;
}
.battle-log-row:not(:last-child) { border-bottom: 1px solid var(--border); }
@keyframes log-row-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.battle-log-round {
  width: 26px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 9px;
}
.battle-log-actor {
  flex-shrink: 0;
  font-weight: 700;
}
.battle-log-dmg { color: var(--text); }

/* ── Battle stage (animated replay) ──────────────────────────── */
.battle-stage {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.fighter-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.fighter-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fighter-sprite-wrap {
  height: 96px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fighter-sprite {
  height: 96px;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}
.fighter-bars {
  width: 100%;
  max-width: 140px;
}
.battle-vs {
  flex-shrink: 0;
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(var(--gold-rgb),0.4);
  padding-bottom: 34px;
}
.replay-caption {
  margin-top: 12px;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}

/* ── League cards ─────────────────────────────────────────────── */
.league-card { padding: 12px 14px; }
.league-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.league-card-name {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--bright);
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.15s;
}
.league-card-name:hover { color: var(--cyan); text-shadow: 0 0 8px rgba(var(--cyan-rgb),0.4); }
.league-owner-badge {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--gold);
  border: 1px solid rgba(var(--gold-rgb),0.4);
  padding: 1px 6px;
}
.league-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}
.league-card-code strong { color: var(--cyan); letter-spacing: 1px; }
.league-card-rating {
  margin-left: auto;
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--cyan);
}
.league-card-actions { display: flex; gap: 8px; }

/* ═══════════════════════════════════════════════════════════════
   THEME PICKER — each .theme-card carries its own [data-theme], so
   it previews in that theme's real colors regardless of the page's
   active theme (custom properties cascade from the attribute match).
═══════════════════════════════════════════════════════════════ */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .theme-grid { grid-template-columns: 1fr 1fr; }
}
.theme-card {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-card:hover { border-color: var(--cyan); box-shadow: 0 0 10px rgba(var(--cyan-rgb),0.18); }
.theme-card.selected { border-color: var(--gold); box-shadow: 0 0 12px rgba(var(--gold-rgb),0.25); }
.theme-card-check {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  color: var(--gold);
  font-size: 14px;
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.5);
}
.theme-card-logo {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  width: 32px; height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
}
.theme-card-strip { display: flex; height: 24px; }
.theme-card-strip span { flex: 1; }
.theme-card-strip .ts-cyan   { background: var(--cyan); }
.theme-card-strip .ts-gold   { background: var(--gold); }
.theme-card-strip .ts-orange { background: var(--orange); }
.theme-card-strip .ts-red    { background: var(--red); }
.theme-card-body {
  display: block;
  padding: 10px 12px;
  background: var(--bg);
}
.theme-card-name {
  display: block;
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1;
  color: var(--bright);
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.3);
  letter-spacing: 1px;
}
.theme-card-desc {
  display: block;
  margin-top: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════
   LEAGUE ROOM — member list + chat
═══════════════════════════════════════════════════════════════ */
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-family: 'Share Tech Mono', monospace;
}
.member-name { font-size: 12px; color: var(--text); }

.chat-log {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
}
.chat-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
}
.chat-time { flex-shrink: 0; width: 36px; color: var(--muted); font-size: 9px; }
.chat-user { flex-shrink: 0; color: var(--cyan); font-weight: 700; }
.chat-user.me { color: var(--gold); }
.chat-body { flex: 1; min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.chat-empty {
  padding: 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--muted);
}
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.chat-form .form-control { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   ACHIEVEMENTS
═══════════════════════════════════════════════════════════════ */
.tier-bronze   { --tier: var(--orange); --tier-rgb: var(--orange-rgb); }
.tier-silver   { --tier: var(--bright); --tier-rgb: var(--cyan-rgb); }
.tier-gold     { --tier: var(--gold);   --tier-rgb: var(--gold-rgb); }
.tier-platinum { --tier: var(--cyan);   --tier-rgb: var(--cyan-rgb); }

.achievement-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) { .achievement-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .achievement-grid { grid-template-columns: 1fr 1fr 1fr; } }

.achievement-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.achievement-card.unlocked {
  border-color: rgba(var(--tier-rgb),0.5);
  box-shadow: 0 0 10px rgba(var(--tier-rgb),0.1);
}
.achievement-card.locked { opacity: 0.45; }
.achievement-card-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.achievement-card.unlocked .achievement-card-icon {
  color: var(--tier);
  border-color: rgba(var(--tier-rgb),0.5);
  text-shadow: 0 0 8px rgba(var(--tier-rgb),0.5);
}
.achievement-card.locked .achievement-card-icon { color: var(--muted); }
.achievement-card-body { min-width: 0; flex: 1; }
.achievement-card-name {
  font-family: 'VT323', monospace;
  font-size: 18px;
  line-height: 1;
  color: var(--bright);
}
.achievement-card.locked .achievement-card-name { color: var(--muted); }
.achievement-card-desc {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}
.achievement-card-date {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--tier);
  margin-top: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Celebration toast — stacks top-right, auto-dismisses ── */
.achievement-toast-stack {
  position: fixed;
  top: 70px;
  right: 14px;
  left: 14px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
@media (min-width: 480px) { .achievement-toast-stack { left: auto; width: 320px; } }

.achievement-toast {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--tier);
  box-shadow: 0 8px 28px rgba(0,0,0,0.55), 0 0 24px rgba(var(--tier-rgb),0.25);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(24px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.achievement-toast.show { opacity: 1; transform: translateX(0) scale(1); }
.achievement-toast.hide { opacity: 0; transform: translateX(24px) scale(0.96); }
.achievement-toast-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--tier);
  background: var(--bg);
  border: 1px solid var(--tier);
  text-shadow: 0 0 10px rgba(var(--tier-rgb),0.6);
}
.achievement-toast-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--tier);
  text-shadow: 0 0 6px rgba(var(--tier-rgb),0.5);
}
.achievement-toast-name {
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1.2;
  color: var(--bright);
}
.achievement-toast-desc {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── PR banner / chip — view_workout.html ── */
.pr-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(var(--gold-rgb),0.4);
  box-shadow: 0 0 16px rgba(var(--gold-rgb),0.15);
}
.pr-banner i { font-size: 16px; }
.streak-risk-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red-bright);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  text-shadow: 0 0 6px rgba(var(--red-rgb),0.3);
}
.streak-risk-banner i { font-size: 16px; flex-shrink: 0; animation: streak-risk-blink 1.4s ease-in-out infinite; }

.pr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  padding: 2px 7px;
  text-shadow: 0 0 6px rgba(var(--gold-rgb),0.4);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE NAV — slide-in overlay panel with backdrop blur, replaces
   Bootstrap's default height-collapse (driven by motion.js, not the
   Bootstrap Collapse component).
═══════════════════════════════════════════════════════════════ */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.mobile-nav-backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 991.98px) {
  .navbar-collapse {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(300px, 85vw);
    margin: 0;
    background: rgba(var(--surface-rgb),0.98);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-left: 1px solid var(--border-hi);
    box-shadow: -12px 0 40px rgba(0,0,0,0.55);
    padding: 76px 20px 24px;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    transform: translateX(105%);
    transition: transform 0.32s cubic-bezier(.2,.8,.2,1);
    z-index: 2000;
    overflow-y: auto;
  }
  .navbar-collapse.show { transform: translateX(0); }
  .navbar-collapse .navbar-nav { width: 100%; }
  .navbar-collapse .nav-link {
    padding: 12px !important;
    width: 100%;
    font-size: 15px !important;
    letter-spacing: 1px !important;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .navbar-collapse .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin-top: 4px;
  }
  .navbar-collapse .dropdown-item {
    font-size: 14px !important;
    padding: 12px !important;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}
@media (min-width: 992px) { .mobile-nav-backdrop { display: none; } }

/* ═══════════════════════════════════════════════════════════════
   SCROLL REVEAL — fade+slide entrance, staggered per sibling group.
   Applied by motion.js via IntersectionObserver; --reveal-i is set
   per element so siblings cascade instead of popping in together.
═══════════════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  transition-delay: calc(var(--reveal-i, 0) * 35ms);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   INTERACTIVE HOVER — glow intensify + slight lift on anything
   clickable. Static display containers (panels, cards) intentionally
   excluded so hover states don't imply interactivity where none exists.
═══════════════════════════════════════════════════════════════ */
.btn:not(:disabled):hover   { transform: translateY(-1px) scale(1.015); }
.btn:not(:disabled):active  { transform: translateY(0) scale(0.98); }
.ex-name:hover, .league-card-name:hover, .day-workout-card:hover,
.theme-card:hover, .template-card:hover, .week-nav-btn:hover, .btn-back:hover {
  transform: translateY(-1px);
}
.stepper-btn:active, .rir-chip:active { transform: scale(0.92); }
.week-nav-btn, .btn-back, .stepper-btn, .rir-chip, .ex-name, .league-card-name,
.day-workout-card, .theme-card, .template-card {
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
              color 0.15s ease, background 0.15s ease;
}

/* Magnetic nudge target — see motion.js; only active on fine-pointer desktops. */
.magnetic { transition: transform 0.2s ease-out, background 0.15s, box-shadow 0.15s; }

/* ═══════════════════════════════════════════════════════════════
   MICRO-REWARDS — brief success pulse, fired via window.pulseSuccess(el)
═══════════════════════════════════════════════════════════════ */
@keyframes pulse-success-ring {
  0%   { box-shadow: 0 0 0 0 rgba(var(--green-rgb),0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(var(--green-rgb),0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--green-rgb),0); }
}
.pulse-success { animation: pulse-success-ring 0.6s ease-out; }

/* ═══════════════════════════════════════════════════════════════
   TERMINAL LOADING — scanning-bracket indicator instead of a generic
   spinner. Usage: <span class="hud-loading">ANALYZING</span>
═══════════════════════════════════════════════════════════════ */
.hud-loading {
  display: inline-flex;
  align-items: baseline;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.4);
}
.hud-loading::before { content: '[ '; opacity: 0.6; }
/* Animating a fixed 3-dot string's *width* (not its `content`, which
   keyframes can't reliably animate cross-browser) — a simple typewriter
   reveal loop that reads as "scanning" rather than a generic spinner. */
.hud-loading::after {
  content: '... ]';
  display: inline-block;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  opacity: 0.6;
  animation: hud-dots-reveal 1.2s steps(4, end) infinite;
}
@keyframes hud-dots-reveal {
  0%   { width: 0; }
  100% { width: 3em; }
}
.hud-scanbar {
  position: relative;
  height: 2px;
  overflow: hidden;
  background: rgba(var(--cyan-rgb),0.1);
  margin-top: 4px;
}
.hud-scanbar::after {
  content: '';
  position: absolute;
  top: 0; left: -30%;
  width: 30%; height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(var(--cyan-rgb),0.6);
  animation: hud-scan-sweep 1.1s ease-in-out infinite;
}
@keyframes hud-scan-sweep {
  0%   { left: -30%; }
  100% { left: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   SKELETON SHIMMER — themed placeholder while async content loads
═══════════════════════════════════════════════════════════════ */
.skeleton-line, .skeleton-block {
  position: relative;
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.skeleton-line { height: 10px; margin: 4px 0; }
.skeleton-block { height: 40px; }
.skeleton-line::after, .skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(var(--cyan-rgb),0.15), transparent);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep {
  100% { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════════════════════
   GLASS — frosted-panel treatment for a few key floating surfaces
═══════════════════════════════════════════════════════════════ */
.glass {
  background: rgba(var(--surface-rgb),0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS OVERVIEW — muscle-grouped exercise mini-charts
═══════════════════════════════════════════════════════════════ */
.progress-ex-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px)  { .progress-ex-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .progress-ex-grid { grid-template-columns: 1fr 1fr 1fr; } }

.progress-ex-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 10px 12px;
}
.progress-ex-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.progress-ex-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--muted);
  white-space: nowrap;
}
.progress-ex-meta strong { color: var(--gold); }
.progress-chart-canvas { max-height: 100px; }

/* ═══════════════════════════════════════════════════════════════
   FRIENDS
═══════════════════════════════════════════════════════════════ */
.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.friend-row:hover { background: var(--cyan-dim); }
.friend-avatar {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(var(--cyan-rgb),0.4);
}
.friend-info { flex: 1; min-width: 0; }
.friend-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--bright);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.friend-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.friend-meta .risk { color: var(--red-bright); }
.friend-actions { display: flex; gap: 6px; flex-shrink: 0; }

.friend-request-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
}
.friend-request-name {
  flex: 1;
  min-width: 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.friend-workout-row { padding: 10px 14px; }
.friend-workout-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.friend-workout-name {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--bright);
  line-height: 1;
}
.friend-workout-date {
  flex: 1;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}
.friend-workout-exercises { display: flex; flex-wrap: wrap; gap: 6px; }
.friend-workout-ex-chip {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.3px;
  color: var(--cyan);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION — automatic, global. Anything added above still
   respects this; motion.js also checks the same media query before
   running JS-driven animation (counters, reveal, parallax, magnetic).
═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
