/* ============================================================
   Quotenprofi Redesign v3 — "Kursblatt"
   Hell · Papier · Harte Kanten · Mono-Ziffern
   ============================================================ */

:root {
    color-scheme: light;

    /* Flächen */
    --paper: #f4f5f6;
    --paper-2: #e9ebee;
    --white: #ffffff;
    --ink: #101214;
    --ink-rgb: 16 18 20;

    /* Text */
    --text: #101214;
    --text-2: #4d545c;
    --text-3: #7d848c;

    /* Akzente */
    --green: #0b7a43;
    --green-rgb: 11 122 67;
    --red: #cc2f2f;
    --red-rgb: 204 47 47;
    --blue: #1f5fa8;
    --blue-rgb: 31 95 168;

    /* Linien */
    --rule: #d2d7dc;
    --rule-strong: #101214;

    /* Radius (nur interaktive Elemente) */
    --radius: 8px;

    /* Abstände */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;

    /* Typo */
    --font-display: "Archivo", sans-serif;
    --font-body: "Archivo", sans-serif;
    --font-mono: "IBM Plex Mono", monospace;
    --fs-xs: 11px;
    --fs-s: 13px;
    --fs-m: 15px;
    --fs-l: 20px;
    --fs-xl: 42px;
}

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

body {
    background: var(--paper);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-m);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- Layout ---------- */

.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    border-left: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
    background: var(--paper);
}

/* ---------- Sidebar: Index-Spalte ---------- */

.sidebar {
    border-right: 1px solid var(--rule);
    padding: var(--s-5) var(--s-4);
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 22px;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    display: block;
    padding-bottom: var(--s-4);
    border-bottom: 3px solid var(--rule-strong);
}

.brand .tld { color: var(--green); }

.nav-section {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-3);
    margin: var(--s-5) 0 var(--s-2);
}

.nav-league {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-2);
    padding: 9px 2px;
    border-bottom: 1px solid var(--rule);
    font-size: var(--fs-s);
    font-weight: 600;
}

.nav-league .count {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
}

.nav-league:hover { color: var(--green); }

.nav-league.active {
    color: var(--green);
    border-bottom: 2px solid var(--green);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: var(--s-4);
    font-size: var(--fs-xs);
    color: var(--text-3);
}

.sidebar-footer .data-note {
    margin: 0 0 var(--s-3);
    line-height: 1.5;
}

.sidebar-footer .age-note,
.mobile-foot .age-note {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.mobile-foot { display: none; }

.age-badge {
    border: 1.5px solid var(--rule-strong);
    font-weight: 700;
    font-size: 10px;
    padding: 2px 5px;
}

/* ---------- Content ---------- */

.content {
    padding: var(--s-5) var(--s-6) var(--s-7);
    min-width: 0;
}

/* Liga-Kopf: Schlagzeile */

.league-head {
    border-bottom: 3px solid var(--rule-strong);
    padding-bottom: var(--s-4);
}

.league-head .kicker {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--green);
}

.league-head h1 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-xl);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    line-height: 1.05;
}

.league-head .sub {
    font-size: var(--fs-s);
    color: var(--text-2);
    margin-top: var(--s-1);
}

/* Spieltag-Navigation: unterstrichene Tabs */

.round-nav {
    display: flex;
    align-items: baseline;
    gap: var(--s-4);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--rule);
    overflow-x: auto;
    scrollbar-width: none;
}
.round-nav::-webkit-scrollbar { display: none; }

.round-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-3);
    white-space: nowrap;
}

.round-tab {
    font-family: var(--font-mono);
    font-size: var(--fs-s);
    color: var(--text-2);
    padding: 2px 0;
    white-space: nowrap;
    text-decoration: none;
}

.round-tab:hover { color: var(--ink); }

.round-tab.active {
    color: var(--ink);
    font-weight: 700;
    box-shadow: 0 3px 0 0 var(--green);
}

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

.day-group { margin-top: var(--s-6); }

.day-header {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 96px repeat(3, 148px);
    gap: var(--s-3);
    align-items: end;
    border-bottom: 2px solid var(--rule-strong);
    padding-bottom: var(--s-1);
}

.day-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-m);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    grid-column: 1 / 3;
}

.col-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-3);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Match-Zeile */

.match-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 96px repeat(3, 148px);
    gap: var(--s-3);
    align-items: center;
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--rule);
}

.match-row:hover { background: var(--white); }

.match-time {
    font-family: var(--font-mono);
    font-size: var(--fs-s);
    color: var(--text-2);
}

.match-teams { min-width: 0; display: grid; gap: 6px; color: inherit; text-decoration: none; }
a.match-teams:hover .team { text-decoration: underline; text-underline-offset: 3px; }

.team {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: var(--fs-m);
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crest {
    flex: none;
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.bk {
    width: 15px;
    height: 15px;
    object-fit: contain;
    vertical-align: -3px;
    margin-right: 4px;
}

/* Liga-Abschnitt (Landing) */

.league-row {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
    padding-bottom: var(--s-2);
    border-bottom: 3px solid var(--rule-strong);
}

.league-name a { color: inherit; text-decoration: none; }
.league-name a:hover { text-decoration: underline; text-decoration-thickness: 3px; }

.odds-cell.empty { opacity: 0.45; }

.league-name {
    font-family: var(--font-display);
    font-size: var(--fs-l);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.league-meta {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Mover-Karten (Landing) */

.movers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s-3);
    padding-top: var(--s-4);
}

.mover {
    display: block;
    padding: var(--s-4);
    background: var(--white);
    border: 1px solid var(--rule);
    text-decoration: none;
    color: var(--text);
}

.mover:hover { border-color: var(--rule-strong); }

.mover-match .team { margin-bottom: var(--s-1); }

.mover-trend {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin: var(--s-3) 0 var(--s-2);
    font-family: var(--font-mono);
}

.mover-trend .spark { width: 100%; height: 22px; }
.mover-trend .pct { font-size: var(--fs-m); font-weight: 600; }
.mover-trend.up .pct { color: var(--green); }
.mover-trend.down .pct { color: var(--red); }
.mover-trend.up .spark polyline { stroke: var(--green); }
.mover-trend.down .spark polyline { stroke: var(--red); }

.mover-odds {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-2);
}

.mover-odds .from { text-decoration: line-through; color: var(--text-3); }
.mover-odds .to { font-weight: 600; color: var(--text); }

/* Trend-Spalte */

.trend {
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.trend .pct { font-weight: 600; }
.trend.up .pct { color: var(--green); }
.trend.down .pct { color: var(--red); }

.spark { display: block; margin: 0 auto 2px; }
.spark polyline { fill: none; stroke-width: 1.5; stroke: var(--text-3); }
.trend.up polyline { stroke: var(--green); }
.trend.down polyline { stroke: var(--red); }

/* Quoten-Zelle */

.odds-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 7px 4px;
    background: var(--white);
    border: 1px solid var(--rule);
}

.odds-cell:hover { border-color: var(--rule-strong); }

.odds-cell .val {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.odds-cell .src {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-3);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.odds-cell.up .val { color: var(--green); }
.odds-cell.down .val { color: var(--red); }

.odds-cell.best {
    border: 1.5px solid var(--green);
    background: rgb(var(--green-rgb) / 0.06);
}
.odds-cell.best .val { color: var(--green); }

/* ---------- Quoten-Zelle mit Bookie-Umschalter (v2) ---------- */
/* Nur aktiv wenn die neue Bookie-Auswahl (.bk-pick) drin steckt —
   Bestandsseiten mit .src bleiben unverändert. */
.odds-cell:has(.bk-pick) {
    gap: var(--s-2);
    padding: var(--s-3) var(--s-2) 10px;
    border-radius: var(--radius);
}
.odds-cell:has(.bk-pick) .val {
    font-size: 16px;
    letter-spacing: 0.01em;
}

.bk-pick {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 5px 9px;
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: var(--fs-s);
    font-weight: 700;
    color: var(--text-2);
    line-height: 1;
    cursor: pointer;
}
.bk-pick:hover { border-color: var(--rule-strong); color: var(--ink); }
.bk-pick .bk {
    width: 17px;
    height: 17px;
    margin: 0;
    vertical-align: 0;
    flex: none;
}
.bk-pick .bk-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bk-pick .bk-caret {
    flex: none;
    width: 0;
    height: 0;
    margin-left: 1px;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid var(--text-3);
}
.bk-pick:hover .bk-caret { border-top-color: var(--ink); }

/* Auswahl-Menü — Popover mit allen Bookies + Quote je Ausgang */
.odds-cell .bk-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    box-shadow: 0 10px 28px rgb(var(--ink-rgb) / 0.16);
    max-height: 420px;
    overflow-y: auto;
}
.bk-menu {
    width: 230px;
    background: var(--white);
    border: 1.5px solid var(--rule-strong);
    border-radius: var(--radius);
    overflow: hidden;
}
.bk-menu-head {
    display: flex;
    justify-content: space-between;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--rule);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}
.bk-option {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    width: 100%;
    padding: var(--s-2) var(--s-3);
    background: none;
    border: 0;
    border-bottom: 1px solid var(--rule);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.bk-option:last-child { border-bottom: 0; }
.bk-option:hover { background: var(--paper); }
.bk-option .bk { width: 18px; height: 18px; flex: none; }
.bk-option .name {
    flex: 1;
    font-size: var(--fs-s);
    font-weight: 600;
    color: var(--text);
}
.bk-option .q {
    font-family: var(--font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
}
.bk-option.active { background: rgb(var(--green-rgb) / 0.08); }
.bk-option.active .name,
.bk-option.active .q { color: var(--green); }

/* ---------- Quotenverlauf ---------- */

.qv-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-4);
}

.qv-panel {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: var(--s-4);
}

.qv-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--s-1);
}

.qv-outcome {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.qv-src {
    font-size: var(--fs-xs);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-left: var(--s-2);
    margin-right: auto;
}

.qv-delta {
    font-family: var(--font-mono);
    font-size: var(--fs-s);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.qv-delta.up { color: var(--green); }
.qv-delta.down { color: var(--red); }

.qv-val {
    font-family: var(--font-mono);
    font-size: var(--fs-l);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-bottom: var(--s-3);
}

.qv-chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}
.qv-chart .grid {
    stroke: var(--rule);
    stroke-dasharray: 3 3;
    vector-effect: non-scaling-stroke;
}
.qv-chart .line {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}
.qv-chart .dot.up { fill: var(--green); }
.qv-chart .dot.down { fill: var(--red); }
.qv-chart .ylabel {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--text-3);
}

.qv-axis {
    display: flex;
    justify-content: space-between;
    margin-top: var(--s-2);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
}

/* Bewegung seit Eröffnung — großes Panel, alle Ausgänge in % */
.qv-move { margin-top: var(--s-4); }
.qv-move .qv-head { margin-bottom: var(--s-4); }

.qv-legend { display: flex; gap: var(--s-2); }

.qv-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: var(--fs-s);
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    cursor: pointer;
}
.qv-toggle:hover { border-color: var(--rule-strong); }
.qv-toggle .swatch { width: 10px; height: 10px; border-radius: 3px; }
.qv-toggle .swatch.s1 { background: var(--ink); }
.qv-toggle .swatch.sx { background: var(--blue); }
.qv-toggle .swatch.s2 { background: var(--green); }
.qv-toggle.off { color: var(--text-3); }
.qv-toggle.off .swatch { background: var(--rule); }

.qv-plot { position: relative; }
.qv-plot .qv-ylab {
    position: absolute;
    left: 2px;
    transform: translateY(-110%);
    padding: 0 3px;
    background: var(--white);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
}

.qv-chart .line.hidden,
.qv-chart .dot.hidden { display: none; }

.qv-chart .grid.zero {
    stroke: var(--text-3);
    stroke-dasharray: none;
}
.qv-chart .line.l1 { stroke: var(--ink); }
.qv-chart .line.lx { stroke: var(--blue); }
.qv-chart .line.l2 { stroke: var(--green); }
.qv-chart .dot.d1 { fill: var(--ink); }
.qv-chart .dot.dx { fill: var(--blue); }
.qv-chart .dot.d2 { fill: var(--green); }

@media (max-width: 720px) {
    .qv-grid { grid-template-columns: minmax(0, 1fr); }
    .qv-move .qv-head { flex-wrap: wrap; gap: var(--s-2); }
}

/* ---------- Spiel-Detailseite ---------- */

.league-head .kicker a { color: inherit; }

.spiel-title {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
}
.spiel-title .side { display: inline-flex; align-items: center; gap: var(--s-3); }
.spiel-title .crest-l { width: 34px; height: 34px; object-fit: contain; }
.spiel-title .vs { color: var(--text-3); }

.odds-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--rule);
}
.odds-table th {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: right;
    padding: 10px 14px;
    border-bottom: 1px solid var(--rule-strong);
}
.odds-table th:first-child { text-align: left; }
.odds-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--rule);
    font-size: var(--fs-s);
}
.odds-table tr:last-child td { border-bottom: none; }
.odds-table td.bookie img.bk { width: 16px; height: 16px; margin-right: 8px; }
.odds-table td.q {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    width: 120px;
}
.odds-table td.q.best {
    font-weight: 600;
    color: var(--green);
    background: rgb(var(--green-rgb) / 0.06);
}
.odds-table td.q.pickable { cursor: pointer; }
.odds-table td.q.pickable:hover { background: rgb(var(--green-rgb) / 0.12); }
.odds-table td.q.sel,
.odds-table td.q.sel:hover {
    font-weight: 600;
    color: var(--green);
    background: rgb(var(--green-rgb) / 0.18);
}

@media (max-width: 720px) {
    .spiel-title .crest-l { width: 26px; height: 26px; }
    .odds-table th, .odds-table td { padding: 8px 10px; }
    .odds-table td.q { width: 64px; }
}

/* ---------- Styleguide-Hilfen ---------- */

.sg-section { margin-top: var(--s-7); }

.sg-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-l);
    text-transform: uppercase;
    border-bottom: 3px solid var(--rule-strong);
    padding-bottom: var(--s-2);
    margin-bottom: var(--s-4);
}

.sg-row { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-start; }

.swatch { width: 120px; }

.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--s-3);
}

.logo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-1);
    background: var(--white);
    border: 1px solid var(--rule);
    text-align: center;
}

.logo-item img { width: 32px; height: 32px; object-fit: contain; }

.logo-item .name {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.swatch .chip { height: 56px; border: 1px solid var(--rule); }
.swatch .name { font-family: var(--font-mono); font-size: var(--fs-xs); margin-top: var(--s-1); }

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
    .layout { grid-template-columns: minmax(0, 1fr); border: none; }
    .sidebar { display: none; }
    .content { padding: var(--s-4) var(--s-3) var(--s-6); }

    .mobile-foot {
        display: block;
        margin-top: var(--s-6);
        padding-top: var(--s-4);
        border-top: 1px solid var(--rule);
        font-size: var(--fs-xs);
        color: var(--text-3);
    }
    .mobile-foot .data-note { margin: 0 0 var(--s-3); line-height: 1.5; }

    .league-head h1 { font-size: 30px; }

    .day-header { grid-template-columns: 34px minmax(0, 1fr) repeat(3, 64px); gap: var(--s-2); }
    .day-header .col-trend { display: none; }
    .day-title { grid-column: 1 / -1; grid-row: 1; }
    .day-header span:nth-child(3) { grid-column: 3; grid-row: 2; }
    .day-header span:nth-child(4) { grid-column: 4; grid-row: 2; }
    .day-header span:nth-child(5) { grid-column: 5; grid-row: 2; }

    .match-row { grid-template-columns: 34px minmax(0, 1fr) repeat(3, 64px); gap: var(--s-2); }
    .crest { width: 16px; height: 16px; }
    .team { gap: var(--s-1); font-size: var(--fs-s); }
    .match-teams { gap: 4px; }
    .trend { display: none; }

    .team { white-space: normal; overflow: visible; text-overflow: clip; }
    .movers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .odds-cell .src { font-size: 0; letter-spacing: 0; }
    .odds-cell .bk { width: 16px; height: 16px; margin-right: 0; vertical-align: 0; }
    .odds-cell .val { font-size: var(--fs-m); }

    /* Bookie-Umschalter: mobil nur Icon + Pfeil */
    .bk-pick .bk-name { display: none; }
    .bk-pick { padding: 4px 7px; }
    .bk-pick .bk { width: 18px; height: 18px; }
    .odds-cell:has(.bk-pick) { padding: 10px 4px 8px; }
}
