/* ---------------------------------------------------------------------
   Design-Tokens - ein Satz Variablen statt verstreuter Hex-Werte, damit
   Farbe/Radius/Abstand/Schatten konsistent bleiben und sich an einer
   Stelle anpassen lassen. Dunkles Theme (bewusst nur ein Modus, kein
   Umschalter - die App ist ein privates Ein-Personen-Tool, kein
   halbfertiger Toggle nötig). Die Farben sind die dokumentierten
   Dark-Mode-Schritte aus der dataviz-Referenzpalette (siehe compare.js) -
   dieselbe Quelle wie die Chart-Farben, dadurch wirkt die App als ein
   System statt aus Einzelteilen zusammengesetzt. Gegen die dunkle Fläche
   #1a1a19 validiert (validate_palette.js, --mode dark): alle 4 Slots
   bestehen CVD- und Kontrast-Check ohne Abstriche.
   --------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --color-page: #0d0d0d;
  --color-surface: #1a1a19;
  --color-surface-muted: #222220;
  --color-border: #2c2c2a;
  --color-border-strong: #3d3d3a;
  --color-text: #ffffff;
  --color-text-secondary: #c3c2b7;
  --color-text-muted: #898781;

  --color-accent: #3987e5;
  --color-accent-hover: #6da7ec;
  --color-accent-soft: rgba(57, 135, 229, 0.16);
  --color-accent-soft-border: rgba(57, 135, 229, 0.4);
  --color-accent-contrast: #ffffff;

  --color-good-bg: rgba(12, 163, 12, 0.18);
  --color-good-text: #2fc32f;
  --color-warn-bg: rgba(250, 178, 25, 0.16);
  --color-warn-text: #fab219;
  --color-warn-strong-bg: rgba(250, 178, 25, 0.26);
  --color-warn-strong-text: #ffc94d;
  --color-danger-bg: rgba(208, 59, 59, 0.2);
  --color-danger-text: #e2685f;
  --color-danger-border: rgba(208, 59, 59, 0.45);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.3);

  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  padding: 1.75rem;
  background: var(--color-page);
  color: var(--color-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 1800px;
  margin: 0 auto;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.app-logo {
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 6px rgba(57, 135, 229, 0.35));
}

header h1 {
  margin: 0 0 0.15rem;
  font-size: 1.55rem;
  font-weight: 700;
}

header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
}

.app-tab > h2:first-child {
  margin-top: 0;
}

a {
  color: var(--color-accent);
}

/* ---------------------------------------------------------------------
   Import-Bereich
   --------------------------------------------------------------------- */
#import-section {
  margin-bottom: 1.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1.25rem;
}

#import-section > label {
  font-weight: 600;
  font-size: 0.9rem;
}

#import-status {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.reference-date-field {
  margin-top: 0.9rem;
}

/* ---------------------------------------------------------------------
   Buttons - eine gemeinsame Basis für alle button-artigen Elemente,
   Primär-/Gefahren-Varianten setzen nur Farbe/Rand ab. Kein Klassen-
   Umbau in HTML/JS nötig, alle bestehenden Container-Selektoren bleiben.
   --------------------------------------------------------------------- */
.storage-actions button,
.compare-bar button,
.tactics-preset-btn,
.tactics-add button,
.view-nav-btn,
.filters button,
.print-bar button,
#hint-thresholds-settings-body button {
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.storage-actions button:hover,
.compare-bar button:hover:not(:disabled),
.tactics-preset-btn:hover,
.tactics-add button:hover,
.view-nav-btn:hover,
.filters button:hover,
.print-bar button:hover,
#hint-thresholds-settings-body button:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
}

.storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

#backup-export-btn {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

#backup-export-btn:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-accent-contrast);
}

#reset-kader-btn {
  color: var(--color-danger-text);
  border-color: var(--color-danger-border);
}

#reset-kader-btn:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-text);
  color: var(--color-danger-text);
}

/* ---------------------------------------------------------------------
   Spielervergleich-Leiste (Kaderübersicht)
   --------------------------------------------------------------------- */
.compare-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  padding: 0.55rem 0.9rem;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent-soft-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--color-text);
}

.compare-bar button:first-of-type {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.compare-bar button:first-of-type:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-accent-contrast);
}

.compare-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------------------------------------------------------------------
   Taktik-Presets
   --------------------------------------------------------------------- */
.tactics-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.tactics-preset-btn.active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}

.tactics-add {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
  font-size: 0.8rem;
}

.tactics-add select {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.tactics-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5rem;
}

.tactics-sidebar {
  flex: 1;
  min-width: 220px;
}

.tactics-sidebar h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.tactics-board {
  position: relative;
  width: 100%;
  max-width: 360px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  background: linear-gradient(180deg, #2b8a3e, #185e26);
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 1rem;
  overflow: hidden;
  touch-action: none;
}

.tactics-halfway-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
}

.tactics-center-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70px;
  height: 70px;
  margin-left: -35px;
  margin-top: -35px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
}

.tactics-box {
  position: absolute;
  left: 25%;
  width: 50%;
  height: 12%;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.tactics-box-top {
  top: 0;
  border-top: none;
}

.tactics-box-bottom {
  bottom: 0;
  border-bottom: none;
}

.tactics-zone-line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.tactics-zone-label {
  position: absolute;
  top: 0.3rem;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.7rem;
  font-weight: 600;
  pointer-events: none;
}

.tactics-row-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.tactics-row-label {
  position: absolute;
  left: 0.3rem;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.6rem;
  font-weight: 600;
  pointer-events: none;
}

.tactic-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.tactic-marker:active {
  cursor: grabbing;
}

.tactic-marker-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: #e2685f;
  color: #1a1a19;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}

/* ---------------------------------------------------------------------
   Positionslücken (Kadertiefe)
   --------------------------------------------------------------------- */
.position-gaps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.position-gap-chip {
  background: var(--color-accent-soft);
  color: var(--color-accent-hover);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 120ms ease;
}

.position-gap-chip.selected {
  border-color: var(--color-accent);
}

.position-gap-chip.tight {
  background: var(--color-warn-strong-bg);
  color: var(--color-warn-strong-text);
}

.position-gap-chip.thin {
  background: var(--color-warn-bg);
  color: var(--color-warn-text);
}

.position-gap-chip.missing {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

/* ---------------------------------------------------------------------
   Haupt-Navigation
   --------------------------------------------------------------------- */
.view-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  padding: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.view-nav-btn {
  border-color: transparent;
}

.view-nav-btn.active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}

.view-nav-btn.active:hover {
  color: var(--color-accent-contrast);
}

.print-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.app-tab h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.app-tab h3:first-of-type {
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------------
   Karten - gemeinsames Muster für Hinweis-Boxen, Einstellungs-Panels,
   Standardsituationen-Kategorien: weiße Fläche, dezenter Rand + Schatten
   statt reinem Flat-Border, damit sich Inhalt vom Seitenhintergrund abhebt.
   --------------------------------------------------------------------- */
.hints-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hint-summary-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.7rem 1rem;
  min-width: 200px;
  font-size: 0.85rem;
}

.hint-summary-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.hint-summary-box ul {
  margin: 0;
  padding-left: 1.1rem;
}

.hint-summary-box li {
  list-style: none;
  margin-left: -1.1rem;
  padding: 0.1rem 0;
}

.hint-resolved-checkbox {
  margin-right: 0.4rem;
}

.hint-summary-box li.resolved {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.quality-settings {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.6rem 1rem;
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
}

.quality-settings summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

#quality-settings-body,
#hint-thresholds-settings-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  align-items: flex-end;
}

#hint-thresholds-settings-body input {
  width: 5rem;
}

/* Reset-Button immer in eigener Zeile unter den Feldern, statt neben dem
   deutlich höheren Checkbox-Feld zu schweben (beide sind Flex-Items in
   #hint-thresholds-settings-body). */
#hint-thresholds-settings-body > button {
  flex: 1 0 100%;
}

/* Die 8 Einsatzstatus-Namen sind länger als typische Attribut-Kürzel (z.B.
   "Talent vor Durchbruch") - breiter/höher als die Standard-Checkbox-Gruppe,
   damit alle ohne Scrollen sichtbar sind. */
#hint-thresholds-settings-body .checkbox-group {
  width: 300px;
  max-height: 260px;
}

#quality-table-wrapper,
#performance-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  background: var(--color-surface);
}

.standards-note {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 0;
}

.standards-results {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.standards-category {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.7rem 1rem;
  min-width: 220px;
  font-size: 0.85rem;
}

.standards-category h4 {
  margin: 0 0 0.4rem 0;
  font-size: 0.9rem;
}

.standards-category ol {
  margin: 0;
  padding-left: 1.2rem;
}

.standards-category .standards-role {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.warnings {
  color: var(--color-warn-text);
  background: var(--color-warn-bg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------------
   Filter / Formularfelder
   --------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
}

.filter-field label {
  color: var(--color-text-secondary);
}

.filter-field input,
.filter-field select,
#reference-date {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.filter-field input:focus,
.filter-field select:focus,
#reference-date:focus,
.checkbox-group input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.3rem;
  width: 260px;
  max-height: 130px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
}

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.checkbox-chip:hover {
  border-color: var(--color-accent);
}

.filters button {
  height: fit-content;
}

/* ---------------------------------------------------------------------
   Tabellen
   --------------------------------------------------------------------- */
th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  background: var(--color-accent-soft);
}

#table-wrapper,
#previous-import-table-wrapper,
#position-gaps-detail-table-wrapper {
  overflow-x: auto;
  max-height: 70vh;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  background: var(--color-surface);
}

#previous-import-table-wrapper {
  margin-top: 0.75rem;
}

.position-gap-detail-heading {
  font-weight: 700;
  margin: 0.75rem 0 0.4rem 0;
  font-size: 0.9rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}

th, td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--color-border-strong);
}

tbody tr:nth-child(even) {
  background: var(--color-surface-muted);
}

tbody tr.clickable-row {
  cursor: pointer;
  transition: background-color 100ms ease;
}

tbody tr.clickable-row:hover {
  background: var(--color-accent-soft);
}

/* ---------------------------------------------------------------------
   Spielerprofil / Positions-Detail
   --------------------------------------------------------------------- */
.profile-page {
  max-width: 980px;
  margin: 0 auto;
}

.position-page {
  max-width: none;
  margin: 0;
}

#profile-content h1,
#position-content h1,
#compare-content h1 {
  margin-top: 0;
  margin-bottom: 0.15rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.profile-subtitle {
  margin-top: 0;
  color: var(--color-text-secondary);
}

.profile-note-label {
  display: block;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.profile-note {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 4rem;
  margin-top: 0.35rem;
  padding: 0.55rem;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.profile-note:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* Spielerprofil - Felder in thematische Abschnitte gebündelt (Basis/
   Leistung/Attribute/Weitere Felder, siehe profile.js) statt einer langen
   flachen Liste. Jeder Abschnitt ist eine eigene Karte; Prozentwerte und
   1-20-Attribute bekommen zusätzlich einen kompakten Balken (dieselbe
   Optik wie der Spielervergleich-Chart, siehe .compare-chart-bar-*). */
.profile-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.1rem;
}

.profile-section {
  width: 100%;
}

/* Zwei Spalten nebeneinander, wenn die Breite es hergibt (Profilseite ist
   auf 980px gewachsen) - fällt auf schmalen Bildschirmen automatisch auf
   eine Spalte zurück. Dasselbe Rasterprinzip wie .profile-bar-grid. */
.profile-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.4rem 2rem;
  font-size: 0.9rem;
}

.profile-field-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.profile-field-label {
  color: var(--color-text-secondary);
}

/* Lange Feldnamen ("Anteil erfolgreicher Zweikämpfe") werden abgeschnitten,
   tragen aber ein title-Attribut als Tooltip (siehe makeBarGrid in profile.js). */
.profile-bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 0.4rem 2rem;
}

.profile-field-grid + .profile-bar-grid {
  margin-top: 0.75rem;
}

.profile-bar-grid .compare-chart-bar-name {
  width: 200px;
}

.profile-bar-grid .compare-chart-bar-value {
  width: 40px;
}

.profile-weitere summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.profile-weitere .profile-field-grid {
  margin-top: 0.75rem;
}

/* ---------------------------------------------------------------------
   Spielervergleich (compare.html/compare.js) - grüne Markierung nur bei
   echten Leistungswerten (siehe compare.js), Statusfarbe statt einer
   Serienfarbe, da sie einen Zustand ("bester Wert") statt eine Identität
   ausdrückt.
   --------------------------------------------------------------------- */
.compare-best {
  background: var(--color-good-bg);
  color: var(--color-good-text);
  font-weight: 700;
}

.compare-chart-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.compare-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0.5rem 0 1.1rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.compare-chart-legend-item {
  display: flex;
  align-items: center;
}

.compare-chart-row {
  margin-bottom: 1.1rem;
}

.compare-chart-row-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 0.35rem;
}

.compare-chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.compare-chart-bar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.compare-chart-bar-name {
  width: 160px;
  flex: 0 0 auto;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-chart-bar-track {
  flex: 1 1 auto;
  height: 20px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.compare-chart-bar-fill {
  height: 100%;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  min-width: 2px;
}

.compare-chart-bar-value {
  width: 70px;
  flex: 0 0 auto;
  text-align: right;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.compare-best-text {
  color: var(--color-good-text);
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Schmale Bildschirme (Handy) - der Rest der App ist dank flex-wrap/
   auto-fit-Rastern schon von selbst responsiv (getestet bei 375px:
   Filter, Taktik-Board, Karten, Balken-Raster stapeln sauber ohne
   horizontales Seiten-Scrollen). Zwei gezielte Korrekturen bleiben:
   die Haupt-Navigation wirkt mit ungleich breiten, zeilenweise
   umbrechenden Buttons unruhig, und breite Tabellen scrollen zwar
   schon innerhalb ihres Wrappers (siehe #table-wrapper), aber ohne
   sichtbaren Scrollbalken ist auf einem Touch-Gerät nicht erkennbar,
   dass dort seitlich gewischt werden kann.
   --------------------------------------------------------------------- */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  .view-nav {
    flex-direction: column;
  }

  .view-nav-btn {
    width: 100%;
    text-align: left;
  }

  #table-wrapper,
  #previous-import-table-wrapper,
  #position-gaps-detail-table-wrapper {
    scrollbar-width: thin;
  }

  #table-wrapper::-webkit-scrollbar,
  #previous-import-table-wrapper::-webkit-scrollbar,
  #position-gaps-detail-table-wrapper::-webkit-scrollbar {
    height: 6px;
  }

  #table-wrapper::-webkit-scrollbar-thumb,
  #previous-import-table-wrapper::-webkit-scrollbar-thumb,
  #position-gaps-detail-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 3px;
  }
}

/* ---------------------------------------------------------------------
   Druckansicht - druckt die gerade sichtbare Ansicht (Reiter), Rest
   entscheidet switchTab wie gehabt. Die einfachste Lösung, weil die App
   ohnehin per Design-Tokens arbeitet: die Tokens selbst auf ein helles,
   tintensparendes Farbschema umstellen (das dunkle Theme ist nur für den
   Bildschirm gedacht) - der Großteil der Komponenten passt sich dadurch
   automatisch an, ohne jede Karte/Tabelle einzeln umzustellen. Dazu
   gezielt die Steuer-/Eingabe-Elemente ausblenden (Import-Bereich, Nav,
   Einstellungs-Panels, Vergleichsauswahl, Druck-Button selbst) und
   Tabellen von ihrer Bildschirm-Scrollbegrenzung befreien, damit der
   Inhalt vollständig über mehrere Seiten läuft statt abgeschnitten zu
   werden. */
@page {
  size: landscape;
  margin: 12mm;
}

@media print {
  :root {
    color-scheme: light;
    --color-page: #ffffff;
    --color-surface: #ffffff;
    --color-surface-muted: #f2f2f2;
    --color-border: #ccc;
    --color-border-strong: #999;
    --color-text: #000000;
    --color-text-secondary: #333333;
    --color-text-muted: #666666;
    --color-accent: #1c5cab;
    --color-accent-hover: #1c5cab;
    --color-accent-soft: #eef2ff;
    --color-accent-soft-border: #ccd4f5;
    --color-accent-contrast: #ffffff;
    --color-good-bg: #e5f7e5;
    --color-good-text: #0a6e0a;
    --color-warn-bg: #fef3c7;
    --color-warn-text: #92400e;
    --color-warn-strong-bg: #fef9c3;
    --color-warn-strong-text: #854d0e;
    --color-danger-bg: #fee2e2;
    --color-danger-text: #991b1b;
    --color-danger-border: #f3b4b4;
    --shadow-card: none;
    --shadow-card-hover: none;
  }

  main {
    max-width: none;
  }

  /* Steuerung/Eingabe - nicht Teil des Berichts, den man drucken will. */
  #import-section,
  .view-nav,
  .print-bar,
  .compare-bar,
  .filters,
  #quality-settings,
  #performance-settings,
  #standards-settings,
  #hint-thresholds-settings,
  #compare-attribute-picker,
  .app-logo {
    display: none !important;
  }

  /* "Vgl."-Auswahlspalte ist nur am Bildschirm relevant. */
  #tab-kader #table-wrapper th:first-child,
  #tab-kader #table-wrapper td:first-child {
    display: none;
  }

  /* Volle Tabellenhöhe statt Scroll-Ausschnitt - der Browser druckt eine
     lange Tabelle ohnehin über mehrere Seiten und wiederholt den Kopf. */
  #table-wrapper,
  #previous-import-table-wrapper,
  #position-gaps-detail-table-wrapper,
  #quality-table-wrapper,
  #performance-table-wrapper {
    max-height: none;
    overflow: visible;
  }

  thead th {
    position: static;
  }

  tbody tr.clickable-row {
    cursor: default;
  }

  /* Das Taktik-Feld nie mitten im Spielfeld auf die nächste Seite umbrechen -
     lieber als Ganzes auf die nächste Seite rutschen, falls es auf der
     aktuellen nicht mehr passt. */
  .tactics-board {
    break-inside: avoid;
  }

  .hint-summary-box,
  .standards-category {
    break-inside: avoid;
  }
}
