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

/* =============== CSS CUSTOM PROPERTIES =============== */
:root {
  /* Primary colors */
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #7c3aed;

  /* Zone colors */
  --color-zone1: #10b981;
  --color-zone1-dark: #059669;
  --color-zone2: #3b82f6;
  --color-zone2-dark: #2563eb;
  --color-zone3: #f59e0b;
  --color-zone3-dark: #d97706;
  --color-zone4: #ef4444;
  --color-zone4-dark: #dc2626;
  --color-zone5: #8b5cf6;
  --color-zone5-dark: #7c3aed;

  /* Accent colors */
  --color-cyan: #06b6d4;
  --color-amber: #f59e0b;

  /* Text colors */
  --color-text: #0f172a;
  --color-text-light: #475569;
  --color-text-muted: #64748b;

  /* Background colors */
  --color-bg: radial-gradient(circle at 0% 0%, #f0f9ff 0%, #e0f2fe 100%);
  --color-bg-card: rgba(255, 255, 255, 0.85);
  --color-bg-white: #fff;

  /* Border colors */
  --color-border: #f1f5f9;
  --color-border-light: #e2e8f0;

  /* Spacing */
  --space-xs: 5px;
  --space-sm: 10px;
  --space-md: 15px;
  --space-lg: 20px;
  --space-xl: 30px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  /* Shadows */
  --shadow-soft: 0 10px 15px -3px rgba(0, 0, 0, 0.03), 0 4px 6px -2px rgba(0, 0, 0, 0.01);
  --shadow-medium: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.01);
  --shadow-glow-primary: 0 20px 25px -5px rgba(79, 70, 229, 0.3), 0 10px 10px -5px rgba(79, 70, 229, 0.2);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  padding: var(--space-lg);
  overflow-x: hidden;
  max-width: 100vw;
}

/* =============== CONTAINER =============== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  /* More rounded */
  padding: 30px;
  /* Modern "Glass" feel with soft shadow */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* =============== BOXEN & GRIDS =============== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  /* Always stacked vertically as requested */
  gap: 30px;
  margin-bottom: 30px;
}

.info-box,
.analysis,
.five-zone-info,
.training-analysis {
  background: var(--color-bg-white);
  /* Modern soft shadow */
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-lg);
  margin: 0 auto var(--space-xl) auto;
  max-width: 1200px;
  padding: 25px;
  border: 1px solid var(--color-border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-box:hover,
.analysis:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.01);
}

/* Vibrant Top Borders */
.info-box {
  border-top: 4px solid var(--color-primary);
}

/* Indigo-600 */
.analysis {
  border-top: 4px solid var(--color-zone1);
}

/* Emerald-500 */
.five-zone-info {
  border-top: 4px solid var(--color-zone3);
}

/* Amber-500 */
.training-analysis {
  border-top: 4px solid var(--color-cyan);
}

/* Cyan-500 */

/* =============== ÜBERSCHRIFTEN =============== */
.modern-header {
  text-align: center;
  margin-bottom: 35px;
  padding: var(--space-xl);
  /* Vibrant Gradient - "Neo-Sport" */
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  /* Colored Glow Shadow */
  box-shadow: var(--shadow-glow-primary);
}

.modern-header h2 {
  font-size: 32px;
  margin-bottom: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modern-header p {
  font-size: 15px;
  opacity: 0.9;
  font-weight: 500;
}

.info-box h3,
.input-titel h3,
.tests-list h3,
.chart-container h3,
.analysis h3,
.five-zone-info h3,
.training-analysis h3 {
  margin: 0 0 18px 0;
  font-size: 22px;
  color: #1e293b;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.training-analysis h3 {
  color: #0891b2;
}

.five-zone-info h3 {
  color: #d97706;
}

/* =============== EINGABE =============== */
.input-section {
  background: #f8fafc;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: 35px;
}

.input-section h3 {
  color: #334155;
  margin-bottom: 25px;
}

.input-header {
  display: flex;
  gap: 15px;
  align-items: end;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.input-header button {
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.input-header button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  /* Thicker, softer border */
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  transition: all 0.2s ease;
  outline: none;
}

input[type="date"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
  border-color: #6366f1;
  /* Indigo focus */
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

input::placeholder {
  color: #94a3b8;
  font-size: 15px;
}

/* =============== STUFEN-GRID =============== */
.stufen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin-top: 25px;
}

.stufe-input {
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stufe-input:hover {
  border-color: #818cf8;
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.01);
}

.stufe-input h4 {
  color: #4f46e5;
  margin-bottom: 12px;
  font-size: 15px;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stufe-input input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

.tempo-display {
  text-align: center;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
  font-size: 14px;
}

.stufe-input input[type="text"] {
  width: 90px;
  min-width: 70px;
  margin: 0 auto 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

/* =============== BUTTONS =============== */
.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.controls button {
  padding: 12px 28px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 700;
  transition: all .2s ease;
}

.controls button.active {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.controls button:hover:not(.active) {
  border-color: #cbd5e1;
  color: #334155;
  transform: translateY(-1px);
}

.method-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
}

.method-btn {
  padding: 10px 14px;
  margin: 0;
  /* Remove margin since grid gap handles spacing */
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all .2s ease;
  color: #475569;
  font-weight: 500;
}

.method-btn.active {
  background: #eff6ff;
  /* Very light blue bg */
  color: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}

.method-btn:hover {
  border-color: #93c5fd;
  color: #2563eb;
}

/* Erfolg/Fehler Buttons */
.button-success {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
}

.button-success:hover {
  background: #059669;
  transform: scale(1.02);
}

.button-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
}

.button-danger:hover {
  background: #dc2626;
  transform: scale(1.02);
}

/* =============== LISTEN & HINWEISE =============== */
.validation-alert {
  margin: 20px 0;
  padding: 15px;
  border-radius: 12px;
  font-weight: 600;
  display: none;
}

.validation-alert.warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.validation-alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.recommendation-box {
  background: #ecfeff;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 25px;
  border-left: 5px solid #06b6d4;
}

.tests-list {
  background: #f8fafc;
  padding: 25px;
  border-radius: 16px;
  margin-bottom: 25px;
  border: 1px solid #e2e8f0;
}

.test-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 18px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all .3s ease;
}

.test-item:hover {
  transform: translateX(5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.test-item.current {
  border-left: 5px solid #10b981;
  background: linear-gradient(to right, #ecfdf5, #fff);
}

.delete-btn {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.delete-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* =============== CHART =============== */
.chart-container {
  position: relative;
  width: 100%;
  height: 420px;
  overflow: visible;
}

.chart-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* =============== ACCESSIBILITY =============== */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =============== ZONEN =============== */
.threshold {
  margin-bottom: 20px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 5px solid #06b6d4;
}

.zone,
.zone-highlight {
  background: #fff;
  border-radius: 10px;
}

.zone {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.zone-highlight {
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}

.zone-color {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  margin-right: 15px;
}


/* Mode Switcher Styles (consolidated from index.html) */
.mode-switch-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
  gap: 10px;
}

.mode-btn {
  padding: 10px 20px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
}

.mode-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5);
}

.mode-btn:hover:not(.active) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Hide/Show logic for mode switching */
.mode-run-only {
  display: none;
}

.mode-bike-only {
  display: none;
}

body.mode-run .mode-run-only {
  display: block;
}

body.mode-run .mode-run-inline {
  display: inline;
}

body.mode-bike .mode-bike-only {
  display: block;
}

body.mode-bike .mode-bike-inline {
  display: inline;
}

/* Input styling adaptation */
.watt-input {
  width: 100px;
  text-align: center;
  font-weight: bold;
}

.zone-grid {
  display: grid;
  /* Default for larger screens */
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  margin-top: 25px;
}

/* Force 2 columns on mobile to prevent "too big" boxes in Run mode */
/* Force 2 columns on mobile/small tablets to prevent layout shifts */
@media (max-width: 600px) {
  .zone-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .zone-card {
    min-width: 0;
    /* Allow item to shrink below content size */
  }

  .zone-card small {
    font-size: 11px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    /* Ensure long words break */
    display: block;
    line-height: 1.3;
  }
}



.zone-card {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  text-align: center;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.zone-card:hover {
  transform: translateY(-3px);
}

/* Zone Colors using CSS Variables */
.zone1-card {
  background: linear-gradient(135deg, var(--color-zone1), var(--color-zone1-dark));
}

.zone2-card {
  background: linear-gradient(135deg, var(--color-zone2), var(--color-zone2-dark));
}

.zone3-card {
  background: linear-gradient(135deg, var(--color-zone3), var(--color-zone3-dark));
}

.zone4-card {
  background: linear-gradient(135deg, var(--color-zone4), var(--color-zone4-dark));
}

.zone5-card {
  background: linear-gradient(135deg, var(--color-zone5), var(--color-zone5-dark));
}

/* =============== REFERENZEN =============== */
.scientific-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 20px;
  margin: 25px 0;
}

.scientific-warning h4 {
  color: #92400e;
  margin-bottom: 10px;
}

.scientific-references {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 2px solid #e2e8f0;
  font-size: 13px;
  color: #64748b;
}

.scientific-references h3 {
  color: #1e293b;
  margin-bottom: 8px;
  font-size: 18px;
}

.scientific-references h4,
.scientific-references h5 {
  color: #4f46e5;
}

.references-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

.ref-box-methods,
.ref-box-values {
  padding: 15px;
}

.sources-container {
  margin-top: 30px;
  padding: 25px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 5px solid #4f46e5;
}

.reference-text {
  font-size: 12px;
  line-height: 1.7;
  color: #475569;
}

.disclaimer {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
}

/* =============== ANALYSE =============== */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  font-size: 16px;
}

.analysis-grid h5 {
  font-size: 1.05em;
  color: #1e40af;
  margin-bottom: 10px;
  font-weight: 700;
}

.analysis-grid ul {
  padding-left: 20px;
  margin: 0 0 8px 0;
}

.analysis-grid li {
  margin-bottom: 6px;
  font-size: 1em;
  color: #334155;
}

.analysis-interpretation {
  margin-top: 20px;
  padding: 15px;
  background: #ecfeff;
  border-radius: 10px;
  font-size: 15px;
  color: #0e7490;
  border: 1px solid #cffafe;
}

.analysis-zones {
  margin-top: 20px;
  padding: 15px;
  background: #f0fdf4;
  border-radius: 10px;
  font-size: 15px;
  color: #15803d;
  border: 1px solid #dcfce7;
}

.analysis-zones span {
  font-size: .97em;
  color: #1e293b;
}

.primary-btn {
  width: 100%;
  padding: 16px 0;
  /* Electric Indigo Gradient */
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1em;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
  margin-top: 20px;
  transition: all .2s ease;
  letter-spacing: .02em;
}

.primary-btn:hover,
.primary-btn:focus {
  background: linear-gradient(135deg, #4338ca, #3730a3);
  box-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.4);
  transform: translateY(-2px);
}

/* =============== THRESHOLD RESULTS =============== */
#thresholds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Side by side */
  gap: 15px;
  margin-top: 20px;
}

.result-box {
  background: #fff;
  border-radius: 12px;
  padding: 15px 18px;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.result-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

/* Colored accents for LT1 (Green) and LT2 (Red) - Updated Colors */
.result-box:nth-child(1) {
  border-left: 6px solid #10b981;
}

.result-box:nth-child(2) {
  border-left: 6px solid #ef4444;
}

.result-box h4 {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 6px;
}

.result-value {
  font-size: 13px;
  color: #334155;
  line-height: 1.4;
}

.result-value strong {
  display: block;
  font-size: 22px;
  color: #0f172a;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 600px) {
  #thresholds {
    grid-template-columns: 1fr;
    /* Stack on mobile */
  }

  .result-value strong {
    font-size: 20px;
  }
}


/* =============== RACE PREDICTION (NEW) =============== */
.race-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
  text-align: center;
}

.race-card {
  background: #f8fafc;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.race-card:hover {
  background: #fff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  border-color: #6366f1;
  /* Indigo border on hover */
  transform: translateY(-3px);
}

.race-card strong {
  display: block;
  color: #64748b;
  font-size: 10px;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
}

.race-card span {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

.race-disclaimer {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 12px;
  text-align: center;
  font-style: italic;
}

/* ===== MOBILE PACK (bereinigt) ===== */
@media (max-width: 768px) {
  :root {
    --radius: 16px;
    --space: 16px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  }

  body {
    padding: 12px env(safe-area-inset-right) 12px env(safe-area-inset-left);
  }

  .container {
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .modern-header {
    padding: 20px;
    border-radius: var(--radius);
  }

  .modern-header h1 {
    font-size: clamp(20px, 5vw, 24px);
    margin-bottom: 8px;
  }

  .modern-header p {
    font-size: 14px;
    opacity: .95;
  }

  .info-box,
  .analysis,
  .five-zone-info,
  .training-analysis {
    padding: var(--space);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--space);
  }

  /* Eingabe */
  .input-section {
    padding: var(--space);
  }

  .input-header {
    gap: 10px;
  }

  .input-header .input-group {
    flex: 1 1 100%;
  }

  .input-header button {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
  }

  /* Stufen: 3×2 (immer zwei nebeneinander) */
  .stufen-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 15px;
  }

  .stufe-input {
    padding: 15px;
    border-radius: 14px;
  }

  .stufe-input input {
    font-size: 16px;
    padding: 10px;
  }

  /* Chart-Schalter */
  .controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
  }

  .controls button {
    border-radius: 999px;
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Methoden-Buttons */
  .method-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .method-btn {
    border-radius: 10px;
    padding: 12px 10px;
    font-size: 13px;
    line-height: 1.3;
  }

  .method-btn small {
    display: block;
    opacity: .9;
    margin-top: 2px;
  }

  /* Diagramm + Deckel */
  .chart-container {
    border-radius: var(--radius);
  }

  .chart-container h3 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .chart-container canvas {
    height: clamp(520px, 82vh, 720px) !important;
    /* Obergrenze, kein endloses Wachsen */
    width: 100% !important;
    max-height: 400px !important;
  }

  /* Schwellen & Zonen: untereinander, volle Breite */
  .info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .info-grid>.info-box {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  /* Analyse / Referenzen */
  .analysis-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    font-size: 15px;
  }

  .analysis-input {
    padding: 14px;
    font-size: 16px;
  }

  .references-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .ref-box-methods,
  .ref-box-values {
    padding: 10px !important;
  }

  .ref-box-methods h4,
  .ref-box-values h4 {
    font-size: 14px !important;
    margin-bottom: 8px !important;
  }

  .ref-box-methods ul,
  .ref-box-values ul {
    padding-left: 15px !important;
  }

  .ref-box-methods li,
  .ref-box-values li {
    font-size: 11px !important;
    line-height: 1.5 !important;
    margin-bottom: 5px !important;
  }

  footer.info-box {
    padding: 20px;
  }

  /* Detail-Abschnitt: Overflow-sicheres 2er-Grid (iOS) */
  #fiveZoneDetailSection .info-box>div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 3vw, 20px);
    width: 100%;
    max-width: 100%;
  }

  #fiveZoneDetailSection .zone-highlight {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 540px) {
  :root {
    --radius: 14px;
    --space: 14px;
  }

  .modern-header h1 {
    font-size: clamp(18px, 6vw, 22px);
  }

  .controls {
    gap: 6px;
  }

  .method-buttons {
    gap: 6px;
  }

  .chart-container canvas {
    height: clamp(500px, 86vh, 680px) !important;
    max-height: 340px !important;
  }

  /* Vier Info-Kacheln lieber 1-spaltig auf sehr schmalen Geräten */
  #fiveZoneDetailSection .info-box>div {
    grid-template-columns: 1fr;
  }
}

/* Optionale Feinheiten */
@media (hover:hover) and (max-width:768px) {

  .controls button:hover,
  .input-header button:hover,
  .method-btn:hover {
    transform: translateY(-1px);
  }
}

/* =============== STUFEN-KONTROLLE (NEU) =============== */
/* Input Labels in der Stufen-Eingabe */
.input-label {
  display: block;
  margin-bottom: 6px;
  color: #475569;
  font-weight: 600;
  font-size: 14px;
}

.input-label-maxhf {
  margin: 12px 0 6px;
}

.input-date,
.input-number-small {
  padding: 8px;
}

.btn-danger {
  background: rgba(220, 53, 69, 0.8);
  border-color: rgba(220, 53, 69, 0.9);
}

/* Stufen-Kontrolle Container */
.stage-controls {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  align-items: center;
  flex-wrap: wrap;
}

.btn-add-stage {
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn-add-stage:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

.btn-remove-stage {
  padding: 10px 20px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn-remove-stage:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4);
}

.stage-count-info {
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
}

.stage-increment-info {
  color: #0891b2;
  font-size: 14px;
  font-style: italic;
}

/* Pace Input in Stufen */
.pace-input {
  width: 90px;
  min-width: 70px;
  margin: 0 auto 10px;
  text-align: center;
  font-size: 18px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  color: #0f172a;
  font-weight: 600;
}

.hr-percent-display {
  font-size: 12px;
  margin-top: 4px;
  margin-bottom: 12px;
  min-height: 16px;
  color: #0891b2;
  font-weight: 600;
}

/* Top-Navigation (überstimmt Basis-Styles durch spätere Lade-Reihenfolge) */
main.container>nav.top-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 25px;
}

main.container>nav.top-nav a.nav-link {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  background: #fff;
  color: #1e293b;
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  transition: all 0.2s ease;
}

main.container>nav.top-nav a.nav-link:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

main.container>nav.top-nav a.nav-link.active,
main.container>nav.top-nav a.nav-link[aria-current="page"] {
  background: #0f172a;
  /* Slate-900 */
  color: #fff;
  border-color: #0f172a;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.2);
}



/* =============== ERWEITERTE STUFEN-GRID RESPONSIVE =============== */
/* Große Bildschirme - mehr Spalten bei vielen Stufen */
@media (min-width: 1400px) {
  .stufen-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* Kleine Bildschirme - Scroll bei vielen Stufen */
@media (max-width: 768px) {
  .stufen-grid {
    padding-right: 10px;
  }

  /* Scrollbar Styling */
  .stufen-grid::-webkit-scrollbar {
    width: 6px;
  }

  .stufen-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }

  .stufen-grid::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
  }

  .stufen-grid::-webkit-scrollbar-thumb:hover {
    background: #64748b;
  }

  /* Mobile Anpassungen für Stufen-Kontrolle */
  .stage-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-add-stage,
  .btn-remove-stage {
    width: 100%;
    padding: 12px;
  }

  .stage-count-info,
  .stage-increment-info {
    text-align: center;
    display: block;
    width: 100%;
  }
}

/* Extra kleine Bildschirme - inherits from 768px breakpoint */
/* Note: scrollbar styling and stage-controls already defined at 768px */

@media (prefers-reduced-motion:reduce) {
  * {
    transition: none !important;
  }
}

/* =============== DATA VALIDATION STYLES =============== */
.validation-container {
  margin-top: var(--space-lg);
}

.validation-summary {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.validation-summary.invalid {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.quality-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  background: var(--color-zone1);
  color: white;
  margin-bottom: var(--space-sm);
}

.quality-badge.low {
  background: var(--color-zone4);
}

.quality-badge.medium {
  background: var(--color-zone3);
}

.quality-badge.high {
  background: var(--color-zone1);
}

.validation-alerts {
  margin-top: var(--space-sm);
}

.validation-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.validation-alert.error {
  background: #fef2f2;
  color: #991b1b;
  border-left: 4px solid var(--color-zone4);
}

.validation-alert.warning {
  background: #fffbeb;
  color: #92400e;
  border-left: 4px solid var(--color-zone3);
}

.validation-alert.info {
  background: #eff6ff;
  color: #1e40af;
  border-left: 4px solid var(--color-zone2);
}

/* =============== VLAMAX SECTION STYLES =============== */
.vlamax-section {
  border-top: 4px solid var(--color-zone3);
}

.section-intro {
  color: var(--color-text-light);
  font-size: 15px;
  margin-bottom: var(--space-lg);
}

.vlamax-container {
  min-height: 100px;
}

.vlamax-placeholder,
.progression-placeholder {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 2px dashed #e2e8f0;
}

.vlamax-card {
  background: white;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.vlamax-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.vlamax-value-container {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.vlamax-value {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
}

.vlamax-unit {
  font-size: 16px;
  color: var(--color-text-muted);
}

.vlamax-category-container {
  text-align: right;
}

.vlamax-category {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.vlamax-type {
  display: block;
  font-size: 14px;
  color: var(--color-text-light);
}

.vlamax-description {
  font-size: 15px;
  color: var(--color-text-light);
  line-height: 1.5;
  margin: 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.carb-estimate {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.carb-estimate h4 {
  color: #047857;
  margin-bottom: 8px;
  font-size: 14px;
}

.carb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.carb-item {
  text-align: center;
  padding: var(--space-sm);
  background: white;
  border-radius: var(--radius-sm);
}

.carb-item strong {
  display: block;
  font-size: 20px;
  color: #059669;
}

.carb-item span {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* =============== PROGRESSION SECTION STYLES =============== */
.progression-section {
  border-top: 4px solid var(--color-zone2);
}

.progression-container {
  min-height: 150px;
}

.progression-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.progression-stat {
  background: white;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.progression-stat.main {
  border-left: 5px solid var(--color-zone1);
}

.progression-stat .stat-label {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.progression-stat .stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.progression-stat .stat-detail {
  display: block;
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 4px;
}

.progression-chart-container {
  background: white;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  height: 250px;
}

.progression-insight {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: #f0f9ff;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-zone2);
  font-size: 14px;
  color: #0c4a6e;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .vlamax-header {
    flex-direction: column;
  }

  .vlamax-category-container {
    text-align: left;
  }

  .vlamax-value {
    font-size: 32px;
  }

  .progression-stat .stat-value {
    font-size: 22px;
  }
}