/* ===== Thème clair (par defaut) ===== */
:root {
    --bg: #faf6f0;
    --bg-elevated: #ffffff;
    --bg-soft: #f3ece1;
    --border: #e8dfd0;
    --text: #2b241a;
    --text-dim: #8a7d68;
    --accent: #e8811a;
    --accent-2: #d1495b;
    --accent-soft: rgba(232,129,26,.12);
    --t-color: #c8862f;
    --ct-color: #3672c9;
    --info: #3672c9;
    --win: #2f9e5b;
    --loss: #d1495b;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --shadow: 0 1px 3px rgba(43,36,26,.06), 0 1px 2px rgba(43,36,26,.08);
    --header-gradient: linear-gradient(135deg, #fff3e2 0%, #fef0ee 100%);
}

/* ===== Thème sombre (systeme) ===== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #17130f;
        --bg-elevated: #221c15;
        --bg-soft: #2a2219;
        --border: #3a2f22;
        --text: #f3ead9;
        --text-dim: #a5937a;
        --accent: #f5a326;
        --accent-2: #ef6f7c;
        --accent-soft: rgba(245,163,38,.15);
        --t-color: #e0a94e;
        --ct-color: #6ea3e8;
        --info: #6ea3e8;
        --win: #4cc179;
        --loss: #ef6f7c;
        --series-1: #3987e5;
        --series-2: #d95926;
        --series-3: #199e70;
        --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.4);
        --header-gradient: linear-gradient(135deg, #241a12 0%, #221419 100%);
    }
}

/* ===== Thème sombre (choix explicite) ===== */
:root[data-theme="dark"] {
    --bg: #17130f;
    --bg-elevated: #221c15;
    --bg-soft: #2a2219;
    --border: #3a2f22;
    --text: #f3ead9;
    --text-dim: #a5937a;
    --accent: #f5a326;
    --accent-2: #ef6f7c;
    --accent-soft: rgba(245,163,38,.15);
    --t-color: #e0a94e;
    --ct-color: #6ea3e8;
    --win: #4cc179;
    --loss: #ef6f7c;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.4);
    --header-gradient: linear-gradient(135deg, #241a12 0%, #221419 100%);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.site-header {
    background: var(--header-gradient);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 16px;
}

.brand {
    font-weight: 800;
    font-size: 21px;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
    letter-spacing: -.01em;
}
.brand span {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
nav a:hover { color: var(--text); background: var(--bg-soft); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-toggle {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .toggle-label-dark { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .toggle-label-light { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .toggle-label-dark { display: inline; }
}

:root[data-theme="dark"] .theme-toggle .toggle-label-light { display: none; }
:root[data-theme="dark"] .theme-toggle .toggle-label-dark { display: inline; }

main.wrap { padding: 40px 20px 64px; }

h1 { font-size: 24px; margin: 0 0 20px; letter-spacing: -.01em; }
h2 { font-size: 15px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin: 32px 0 12px; font-weight: 700; }

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: var(--shadow);
}

.match-list { display: flex; flex-direction: column; gap: 10px; }

.match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text);
    gap: 16px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    transition: transform .12s ease, border-color .12s ease;
}
.match-row:hover { border-color: var(--accent); transform: translateY(-1px); }

.match-map { font-weight: 700; min-width: 90px; }
.match-server { color: var(--text-dim); font-size: 12px; background: var(--bg-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.match-date { color: var(--text-dim); font-size: 13px; min-width: 130px; }

.match-score { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; margin-left: auto; }
.score-t { color: var(--t-color); }
.score-ct { color: var(--ct-color); }
.score-sep { color: var(--text-dim); font-weight: 400; }

.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}
.badge-t { background: rgba(200,134,47,.15); color: var(--t-color); }
.badge-ct { background: rgba(54,114,201,.15); color: var(--ct-color); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-dim); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.player-cell { display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--bg-soft); flex-shrink: 0; object-fit: cover; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.kd-pos { color: var(--win); }
.kd-neg { color: var(--loss); }

.team-block { margin-bottom: 24px; }
.team-title { font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.team-title.t { color: var(--t-color); }
.team-title.ct { color: var(--ct-color); }

.win-tag { color: var(--win); font-weight: 700; }
.loss-tag { color: var(--text-dim); }

.empty-state { color: var(--text-dim); padding: 40px 0; text-align: center; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 36px 0 44px;
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 13px;
}

.rank-num { color: var(--text-dim); font-weight: 700; width: 24px; display: inline-block; }

.map-thumb {
    width: 64px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.map-thumb-lg {
    width: 100%;
    max-width: 320px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: block;
    margin-bottom: 16px;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--header-gradient);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}
.live-dot.on { background: var(--win); box-shadow: 0 0 0 4px rgba(47,158,91,.18); }
.live-dot-info.on { background: var(--info); box-shadow: 0 0 0 4px rgba(54,114,201,.18); }

.status-card-info { border-left: 3px solid var(--info); }

.status-info { flex: 1; min-width: 0; }
.status-host { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.status-mix-tag {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.status-mix-idle { background: var(--bg-soft); color: var(--text-dim); }
.status-mix-mapvote { background: rgba(54,114,201,.15); color: var(--info); }
.status-mix-captainpick { background: rgba(54,114,201,.15); color: var(--info); }
.status-mix-warmup { background: var(--accent-soft); color: var(--accent); }
.status-mix-knife { background: var(--accent-soft); color: var(--accent); }
.status-mix-live { background: rgba(47,158,91,.15); color: var(--win); }

.nav-login {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700 !important;
}
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-avatar { width: 22px; height: 22px; border-radius: 6px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.btn-ghost { color: var(--text); background: var(--bg-elevated); }
.btn-ghost:hover { border-color: var(--accent); }

.status-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.match-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    background: var(--header-gradient);
}
.match-hero .map-thumb-lg { width: 200px; max-width: 200px; margin-bottom: 0; flex-shrink: 0; }
.match-hero-info { flex: 1; min-width: 220px; }
.match-hero-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}
.hero-team { display: flex; align-items: center; gap: 10px; }
.hero-score-num { font-size: 42px; font-weight: 800; line-height: 1; }
.hero-sep { font-size: 28px; color: var(--text-dim); font-weight: 300; }

.scoreboard-card { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.scoreboard { min-width: 480px; }
table.scoreboard th, table.scoreboard td { padding: 12px 16px; }

.player-link { text-decoration: none; color: var(--text); }
.player-link:hover span { text-decoration: underline; }
.mvp-star { color: var(--accent); margin-left: 4px; }

/* ---- profil joueur detaille ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-dim);
    margin-bottom: 10px;
}
.stat-card-numbers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-top: 14px;
    font-size: 13px;
}
.stat-card-numbers b { float: right; color: var(--text); }

.gauge-wrap { display: flex; justify-content: center; margin: 6px 0; }
.gauge {
    --pct: 50;
    --gauge-color: var(--win);
    width: 110px; height: 110px; border-radius: 50%;
    position: relative;
    background: conic-gradient(var(--gauge-color) calc(var(--pct) * 1%), var(--border) 0);
}
.gauge::before {
    content: "";
    position: absolute; inset: 10px;
    border-radius: 50%;
    background: var(--bg-elevated);
}
.gauge-value {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800;
}

.simple-num-row { display: flex; gap: 22px; flex-wrap: wrap; }
.simple-num-row .n-label { color: var(--text-dim); font-size: 12px; }
.simple-num-row .n-val { font-size: 20px; font-weight: 700; }

.clutch-grid { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.clutch-item { text-align: center; }
.clutch-donut {
    --pct: 0;
    --gauge-color: var(--win);
    width: 54px; height: 54px; border-radius: 50%;
    position: relative;
    background: conic-gradient(var(--gauge-color) calc(var(--pct) * 1%), var(--border) 0);
    margin: 0 auto 6px;
}
.clutch-donut::before { content:""; position:absolute; inset:6px; border-radius:50%; background:var(--bg-elevated); }
.clutch-donut-val { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; }
.clutch-label { font-size: 11px; color: var(--text-dim); }
.clutch-record { font-size: 10px; color: var(--text-dim); }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; transition: width .3s ease; }
.bar-label { font-size: 12px; color: var(--text-dim); width: 90px; flex-shrink: 0; }
.bar-pct { font-size: 12px; font-weight: 700; width: 40px; text-align: right; flex-shrink: 0; }

.match-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.match-dot {
    width: 12px; height: 12px; border-radius: 50%;
    display: inline-block;
}
.match-dot.win { background: var(--win); }
.match-dot.loss { background: var(--loss); }
.match-dot.tie { background: var(--text-dim); }

.mini-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mini-list-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.mini-list-row .n-val { font-weight: 700; }

.rating-note { font-size: 12px; color: var(--text-dim); margin-top: -8px; margin-bottom: 20px; }

/* ---- refonte fiche joueur : bandeau profil + pilules + tableau + cartes d'armes ---- */
.player-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--header-gradient);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.player-hero-avatar { width: 72px; height: 72px; border-radius: 14px; border: 2px solid var(--border); flex-shrink: 0; object-fit: cover; }
.player-hero-name { margin: 0; font-size: 24px; }
.player-hero-steamid { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.pstat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.pstat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}
.pstat-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.pstat-value { font-size: 20px; font-weight: 800; line-height: 1.1; }
.pstat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.ig-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elevated); box-shadow: var(--shadow); margin-bottom: 24px; }
.ig-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.ig-table th, .ig-table td { padding: 12px 16px; text-align: center; }
.ig-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.ig-table tbody td { font-weight: 700; }

.weapon-card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 24px; }
.weapon-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); text-align: center; }
.weapon-card-top1 { border-color: var(--accent); background: var(--accent-soft); }
.weapon-card-rank { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-dim); letter-spacing: .04em; }
.weapon-card-name { font-size: 15px; font-weight: 800; margin: 4px 0 2px; }
.weapon-card-kills { font-size: 20px; font-weight: 800; color: var(--accent); }
.weapon-card-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin: 28px 0 12px; }

@media (max-width: 600px) {
    .player-hero { flex-direction: column; text-align: center; padding: 18px; }
    .ig-table th, .ig-table td { padding: 10px 12px; }
}

/* ---- camemberts (conic-gradient, pas de librairie) ---- */
.pie-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 10px 0; }
.pie-chart { width: 96px; height: 96px; border-radius: 50%; position: relative; flex-shrink: 0; }
.pie-chart-hole {
    position: absolute; inset: 20px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    text-align: center;
}
.pie-chart-hole-value { font-size: 15px; font-weight: 800; line-height: 1.1; }
.pie-chart-hole-label { font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; }
.pie-legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; flex: 1; min-width: 130px; }
.pie-legend-item { display: flex; align-items: center; gap: 8px; }
.pie-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.pie-legend-label { color: var(--text-dim); }
.pie-legend-value { font-weight: 700; margin-left: auto; padding-left: 10px; }

/* ===== Accueil : bandeau serveurs cote a cote sur desktop ===== */
.servers-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.servers-row .status-card { margin-bottom: 0; }

.status-card-pulse {
    animation: pp-card-pulse 2.2s ease-in-out infinite;
}
@keyframes pp-card-pulse {
    0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(232,129,26,.35); }
    50% { box-shadow: var(--shadow), 0 0 0 7px rgba(232,129,26,0); }
}
.status-card-pulse-info {
    animation: pp-card-pulse-info 2.2s ease-in-out infinite;
}
@keyframes pp-card-pulse-info {
    0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(54,114,201,.35); }
    50% { box-shadow: var(--shadow), 0 0 0 7px rgba(54,114,201,0); }
}
.status-card-blink-blue {
    animation: pp-card-blink-blue 1.3s ease-in-out infinite;
}
@keyframes pp-card-blink-blue {
    0%, 100% { border-color: var(--border); box-shadow: var(--shadow), 0 0 0 0 rgba(54,114,201,.5); }
    50% { border-color: var(--info); box-shadow: var(--shadow), 0 0 0 8px rgba(54,114,201,.12); }
}

@media (prefers-reduced-motion: reduce) {
    .status-card-pulse, .status-card-pulse-info, .status-card-blink-blue { animation: none; }
}

/* ===== Responsive ===== */
@media (max-width: 780px) {
    .servers-row { grid-template-columns: 1fr; }

    .header-inner { height: 58px; }
    .brand { font-size: 18px; }

    .nav-toggle { display: inline-flex; }
    nav {
        display: none;
        position: absolute;
        top: 58px;
        left: 0;
        right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
        box-shadow: var(--shadow);
    }
    nav.open { display: flex; }
    nav a { padding: 12px 14px; border-radius: 8px; }

    main.wrap { padding: 20px 14px 40px; }
    .wrap { padding: 0 14px; }

    h1 { font-size: 20px; }

    .match-row { padding: 12px 14px; gap: 10px; }
    .match-date { min-width: 0; font-size: 12px; }
    .match-score { font-size: 16px; }

    .match-hero { padding: 16px; gap: 14px; }
    .match-hero .map-thumb-lg { width: 100%; max-width: 100%; height: 140px; }
    .hero-score-num { font-size: 32px; }

    .stat-card { padding: 14px; }
    .gauge { width: 90px; height: 90px; }
    .gauge-value { font-size: 22px; }
}

/* Cartes de statut serveur (automix, war, file d'attente...) : sur petit
   ecran, le point/la vignette/le tag/les boutons alignes sur une seule
   ligne ecrasaient le nom du serveur (troncature en "..."). On les
   reorganise en colonnes lisibles, avec le nom complet qui passe a la
   ligne au lieu d'etre coupe. */
@media (max-width: 600px) {
    .status-card {
        position: relative;
        flex-wrap: wrap;
        padding: 14px 16px 14px 40px;
        gap: 8px;
    }
    .status-card .live-dot {
        position: absolute;
        top: 18px;
        left: 16px;
    }
    .status-card .map-thumb {
        width: 48px;
        height: 34px;
    }
    .status-info {
        flex: 1 1 auto;
        min-width: 140px;
    }
    .status-host {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
        font-size: 14px;
        line-height: 1.3;
    }
    .status-sub { font-size: 12px; }
    .status-mix-tag {
        order: 3;
        flex: 1 1 100%;
        text-align: center;
    }
    .status-actions {
        order: 4;
        flex: 1 1 100%;
        gap: 8px;
    }
    .status-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        font-size: 12px;
    }
}

@media (min-width: 1400px) {
    .wrap { max-width: 1320px; }
}
