/* =====================================================================
   RENSEI V3.6 — DESIGN SYSTEM "FORGED STEEL & EMBER"
   Tactical Industrial Athletic UI + Fullscreen Wall HUD + Mobile Polish
   ===================================================================== */

:root {
  --bg-base: #090B0E;
  --bg-surface: rgba(18, 22, 28, 0.86);
  --bg-surface-solid: #12161C;
  --bg-elevated: rgba(26, 32, 41, 0.92);
  --bg-input: rgba(11, 14, 18, 0.94);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #F4F6F8;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --ember: #FF5A1F;
  --ember-bright: #FF7847;
  --ember-soft: rgba(255, 90, 31, 0.14);
  --ember-border: rgba(255, 90, 31, 0.44);
  --ember-glow: 0 0 24px rgba(255, 90, 31, 0.24);

  --cyan: #00D4FF;
  --cyan-soft: rgba(0, 212, 255, 0.13);
  --cyan-border: rgba(0, 212, 255, 0.38);

  --gold: #F5B041;
  --gold-soft: rgba(245, 176, 65, 0.15);
  --gold-border: rgba(245, 176, 65, 0.48);

  --emerald: #22C55E;
  --emerald-soft: rgba(34, 197, 94, 0.15);
  --emerald-border: rgba(34, 197, 94, 0.38);

  --crimson: #EF4444;
  --crimson-soft: rgba(239, 68, 68, 0.15);

  --font-display: 'Barlow Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --nav-height: 68px;
  --header-height: 62px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* ----- Atmospheric Backdrop ----- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url('./assets/bg-forge.jpg');
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  opacity: 0.34;
  transform: scale(1.02);
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 85% 90%, rgba(255, 90, 31, 0.11), transparent 45%),
    radial-gradient(circle at 12% 10%, rgba(0, 212, 255, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(9, 11, 14, 0.78) 0%, rgba(9, 11, 14, 0.88) 65%, rgba(9, 11, 14, 0.96) 100%);
}

/* ----- Auth Overlay ----- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 8, 11, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(22, 27, 35, 0.97), rgba(14, 17, 22, 0.99));
  border: 1px solid var(--ember-border);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: var(--ember-glow), 0 28px 70px rgba(0, 0, 0, 0.75);
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  border: 1px solid var(--ember-border);
  box-shadow: 0 8px 24px rgba(255, 90, 31, 0.22);
  margin-bottom: 10px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin: 0;
  line-height: 1;
}

.auth-subtitle {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ember-bright);
  margin: 6px 0 0;
}

.auth-identity-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 11px;
  background: rgba(9, 11, 14, 0.7);
  border: 1px solid var(--border-strong);
  margin-bottom: 16px;
}

.pin-input {
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.35em;
}

.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--crimson-soft);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #FECACA;
  font-size: 13px;
  text-align: center;
}

.auth-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.btn-link-muted {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
}

.btn-link-muted:hover { color: var(--text-primary); }

/* ----- Header ----- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(9, 11, 14, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 90, 31, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  color: var(--ember);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.cycle-selector-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 5px 4px 10px;
  max-width: 100%;
  min-width: 0;
}

.cycle-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.cycle-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  max-width: 148px;
  min-width: 60px;
  text-overflow: ellipsis;
}

.cycle-select option {
  background: #12161C;
  color: #F4F6F8;
}

.btn-cycle-add {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--ember-border);
  background: var(--ember-soft);
  color: var(--ember-bright);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-cycle-add:hover {
  background: var(--ember);
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon, .btn-icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
}

.btn-icon { width: 36px; padding: 0; }
.btn-icon-label { padding: 0 11px; }

.btn-icon svg, .btn-icon-label svg {
  width: 17px;
  height: 17px;
}

.btn-icon:hover, .btn-icon-label:hover {
  border-color: var(--ember-border);
  background: var(--ember-soft);
  color: var(--ember-bright);
}

.btn-icon.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

/* ----- Demo Banner ----- */
.demo-banner {
  background: linear-gradient(90deg, rgba(245, 176, 65, 0.16), rgba(255, 90, 31, 0.16));
  border-bottom: 1px solid var(--gold-border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: #FDE68A;
}

.btn-banner {
  background: var(--gold);
  color: #0B0D10;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 11.5px;
  cursor: pointer;
}

/* ----- Main Container ----- */
.main-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--nav-height) + 42px + env(safe-area-inset-bottom));
}

.app-view { display: none; animation: fadeIn 0.2s ease; }
.app-view.active { display: block; }

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

/* ----- Typography Helpers ----- */
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.display-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0;
}

/* ----- Hero Command Card (Forge Home) ----- */
.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(22, 27, 35, 0.92), rgba(14, 17, 22, 0.94));
  border: 1px solid var(--ember-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: var(--ember-glow), 0 18px 40px rgba(0, 0, 0, 0.45);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ember), #FF9650, transparent);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill-ember { background: var(--ember-soft); color: var(--ember-bright); border: 1px solid var(--ember-border); }
.pill-cyan { background: var(--cyan-soft); color: var(--cyan); border: 1px solid var(--cyan-border); }
.pill-gold { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-border); }
.pill-emerald { background: var(--emerald-soft); color: var(--emerald); border: 1px solid var(--emerald-border); }
.pill-muted { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

.hero-sub {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.mini-stat {
  background: rgba(9, 11, 14, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.mini-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mini-stat-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2px;
}

.mini-stat-val.cyan { color: var(--cyan); }
.mini-stat-val.ember { color: var(--ember-bright); }

/* ----- Buttons ----- */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  text-decoration: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--ember), #E0430D);
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 90, 31, 0.30);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(255, 90, 31, 0.44); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary.cyan-btn { background: linear-gradient(135deg, #00B8E6, #0284C7); box-shadow: 0 6px 20px rgba(0, 212, 255, 0.25); }

.btn-secondary { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-primary); }
.btn-secondary:hover { border-color: var(--ember-border); background: rgba(255, 90, 31, 0.1); }
.btn-secondary.active-wake { border-color: var(--emerald-border); background: var(--emerald-soft); color: var(--emerald); }

.btn-ghost { background: transparent; border-color: var(--border-subtle); color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-strong); }

.btn-danger { background: var(--crimson-soft); border-color: rgba(239, 68, 68, 0.35); color: #FCA5A5; padding: 7px 12px; font-size: 12px; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.28); }

/* ----- Session Cards Grid (Forge Home) ----- */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.session-card {
  position: relative;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.session-card:hover { transform: translateY(-2px); border-color: var(--border-strong); background: var(--bg-elevated); }
.session-card.recommended { border-color: var(--ember-border); box-shadow: 0 0 0 1px rgba(255, 90, 31, 0.18), 0 12px 26px rgba(0, 0, 0, 0.32); }
.session-card.cat-run:hover, .session-card.cat-run.recommended-run { border-color: var(--cyan-border); }

.session-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.session-card-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 4px 0 2px;
}

.session-card-preview {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.session-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ----- Active Session View ----- */
.session-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.session-switcher-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip-tab {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-tab:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip-tab.active { background: var(--ember-soft); border-color: var(--ember-border); color: var(--ember-bright); }
.chip-tab.active.is-run { background: var(--cyan-soft); border-color: var(--cyan-border); color: var(--cyan); }

/* Quick Rest Presets */
.quick-timer-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(18, 22, 28, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.quick-timer-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-right: 4px;
}

.timer-preset-btn {
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timer-preset-btn:hover { border-color: var(--ember-border); background: var(--ember-soft); color: var(--ember-bright); }

/* Warm-up Accordion */
.warmup-box {
  background: rgba(18, 22, 28, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
}

.warmup-toggle {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.warmup-toggle:hover { background: rgba(255, 255, 255, 0.03); }

.warmup-list {
  padding: 12px 16px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
}

.warmup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(9, 11, 14, 0.55);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

/* Workout Main Blocks + Set Tracker */
.workout-blocks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.exo-block {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.exo-block.is-superset {
  border-left: 3px solid var(--ember);
  background: linear-gradient(90deg, rgba(255, 90, 31, 0.07), rgba(18, 22, 28, 0.88) 28%);
}

.exo-block.is-run {
  border-left: 3px solid var(--cyan);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.07), rgba(18, 22, 28, 0.88) 28%);
}

.superset-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ember-bright);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.exo-row-wrap {
  transition: opacity 0.18s ease;
}

.exo-row-wrap.exo-all-done {
  opacity: 0.62;
}

.exo-block.is-superset .exo-row-wrap + .exo-row-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}

.exo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.exo-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
}

.exo-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  padding: 0 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.exo-block.is-superset .exo-code { background: var(--ember-soft); border-color: var(--ember-border); color: var(--ember-bright); }
.exo-block.is-run .exo-code { background: var(--cyan-soft); border-color: var(--cyan-border); color: var(--cyan); }

.exo-name {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.exo-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
}

.metric-vol { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); }
.metric-load { background: var(--ember-soft); color: var(--ember-bright); border: 1px solid var(--ember-border); }
.metric-load.run-load { background: var(--cyan-soft); color: var(--cyan); border-color: var(--cyan-border); }
.metric-load.missing-load { background: var(--gold-soft); color: var(--gold); border: 1px dashed var(--gold); }

.metric-rest {
  background: rgba(148, 163, 184, 0.12);
  color: #CBD5E1;
  border: 1px solid rgba(148, 163, 184, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
}

.metric-rest:hover { background: var(--ember); color: #fff; border-color: var(--ember); }

/* Tactile Set Check Pills */
.set-tracker-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-left: 44px;
}

.set-tracker-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 2px;
}

.set-pill {
  min-width: 34px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(9, 11, 14, 0.65);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.set-pill:hover { border-color: var(--ember-border); color: var(--text-primary); }
.set-pill.done {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #052e16;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.32);
}

/* ----- Previous Ressenti Callout ----- */
.prev-note-box {
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #CFFAFE;
}

.prev-note-box strong {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  display: block;
  margin-bottom: 4px;
}

.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  color: #BBF7D0;
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* ----- Logging Panel (Snowball Editor) ----- */
.log-panel {
  background: linear-gradient(180deg, rgba(20, 25, 33, 0.95), rgba(14, 17, 22, 0.97));
  border: 1px solid var(--ember-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 22px;
}

.log-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.editor-mode-switch {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 3px;
}

.editor-mode-btn {
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.editor-mode-btn.active { background: var(--ember); color: #fff; }

.quick-edit-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.quick-edit-row {
  display: grid;
  grid-template-columns: 42px 1fr minmax(180px, 270px);
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  background: rgba(9, 11, 14, 0.62);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.quick-edit-row.is-warmup-edit { opacity: 0.85; }
.quick-edit-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-field:focus { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.15); }
.input-field.small { padding: 7px 10px; font-size: 12.5px; }
.raw-textarea { min-height: 240px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; resize: vertical; }

/* Tactile RPE Selector */
.rpe-section { margin: 18px 0; }
.rpe-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rpe-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }

.rpe-btn {
  height: 44px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(9, 11, 14, 0.72);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.rpe-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.rpe-btn.selected-low { background: var(--emerald); color: #052e16; border-color: var(--emerald); }
.rpe-btn.selected-mid { background: var(--gold); color: #1c1204; border-color: var(--gold); }
.rpe-btn.selected-high { background: var(--ember); color: #fff; border-color: var(--ember); box-shadow: 0 0 14px rgba(255,90,31,0.4); }
.rpe-btn.selected-max { background: var(--crimson); color: #fff; border-color: var(--crimson); box-shadow: 0 0 14px rgba(239,68,68,0.45); }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field-hint { margin: 6px 0 0; font-size: 12px; color: var(--text-muted); }

/* ----- History / Journal View ----- */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.history-list { display: flex; flex-direction: column; gap: 12px; }

.history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.history-card-head {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.history-card-head:hover { background: rgba(255, 255, 255, 0.02); }
.history-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.history-title { font-family: var(--font-display); font-size: 22px; font-weight: 800; text-transform: uppercase; margin: 2px 0; }
.history-body { padding: 14px 16px 16px; border-top: 1px solid var(--border-subtle); }

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.ai-analysis-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.10), rgba(18, 22, 28, 0.92));
  border: 1px solid var(--cyan-border);
  font-size: 13.5px;
  white-space: pre-wrap;
}

/* ----- KPI View (Dynamic Period + Slider + Exercise Tracker) ----- */
.kpi-controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kpi-controls-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.range-slider {
  flex: 1;
  min-width: 160px;
  accent-color: var(--ember);
  cursor: pointer;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.kpi-val {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  margin: 6px 0 4px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

.cycle-bars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cycle-bar-row { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--ember), #FF9650); }
.bar-fill.is-run { background: linear-gradient(90deg, var(--cyan), #38BDF8); }

/* Exercise Progression Timeline */
.exo-prog-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.exo-prog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(9, 11, 14, 0.62);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

/* ----- Guide Page ----- */
.guide-hero {
  background: linear-gradient(135deg, rgba(255, 90, 31, 0.14), rgba(18, 22, 28, 0.94));
  border: 1px solid var(--ember-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.guide-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.guide-card h3 {
  font-family: var(--font-display);
  font-size: 23px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.guide-card p, .guide-card li {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.guide-card ul { padding-left: 18px; margin: 0; }

.code-sample {
  background: rgba(9, 11, 14, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #E2E8F0;
  white-space: pre-wrap;
  overflow-x: auto;
  margin: 10px 0;
}

.rpe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.rpe-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.rpe-table tr:last-child td { border-bottom: none; }

/* ----- Cycles Manager Modal ----- */
.cycle-mgr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: rgba(9, 11, 14, 0.62);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  margin-bottom: 10px;
}

.cycle-mgr-item.is-active {
  border-color: var(--ember-border);
  background: rgba(255, 90, 31, 0.08);
}

.builder-session-card {
  background: rgba(9, 11, 14, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.builder-session-head {
  display: grid;
  grid-template-columns: 1fr 110px 72px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

/* ----- Bottom Navigation (5 Tabs) ----- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(9, 11, 14, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.16s ease;
  position: relative;
}

.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--ember-bright); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 30px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--ember);
}

/* ----- Floating Rest Timer HUD ----- */
.timer-hud {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + 14px + env(safe-area-inset-bottom));
  z-index: 60;
  width: min(390px, calc(100vw - 24px));
  background: rgba(15, 19, 25, 0.97);
  backdrop-filter: blur(16px);
  border: 1px solid var(--ember-border);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65), var(--ember-glow);
  overflow: hidden;
}

body.wall-mode .timer-hud { bottom: 20px; }

.timer-progress-track { height: 4px; background: rgba(255, 255, 255, 0.08); }
.timer-progress-bar { height: 100%; background: linear-gradient(90deg, var(--ember), #FFB020); width: 100%; transition: width 0.25s linear; }

.timer-inner {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timer-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.timer-meta { display: flex; flex-direction: column; min-width: 0; }
.timer-tag { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; color: var(--ember-bright); }
.timer-exo-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 125px; }
.timer-display { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: #fff; letter-spacing: 0.04em; }

.timer-controls { display: flex; gap: 6px; }
.timer-btn {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.timer-btn-accent { background: var(--ember); border-color: var(--ember); }
.timer-btn-close { background: transparent; color: var(--text-muted); }

/* =====================================================================
   WALL HUD MODE (KIOSK / GARAGE SCREEN)
   ===================================================================== */
body.wall-mode { overflow: hidden; height: 100vh; }

.wall-header {
  height: 64px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(9, 11, 14, 0.94);
  border-bottom: 2px solid var(--ember-border);
}

.wall-brand { display: flex; align-items: center; gap: 12px; }
.wall-logo { width: 36px; height: 36px; border-radius: 8px; }
.wall-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wall-app-name { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: 0.08em; }
.badge-cycle { padding: 3px 9px; border-radius: 6px; background: rgba(255, 255, 255, 0.09); font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.wall-session-name { font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--ember-bright); text-transform: uppercase; letter-spacing: 0.04em; }
.wall-session-name.is-run { color: var(--cyan); }
.badge-snowball { padding: 3px 9px; border-radius: 6px; background: var(--emerald-soft); border: 1px solid var(--emerald-border); color: var(--emerald); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }

.wall-switcher { display: flex; gap: 6px; }
.wall-sw-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.wall-sw-btn.active { background: var(--ember); border-color: var(--ember); color: #fff; }
.wall-sw-btn.active.is-run { background: var(--cyan); border-color: var(--cyan); color: #06131a; }

.wall-telemetry { display: flex; align-items: center; gap: 14px; }
.wall-refresh-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 8px var(--emerald); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.wall-clock { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: #fff; }
.btn-wall-exit { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-secondary); font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; cursor: pointer; }
.btn-wall-exit:hover { border-color: var(--ember); color: #fff; }

.wall-container {
  height: calc(100vh - 64px);
  padding: 16px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.wall-warmup-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(18, 22, 28, 0.88);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.wall-warmup-label { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: 0.1em; margin-right: 4px; }
.wall-warmup-pill { padding: 4px 10px; border-radius: 7px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-subtle); font-size: 13px; color: #E2E8F0; }
.wall-warmup-pill span { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-left: 5px; }

.wall-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 14px; align-content: start; }
.wall-grid .exo-block { padding: 16px 18px; }
.wall-grid .exo-name { font-size: 20px; font-weight: 700; }
.wall-grid .exo-code { min-width: 42px; height: 36px; font-size: 15px; }
.wall-grid .metric-badge { padding: 6px 12px; font-size: 15.5px; }

.wall-footer-note {
  padding: 10px 16px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid var(--cyan-border);
  border-radius: 10px;
  font-size: 14px;
  color: #E0F2FE;
}

/* ----- Modals ----- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(4, 6, 9, 0.80);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #12161C;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
}

.modal-card.modal-wide { width: min(740px, 100%); }

.modal-header, .modal-footer { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-header { border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; background: #12161C; z-index: 2; }
.modal-header h2 { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.06em; margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-footer { border-top: 1px solid var(--border-subtle); justify-content: flex-end; }

.settings-account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(9, 11, 14, 0.72);
  border: 1px solid var(--ember-border);
  margin-bottom: 16px;
}

.kiosk-box { background: rgba(9, 11, 14, 0.65); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 12px; margin-top: 8px; }
.kiosk-box-title { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--cyan); margin-bottom: 8px; text-transform: uppercase; }
.kiosk-url-row { display: flex; gap: 8px; flex-wrap: wrap; }
.kiosk-url-row .input-field { flex: 1; min-width: 150px; }
.status-pill-box { margin-top: 12px; font-family: var(--font-mono); font-size: 12px; }

/* ----- Toasts ----- */
.toast-container { position: fixed; top: 76px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: #171D26;
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  animation: fadeIn 0.18s ease;
}
.toast.success { border-color: rgba(34, 197, 94, 0.6); color: #BBF7D0; }
.toast.error { border-color: rgba(239, 68, 68, 0.6); color: #FECACA; }

.empty-state {
  text-align: center;
  padding: 36px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

/* =====================================================================
   SMARTPHONE & TABLET POLISH (<= 680px)
   Zero iOS Auto-Zoom (16px inputs) + Spacious 2-Row Timer + Airy Header
   ===================================================================== */
@media (max-width: 680px) {
  .hide-sm, .hide-xs { display: none !important; }

  /* CRITICAL iOS Safari anti-zoom fix */
  input, select, textarea, .input-field, .input-field.small, .cycle-select {
    font-size: 16px !important;
  }

  .app-header { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .brand-name { font-size: 18px; }
  .brand-sub { display: none; }
  .brand-icon { width: 30px; height: 30px; }
  .cycle-select { max-width: 122px; font-size: 13px !important; }
  .btn-icon-label { width: 36px; padding: 0; }

  .main-container { padding: 14px 12px calc(var(--nav-height) + 46px + env(safe-area-inset-bottom)); }
  .display-title { font-size: 28px; }
  .hero-card { padding: 16px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn-primary, .hero-actions .btn-secondary { flex: 1; padding: 11px 12px; font-size: 13px; }
  .hero-stats-strip { grid-template-columns: 1fr 1fr; }
  .hero-stats-strip .mini-stat:last-child { grid-column: 1 / -1; }

  .set-tracker-row { padding-left: 0; }
  .set-pill { min-width: 38px; height: 34px; font-size: 13px; }

  .rpe-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .rpe-btn { height: 48px; }

  .quick-edit-row { grid-template-columns: 40px 1fr; }
  .quick-edit-row input { grid-column: 1 / -1; }
  .form-row { grid-template-columns: 1fr; }
  .builder-session-head { grid-template-columns: 1fr 96px; }

  /* Two-tier Rest Timer HUD for sweaty thumbs */
  .timer-hud { left: 12px; right: 12px; width: auto; }
  .timer-inner { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .timer-top-row { justify-content: space-between; }
  .timer-exo-label { max-width: 190px; }
  .timer-controls { display: grid; grid-template-columns: 1fr 1fr 1.4fr 42px; gap: 8px; }
  .timer-btn { padding: 10px 6px; font-size: 12.5px; }

  .nav-item { font-size: 9.5px; }
  .wall-grid { grid-template-columns: 1fr; }
  .wall-switcher { display: none; }
}


/* =====================================================================
   SMARTPHONE LANDSCAPE AUTO-ADAPTATION ("MINI-HUD PUPITRE")
   Déclenché automatiquement dès qu'un smartphone pivote à l'horizontale
   ===================================================================== */
@media (orientation: landscape) and (max-height: 540px) {
  :root {
    --rail-width: 62px;
    --header-height: 46px;
  }

  /* Compact header offset to the right of the side rail */
  .app-header {
    left: calc(var(--rail-width) + env(safe-area-inset-left));
    width: calc(100% - var(--rail-width) - env(safe-area-inset-left));
    margin-left: calc(var(--rail-width) + env(safe-area-inset-left));
    height: var(--header-height);
    padding: 0 calc(12px + env(safe-area-inset-right)) 0 12px;
  }

  .brand-icon { width: 26px; height: 26px; }
  .brand-name { font-size: 17px; }
  .brand-sub { display: none; }
  .btn-icon, .btn-icon-label { height: 32px; }
  .btn-icon { width: 32px; }

  .demo-banner {
    margin-left: calc(var(--rail-width) + env(safe-area-inset-left));
    padding: 5px 12px;
    font-size: 11.5px;
  }

  /* Bottom nav automatically rotates into a slim Left Side Rail */
  .bottom-nav {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: calc(var(--rail-width) + env(safe-area-inset-left));
    height: 100vh;
    padding-left: env(safe-area-inset-left);
    padding-bottom: 0;
    border-top: none;
    border-right: 1px solid var(--border-subtle);
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 1fr);
  }

  .nav-item {
    font-size: 8.5px;
    gap: 2px;
  }

  .nav-item svg { width: 18px; height: 18px; }

  .nav-item.active::before {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 28px;
    border-radius: 0 4px 4px 0;
  }

  /* Main content expands horizontally with zero wasted vertical bar */
  .main-container {
    margin-left: calc(var(--rail-width) + env(safe-area-inset-left));
    max-width: none;
    padding: 12px calc(14px + env(safe-area-inset-right)) 24px 14px;
  }

  /* 2-Column Mini-HUD layout for Sessions & Forge cards */
  .sessions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .workout-blocks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
  }

  .exo-block {
    padding: 11px 13px;
  }

  .exo-name { font-size: 14px; }
  .metric-badge { padding: 4px 8px; font-size: 11.5px; }
  .set-tracker-row { padding-left: 0; margin-top: 8px; }

  .hero-card { padding: 14px 16px; margin-bottom: 14px; }
  .display-title { font-size: 26px; }
  .hero-stats-strip { grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding-top: 10px; }
  .hero-stats-strip .mini-stat:last-child { grid-column: auto; }
  .mini-stat { padding: 7px 10px; }
  .mini-stat-val { font-size: 20px; }

  /* Single compact row for RPE 1..10 in landscape */
  .rpe-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
  }
  .rpe-btn { height: 38px; font-size: 13.5px; }

  .quick-edit-row {
    grid-template-columns: 38px 1fr minmax(170px, 240px);
  }
  .quick-edit-row input { grid-column: auto; }
  .form-row { grid-template-columns: repeat(2, 1fr); }

  /* Compact corner timer HUD in landscape */
  .timer-hud {
    left: auto;
    right: calc(12px + env(safe-area-inset-right));
    bottom: 10px;
    width: 360px;
  }
  .timer-inner { flex-direction: row; align-items: center; padding: 9px 12px; gap: 8px; }
  .timer-display { font-size: 22px; }
  .timer-controls { display: flex; gap: 5px; }
  .timer-btn { padding: 6px 8px; font-size: 11px; }

  /* Compact auth card in landscape */
  .auth-card {
    padding: 16px 20px;
    max-width: 480px;
  }
  .auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
    text-align: left;
  }
  .auth-logo { width: 42px; height: 42px; margin-bottom: 0; }
  .auth-title { font-size: 26px; }
}


/* =====================================================================
   RENSEI V3.3 — COMPATIBILITY ENGINE, STICKY CHRONO & NETLIFY CLEARANCE
   ===================================================================== */

/* Compatibility Traffic Light Badges (Indicative, never blocking) */
.compat-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

.compat-banner .compat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.compat-banner.compat-ideal {
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.55);
  color: #BBF7D0;
}
.compat-banner.compat-ideal .compat-dot { background: #22C55E; box-shadow: 0 0 10px #22C55E; }

.compat-banner.compat-vert {
  background: rgba(34, 197, 94, 0.09);
  border: 1px solid rgba(34, 197, 94, 0.34);
  color: #DCFCE7;
}
.compat-banner.compat-vert .compat-dot { background: #22C55E; }

.compat-banner.compat-orange {
  background: rgba(245, 176, 65, 0.14);
  border: 1px solid rgba(245, 176, 65, 0.52);
  color: #FDE68A;
}
.compat-banner.compat-orange .compat-dot { background: #F5B041; box-shadow: 0 0 8px rgba(245, 176, 65, 0.7); }

.compat-banner.compat-rouge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #FECACA;
}
.compat-banner.compat-rouge .compat-dot { background: #EF4444; box-shadow: 0 0 9px rgba(239, 68, 68, 0.8); }

.pill-compat-ideal {
  background: rgba(34, 197, 94, 0.18);
  color: #4ADE80;
  border: 1px solid rgba(34, 197, 94, 0.52);
}
.pill-compat-vert {
  background: rgba(34, 197, 94, 0.12);
  color: #86EFAC;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.pill-compat-orange {
  background: rgba(245, 176, 65, 0.16);
  color: #FBBF24;
  border: 1px solid rgba(245, 176, 65, 0.48);
}
.pill-compat-rouge {
  background: rgba(239, 68, 68, 0.17);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.52);
}

.badge-compat {
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.compat-dot-mini {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dot-ideal { background: #22C55E; box-shadow: 0 0 6px #22C55E; }
.dot-vert { background: #22C55E; }
.dot-orange { background: #F5B041; }
.dot-rouge { background: #EF4444; }

/* Dual Ready Rail Strip on Forge Hero */
.hero-alt-rail {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(9, 11, 14, 0.6);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-alt-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.weekly-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.session-card-compat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 6px;
}
.session-card-compat.c-ideal { color: #4ADE80; }
.session-card-compat.c-vert { color: #86EFAC; }
.session-card-compat.c-orange { color: #FBBF24; }
.session-card-compat.c-rouge { color: #FCA5A5; }

.session-card.run-done-week {
  border-color: rgba(34, 197, 94, 0.30);
}

.chip-tab .chip-check {
  color: #4ADE80;
  margin-left: 4px;
  font-weight: 800;
}

.chip-tab.chip-ready {
  box-shadow: inset 0 0 0 1px rgba(255, 90, 31, 0.36);
}
.chip-tab.chip-ready.is-run {
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.38);
}

/* Sticky Rest Timer Bar (Always accessible while scrolling exercises) */
.quick-timer-bar.is-sticky {
  position: sticky;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 6px);
  z-index: 35;
  background: rgba(14, 18, 24, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ember-border);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
}

/* Landscape compact timer toggle button (avoids losing vertical height) */
.landscape-timer-fab {
  display: none;
}

@media (orientation: landscape) and (max-height: 540px) {
  .quick-timer-bar.is-sticky {
    position: static;
    padding: 7px 10px;
    box-shadow: none;
  }
  .quick-timer-bar.is-sticky.landscape-collapsed {
    display: none;
  }
  .landscape-timer-fab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    right: calc(12px + env(safe-area-inset-right));
    bottom: 12px;
    z-index: 55;
    padding: 8px 13px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--ember), #E0430D);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(255, 90, 31, 0.42);
  }
}

/* Dégagement du badge "Powered by Netlify" */
@media (min-width: 681px) and (min-height: 541px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    bottom: 14px;
    transform: translateX(-50%);
    width: 520px;
    height: 62px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .bottom-nav {
    height: calc(var(--nav-height) + 46px + env(safe-area-inset-bottom));
    padding-bottom: calc(46px + env(safe-area-inset-bottom));
  }
  .main-container {
    padding-bottom: calc(var(--nav-height) + 92px + env(safe-area-inset-bottom));
  }
  .timer-hud {
    bottom: calc(var(--nav-height) + 58px + env(safe-area-inset-bottom));
  }
}


/* =====================================================================
   RENSEI V3.4 — ANTI-DOUBLE-TAP ZOOM (PINCH-ZOOM PRESERVED)
   + PASSER / REMPLACER / AJOUTER EXERCICE
   ===================================================================== */

/* Disables iOS/Android double-tap zoom & 300ms delay while keeping pinch-zoom */
html, body, button, a, select, input, textarea, .session-card, .history-card-head {
  touch-action: manipulation;
}

/* Skipped Exercise State (Card & Journal) */
.exo-row-wrap.exo-skipped {
  opacity: 0.56;
}

.exo-row-wrap.exo-skipped .exo-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.metric-skipped {
  background: rgba(100, 116, 139, 0.22);
  color: #CBD5E1;
  border: 1px dashed rgba(148, 163, 184, 0.45);
}

.metric-ref-hint {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 500;
}

.set-tracker-row {
  justify-content: space-between;
}

.set-pills-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.btn-skip-inline {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
  margin-left: auto;
}

.btn-skip-inline:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-skip-inline.is-restore {
  border-color: var(--cyan-border);
  background: var(--cyan-soft);
  color: var(--cyan);
}

/* Upgraded Quick Edit Rows (Editable Name + Editable Details + Skip/Remove) */
.quick-edit-row-v2 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(9, 11, 14, 0.64);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.quick-edit-row-v2.is-warmup-edit {
  opacity: 0.85;
}

.quick-edit-row-v2.is-skipped-edit {
  opacity: 0.64;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.35);
}

.quick-edit-top {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
}

.quick-edit-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-qe-action {
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-qe-action:hover {
  color: var(--text-primary);
  border-color: var(--ember-border);
}

.btn-qe-action.is-restore {
  border-color: var(--cyan-border);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.btn-qe-del {
  width: 30px;
  padding: 0;
  color: var(--text-muted);
}

.btn-qe-del:hover {
  border-color: rgba(239, 68, 68, 0.5);
  background: var(--crimson-soft);
  color: #FCA5A5;
}

.quick-edit-skipped-note {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-subtle);
}

.btn-add-exo {
  width: 100%;
  margin-bottom: 16px;
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-add-exo:hover {
  border-color: var(--ember-border);
  color: var(--ember-bright);
  background: var(--ember-soft);
}

@media (min-width: 720px) {
  .quick-edit-row-v2 {
    display: grid;
    grid-template-columns: 40px 1fr minmax(200px, 270px) auto;
    align-items: center;
  }
  .quick-edit-top {
    display: contents;
  }
  .quick-edit-actions {
    order: 4;
  }
  .quick-edit-skipped-note {
    order: 3;
  }
}


/* =====================================================================
   RENSEI V3.5 — INSTALL SHORTCUT BANNER & GUIDED MODAL
   ===================================================================== */
.auth-install-wrap {
  margin-top: 14px;
}

.install-cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 90, 31, 0.13), rgba(18, 22, 28, 0.92));
  border: 1px solid var(--ember-border);
}

.install-cta-left {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 200px;
}

.install-cta-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--ember-border);
  flex-shrink: 0;
}

.install-cta-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.25;
}

.install-cta-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.install-cta-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.install-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.install-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.install-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 11px;
  background: rgba(9, 11, 14, 0.72);
  border: 1px solid var(--border-subtle);
}

.install-step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ember-soft);
  border: 1px solid var(--ember-border);
  color: var(--ember-bright);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-step-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.45;
}

.install-step-text strong {
  color: #fff;
}

.ios-inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(0, 212, 255, 0.14);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  vertical-align: middle;
  margin: 0 3px;
}

.ios-inline-icon svg {
  width: 14px;
  height: 14px;
}

.install-warn-box {
  padding: 12px;
  border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  color: #FDE68A;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.install-note-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid var(--cyan-border);
  color: #CFFAFE;
  font-size: 12px;
  margin-top: 12px;
}


/* =====================================================================
   RENSEI V3.6 — COACH IA DUAL ACTIONS (BILAN COACH + ANALYSE IA GEMINI)
   ===================================================================== */
.coach-card {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.10), rgba(18, 22, 28, 0.94));
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.coach-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.coach-actions-row > button {
  flex: 1;
  min-width: 210px;
}

.btn-ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border-radius: 10px;
  border: 1px solid var(--cyan-border);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.22), rgba(2, 132, 199, 0.26));
  color: #E0F2FE;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-ai:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.34), rgba(2, 132, 199, 0.40));
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.btn-ai:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.btn-ai.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 8px;
}

.ai-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ai-setup-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(245, 176, 65, 0.12);
  border: 1px solid var(--gold-border);
  color: #FDE68A;
  font-size: 12px;
}
