/* schwinggenie.ch -- Sägemehl, eine Spalte, dünne Linien, kein Schmuck.
   Kein Framework; diese Datei wird 1:1 in die Site kopiert. */

:root {
  --bg: #e8d9b8;       /* Sägemehl */
  --fg: #2a2118;       /* warmes Schwarz */
  --accent: #7a2e1f;   /* Rotbraun: Links, Sterne, Titelzeilen, aktive Filter */
  --rule: #c9b48c;     /* dünne Linien */
  --muted: #7c6a52;    /* Nebentext */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, sans-serif;
}

.wrap { max-width: 52rem; margin: 0 auto; padding: 0 1rem; }

/* Listen und Profile nutzen grosse Bildschirme aus; Über bleibt Lesbreite.
   Kopf und Fusszeile weiten sich mit (body.wide), der Hintergrund bleibt
   durchgehend Sägemehl. */
body.wide .wrap { max-width: 80rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------------- Kopfzeile */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);       /* sonst scheint beim Scrollen die Tabelle durch */
  border-bottom: 1px solid var(--rule);
}

header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  padding-top: 1.3rem;
  padding-bottom: 1.3rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--fg);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .38em;
  text-transform: uppercase;
}
.brand .mark { width: 2.4rem; height: 2.4rem; flex-shrink: 0; }
.brand:hover { text-decoration: none; color: var(--accent); }

nav { display: flex; gap: 1.4rem; }
nav a { color: var(--fg); }
nav a:hover { color: var(--accent); text-decoration: none; }
nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ------------------------------------------------ Abschnitts-Überschrift */
/* kleine zentrierte Versal-Zeile, wie schlussgang sie über jeden Block setzt */

.label {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .78rem;
  color: var(--muted);
  margin: 2.2rem 0 1rem;
}

/* Seitentitel (die h1 der Listen): die Suchanfrage, wörtlich beantwortet */
h1.pagetitle {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: .02em;
  margin: 2.6rem 0 .4rem;
}
h1.pagetitle + .label { margin-top: .2rem; }

/* Der eine zitierbare Satz: die direkte Antwort auf die Kernfrage, auch
   für KI-Antwortmaschinen lesbar statt nur in Tabellen verborgen */
.lead {
  text-align: center;
  margin: .55rem auto 0;
  max-width: 42rem;
  font-size: 1rem;
  line-height: 1.6;
}
.lead b { font-weight: 650; }

h2 {
  font-size: .95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--muted);
  margin: 2.4rem 0 .8rem;
}

/* ---------------------------------------------------------------- Filter */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0; }

.filters select, .filters input[type="search"] {
  font: inherit;
  font-size: .9rem;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .3rem .45rem;
}
.filters input[type="search"] { width: 9rem; }
.filters select:focus, .filters input:focus { outline: none; border-color: var(--accent); }
.filters select.on, .filters input.on { color: var(--accent); border-color: var(--accent); }

.filters .check {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}
.filters .check input { accent-color: var(--accent); }
.filters .check.on { color: var(--accent); }

.filters .fltlbl { color: var(--muted); font-size: .85rem; letter-spacing: .04em; }

.filters .count { margin-left: auto; color: var(--muted); font-size: .88rem; }

.filters .reset {
  font: inherit;
  font-size: .85rem;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  padding: .2rem 0;
  text-decoration: underline;
}
.filters .reset:hover { color: var(--fg); }

/* Seitenwahl unter den Ranglisten: alles bleibt im HTML (Suchmaschinen
   bekommen die ganze Tabelle), angezeigt wird eine Seite davon */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin: 1.1rem 0 0;
}
.pager a {
  color: var(--fg);
  padding: .15rem .55rem;
  border: 1px solid transparent;
  border-radius: 2px;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pager a:hover { color: var(--accent); text-decoration: none; border-color: var(--rule); }
.pager a.off { color: var(--rule); pointer-events: none; }
.pager .cur {
  color: var(--accent);
  font-weight: 600;
  padding: .15rem .55rem;
  font-variant-numeric: tabular-nums;
}
.pager span:not(.cur) { color: var(--muted); }
.pager select {
  font: inherit;
  font-size: .85rem;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .2rem .4rem;
  margin-left: .8rem;
}
table { scroll-margin-top: 6rem; }   /* Sticky-Header bei Seitenwechsel */

/* ---------------------------------------------------------------- Tabelle */

.tablewrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

th {
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  border-bottom: 2px solid var(--rule);
  padding: .4rem .55rem .4rem 0;
}
th[data-k] { cursor: pointer; user-select: none; }
th[data-k]::after { content: " ↕"; color: var(--muted); }
th[data-k]:hover { color: var(--fg); }
th[data-k]:hover::after { color: var(--fg); }
th.sorted::after { content: " ▾"; color: var(--accent); }
th.sorted.asc::after { content: " ▴"; color: var(--accent); }

/* Legende über der Tabelle: Sterne und Trend sichtbar erklären, nicht
   nur im Hover-Tooltip */
.legend { color: var(--muted); font-size: .78rem; margin: .6rem 0 0; }
.legend .stars { color: var(--accent); }
th.num, td.num { text-align: right; padding-right: .55rem; padding-left: 0; }

td { border-bottom: 1px solid var(--rule); padding: .42rem .55rem .42rem 0; vertical-align: baseline; }
tbody tr:hover { background: rgba(122, 46, 31, .05); }

/* In den Ranglisten brechen Zellen nicht um: die Spalten behalten ihre
   Position, egal wie breit der Bildschirm ist. */
#ranks td, #allzeit td { white-space: nowrap; }

td .muted, .muted { color: var(--muted); }
.stars { color: var(--accent); white-space: nowrap; }

.up { color: var(--accent); }
.down { color: var(--muted); }

/* ------------------------------------------------------------------ Profil */

.profile .head { margin: 2.2rem 0 .4rem; }
.profile h1 { font-size: 1.55rem; margin: 0; letter-spacing: .01em; }
.profile h1 .stars { font-size: 1.1rem; margin-left: .3rem; }
.profile .meta { color: var(--muted); font-size: .92rem; margin: .35rem 0 0; }

/* Fakten unter dem Namen: zweispaltige Tabelle statt Flusszeile */
.profile dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem 2rem;
  margin: 1.05rem 0 0;
}
.profile dl.facts dt {
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  align-self: center;
}
.profile dl.facts dd { margin: 0; }

/* Einordnungs-Kasten über der Rangliste: Ø-Rating je Kranzklasse */
.scale {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.6rem;
  margin: .9rem 0 0; padding: .7rem .9rem;
  border: 1px solid var(--rule); border-radius: 2px;
}
.scale .slbl {
  flex-basis: 100%; color: var(--muted);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .12em;
}
.scale .tile { display: flex; flex-direction: column; }
.scale .tile .tlbl { color: var(--muted); font-size: .8rem; }
.scale .tile .tnum { font-size: 1.35rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }

.ratingbox { display: flex; align-items: baseline; gap: 1.2rem; margin: 1.6rem 0 0; }
.ratingbox .rlbl {
  display: block;
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.ratingbox .big { font-size: 2.6rem; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.ratingbox .where { color: var(--muted); font-size: .92rem; }

/* Im Profil brechen nur die Label-Spalten um: Zahlen, Jahre und "S–G–N"
   bleiben in einer Zeile, sonst quetscht der Browser sie auseinander. */
.profile td:not(:first-child), .profile th:not(:first-child) { white-space: nowrap; }

svg.history { width: 100%; height: auto; margin-top: .5rem; }
svg.history text { font: 11px system-ui, sans-serif; fill: var(--muted); }
svg.history .line { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.history .dot { fill: var(--accent); }
svg.history .now { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; }
svg.history .avg { stroke: var(--rule); stroke-dasharray: 2 4; stroke-width: 1; }
svg.history text.avg { stroke: none; fill: var(--muted); font-size: 10px; }

/* Vergleichs-Kurven: gedämpfte Erdtöne, dieselbe Transformation wie die eigene */
svg.history .cmp { fill: none; stroke-width: 2; }
svg.history .c0 { stroke: #7c6a52; }
svg.history .c1 { stroke: #5f7050; }
svg.history .c2 { stroke: #5b6d7d; }

.compare { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0 0; }
.compare input {
  font: inherit;
  font-size: .88rem;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .3rem .55rem;
  width: min(20rem, 100%);
}
.compare input:focus { outline: none; border-color: var(--accent); }
.compare .hits {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 14rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  z-index: 10;
  display: none;
}
.compare .hits.open { display: block; }
.compare .hits a {
  display: block;
  padding: .3rem .6rem;
  color: var(--fg);
  font-size: .88rem;
  white-space: nowrap;
}
.compare .hits a small { color: var(--muted); margin-left: .4rem; }
.compare .hits a:hover, .compare .hits a.sel { background: var(--accent); color: var(--bg); text-decoration: none; }
.compare .hits a:hover small, .compare .hits a.sel small { color: var(--bg); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .12rem .65rem .12rem .8rem;
  font-size: .8rem;
}
.chip::before { content: ""; width: 1.1rem; border-top: 3px solid var(--rule); margin-right: .1rem; }
.chip.c0::before { border-color: #7c6a52; }
.chip.c1::before { border-color: #5f7050; }
.chip.c2::before { border-color: #5b6d7d; }
.chip button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .95rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.chip button:hover { color: var(--accent); }

/* Kränze und Festlisten: Fliesstext mit Links, keine Tabellen */
.kranze { line-height: 1.9; margin: 0; }
.kranze b { font-weight: 600; }
.festliste { line-height: 1.9; margin: 0; }

/* ------------------------------------------------------------------ Footer */

footer { border-top: 1px solid var(--rule); margin-top: 3rem; }
footer .wrap {
  padding-top: 2.1rem;
  padding-bottom: 1.8rem;
  text-align: center;
}
.footbrand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--fg);
}
.footbrand:hover { text-decoration: none; }
.footbrand .mark { width: 2.2rem; height: 2.2rem; flex-shrink: 0; }
.footbrand span {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .38em;
}
footer .slogan { color: var(--muted); font-size: .92rem; margin: .4rem 0 0; }
footer .legal { color: var(--muted); font-size: .84rem; margin: 1.2rem 0 0; }

/* Zum Seitenanfang: erst sichtbar, wenn man tatsächlich unten war */
#totop {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font: 1.15rem/1 system-ui, sans-serif;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s;
  z-index: 20;
}
#totop.show { opacity: 1; visibility: visible; }
#totop:hover { background: var(--fg); }

/* ------------------------------------------------------------------ Mobil */

@media (max-width: 40rem) {
  header .wrap { gap: .6rem 1.2rem; }
  .brand { font-size: 1.05rem; }
  .brand .mark { width: 1.9rem; height: 1.9rem; }
  nav { gap: 1rem; }

  .filters { flex-direction: column; align-items: stretch; }
  .filters .fltlbl { display: none; }
  .filters select, .filters input[type="search"] { width: 100%; }
  .filters .count { margin-left: 0; }

  /* auf dem Handy bleiben Rang, Schwinger, Rating und Trend */
  .opt { display: none; }

  /* Profil-Tabellen nicht quetschen: natürlich messen und im Zweifel im
     .tablewrap scrollen -- die Spalten behalten ihre Positionen. */
  .profile table { width: auto; min-width: 100%; }

  .label { margin-top: 1.6rem; }
}

/* Festseite: Weg und Fest-Leistung in einer Tabelle.
   Weg = Punkt auf der Spanne leichtester..schwerster Weg des Fests;
   Hantel = ○ Rating vor dem Fest → ● Fest-Leistung, die Zahlen aussen an den Enden. */
.festlead { line-height: 1.6; margin: 1.2rem 0 0; }
.perfexp { margin: .5rem 0 0; }
.perfsum { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: .9rem 0 0; }
.perfsum dt { font-weight: 600; }
.perfsum dd { margin: 0; }
.perfkey i { display: inline-block; vertical-align: middle; margin: 0 .25rem 0 .9rem; }
.perfkey i:first-child { margin-left: 0; }
.perfkey .k-own, .perfkey .k-dot { width: 10px; height: 10px; border-radius: 50%; }
.perfkey .k-own { border: 2px solid var(--fg); }
.perfkey .k-dot { background: var(--fg); }
.perfkey .k-up, .perfkey .k-down { width: 22px; height: 3px; border-radius: 2px; background: var(--accent); }
.perfkey .k-down { background: var(--muted); }

table.weg td, table.weg th { padding-top: .28rem; padding-bottom: .28rem; }
table.weg thead th { white-space: nowrap; vertical-align: bottom; }
table.weg th.wegh { text-align: left; }
table.weg th.center { text-align: center; }
table.weg .stars { color: var(--accent); }

/* Weg: Zahl und Punkt in einer Zelle -- auf dem Handy fällt der Punkt weg */
table.weg td.wegc { white-space: nowrap; }
table.weg td.wegc .wnum { display: inline-block; min-width: 3.2rem; text-align: right;
  font-variant-numeric: tabular-nums; vertical-align: middle; }
table.weg td.wegc .track { display: inline-block; position: relative; width: 7rem; height: 1rem;
  margin-left: .6rem; vertical-align: middle; }
table.weg td.wegc .track::before {
  content: ""; position: absolute; left: .4rem; right: .4rem; top: 50%;
  border-top: 1px solid var(--rule);
}
table.weg td.wegc .track .dot {
  position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: var(--accent);
}

table.weg td.dumb { --pad: 6.5rem; position: relative; min-width: 26rem; width: 50%; }
table.weg td.dumb::before {
  content: ""; position: absolute; left: var(--pad); right: var(--pad); top: 50%;
  border-top: 1px dotted var(--rule);
}
table.weg td.dumb .bar { position: absolute; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; }
table.weg td.dumb .bar.up { background: var(--accent); }
table.weg td.dumb .bar.down { background: var(--muted); }
table.weg td.dumb .dot, table.weg td.dumb .own {
  position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
}
table.weg td.dumb .dot { background: var(--fg); }
table.weg td.dumb .own { background: var(--bg); border: 2px solid var(--fg); }
table.weg td.dumb .lab {
  position: absolute; top: 50%; white-space: nowrap; line-height: 1;
  font-size: .85rem; font-variant-numeric: tabular-nums;
}
table.weg td.dumb .lab.r { transform: translate(9px, -50%); }
table.weg td.dumb .lab.l { transform: translate(calc(-100% - 9px), -50%); }
table.weg td.dumb .lab .up { color: var(--accent); font-weight: 600; }
table.weg td.dumb .lab .down { color: var(--muted); }

/* Handy: keine Hantel, nur Fest-Leistung mit dem ± klein darunter; Namen
   dürfen umbrechen, die Kurzfassung steht untereinander */
@media (max-width: 40rem) {
  table.weg td.dumb { min-width: 0; width: auto; text-align: right; }
  table.weg td.dumb::before, table.weg td.dumb .bar, table.weg td.dumb .own,
  table.weg td.dumb .dot, table.weg td.dumb .lab.muted { display: none; }
  table.weg td.dumb .lab { position: static; transform: none; line-height: 1.25; }
  table.weg td.dumb .lab .up, table.weg td.dumb .lab .down,
  table.weg td.dumb .lab .muted { display: block; font-size: .75rem; }
  table.weg td.wegc .track { display: none; }
  table.weg td.wegc .wnum { min-width: 0; }
  table.weg td:nth-child(2) { white-space: normal; }
  table.weg thead th { white-space: normal; letter-spacing: .06em; }
  table.weg thead th:first-child { white-space: nowrap; }
  table.weg td:first-child { padding-right: .4rem; }
  .perfsum { grid-template-columns: 1fr; gap: .1rem; }
  .perfsum dd { margin-bottom: .5rem; }
}

/* Sortierung einer Einzeltabelle zurücksetzen (app.js blendet ihn ein) */
.tblreset {
  display: block; margin: .6rem 0 0 auto; padding: .25rem .7rem;
  font: inherit; font-size: .85rem; color: var(--accent);
  background: none; border: 1px solid var(--accent); border-radius: 2px; cursor: pointer;
}
.tblreset:hover { background: var(--accent); color: var(--bg); }
.tblreset[hidden] { display: none; }
