/* ── Twemoji: Emoji-Bilder korrekt im Text ausrichten ── */
img.emoji {
  height: 1em;
  width: 1em;
  margin: 0 0.05em 0 0.1em;
  vertical-align: -0.1em;
  display: inline-block;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:     #1a56a0;
  --blue-dk:  #154390;
  --blue-lt:  #e8f0fb;
  --gold:     #d4ac0d;
  --green:    #2e7d32;
  --red:      #c0392b;
  --gray-1:   #f5f5f5;
  --gray-2:   #e0e0e0;
  --gray-3:   #9e9e9e;
  --gray-4:   #424242;
  --text:     #212121;
  --shadow:   0 1px 4px rgba(0,0,0,.12);
  --radius:   8px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-1);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ── Header ── */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Homescreen-PWA (iOS): Statusbalken oben freihalten */
  padding-top: env(safe-area-inset-top);
}

header {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo { height: 36px; width: auto; display: block; flex-shrink: 0; }
h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.header-sub { font-size: 0.72rem; opacity: .85; }
.header-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.header-status-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-reload-btn {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: .02em;
  transition: background .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-reload-btn:hover { background: rgba(255,255,255,.32); }
.reload-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  vertical-align: middle;
}
.update-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray-3);
  flex-shrink: 0;
}
.update-dot.ok    { background: #52d987; }
.update-dot.error { background: #ff7043; }
.update-dot.scraping { background: #ffd54f; animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.update-time { font-size: 0.7rem; opacity: .85; white-space: nowrap; }
.refresh-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.refresh-btn:hover { background: rgba(255,255,255,.35); }
.refresh-btn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Nav ── */
.main-nav {
  background: var(--blue-dk);
  display: flex;
  gap: 2px;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.nav-btn:hover { color: #fff; }
.nav-btn.active { color: #fff; border-bottom-color: #fff; }
.nav-admin {
  margin-left: auto;
  text-decoration: none;
  opacity: .75;
  border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 16px;
}
.nav-admin:hover { opacity: 1; }
.nav-embed-btn {
  margin-left: auto;
  opacity: .8;
  border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 16px;
  font-family: monospace;
  letter-spacing: -.02em;
}
.nav-embed-btn:hover { opacity: 1; color: #fff; }

/* ── Main layout ── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}
.tab { display: none; }
.tab.active { display: block; }

/* ── Filters ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.filter-btn {
  background: #fff;
  border: 1.5px solid var(--gray-2);
  color: var(--gray-4);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
}
.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.filter-select {
  border: 1.5px solid var(--gray-2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .8rem;
  color: var(--gray-4);
  background: #fff;
  cursor: pointer;
}

/* ── Athleten-Profilleiste ── */
#athlete-profile-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.athlete-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--blue);
  text-decoration: none;
  border: 1.5px solid var(--blue);
  border-radius: 20px;
  padding: 4px 12px 4px 9px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.athlete-profile-link:hover { background: var(--blue); color: #fff; }
.athlete-profile-ig { color: #c13584; border-color: #c13584; }
.athlete-profile-ig:hover { background: #c13584; color: #fff; }
.profile-link-icon { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Month group (collapsible) ── */
.month-group { margin-bottom: 4px; }

.month-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--gray-1);
  border: none;
  border-bottom: 2px solid var(--blue);
  padding: 9px 2px 7px;
  cursor: pointer;
  text-align: left;
  position: sticky;
  top: calc(103px + env(safe-area-inset-top)); /* height of .sticky-top (header + nav) + iOS safe area */
  z-index: 5;
  transition: background .15s;
}
.month-header:hover { background: var(--blue-lt); }

.month-label {
  font-size: .82rem;
  font-weight: 800;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.month-count {
  font-size: .74rem;
  color: var(--gray-3);
  margin-left: auto;
}
.month-chevron {
  width: 16px;
  height: 16px;
  color: var(--blue);
  flex-shrink: 0;
  transition: transform .2s ease;
}
.month-header[aria-expanded="false"] .month-chevron {
  transform: rotate(-90deg);
}

.month-body { display: none; padding-top: 6px; }
.month-body--open { display: block; }

/* ── Date group ── */
.date-group { margin-bottom: 10px; }
.date-header {
  font-weight: 700;
  font-size: .82rem;
  color: var(--gray-4);
  padding: 4px 0 5px;
  border-bottom: 2px solid var(--gray-2);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-header .today-badge {
  background: var(--blue);
  color: #fff;
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}
.date-header .future-badge {
  background: var(--blue);
  color: #fff;
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ── Result card ── */
.result-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 5px 10px 4px;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gray-2);
  position: relative;
  transition: box-shadow .15s;
}
.result-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.13); }
.result-card--highlight {
  animation: highlight-pulse 3s ease-out forwards;
}
@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 37,99,235), .55); background: rgba(var(--accent-rgb, 37,99,235), .07); }
  70%  { box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 37,99,235), .15); background: rgba(var(--accent-rgb, 37,99,235), .03); }
  100% { box-shadow: none; background: transparent; }
}
.result-card.level-olympia { border-left-color: #c9960a; }       /* gold   */
.result-card.level-wm        { border-left-color: #7d3098; }       /* lila        */
.result-card.level-em        { border-left-color: var(--blue); }   /* blau        */
.result-card.level-wtcs      { border-left-color: #1565c0; }       /* deep blue   */
.result-card.level-wc        { border-left-color: #e65100; }       /* orange      */
.result-card.level-ec        { border-left-color: var(--green); }  /* grün        */
.result-card.level-coc       { border-left-color: #3949ab; }       /* indigo      */
.result-card.level-ironman   { border-left-color: #b71c1c; }       /* rot         */
.result-card.level-challenge { border-left-color: #00695c; }       /* dunkel-teal */
.result-card.level-t100      { border-left-color: #6a1b9a; }       /* lila        */
.result-card.level-junior    { border-left-color: #00897b; }       /* teal        */
.result-card.level-bundesliga{ border-left-color: #e65100; }       /* orange-dunkel */
.result-card.level-eyof,
.result-card.level-yog     { border-left-color: #00897b; }       /* teal   */
/* Sport-spezifische Overrides: einheitliche Randfarbe unabhängig vom Level */
.result-card.sport-reiten       { border-left-color: var(--blue)   !important; border-left-style: solid !important; }
.result-card.sport-eiskunstlauf { border-left-color: #00838f !important; border-left-style: solid !important; }

/* ── Meldungs-Card ──────────────────────────────────────────────────────────── */
.result-card.notice-card {
  border-left-color: #546e7a;
  border-left-style: dashed;
  background: #f8f9fa;
}
.notice-header {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.notice-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}
.notice-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.notice-tags {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.notice-cat-tag, .notice-sport-tag {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
}
.notice-cat-tag   { background: #eceff1; color: #546e7a; border: 1px solid #cfd8dc; }
.notice-sport-tag { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.notice-text {
  font-size: .86rem;
  color: var(--gray-5);
  margin-top: 5px;
  line-height: 1.5;
}
.notice-athletes {
  font-size: .83rem;
  color: var(--gray-4);
  margin-top: 4px;
}

.card-header {
  font-size: .85rem;
  color: var(--gray-4);
  margin-bottom: 5px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-meta {
  flex: 1;
  line-height: 1.4;
}
.card-level {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.level-badge-olympia { background: #fef9e7; color: #9a7d0a; border: 1px solid #f9e79f; }  /* gold    */
.level-badge-wm        { background: #f5eef8; color: #6c3483; border: 1px solid #d7bde2; }  /* lila        */
.level-badge-em        { background: #eaf2ff; color: #1a5276; border: 1px solid #aed6f1; }  /* blau        */
.level-badge-wtcs      { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }  /* deep blue   */
.level-badge-wc        { background: #fff3e0; color: #bf360c; border: 1px solid #ffcc80; }  /* orange      */
.level-badge-ec        { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }  /* grün        */
.level-badge-coc       { background: #e8eaf6; color: #283593; border: 1px solid #9fa8da; }  /* indigo      */
.level-badge-ironman   { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }  /* rot         */
.level-badge-challenge { background: #e0f2f1; color: #00695c; border: 1px solid #80cbc4; }  /* dunkel-teal */
.level-badge-t100      { background: #ede7f6; color: #4527a0; border: 1px solid #b39ddb; }  /* lila        */
.level-badge-junior  { background: #e0f2f1; color: #00695c; border: 1px solid #80cbc4; }  /* teal    */
.level-badge-eyof,
.level-badge-yog     { background: #e0f2f1; color: #00695c; border: 1px solid #80cbc4; }  /* teal    */
.level-badge-bundesliga { background: #fff8e1; color: #e65100; border: 1px solid #ffcc02; }  /* amber (österr. Bundesliga) */
.level-badge-om      { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }  /* grün (nationale Meisterschaft) */
.level-badge-other   { background: var(--gray-2); color: var(--gray-4); border: 1px solid #ccc; }

.card-athletes {
  font-size: .82rem;
  line-height: 1.45;
}

/* ── Leichtathletik card ─────────────────────────────────────────────────────── */
.la-athletes { font-size: .82rem; }
.la-athlete-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}
.la-athlete-left {
  flex: 1;
}
.la-mark {
  color: var(--gray-4);
}
.la-mark-pb {
  color: var(--gold);
}
.la-mark-sb {
  color: #1565c0;
}
/* Halle / Freiluft Badge */
.card-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.la-env-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
  letter-spacing: .02em;
}
.la-env-halle {
  background: #e8f4fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}
.la-env-freiluft {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.la-wind {
  font-size: .74rem;
  color: var(--gray-3);
  font-weight: 400;
}
.la-pb {
  font-size: .74rem;
  color: var(--gray-3);
  white-space: nowrap;
  text-align: right;
  flex-shrink: 0;
  display: block;
}
.la-pb-new,
.la-athlete-row:has(.la-mark-pb) .la-pb,
.hepta-disc-row:has(.la-mark-pb) .la-pb {
  color: var(--gold);
  font-weight: 700;
}
.la-sb {
  font-size: .74rem;
  color: var(--gray-3);
  white-space: nowrap;
  text-align: right;
  flex-shrink: 0;
  display: block;
}
.la-sb-new,
.hepta-disc-row:has(.la-mark-sb) .la-sb {
  color: #1565c0;
  font-weight: 700;
}
.la-athlete-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
/* ── Siebenkampf Einzeldisziplinen ─────────────────────────────────────────── */
.hepta-disciplines {
  margin-top: .45rem;
  padding-top: .35rem;
  border-top: 1px solid var(--gray-1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hepta-disc-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .25rem .5rem;
  font-size: .8rem;
}
.hepta-disc-name {
  min-width: 8rem;
  color: var(--gray-3);
  flex-shrink: 0;
}
.hepta-disc-mark {
  font-weight: 600;
}
/* PB/SB-Farben aus der Leichtathletik auch im Siebenkampf */
.hepta-disc-mark.la-mark-pb { color: var(--gold); }
.hepta-disc-mark.la-mark-sb { color: #1565c0; }
.hepta-disc-pending {
  color: var(--gray-2);
}
.hepta-disc-bests {
  display: flex;
  gap: .35rem;
  margin-left: auto;
}
.hepta-disc-place {
  font-weight: 600;
  min-width: 1.8rem;
  color: var(--text-main);
  flex-shrink: 0;
}
.hepta-disc-pts {
  font-size: .75rem;
  color: var(--gray-3);
  margin-left: .15rem;
}
.hepta-interim {
  margin-top: .4rem;
  padding-top: .35rem;
  border-top: 1px dashed var(--gray-1);
  font-size: .78rem;
  color: var(--gray-3);
}
.hepta-interim strong {
  color: var(--text-main);
  font-weight: 600;
}

.la-winner {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px solid var(--gray-2);
  font-size: .78rem;
  color: var(--gray-3);
}
.la-winner-label {
  font-weight: 600;
  color: var(--gray-4);
  white-space: nowrap;
}
.la-winner-name {
  font-weight: 600;
  color: var(--gray-4);
}
.la-winner-mark {
  color: var(--gray-4);
}
.card-team-members {
  font-size: .82rem;
  margin-top: 3px;
  line-height: 1.45;
}
.athlete-name { font-weight: 700; cursor: pointer; }
.athlete-result { color: var(--gray-4); }
.winner-line { color: var(--gray-3); font-size: .78rem; }
.athlete-wrl { color: var(--gray-3); font-size: .76rem; }
.athlete-qual { color: var(--gray-3); font-size: .76rem; }
.athlete-fights { color: var(--gray-3); font-size: .76rem; font-style: italic; }
.athlete-time { color: var(--gray-3); font-size: .82rem; }
.athlete-gap { color: var(--gray-4); font-size: .78rem; }
.athlete-splits { color: var(--gray-3); font-size: .76rem; }
.tri-athletes { display: flex; flex-direction: column; gap: .2rem; }
.tri-athlete-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; }
.tri-winner-line { color: var(--gray-3); font-size: .76rem; margin-top: .2rem; }
.reiten-horse { color: var(--gray-3); font-size: .82rem; font-style: italic; }

/* ── Schwimmen card ── */
.swim-badges { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.swim-pool-badge {
  display: inline-block;
  font-size: .68rem; font-weight: 600; letter-spacing: .03em;
  padding: .15rem .45rem; border-radius: 3px;
  white-space: nowrap;
}
.swim-pool-kb { background: #e8f4fd; color: #0369a1; border: 1px solid #bae0f9; }
.swim-pool-lb { background: #e0f5ee; color: #047857; border: 1px solid #a7f3d0; }

/* ── Badminton tournament card ── */
.badminton-card { display: flex; flex-direction: column; gap: .5rem; }
.badminton-athlete { padding: .1rem 0; }
.badminton-athlete + .badminton-athlete { border-top: 1px solid var(--gray-5); padding-top: .4rem; margin-top: .1rem; }
.badminton-athlete-name { margin-bottom: .15rem; }
.badminton-disc-header {
  display: flex; align-items: baseline; gap: .4rem;
  font-size: .84rem; color: var(--gray-2);
  margin-bottom: .1rem;
}
.badminton-disc-label { font-weight: 600; color: var(--gray-1); }
.badminton-partner { color: var(--gray-3); font-weight: 400; }
.badminton-disc-result { margin-left: auto; }
.badminton-pair-name { font-weight: 700; color: #000; }
.badminton-name-sep  { color: var(--gray-3); font-size: .80rem; }

/* Badminton match grid – narrower phase column than Judo */
.badminton-fights {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  margin-top: 4px;
  font-size: .80rem;
}
.badminton-fights .judo-fight { display: contents; }
.badminton-fights .judo-phase::after {
  content: "QF";
}

/* ── Judo fight-by-fight display ── */
.judo-header {
  line-height: 1.6;
}
.judo-fights {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  margin-top: 4px;
  font-size: .80rem;
}
.judo-fight {
  display: contents;
}
.judo-fight-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  line-height: 1.5;
}
.judo-phase {
  font-weight: 700;
  color: var(--gray-5);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.5;
  white-space: nowrap;
}
/* Invisible sizer: forces the phase column to always be at least as wide
   as "MEDAILLENKAMPF" (the longest phase label), regardless of which
   phases are actually present in the fight list. */
.judo-phase::after {
  content: "Medaillenkampf";
  display: block;
  height: 0;
  visibility: hidden;
}
.judo-won  { color: var(--success, #2a7a2a); font-weight: 600; }
.judo-lost { color: var(--gray-3); }
.judo-draw { color: var(--accent, #b07800); font-weight: 600; }
.judo-opp-wrl { color: var(--gray-3); font-size: .74rem; }
.judo-method  { color: var(--gray-4); font-size: .78rem; }
.judo-score   { color: var(--gray-3); font-size: .82rem; }
.kb-opponent  { color: var(--gray-5); }
.kb-opp-wrl   { color: var(--gray-3); font-size: .74rem; }

/* ── Schießen (ISSF) ─────────────────────────────────────────────────────── */
/* Reuses .judo-fights grid + .judo-phase for phase labels. */
.issf-phases          { margin-top: 4px; }
.issf-score           { color: var(--gray-6); font-weight: 500; }
.issf-score-unit      { font-weight: 400; color: var(--gray-3); font-size: .80rem; }
.issf-rpo             { font-weight: 400; color: var(--gray-3); font-size: .88rem; margin-left: 2px; }
.issf-cutoff-gap      { font-weight: 400; color: var(--gray-3); font-size: .80rem; margin-left: 3px; }
/* Override sizer pseudo-element: longest ISSF phase name is "Qualification" */
.issf-phases .judo-phase::after { content: "Qualification"; }

/* ── Golf ────────────────────────────────────────────────────────────────── */
.golf-tournament-name { font-size: .82rem; color: var(--gray-3); margin-bottom: 4px; }
.golf-athletes        { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; line-height: 1.45; }
.golf-athlete-row     { display: flex; flex-direction: column; gap: 2px; }
.golf-athlete-main    { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem; }
.golf-pos-num         { font-weight: 700; color: var(--accent); }
.golf-pos-mc          { color: var(--gray-3); font-size: .85rem; }
.golf-pos-wd          { color: var(--gray-3); font-size: .85rem; }
.golf-topar           { font-size: .82rem; font-weight: 600; }
.golf-topar-under     { color: #2a9d2a; }
.golf-topar-even      { color: var(--gray-3); }
.golf-topar-over      { color: var(--gray-3); }
.golf-prize           { font-size: .78rem; color: var(--gray-3); }
.golf-rounds          { display: flex; gap: .4rem; flex-wrap: wrap; }
.golf-total-score     { font-size: .82rem; color: var(--gray-4); font-weight: 600; }
.golf-round           { font-size: .78rem; color: var(--gray-3); background: var(--gray-1); padding: 1px 5px; border-radius: 3px; }

.card-notes {
  font-size: .8rem;
  font-style: italic;
  color: var(--gray-3);
  margin-top: 4px;
  line-height: 1.4;
}
/* ── Rudern ── */
.level-badge-flachwasser { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.level-badge-coastal      { background: #e0f7fa; color: #00695c; border: 1px solid #80cbc4; }
.rowing-phase { font-size: .75rem; opacity: .7; }
.rowing-time  { font-size: .8rem; opacity: .75; margin-left: 3px; }

/* ── Kraftdreikampf ── */
.ipf-athlete-row { margin-bottom: 4px; }
.ipf-total  { font-weight: 700; margin-left: 4px; }
.ipf-wc     { font-size: .75rem; opacity: .7; margin-left: 4px; }
.ipf-lifts  { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: .78rem; }
.ipf-lift   { display: inline-flex; align-items: center; gap: 3px; background: var(--gray-1); border-radius: 6px; padding: 2px 7px; }
.ipf-lift-pb{ background: #fef9e7; border: 1px solid #f9e79f; }
.ipf-lift-name { opacity: .65; }
.ipf-lift-kg   { font-weight: 600; }
.ipf-pb-badge  { font-size: .65rem; font-weight: 700; color: #9a7d0a; background: #fef9e7; border: 1px solid #f9e79f; border-radius: 4px; padding: 1px 4px; margin-left: 2px; }
.ipf-prevpb    { font-size: .68rem; opacity: .55; }

.sail-event-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 2px 0 4px;
  line-height: 1.3;
}
.card-links {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
  align-items: center;
}
.card-link-item {
  display: inline-flex;
  align-items: center;
  font-size: .74rem;
  padding: 1px 8px 1px 6px;
  border: 1px solid #aed6f1;
  border-radius: 10px;
  background: var(--blue-lt);
  white-space: nowrap;
  cursor: default;
  transition: background .15s;
}
.card-link-item:hover { background: #d0e5f8; }
.card-link {
  font-size: .74rem;
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}
.card-link:hover { text-decoration: underline; }
.ig-link { color: var(--blue); text-decoration: none; font-size: .82rem; }
.ig-link:hover { text-decoration: underline; }
.fed-profile-link { color: var(--blue); text-decoration: none; font-size: .82rem; white-space: nowrap; }
.fed-profile-link:hover { text-decoration: underline; }
.fed-profile-none { color: var(--gray-3); font-size: .82rem; }

.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.result-card:hover .card-actions { opacity: 1; }
.card-action-btn {
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: .75rem;
  cursor: pointer;
  color: var(--gray-4);
  transition: all .15s;
}
.card-action-btn:hover { background: var(--blue-lt); color: var(--blue); border-color: var(--blue); }
.card-action-btn.del:hover { background: #fdecea; color: var(--red); }

/* ── Upcoming event card ── */
.event-card {
  background: #f0f5ff;
  border-radius: var(--radius);
  padding: 5px 10px 4px;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--blue);
  opacity: .95;
}
.event-card.level-olympia { border-left-color: #c9960a;         background: #fffdf0; }  /* gold   */
.event-card.level-wm        { border-left-color: #7d3098;       background: #faf5ff; }  /* lila        */
.event-card.level-em        { border-left-color: var(--blue); }                         /* blau        */
.event-card.level-wtcs      { border-left-color: #1565c0;       background: #f0f6ff; }  /* deep blue   */
.event-card.level-wc        { border-left-color: #e65100; }                             /* orange      */
.event-card.level-ec        { border-left-color: var(--green);  background: #f1f8f1; }  /* grün        */
.event-card.level-coc       { border-left-color: #3949ab;       background: #f0f0fa; }  /* indigo      */
.event-card.level-ironman   { border-left-color: #b71c1c;       background: #fff5f5; }  /* rot         */
.event-card.level-challenge { border-left-color: #00695c;       background: #f0faf8; }  /* dunkel-teal */
.event-card.level-t100      { border-left-color: #6a1b9a;       background: #f9f0ff; }  /* lila        */
.event-card.level-junior  { border-left-color: #00897b;         background: #f0faf9; }  /* teal   */
.event-card .card-header  { margin-bottom: 2px; }
.event-card .card-meta    { font-size: .82rem; color: var(--gray-4); }
.event-athletes { font-size: .76rem; color: var(--gray-3); margin-top: 2px; }

/* ── Admin panel ── */
.admin-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.admin-section h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--gray-4);
  border-bottom: 1px solid var(--gray-2);
  padding-bottom: 8px;
}
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: flex-end;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}
.form-group label { font-size: .78rem; color: var(--gray-4); font-weight: 600; }
.form-group input,
.form-group select,
.form-group textarea {
  border: 1.5px solid var(--gray-2);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .85rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dk); }
.btn-secondary { background: var(--gray-2); color: var(--gray-4); }
.btn-secondary:hover { background: #d0d0d0; }
.btn-danger { background: #fdecea; color: var(--red); border: 1px solid #f1948a; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-success { background: var(--green) !important; color: #fff !important; }

/* ── Embed Modal ─────────────────────────────────────────────────────────────── */
.embed-modal { max-width: 560px; }
.embed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.embed-full { grid-column: 1 / -1; }
.embed-url-input {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  font-size: .84rem;
  font-family: monospace;
}
.embed-px-row { display: flex; align-items: center; gap: 6px; }
.embed-px-input {
  width: 80px;
  padding: 6px 9px;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  font-size: .84rem;
}
.embed-px-unit { font-size: .8rem; color: var(--gray-3); }
.embed-code-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-3);
  margin-bottom: 6px;
}
.embed-code-wrap {
  border: 1px solid var(--gray-2);
  border-radius: 8px;
  background: #f8f9fa;
  overflow: hidden;
  margin-bottom: 12px;
}
.embed-code-output {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: none;
  background: transparent;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .78rem;
  line-height: 1.55;
  color: #2d3748;
  resize: none;
  outline: none;
  overflow: hidden;
}
.embed-copy-btn {
  width: 100%;
  padding: 11px;
  font-size: .88rem;
  transition: background .2s, transform .1s;
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}
.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--gray-1);
  color: var(--gray-4);
  font-weight: 600;
  border-bottom: 2px solid var(--gray-2);
}
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-2);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--gray-1); }
.data-table .actions { white-space: nowrap; }
.data-table .sortable-th { cursor: pointer; user-select: none; }
.data-table .sortable-th:hover { color: var(--primary, #1a56db); }
.data-table .sortable-th.sort-active { color: var(--primary, #1a56db); }

/* ── Search ── */
.search-box {
  border: 1.5px solid var(--gray-2);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: .85rem;
  width: 100%;
  max-width: 280px;
  margin-bottom: 12px;
}
.search-box:focus { outline: none; border-color: var(--blue); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: .85rem;
  z-index: 999;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-3);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: .9rem; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--blue);
}
.modal-close-btn {
  float: right;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--gray-3);
  margin-top: -4px;
}

/* ── Source status badge ── */
.status-active   { color: var(--green); font-weight: 700; }
.status-inactive { color: var(--gray-3); }
.row-inactive td { opacity: .5; }

/* ── Scraping log ── */
.log-box {
  background: #1a1a1a;
  color: #a8d8a8;
  font-family: 'Courier New', monospace;
  font-size: .75rem;
  padding: 12px;
  border-radius: 6px;
  height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}
.log-box .log-error { color: #ff7043; }

/* ── KI-Chat ── */
.chat-section { display: flex; flex-direction: column; gap: 12px; }
.chat-hint { font-size: .82rem; color: var(--gray-3); margin: 0; }
.chat-quickactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 12px;
}
.chat-qa-label {
  font-size: .78rem;
  color: var(--gray-3);
  font-weight: 600;
  white-space: nowrap;
}
.chat-qa-chip {
  font-size: .78rem;
  padding: 3px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-2);
  background: #fff;
  cursor: pointer;
  color: var(--text);
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.chat-qa-chip:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.chat-messages {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 120px; max-height: 460px;
  overflow-y: auto;
  padding: 10px;
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
}
.chat-msg { display: flex; }
.chat-msg-user  { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }
.chat-bubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.55;
  word-break: break-word;
}
.chat-msg-user .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-bubble {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--gray-2);
  border-bottom-left-radius: 4px;
}
.chat-msg-assistant .chat-bubble code {
  background: var(--gray-1);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .82em;
  font-family: 'Courier New', monospace;
}
.chat-input-row {
  display: flex; gap: 8px; align-items: flex-end;
}
.chat-textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: .9rem;
  font-family: inherit;
}
.chat-send-btn { flex-shrink: 0; align-self: flex-end; }

/* ── Import zone ── */
.import-zone {
  border: 2px dashed var(--gray-2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--gray-3);
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 12px;
}
.import-zone:hover, .import-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-lt);
  color: var(--blue);
}
.import-zone input { display: none; }

/* ── Footer ── */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: .72rem;
  color: var(--gray-3);
  /* top padding stays 5px; bottom grows by the home-indicator safe area */
  padding: 5px 16px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--gray-1);
  border-top: 1px solid var(--gray-2);
  z-index: 50;
  line-height: 1.5;
}
.footer-sub {
  display: block;
}

/* Prevent content from hiding behind fixed footer (+ home-indicator clearance) */
body { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }

/* ── Eiskunstlauf result cards ── */
.ek-competition-name {
  font-size: .78rem;
  color: var(--gray-3);
  margin-bottom: .3rem;
}
.ek-athletes    { display: flex; flex-direction: column; gap: .4rem; }
.ek-athlete-row { display: flex; flex-direction: column; gap: .2rem; font-size: .84rem; }

.ek-top-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .5rem;
}

/* Gesamtpunktzahl — primäre Info */
.ek-total {
  font-weight: 700;
  font-size: .92rem;
  color: var(--text);
}
.ek-total-pb { color: var(--gold); }
.ek-total-sb { color: #2196f3; }

/* Pflicht / Kür aufgeteilt */
.ek-components {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .8rem;
  font-size: .80rem;
  color: var(--gray-4);
  padding-left: .1rem;
}
.ek-comp-label { color: var(--gray-3); }
.ek-comp-val   { color: var(--gray-5); font-variant-numeric: tabular-nums; }
.ek-sep        { color: var(--gray-2); }

/* PB / SB Badges */
.ek-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.4;
  vertical-align: middle;
  margin-left: 2px;
}
.ek-pb { color: var(--gold);  border: 1px solid var(--gold);  }
.ek-sb { color: #2196f3;      border: 1px solid #2196f3;      }

.ek-placement { font-weight: 600; }
.ek-winner {
  font-size: .82rem;
  color: var(--gray-3);
  margin-top: .25rem;
  padding-top: .25rem;
  border-top: 1px solid #f0f0f0;
}

/* Referenz PB/SB Werte (grau, klein) */
.ek-ref {
  color: var(--gray-3);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

/* Altklassen-Kompatibilität */
.ek-score-total  { color: var(--text); }
.ek-score-detail { color: var(--gray-4); }
.ek-pb-ref       { color: var(--gray-3); font-size: .80rem; }
.ek-pb-detail    { font-size: .76rem; }

/* ── Tennis match cards ── */
.tennis-matches {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .82rem;
  line-height: 1.5;
}
.tennis-match {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  row-gap: 1px;
}
.tennis-round {
  font-weight: 700;
  min-width: 3.2em;
  color: var(--gray-5);
  flex-shrink: 0;
}
.tennis-player {
  font-weight: 700;
  white-space: nowrap;
}
.tennis-partner { font-weight: 400; }
.tennis-sep {
  color: var(--gray-3);
  flex-shrink: 0;
}
.tennis-opponent {
  white-space: nowrap;
}
.tennis-wrl {
  color: var(--gray-3);
  font-size: .76rem;
  font-weight: 400;
}
.tennis-score {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 8px;
}
.tennis-score-won  { color: var(--success, #2a7a2a); font-weight: 600; }
.tennis-score-lost { color: var(--gray-3); }
@media (max-width: 600px) {
  .tennis-score { margin-left: 0; padding-left: 0; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  main { padding: 10px; }
  .form-row { flex-direction: column; }
  .data-table th:nth-child(3),
  .data-table td:nth-child(3),
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) { display: none; }
}

/* ── CSV-Download Button ─────────────────────────────────────────────────────── */
.csv-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--gray-2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .8rem;
  color: var(--gray-4);
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.csv-btn:hover { border-color: #217346; color: #217346; }
.csv-excel-icon { width: 14px; height: 14px; flex-shrink: 0; border-radius: 2px; }

/* ── CSV Modal ───────────────────────────────────────────────────────────────── */
.csv-modal { max-width: 480px; }

.csv-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-3);
  margin-bottom: 8px;
}

.csv-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.csv-radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 0;
}
.csv-radio-row input[type="radio"] { flex-shrink: 0; accent-color: var(--blue); }

.csv-radio-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: .85rem;
  color: var(--gray-4);
  flex: 1;
}
.csv-radio-hint {
  font-size: .73rem;
  color: var(--gray-3);
  font-weight: 400;
}

.csv-inline-select,
.csv-inline-input {
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: .8rem;
  color: var(--gray-4);
  background: #fff;
  min-width: 160px;
  max-width: 220px;
}
.csv-inline-select:disabled,
.csv-inline-input:disabled { opacity: .4; cursor: not-allowed; }
.csv-inline-select:not(:disabled),
.csv-inline-input:not(:disabled) { border-color: var(--blue); color: #111; }

.csv-date-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.csv-date-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--gray-4);
}
.csv-date-input {
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: .8rem;
  color: var(--gray-4);
}

.csv-execute-btn { font-size: .9rem; padding: 10px 20px; border-radius: 8px; }

.csv-row-count {
  text-align: center;
  font-size: .76rem;
  color: var(--gray-3);
  margin-top: 8px;
  min-height: 18px;
}

/* ── CSV-Felder Admin ────────────────────────────────────────────────────────── */
.csv-fields-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) {
  .csv-fields-layout { grid-template-columns: 1fr; }
}
.csv-fields-panel {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 14px;
  background: #fafafa;
}
.csv-fields-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
}
.csv-fields-panel-sub {
  font-size: .8rem;
  color: #888;
  font-weight: 400;
}
.csv-fields-badge {
  font-size: .73rem;
  padding: 2px 9px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.csv-fields-badge-basic { background: #e8f4fd; color: #1a6ca8; }
.csv-fields-badge-full  { background: #e8f7ee; color: #1a7a3e; }

.csv-fields-list {
  list-style: none;
  padding: 6px;
  margin: 0 0 4px 0;
  min-height: 60px;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed #ccc;
}
.csv-fields-pool {
  list-style: none;
  padding: 0;
  margin: 0;
  min-height: 10px;
}
.csv-field-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 4px;
  border: 1px solid #e4e4e4;
  font-size: .84rem;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.csv-field-item:last-child { margin-bottom: 0; }
.csv-field-item.dragging { opacity: .35; }
.csv-field-item.drop-target { border-color: #2563eb; background: #eff6ff; }
.csv-field-inactive {
  background: #f5f5f5;
  border-style: dashed;
}
.csv-field-drag {
  color: #ccc;
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.csv-field-drag:active { cursor: grabbing; }
.csv-field-label { flex: 1; color: #333; }
.csv-field-remove, .csv-field-add {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0 3px;
  line-height: 1;
  transition: opacity .12s;
  flex-shrink: 0;
}
.csv-field-remove { color: #c00; opacity: .55; }
.csv-field-remove:hover { opacity: 1; }
.csv-field-add { color: #1a7a3e; font-weight: 700; opacity: .65; }
.csv-field-add:hover { opacity: 1; }
.csv-fields-pool-title {
  font-size: .72rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 10px 0 5px;
}

/* ── Push-Benachrichtigungs-Banner ─────────────────────────────────────────── */
#push-banner {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 8900;
  background: #1a3a6b;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 8px rgba(0,0,0,.22);
  font-size: .9rem;
}
#push-banner-text {
  flex: 1;
  font-weight: 500;
}
#push-banner-btn {
  background: #fff;
  color: #1a3a6b;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#push-banner-btn:hover { background: #e8f0fb; }
#push-banner-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 2px;
  line-height: 1;
}
#push-banner-dismiss:hover { color: #fff; }

/* ── Add-to-Home-Screen Banner ─────────────────────────────────────────────── */
#a2hs-banner {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 9000;
  background: var(--blue-dk);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  box-shadow: 0 -2px 8px rgba(0,0,0,.18);
  font-size: .9rem;
}
#a2hs-text {
  flex: 1;
  font-weight: 500;
}
#a2hs-btn {
  background: #fff;
  color: var(--blue-dk);
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#a2hs-btn:hover { background: var(--blue-lt); }
#a2hs-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 2px;
  line-height: 1;
}
#a2hs-dismiss:hover { color: #fff; }

/* iOS-Hinweis */
#a2hs-ios-hint {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  background: #222;
  color: #fff;
  border-radius: 10px;
  padding: 14px 18px 10px;
  font-size: .88rem;
  text-align: center;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  min-width: 240px;
  max-width: 300px;
}
.a2hs-ios-arrow {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid #222;
}
#a2hs-ios-close {
  display: block;
  margin: 10px auto 0;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 5px 20px;
  cursor: pointer;
  font-size: .85rem;
}
#a2hs-ios-close:hover { background: rgba(255,255,255,.25); }

/* ── KI-Assistent (floating Bot) ── */

/* Toggle-Button unten rechts, über dem Footer */
.bot-toggle-btn {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,.25);
  z-index: 200;
  transition: background .15s, transform .15s;
}
.bot-toggle-btn:hover  { background: var(--blue-dk); }
.bot-toggle-btn--open  { background: var(--blue-dk); transform: scale(.92); }

/* Chat-Panel */
.bot-panel {
  position: fixed;
  bottom: calc(122px + env(safe-area-inset-bottom, 0px));
  right: 12px;
  width: 340px;
  max-width: calc(100vw - 24px);
  max-height: 70dvh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  z-index: 199;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .18s, transform .18s;
}
.bot-panel--open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.bot-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 16px;
  background: var(--blue);
  color: #fff;
  flex-shrink: 0;
}
.bot-panel-title { font-weight: 600; font-size: .9rem; }
.bot-panel-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}
.bot-panel-close:hover { color: #fff; background: rgba(255,255,255,.15); }

/* Nachrichtenliste */
.bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--gray-1);
}
.bot-msg { display: flex; }
.bot-msg-user      { justify-content: flex-end; }
.bot-msg-assistant { justify-content: flex-start; }
.bot-bubble {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 14px;
  font-size: .84rem;
  line-height: 1.5;
  word-break: break-word;
}
.bot-msg-user .bot-bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bot-msg-assistant .bot-bubble {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--gray-2);
  border-bottom-left-radius: 4px;
}
.bot-msg-assistant .bot-bubble code {
  background: var(--gray-1);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: .82em;
  font-family: 'Courier New', monospace;
}

/* Typing-Indikator */
.bot-typing { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.bot-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gray-3);
  animation: botDot 1.2s infinite;
}
.bot-typing span:nth-child(2) { animation-delay: .2s; }
.bot-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes botDot {
  0%, 80%, 100% { transform: scale(.7); opacity: .5; }
  40%            { transform: scale(1);  opacity: 1;  }
}

/* Eingabebereich */
.bot-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  padding: 8px 10px;
  border-top: 1px solid var(--gray-2);
  background: #fff;
  flex-shrink: 0;
}
.bot-textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--gray-2);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: .84rem;
  font-family: inherit;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}
.bot-textarea:focus { outline: none; border-color: var(--blue); }
.bot-send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  transition: background .12s;
}
.bot-send-btn:hover    { background: var(--blue-dk); }
.bot-send-btn:disabled { background: var(--gray-3); cursor: default; }

/* Verlauf-löschen-Link */
.bot-clear-btn {
  background: none;
  border: none;
  color: var(--gray-3);
  font-size: .72rem;
  cursor: pointer;
  text-align: center;
  padding: 4px 0 6px;
  width: 100%;
  flex-shrink: 0;
}
.bot-clear-btn:hover { color: var(--gray-4); }

/* Mobile: Panel nimmt mehr Höhe ein */
@media (max-width: 400px) {
  .bot-panel { width: calc(100vw - 16px); right: 8px; }
}

/* ── Weltrangliste (WRL) ────────────────────────────────────────────────────── */

.rankings-sport-filter {
  display: flex;
  gap: 8px;
  padding: 12px 16px 4px;
  flex-wrap: wrap;
}

.rankings-sport-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 2px solid var(--sport-color, #1a56a0);
  background: transparent;
  color: var(--sport-color, #1a56a0);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.rankings-sport-btn.active,
.rankings-sport-btn:hover {
  background: var(--sport-color, #1a56a0);
  color: #fff;
}

.rankings-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

.rankings-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.12s;
  gap: 12px;
}

.rankings-card:hover {
  background: #f7f9fc;
}

.rankings-card-left {
  flex: 1;
  min-width: 0;
}

.rankings-card-name {
  font-weight: 600;
  font-size: 15px;
  color: #1a1a2e;
}

.rankings-card-meta {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.rankings-card-rank {
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
}

.rankings-card-pts {
  font-weight: 400;
  font-size: 13px;
  margin-left: 6px;
  color: #666;
}

.rankings-card-spark {
  flex-shrink: 0;
}

/* Detail view */
.rankings-detail {
  padding: 0;
}

.rankings-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.rankings-back-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
}

.rankings-back-btn:hover {
  background: #f5f5f5;
}

.rankings-detail-title {
  font-weight: 600;
  font-size: 15px;
  color: #1a1a2e;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rankings-chart-wrap {
  padding: 16px;
  height: 340px;
  position: relative;
}

.rankings-no-data {
  text-align: center;
  padding: 48px 16px;
  color: #888;
}

.rankings-no-data .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
