/* ═══════════════════════════════════════════════════════════════════════════
   Dive Analyser
   Clean, light, technical, readable
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #f4f7fb;
  --bg-card: #ffffff;
  --bg-soft: #eef3f8;
  --bg-soft-2: #f8fbfe;
  --bg-hover: #e7f0fb;
  --bg-input: #ffffff;

  --border: #d8e1eb;
  --border-soft: #e7edf4;
  --border-strong: #c6d3e0;

  --text-primary: #1f2b37;
  --text-secondary: #526576;
  --text-muted: #77899c;

  --accent: #2f7ddf;
  --accent-dim: #dbe9fb;
  --accent-strong: #1f68c3;

  --temp: #d98943;
  --pressure: #2f9d57;
  --ceiling: #d64b4b;
  --ndl: #7c72d8;

  --tissue-uptake: #4ea8de;
  --tissue-offgassing: #f4a261;
  --tissue-deco: #d62828;
  --tissue-inspired: rgba(80, 150, 210, 0.95);
  --tissue-surface-m: rgba(220, 80, 80, 0.95);

  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius: 10px;
  --radius-lg: 18px;

  --shadow-sm: 0 4px 12px rgba(28, 42, 56, 0.05);
  --shadow: 0 10px 30px rgba(28, 42, 56, 0.08);

  --chart-h: 340px;
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.6;
  background: var(--bg);
}

/* ─── Tool layout ────────────────────────────────────────────────────────── */
.pf-tool-main .pf-tool-frame.dive-analyser-tool {
  width: 100%;
  max-width: 1450px;
  margin: 0 auto;
  padding: 24px;
}

/* ─── Top / intro ────────────────────────────────────────────────────────── */
.tool-top {
  margin-bottom: 24px;
}

.tool-top h1 {
  margin: 0 0 8px;
  font-size: 2.25rem;
  line-height: 1.08;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.tool-top .sub {
  margin: 0;
  max-width: 780px;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ─── Generic section card ──────────────────────────────────────────────── */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.section-card .section-title,
.section-title {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.section-card .section-desc,
.section-desc {
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Profile save/load bar ─────────────────────────────────────────────── */
.profile-bar {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.profile-bar input[type="text"] {
  width: 100%;
  min-width: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  padding: 11px 14px;
  border-radius: var(--radius);
}

.profile-bar input[type="text"]::placeholder {
  color: var(--text-muted);
}

.profile-bar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 223, 0.12);
}

.profile-status {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.btn-secondary {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn-secondary:active {
  transform: translateY(1px);
}

/* ─── Upload area ───────────────────────────────────────────────────────── */
.upload-section {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-section h1,
.upload-section h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-section .sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.96rem;
}

.drop-zone {
  position: relative;
  margin-top: 10px;
  width: 100%;
  max-width: 820px;
  padding: 52px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: linear-gradient(180deg, #f7fbff 0%, #eaf3fd 100%);
}

.drop-zone .drop-icon {
  width: 44px;
  height: 44px;
  opacity: 0.7;
}

.drop-zone .drop-label {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.drop-zone .drop-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.formats-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: var(--radius);
  display: none;
}

.upload-status.loading {
  display: block;
  color: var(--text-secondary);
}

.upload-status.error {
  display: block;
  color: var(--ceiling);
  background: rgba(214, 75, 75, 0.08);
  border: 1px solid rgba(214, 75, 75, 0.22);
}

/* ─── Dive selector ─────────────────────────────────────────────────────── */
.dive-selector {
  display: none;
  margin-top: 20px;
  width: 100%;
  max-width: 820px;
}

.dive-selector label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dive-selector select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2377899c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.dive-selector select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 223, 0.12);
}

/* ─── Main dive display ─────────────────────────────────────────────────── */
#dive-display {
  margin-top: 34px;
}

/* ─── Stats / summary ───────────────────────────────────────────────────── */
.stats-heading {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

.stat-cell {
  background: var(--bg-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.stat-cell .stat-value {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  color: var(--text-primary);
  font-weight: 500;
}

.stat-cell .stat-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Profile chart / depth profile ─────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  height: var(--chart-h);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fcfdff 0%, #f6f9fc 100%);
  padding: 10px;
}

canvas.profile-canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 3px;
  border-radius: 2px;
}

/* ─── Tissue inspector ──────────────────────────────────────────────────── */
#tissue-wrap {
  position: relative;
}

.tissue-no-data {
  padding: 24px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.tissue-inspector-top {
  margin: 10px 0 8px;
}

.tissue-cursor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.tissue-cursor-meta strong {
  color: var(--text-primary);
  font-weight: 600;
}

.tissue-slider-wrap {
  margin: 10px 0 14px;
}

.tissue-slider {
  width: 100%;
  accent-color: var(--accent);
}

.tissue-bars-chart {
  position: relative;
  padding: 12px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f8fbfe 0%, #edf4fb 100%);
}

.tissue-bars-axis {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tissue-bars {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(16, minmax(18px, 1fr));
  gap: 8px;
  align-items: end;
}

.tissue-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.tissue-bar-plot {
  position: relative;
  width: 100%;
  height: 220px;
  min-height: 220px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #cdd9e4;
  background:
    linear-gradient(to top, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.28)),
    #dfeaf4;
}

.tissue-bar-plot.leading {
  box-shadow: 0 0 0 2px rgba(230, 181, 40, 0.45) inset;
}

.tissue-bar-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  min-height: 2px;
  border-radius: 8px 8px 0 0;
  transition: height 0.12s linear;
}

.tissue-marker {
  position: absolute;
  left: 8%;
  width: 84%;
  height: 2px;
  pointer-events: none;
}

.tissue-marker.inspired {
  background: var(--tissue-inspired);
}

.tissue-marker.surface-m {
  background: var(--tissue-surface-m);
}

.tissue-marker.ambient {
  background: #7fb3ff;
}

.tissue-bar-label {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.tissue-bars-legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-swatch,
.legend-line {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-swatch.uptake {
  background: var(--tissue-uptake);
}

.legend-swatch.offgassing {
  background: var(--tissue-offgassing);
}

.legend-swatch.deco {
  background: var(--tissue-deco);
}

.legend-swatch.desat {
  background: #5aa469;
}

.legend-swatch.supersat {
  background: #f4a261;
}

.legend-line {
  width: 14px;
  height: 2px;
}

.legend-line.inspired {
  background: var(--tissue-inspired);
}

.legend-line.surface-m {
  background: var(--tissue-surface-m);
}

.legend-line.ambient {
  background: #7fb3ff;
}

.tissue-tooltip {
  position: absolute;
  z-index: 9999;
  left: 0;
  top: 0;
  min-width: 180px;
  padding: 10px 12px;
  pointer-events: none;
  display: none;
  opacity: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  box-shadow: 0 10px 24px rgba(28, 42, 56, 0.18);
}

.tissue-tooltip.visible {
  display: block;
  opacity: 1;
}

/* ─── Analysis block ─────────────────────────────────────────────────────── */
.analysis-card {
  margin-top: 22px;
}

.analysis-block {
  padding: 16px 0;
  border-top: 1px solid var(--border-soft);
}

.analysis-block:first-child {
  border-top: none;
  padding-top: 0;
}

.analysis-subtitle {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.analysis-line {
  margin-bottom: 8px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.analysis-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.analysis-note-soft {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

.analysis-link {
  margin-top: 10px;
}

.analysis-link a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.analysis-link a:hover {
  text-decoration: underline;
}

/* ─── Final ascent cards ─────────────────────────────────────────────────── */
.final-ascent-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.final-ascent-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
}

.final-ascent-card-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.final-ascent-card-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.final-ascent-card-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── GF tissue strip ────────────────────────────────────────────────────── */
.gf-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 14px 0 8px;
}

.gf-tissue-card {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-soft-2);
}

.gf-tissue-card.is-leading {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(47, 125, 223, 0.12) inset;
}

.gf-tissue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.gf-tissue-name {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-primary);
  font-weight: 500;
}

.gf-tissue-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gf-tissue-half {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.gf-tissue-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 8px;
}

.gf-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #dfe7ef;
  overflow: hidden;
}

.gf-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.gf-band-low {
  background: #6fae8a;
}

.gf-band-mid {
  background: #d7a252;
}

.gf-band-high {
  background: #c96b6b;
}

/* ─── Summary text helpers ──────────────────────────────────────────────── */
.summary-block {
  margin-top: 18px;
}

.summary-subtitle {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-line {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.summary-line strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── Footer note ───────────────────────────────────────────────────────── */
.tool-footer-note {
  margin-top: 14px;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.privacy-icon {
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .pf-tool-main .pf-tool-frame.dive-analyser-tool {
    max-width: 100%;
  }
}

@media (max-width: 1100px) {
  .profile-bar {
    grid-template-columns: 1fr 1fr;
  }

  .profile-status {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  :root {
    --chart-h: 280px;
  }

  .tissue-bars {
    gap: 5px;
    grid-template-columns: repeat(16, minmax(14px, 1fr));
  }

  .tissue-bar-label {
    font-size: 0.62rem;
  }

  .tissue-cursor-meta {
    gap: 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 700px) {
  .profile-bar {
    grid-template-columns: 1fr;
  }

  .drop-zone,
  .dive-selector {
    max-width: 100%;
  }

  .final-ascent-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  :root {
    --chart-h: 220px;
  }

  .pf-tool-main .pf-tool-frame.dive-analyser-tool {
    padding: 14px;
  }

  .tool-top h1 {
    font-size: 1.75rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-card {
    padding: 18px;
  }

  .tissue-bars {
    height: 220px;
    gap: 4px;
  }

  .tissue-bar-plot {
    height: 185px;
    min-height: 185px;
  }

  .tissue-bars-legend {
    gap: 10px;
    font-size: 0.72rem;
  }
}


@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Karten nebeneinander halten */
  .final-ascent-cards {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  /* Seitenumbruch innerhalb des Blocks verhindern */
  .final-ascent-cards,
  .final-ascent-card {
    break-inside: avoid;
  }

  /* Den ganzen analysis-block zusammenhalten */
  .analysis-block {
    break-inside: avoid;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .no-print,
  .lang-switcher,
  .upload-card,
  .upload-actions,
  .topbar,
  .site-header,
  .site-footer {
    display: none !important;
  }

  main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .section-card,
  .analysis-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  button {
    display: none !important;
  }
}

.gf-profile-chart-wrap {
  position: relative;
  width: 100%;
  min-height: 320px;
  margin-top: 12px;
  margin-bottom: 10px;
}

.gf-profile-legend-note {
  font-size: 0.92rem;
  opacity: 0.85;
  margin-top: 8px;
}

.example-profile-panel {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
}

.example-profile-head h2 {
  margin: 0 0 0.35rem;
}

.example-profile-head p {
  margin: 0 0 1rem;
  opacity: 0.85;
}

.example-profile-list {
  display: grid;
  gap: 0.75rem;
}

.example-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.07);
}

.example-profile-title {
  font-weight: 700;
}

.example-profile-meta {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.15rem;
}

.example-profile-load {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.example-profile-load:disabled {
  opacity: 0.6;
  cursor: wait;
}

.example-profile-error,
.example-profile-empty,
.example-profile-loading {
  margin: 0;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .example-profile-card {
    align-items: stretch;
    flex-direction: column;
  }

  .example-profile-load {
    align-self: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Altitude Simulator
   ═══════════════════════════════════════════════════════════════════════════ */

.altitude-simulator {
  margin-top: 2.5rem;
}

.altitude-card {
  border: 1px solid rgba(20, 40, 80, 0.12);
  border-radius: 1.25rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 35px rgba(10, 20, 40, 0.08);
}

.altitude-intro {
  max-width: 72ch;
  margin: 0.5rem 0 1.25rem;
  line-height: 1.6;
}

.altitude-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.altitude-control {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(244, 247, 252, 0.9);
  border: 1px solid rgba(20, 40, 80, 0.08);
}

.altitude-control span {
  font-weight: 700;
}

.altitude-control input[type="range"] {
  width: 100%;
}

.altitude-control output {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.altitude-summary {
  margin: 1.25rem 0;
}

.altitude-summary-empty {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 205, 0, 0.14);
}

.altitude-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.altitude-summary-item {
  padding: 0.85rem;
  border-radius: 0.9rem;
  background: rgba(244, 247, 252, 0.9);
  border: 1px solid rgba(20, 40, 80, 0.08);
}

.altitude-summary-item span {
  display: block;
  font-size: 0.82rem;
  opacity: 0.75;
  margin-bottom: 0.25rem;
}

.altitude-summary-item strong {
  display: block;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.altitude-summary-gf.low strong,
.altitude-summary-gf.negative strong {
  color: #257a3e;
}

.altitude-summary-gf.medium strong {
  color: #9a6a00;
}

.altitude-summary-gf.high strong {
  color: #b55300;
}

.altitude-summary-gf.critical strong {
  color: #b00020;
}

.altitude-tissue-bars {
  margin-top: 1.25rem;
}

.altitude-bars-head {
  display: grid;
  grid-template-columns: 8rem 1fr 9rem;
  gap: 0.75rem;
  padding: 0 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.75;
}

.altitude-bars-list {
  display: grid;
  gap: 0.45rem;
}

.altitude-tissue-row {
  display: grid;
  grid-template-columns: 8rem 1fr 9rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem;
  border-radius: 0.8rem;
  background: rgba(244, 247, 252, 0.76);
  border: 1px solid rgba(20, 40, 80, 0.07);
}

.altitude-tissue-label {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.altitude-tissue-label strong {
  min-width: 1.6rem;
}

.altitude-tissue-label span {
  font-size: 0.82rem;
  opacity: 0.72;
}

.altitude-tissue-track {
  position: relative;
  height: 0.72rem;
  border-radius: 999px;
  background: rgba(20, 40, 80, 0.1);
  overflow: hidden;
}

.altitude-tissue-fill {
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.8;
}

.altitude-tissue-row.negative,
.altitude-tissue-row.low {
  color: #257a3e;
}

.altitude-tissue-row.medium {
  color: #9a6a00;
}

.altitude-tissue-row.high {
  color: #b55300;
}

.altitude-tissue-row.critical {
  color: #b00020;
}

.altitude-tissue-values {
  display: grid;
  justify-items: end;
  gap: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.altitude-gf {
  font-weight: 800;
}

.altitude-pn2 {
  font-size: 0.78rem;
  opacity: 0.7;
}

.altitude-note {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 205, 0, 0.14);
  border: 1px solid rgba(255, 205, 0, 0.28);
  line-height: 1.55;
}

@media (max-width: 900px) {
  .altitude-controls,
  .altitude-summary-grid {
    grid-template-columns: 1fr;
  }

  .altitude-bars-head {
    display: none;
  }

  .altitude-tissue-values {
    justify-items: start;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Altitude Simulator – vertical comparison chart
   ═══════════════════════════════════════════════════════════════════════════ */

.altitude-explain-card {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0 1.2rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 205, 0, 0.13);
  border: 1px solid rgba(255, 205, 0, 0.28);
  line-height: 1.55;
}

.altitude-explain-card strong {
  font-size: 1rem;
}

.altitude-explain-card span {
  opacity: 0.88;
}

.altitude-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin: 1.5rem 0 0.75rem;
}

.altitude-chart-head strong,
.altitude-chart-head span {
  display: block;
}

.altitude-chart-head span {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  opacity: 0.72;
}

.altitude-chart-scale {
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.75;
  white-space: nowrap;
}

.altitude-column-chart {
  position: relative;
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.75rem;
  min-height: 320px;
  padding: 1rem 0.5rem 0.75rem;
  border-radius: 1.1rem;
  background:
    linear-gradient(to top, rgba(20, 40, 80, 0.08) 1px, transparent 1px);
  background-size: 100% 20%;
  border: 1px solid rgba(20, 40, 80, 0.08);
  overflow-x: auto;
}

.altitude-y-axis {
  position: relative;
  height: 240px;
  margin-top: 2.2rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.68;
}

.altitude-y-tick {
  position: absolute;
  right: 0;
  transform: translateY(50%);
}

.altitude-y-tick span::after {
  content: "%";
}

.altitude-column-grid {
  display: grid;
  grid-template-columns: repeat(16, minmax(2.2rem, 1fr));
  gap: 0.45rem;
  min-width: 720px;
  align-items: end;
}

.altitude-column {
  display: grid;
  grid-template-rows: 2rem 240px auto;
  gap: 0.35rem;
  align-items: end;
  min-width: 2.2rem;
  color: #257a3e;
}

.altitude-column.medium {
  color: #9a6a00;
}

.altitude-column.high {
  color: #b55300;
}

.altitude-column.critical {
  color: #b00020;
}

.altitude-column.negative,
.altitude-column.low {
  color: #257a3e;
}

.altitude-column-value {
  grid-row: 1;
  display: grid;
  justify-items: center;
  align-self: end;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.altitude-column-value strong {
  font-size: 0.9rem;
}

.altitude-column-value span {
  font-size: 0.68rem;
  opacity: 0.72;
}

.altitude-column-plot {
  grid-row: 2;
  position: relative;
  height: 240px;
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 0.8rem;
  background: rgba(20, 40, 80, 0.06);
  overflow: hidden;
}

.altitude-column-fill {
  width: 72%;
  min-height: 2px;
  border-radius: 0.6rem 0.6rem 0 0;
  background: currentColor;
  opacity: 0.78;
  transition: height 220ms ease-out;
}

.altitude-sea-marker {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 3px;
  border-radius: 99px;
  background: #111827;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.78);
  transition: bottom 220ms ease-out;
}

.altitude-column-label {
  grid-row: 3;
  display: grid;
  justify-items: center;
  gap: 0.05rem;
  font-variant-numeric: tabular-nums;
}

.altitude-column-label strong {
  font-size: 0.82rem;
}

.altitude-column-label span {
  font-size: 0.65rem;
  opacity: 0.65;
}

.altitude-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: center;
  margin-top: 0.85rem;
  font-size: 0.86rem;
  opacity: 0.88;
}

.altitude-legend > span {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.legend-line.sea-level {
  display: inline-block;
  width: 1.6rem;
  height: 3px;
  border-radius: 99px;
  background: #111827;
}

.legend-box.altitude {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  background: currentColor;
  color: #b55300;
  opacity: 0.78;
}

@media (max-width: 760px) {
  .altitude-chart-head {
    display: grid;
  }

  .altitude-chart-scale {
    white-space: normal;
  }

  .altitude-column-chart {
    grid-template-columns: 2.4rem 1fr;
  }

  .altitude-column-grid {
    min-width: 620px;
  }
}