/* ============================================================
   GAELIC ANALYZER — FFSG/LBSG BRETAGNE
   Dark Industrial Theme — Barlow Condensed
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Barlow:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    /* Team colors */
    --vannes: #1b4f72;
    --vannes-light: #2e86c1;
    --vannes-dim: #1a3a52;
    --liffre: #641e16;
    --liffre-light: #c0392b;
    --liffre-dim: #4a1610;

    /* Accent */
    --accent: #0f3460;
    --accent-bright: #1a5276;
    --gold: #d4ac0d;
    --gold-dim: #9a7d0a;

    /* UI neutrals */
    --bg: #0a0c0e;
    --bg-panel: #0f1215;
    --bg-card: #141820;
    --bg-card-hover: #1a2030;
    --bg-overlay: #1e2535;
    --border: #252d3a;
    --border-light: #2e3848;
    --border-glow: #1b4f72;

    /* Text */
    --text-primary: #e8ecf0;
    --text-secondary: #8a9ab0;
    --text-dim: #506070;
    --text-accent: #5dade2;

    /* Status */
    --green: #1e8449;
    --green-l: #27ae60;
    --red: #c0392b;
    --yellow: #d4ac0d;
    --orange: #e67e22;

    /* Spacing */
    --tab-h: 48px;
    --top-h: 56px;

    /* Fonts */
    --font-display: "Barlow Condensed", sans-serif;
    --font-body: "Barlow", sans-serif;
    --font-mono: "JetBrains Mono", monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ── Header ────────────────────────────────────────────────── */
#app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--top-h);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
}

.header-logo {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0; overflow: visible;
}
.header-logo-img {
    height: 58px; width: auto; object-fit: contain;
    margin-top: 4px;
    filter: drop-shadow(0 2px 8px rgba(249,115,22,0.3));
    flex-shrink: 0;
}
.header-logo-text {
    display: flex; flex-direction: column;
    line-height: 1; gap: 1px;
}
.logo-gaelic {
    font-family: var(--fd, "Barlow Condensed", sans-serif);
    font-weight: 300; font-size: 0.85rem;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--t1, #edf2f7);
}
.logo-analyser {
    font-family: var(--fd, "Barlow Condensed", sans-serif);
    font-weight: 800; font-size: 0.95rem;
    letter-spacing: .12em; text-transform: uppercase;
    color: #f97316;
}

.header-match {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.match-badge {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}
.match-badge.active {
    border-color: var(--gold-dim);
    color: var(--gold);
}

.match-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.match-score {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.match-score .home {
    color: var(--vannes-light);
}
.match-score .away {
    color: var(--liffre-light);
}
.match-score .sep {
    color: var(--text-dim);
    margin: 0 4px;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Tab Bar ───────────────────────────────────────────────── */
#tab-bar {
    position: fixed;
    top: var(--top-h);
    left: 0;
    right: 0;
    z-index: 99;
    height: var(--tab-h);
    background: var(--bg-panel);
    border-bottom: 2px solid var(--border);
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
#tab-bar::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    height: 100%;
    padding: 0 16px;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition:
        color 0.2s,
        border-color 0.2s;
    position: relative;
}
.tab-btn:hover {
    color: var(--text-secondary);
}
.tab-btn.active {
    color: #f97316;
    border-bottom-color: #f97316;
}
.tab-btn .tab-num {
    font-size: 0.6rem;
    color: var(--text-dim);
    margin-right: 5px;
    font-weight: 400;
}

/* ── Main Content Area ─────────────────────────────────────── */
#main-content {
    margin-top: calc(var(--top-h) + var(--tab-h));
    padding: 20px 16px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    margin-top: calc(var(--top-h) + var(--tab-h) + 0px);
    padding-top: 20px;
}

.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* ── Drop Zone ─────────────────────────────────────────────── */
#drop-zone {
    border: 2px dashed var(--border-light);
    border-radius: 4px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
}
#drop-zone:hover,
#drop-zone.drag-over {
    border-color: var(--vannes-light);
    background: var(--vannes-dim);
}
#drop-zone .dz-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}
#drop-zone .dz-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
#drop-zone .dz-sub {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}
#drop-zone .dz-formats {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 8px 16px;
    border-radius: 2px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary {
    background: var(--vannes);
    border-color: var(--vannes-light);
    color: #fff;
}
.btn-primary:hover {
    background: var(--vannes-light);
}
.btn-ghost {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-secondary);
}
.btn-ghost:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}
.btn-gold {
    background: transparent;
    border-color: var(--gold-dim);
    color: var(--gold);
}
.btn-gold:hover {
    background: var(--gold-dim);
    color: #fff;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 0.72rem;
}
.btn-demo {
    background: linear-gradient(135deg, var(--vannes-dim), var(--accent));
    border-color: var(--vannes);
    color: var(--text-accent);
}
.btn-demo:hover {
    border-color: var(--vannes-light);
    color: #fff;
}

/* ── Cards & Panels ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 16px;
}
.card-header {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.card-title-lg {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
}

/* ── Section Headers ───────────────────────────────────────── */
.section-header {
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.section-header::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Score Block ───────────────────────────────────────────── */
.score-block {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
}
.score-team {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.score-team.home {
    text-align: left;
}
.score-team.away {
    text-align: right;
}
.team-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.team-name.home {
    color: var(--vannes-light);
}
.team-name.away {
    color: var(--liffre-light);
}
.team-detail {
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}
.score-center {
    text-align: center;
    padding: 0 16px;
}
.score-main {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1;
}
.score-main .h {
    color: var(--vannes-light);
}
.score-main .a {
    color: var(--liffre-light);
}
.score-main .d {
    color: var(--text-dim);
    margin: 0 6px;
}
.score-goal-pts {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}
.score-meta {
    font-family: var(--font-display);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ── Stat Rows ─────────────────────────────────────────────── */
.stat-row {
    display: grid;
    grid-template-columns: 1fr 80px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child {
    border-bottom: none;
}
.stat-label {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: center;
}
.stat-val {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
}
.stat-val.home {
    color: var(--vannes-light);
    text-align: right;
}
.stat-val.away {
    color: var(--liffre-light);
    text-align: left;
}
.stat-val.home.winner,
.stat-val.away.winner {
    font-weight: 700;
}

/* ── Progress Bars ─────────────────────────────────────────── */
.progress-bar-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    height: 6px;
}
.progress-bar {
    height: 100%;
    border-radius: 1px;
    transition: width 0.4s ease;
}
.progress-bar.home {
    background: var(--vannes);
    justify-self: end;
    width: 50%;
}
.progress-bar.away {
    background: var(--liffre);
    justify-self: start;
    width: 50%;
}

/* ── Bar Chart ─────────────────────────────────────────────── */
.bar-stat {
    display: grid;
    grid-template-columns: 90px 1fr 40px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.bar-stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: right;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.bar-stat-track {
    height: 12px;
    background: var(--bg-overlay);
    border-radius: 2px;
    overflow: hidden;
}
.bar-stat-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
.bar-stat-fill.home {
    background: linear-gradient(90deg, var(--vannes-dim), var(--vannes-light));
}
.bar-stat-fill.away {
    background: linear-gradient(90deg, var(--liffre-dim), var(--liffre-light));
}
.bar-stat-val {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ── Pct Display ───────────────────────────────────────────── */
.pct-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.pct-num {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}
.pct-symbol {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 400;
}

/* ── Table ─────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.data-table th {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.data-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}
.data-table tr:hover td {
    background: var(--bg-card-hover);
}
.data-table td.mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
}
.data-table td.home {
    color: var(--vannes-light);
}
.data-table td.away {
    color: var(--liffre-light);
}
.data-table td.num {
    text-align: right;
    font-family: var(--font-mono);
}
.data-table .highlight td {
    background: rgba(27, 79, 114, 0.15);
}

/* ── Badge / Tag ───────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 1px;
    white-space: nowrap;
}
.badge-win {
    background: var(--green);
    color: #fff;
}
.badge-loss {
    background: var(--red);
    color: #fff;
}
.badge-draw {
    background: var(--bg-overlay);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.badge-yellow {
    background: var(--yellow);
    color: #000;
}
.badge-black {
    background: #111;
    color: #fff;
    border: 1px solid #333;
}
.badge-red {
    background: var(--red);
    color: #fff;
}
.badge-gold {
    background: var(--gold-dim);
    color: var(--gold);
    border: 1px solid var(--gold-dim);
}
.badge-home {
    background: var(--vannes-dim);
    color: var(--vannes-light);
    border: 1px solid var(--vannes);
}
.badge-away {
    background: var(--liffre-dim);
    color: var(--liffre-light);
    border: 1px solid var(--liffre);
}

/* ── Timeline ──────────────────────────────────────────────── */
.timeline-wrap {
    position: relative;
    padding: 0 0 0 16px;
}
.timeline-event {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border-left: 2px solid var(--border);
    padding-left: 16px;
    position: relative;
}
.timeline-event::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}
.timeline-event.home::before {
    background: var(--vannes);
}
.timeline-event.away::before {
    background: var(--liffre);
}
.timeline-event.goal::before {
    background: var(--gold);
    width: 12px;
    height: 12px;
    left: -7px;
}
.tl-time {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    width: 44px;
    flex-shrink: 0;
    margin-top: 2px;
}
.tl-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex: 1;
}
.tl-score {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
}

/* ── Canvas Terrain ────────────────────────────────────────── */
#terrain-canvas {
    display: block;
    margin: 0 auto;
    border: 1px solid var(--border);
    background: #0d4a1c;
    border-radius: 2px;
    max-width: 100%;
}

.terrain-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.filter-btn {
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 2px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
}
.filter-btn:hover {
    border-color: var(--text-dim);
    color: var(--text-secondary);
}
.filter-btn.active {
    border-color: var(--gold-dim);
    color: var(--gold);
    background: rgba(212, 172, 13, 0.08);
}
.filter-btn.home.active {
    border-color: var(--vannes);
    color: var(--vannes-light);
    background: var(--vannes-dim);
}
.filter-btn.away.active {
    border-color: var(--liffre);
    color: var(--liffre-light);
    background: var(--liffre-dim);
}

/* ── Player Cards ──────────────────────────────────────────── */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.player-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.player-card:hover {
    border-color: var(--vannes-light);
    background: var(--bg-card-hover);
}
.player-num {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--vannes-light);
    line-height: 1;
}
.player-name {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-top: 4px;
}
.player-pos {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 2px;
}
.player-stats-mini {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.pstat {
    font-size: 0.7rem;
    color: var(--text-dim);
}
.pstat span {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ── Alert / Notice ────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: 2px;
    border-left: 3px solid;
    margin-bottom: 12px;
    font-size: 0.82rem;
}
.alert-info {
    border-color: var(--vannes-light);
    background: rgba(27, 79, 114, 0.15);
    color: var(--text-accent);
}
.alert-warn {
    border-color: var(--yellow);
    background: rgba(212, 172, 13, 0.1);
    color: var(--yellow);
}
.alert-error {
    border-color: var(--red);
    background: rgba(192, 57, 43, 0.1);
    color: #e74c3c;
}
.alert-success {
    border-color: var(--green-l);
    background: rgba(39, 174, 96, 0.1);
    color: var(--green-l);
}

/* ── AI Report ─────────────────────────────────────────────── */
.report-section {
    margin-bottom: 24px;
}
.report-section h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.report-section p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}
.report-section li {
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-left: 16px;
    margin-bottom: 4px;
}
.report-type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.report-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.85rem;
}
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--vannes-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Vocabulary ────────────────────────────────────────────── */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.vocab-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 12px;
}
.vocab-en {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold);
}
.vocab-fr {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: 3px;
}
.vocab-def {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 5px;
    line-height: 1.5;
}

/* ── Config ────────────────────────────────────────────────── */
.config-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 16px;
    margin-bottom: 12px;
}
.config-group-title {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 14px;
}
.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}
.config-row:last-child {
    border-bottom: none;
}
.config-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex: 1;
}
.config-label small {
    display: block;
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-top: 2px;
}
.config-control select,
.config-control input[type="text"],
.config-control input[type="number"] {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: var(--bg-overlay);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: 2px;
    min-width: 140px;
}
.config-control select:focus,
.config-control input:focus {
    outline: none;
    border-color: var(--vannes-light);
}

/* ── Raw Data View ─────────────────────────────────────────── */
.raw-data-wrap {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}
.raw-data-wrap .key {
    color: #5dade2;
}
.raw-data-wrap .str {
    color: #a9cce3;
}
.raw-data-wrap .num {
    color: #a9dfbf;
}
.raw-data-wrap .bool {
    color: var(--gold);
}
.raw-data-wrap .null {
    color: var(--text-dim);
}

/* ── Welcome screen ────────────────────────────────────────── */
#welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--top-h, 56px) - var(--tab-h, 48px));
    text-align: center;
    gap: 20px;
    padding: 20px 16px 40px;
    width: 100%;
}
.welcome-logo {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1;
}
.welcome-logo span {
    color: var(--gold);
}
.welcome-subtitle {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: -12px;
}
.welcome-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Grid Helpers ──────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
.grid-cols-ko {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --top-h: 50px;
        --tab-h: 44px;
    }
    .header-logo {
        font-size: 1.1rem;
    }
    .match-title {
        display: none;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }
    .grid-cols-ko {
        grid-template-columns: 1fr;
    }
    .score-main {
        font-size: 1.8rem;
    }
    .welcome-logo {
        font-size: 2rem;
    }
    #main-content {
        padding: 12px 10px;
    }
    .player-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 0 10px;
        font-size: 0.68rem;
        letter-spacing: 0.06em;
    }
    .grid-3 {
        grid-template-columns: 1fr;
    }
    .score-block {
        grid-template-columns: 1fr auto 1fr;
    }
    .team-name {
        font-size: 0.9rem;
    }
}

/* ── Utilities ─────────────────────────────────────────────── */
.mt-4 {
    margin-top: 4px;
}
.mt-8 {
    margin-top: 8px;
}
.mt-12 {
    margin-top: 12px;
}
.mt-16 {
    margin-top: 16px;
}
.mt-24 {
    margin-top: 24px;
}
.mb-12 {
    margin-bottom: 12px;
}
.mb-16 {
    margin-bottom: 16px;
}
.gap-8 {
    gap: 8px;
}
.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.align-center {
    align-items: center;
}
.justify-between {
    justify-content: space-between;
}
.text-right {
    text-align: right;
}
.text-center {
    text-align: center;
}
.hidden {
    display: none !important;
}
.dim {
    color: var(--text-dim);
}
.gold {
    color: var(--gold);
}
.home-col {
    color: var(--vannes-light);
}
.away-col {
    color: var(--liffre-light);
}
.mono {
    font-family: var(--font-mono);
}
.small {
    font-size: 0.75rem;
}
.uppercase {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════════════════════════
   S3b ADDITIONS — Auth · Drawer · Sous-onglets · Welcome
   ═══════════════════════════════════════════════════════════ */

/* ── AUTH ZONE ────────────────────────────────────────────── */
#auth-zone {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btn-auth {
    font-family: var(--fd);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: var(--r2);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    border: 1px solid #f97316;
    background: rgba(249, 115, 22, 0.08);
    color: #f97316;
}
.btn-auth:hover {
    background: rgba(249, 115, 22, 0.18);
}

/* User menu */
.user-menu {
    position: relative;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: var(--r2);
    background: var(--bg-card);
    border: 1px solid var(--b);
    cursor: pointer;
    transition: all 0.15s;
}
.user-avatar:hover {
    border-color: var(--b-light);
    background: var(--bg-hover);
}

.user-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f97316;
    color: #fff;
    font-family: var(--fd);
    font-size: 0.82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: left;
}
.user-name {
    font-family: var(--fd);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--t1);
    letter-spacing: 0.04em;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 0.62rem;
    color: var(--t3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.user-chevron {
    font-size: 0.6rem;
    color: var(--t3);
}

/* Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    z-index: 300;
    background: var(--bg-card-2);
    border: 1px solid var(--b-light);
    border-radius: var(--r3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}
.user-dropdown-header {
    padding: 14px 14px 10px;
    background: var(--bg-overlay);
}
.ud-name {
    font-family: var(--fd);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--t1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ud-club {
    font-size: 0.75rem;
    color: #f97316;
    margin-top: 2px;
}
.ud-role {
    display: inline-block;
    margin-top: 6px;
    font-family: var(--fd);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: var(--r1);
    background: var(--bg-card);
    border: 1px solid var(--b-light);
    color: var(--t2);
}
.user-dropdown-divider {
    height: 1px;
    background: var(--b);
    margin: 4px 0;
}
.ud-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: var(--t2);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.ud-item:hover {
    background: var(--bg-hover);
    color: var(--t1);
}
.ud-danger {
    color: var(--r) !important;
}
.ud-danger:hover {
    background: var(--r-bg) !important;
}

/* ── HAMBURGER ────────────────────────────────────────────── */
.btn-hamburger {
    display: none; /* masqué desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--b);
    border-radius: var(--r2);
    cursor: pointer;
    flex-shrink: 0;
}
.btn-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--t2);
    border-radius: 1px;
    transition: all 0.2s;
}
.btn-hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.btn-hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.btn-hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── DRAWER MOBILE ────────────────────────────────────────── */
#drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

#drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(280px, 85vw);
    z-index: 201;
    background: var(--bg-panel);
    border-left: 1px solid var(--b);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    animation: slideInRight 0.2s ease;
}
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--b);
}
.drawer-logo {
    font-family: var(--fd);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--t1);
}
.drawer-logo span {
    color: #f97316;
}

.btn-drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--b);
    color: var(--t2);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-drawer-close:hover {
    background: var(--bg-hover);
    color: var(--t1);
}

.drawer-user {
    padding: 12px 16px;
    border-bottom: 1px solid var(--b);
    background: var(--bg-overlay);
}
.drawer-user-name {
    font-family: var(--fd);
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--t1);
}
.drawer-user-club {
    font-size: 0.75rem;
    color: #f97316;
    margin-top: 2px;
}

#drawer-nav {
    flex: 1;
    padding: 8px 0;
}
.drawer-nav-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    font-family: var(--fd);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--t2);
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.drawer-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--t1);
    border-left-color: #f97316;
}
.drawer-nav-btn.active {
    color: #f97316;
    border-left-color: #f97316;
    background: rgba(249, 115, 22, 0.06);
}

.drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--b);
}
.drawer-login-btn,
.drawer-logout-btn {
    width: 100%;
    padding: 10px;
    font-family: var(--fd);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: var(--r2);
    cursor: pointer;
    transition: all 0.15s;
}
.drawer-login-btn {
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid #f97316;
    color: #f97316;
}
.drawer-login-btn:hover {
    background: rgba(249, 115, 22, 0.18);
}
.drawer-logout-btn {
    background: var(--r-bg);
    border: 1px solid var(--r-d);
    color: var(--r);
}
.drawer-logout-btn:hover {
    background: var(--r-bg);
    filter: brightness(1.2);
}

/* ── BARRE RAPIDE MOBILE ──────────────────────────────────── */
#mobile-quickbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 98;
    height: 60px;
    background: var(--bg-panel);
    border-top: 1px solid var(--b);
    display: none; /* affiché via media query mobile */
    grid-template-columns: repeat(4, 1fr);
}
.quickbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    padding: 6px 4px;
}
.quickbar-btn:hover,
.quickbar-btn.active {
    background: rgba(249, 115, 22, 0.06);
}
.quickbar-btn.active .qb-icon,
.quickbar-btn.active .qb-label {
    color: #f97316;
}
.qb-icon {
    font-size: 1.1rem;
}
.qb-label {
    font-family: var(--fd);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f97316;
}

/* ── SOUS-ONGLETS ─────────────────────────────────────────── */
.sub-tab-bar {
    display: flex;
    overflow-x: auto;
    gap: 2px;
    padding: 12px 0 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--b);
    scrollbar-width: none;
}
.sub-tab-bar::-webkit-scrollbar {
    display: none;
}

.sub-tab-btn {
    flex: 0 0 auto;
    padding: 7px 16px;
    font-family: var(--fd);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--t3);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.sub-tab-btn:hover {
    color: var(--t2);
}
.sub-tab-btn.active {
    color: #f97316;
    border-bottom-color: #f97316;
}

.sub-tab-panel {
    display: none;
}
.sub-tab-panel.active {
    display: block;
}

/* ── WELCOME SCREEN MIS À JOUR ────────────────────────────── */
.welcome-state {
    width: 100%;
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
    text-align: center;
}

.welcome-tagline {
    font-family: var(--fd);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--t2);
    margin-top: -6px;
}
.welcome-orgs {
    font-size: 0.75rem;
    color: #f97316;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: -8px;
}

/* Login box */
.welcome-login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(340px, 90vw);
    padding: 24px;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--b);
    border-radius: var(--r3);
}
.btn-lg {
    padding: 12px 28px;
    font-size: 0.88rem;
    width: 100%;
    justify-content: center;
}
.welcome-login-note {
    font-size: 0.72rem;
    color: var(--t3);
    text-align: center;
}
.welcome-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: var(--t3);
    font-size: 0.72rem;
}
.welcome-divider::before,
.welcome-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--b);
}

/* Welcome connecté */
.welcome-greeting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.welcome-logo-sm {
    gap: 8px !important;
}
.welcome-logo-img-sm {
    height: 60px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(249, 115, 22, 0.2));
}
.welcome-hello {
    font-family: var(--fd);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--t1);
    letter-spacing: 0.04em;
}
.welcome-club {
    font-size: 0.8rem;
    color: #f97316;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Matchs récents */
#recent-matches-wrap {
    width: min(500px, 90vw);
}
.recent-title {
    font-family: var(--fd);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--t3);
    margin-bottom: 8px;
}
.recent-match-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 5px;
    background: var(--bg-card);
    border: 1px solid var(--b);
    border-radius: var(--r2);
    cursor: pointer;
    transition: all 0.15s;
}
.recent-match-item:hover {
    border-color: #f97316;
    background: var(--bg-hover);
}
.rm-teams {
    flex: 1;
    font-family: var(--fd);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--t1);
}
.rm-score {
    font-family: var(--fm);
    font-size: 0.78rem;
    color: #f97316;
    font-weight: 700;
}
.rm-date {
    font-size: 0.7rem;
    color: var(--t3);
}

/* Logo welcome */
.welcome-logo-img {
    height: 150px; width: auto; object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(249,115,22,0.30));
    animation: floatLogo 3s ease-in-out infinite;
}
@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
/* Pied de page welcome */
.welcome-footer-note {
    font-size: 0.72rem; color: var(--t3);
    text-align: center; line-height: 1.6;
    max-width: 380px;
    padding: 8px 16px;
    border-top: 1px solid var(--b);
    margin-top: 8px;
}
.welcome-footer-note strong { color: #f97316; }

/* ── RESPONSIVE S3b ───────────────────────────────────────── */
@media (max-width: 900px) {
    /* Masquer tab bar desktop, afficher hamburger */
    #tab-bar {
        display: none;
    }
    .btn-hamburger {
        display: flex;
    }
    /* Afficher barre rapide */
    #mobile-quickbar {
        display: grid;
    }
    /* Décaler le contenu pour la quickbar */
    #main-content {
        padding-bottom: 72px;
    }
    /* Masquer label btn JSON */
    .btn-load-label {
        display: none;
    }
    .btn-load-json {
        padding: 7px 10px;
    }
    /* User info réduite */
    .user-info {
        display: none;
    }
    .user-chevron {
        display: none;
    }
}

@media (max-width: 480px) {
    .welcome-logo-img {
        height: 140px;
    }
    .welcome-login-box {
        padding: 18px;
    }
    .hbadge {
        display: none;
    }
}

/* ── MODAL LOGIN ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  position: relative;
  width: min(400px, 95vw);
  background: var(--bg-card-2);
  border: 1px solid var(--b-light);
  border-radius: var(--r3);
  padding: 28px 24px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 20px;
}
.modal-title {
  font-family: var(--fd); font-size: 1.3rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--t1);
}
.modal-subtitle {
  font-family: var(--fd); font-size: .80rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--t2); text-align: center; margin-bottom: 18px;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-overlay); border: 1px solid var(--b);
  color: var(--t3); cursor: pointer; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--t1); }
.modal-note {
  font-size: .68rem; color: var(--t3); text-align: center;
  margin-top: 14px; line-height: 1.5;
}

/* Form elements */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-family: var(--fd); font-size: .68rem;
  font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--t3); margin-bottom: 5px;
}
.form-input {
  width: 100%; padding: 10px 12px;
  font-family: var(--fm); font-size: .84rem;
  background: var(--bg-overlay); border: 1px solid var(--b-light);
  color: var(--t1); border-radius: var(--r2);
  transition: border-color .15s;
}
.form-input:focus {
  outline: none; border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249,115,22,.15);
}
.form-error {
  font-size: .75rem; color: var(--r);
  padding: 7px 10px; border-radius: var(--r1);
  background: var(--r-bg); margin-bottom: 10px;
}
.form-success {
  font-size: .75rem; color: var(--g);
  padding: 7px 10px; border-radius: var(--r1);
  background: var(--g-bg); margin-bottom: 10px;
}
.btn-full { width: 100%; justify-content: center; }
.btn-link {
  display: block; width: 100%; margin-top: 10px;
  font-size: .74rem; color: var(--t3); text-align: center;
  background: none; border: none; cursor: pointer;
  text-decoration: underline; transition: color .15s;
}
.btn-link:hover { color: #f97316; }
