:root {
  --bg: #0f0f10; --bg-2: #161618; --bg-3: #1d1d20; --bg-4: #26262a;
  --line: #29292d; --line-2: #37373c;
  --t1: #f1efe9; --t2: #a7a59f; --t3: #6f6e69;
  --acc: #f0b429; --acc-2: #ffc94d; --ink: #141414;
  --ok: #4cc38a; --bad: #e5534b; --info: #4f8ff7; --purple: #a970f5;
  --f-ui: "Barlow", system-ui, sans-serif;
  --f-cond: "Barlow Condensed", "Barlow", sans-serif;
  --f-display: "Big Shoulders Display", Impact, sans-serif;
  --radius: 6px;
  --radius-lg: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--t1); font-family: var(--f-ui); }
.hidden { display: none !important; }
.muted { color: var(--t3); }
.small { font-size: 12px; }
button { font: inherit; cursor: pointer; border: none; }

/* ------------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login__card { width: 100%; max-width: 340px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px 28px; text-align: center; }
.login__card h1 { font: 900 32px/1 var(--f-display); letter-spacing: .02em; margin-bottom: 6px; }
.login__card p { margin-bottom: 18px; }
.login__card input { width: 100%; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--t1); padding: 12px 14px; font-size: 15px; margin-bottom: 14px; }
.login__card input:focus { outline: none; border-color: var(--acc); }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ------------------------------------------------------------------------- bar */
.bar { display: flex; align-items: center; justify-content: space-between; padding: 0 22px; height: 60px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 20; gap: 18px; }
.bar__brand { display: flex; align-items: baseline; gap: 8px; flex: none; }
.bar__logo { font: 700 22px/1 var(--f-cond); letter-spacing: .06em; }
.bar__label { font: 600 12px/1 var(--f-ui); color: var(--t3); text-transform: uppercase; letter-spacing: .12em; }
.bar__search { flex: 1; max-width: 360px; position: relative; }
.bar__search input { width: 100%; height: 34px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--t1); padding: 0 12px 0 32px; font-size: 13px; }
.bar__search input:focus { outline: none; border-color: var(--acc); }
.bar__search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--t3); pointer-events: none; }
.bar__right { display: flex; align-items: center; gap: 12px; flex: none; }
.btn { height: 34px; padding: 0 14px; border-radius: var(--radius); background: var(--bg-4); color: var(--t1); font: 600 13px var(--f-ui); border: 1px solid var(--line-2); }
.btn:hover { border-color: var(--acc); }
.btn--primary { background: var(--acc); color: var(--ink); border: none; width: 100%; height: 42px; font-size: 15px; }
.btn--sm { height: 30px; font-size: 12px; }

/* ---------------------------------------------------------------------- layout */
.layout { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 210px 1fr; align-items: start; }
.nav { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 22px 10px 40px 22px; display: flex; flex-direction: column; gap: 2px; }
.nav__link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius); color: var(--t2); font: 600 12.5px var(--f-ui); text-decoration: none; letter-spacing: .01em; border-left: 2px solid transparent; transition: background-color .15s, color .15s; }
.nav__link:hover { color: var(--t1); background: var(--bg-3); }
.nav__link.is-active { color: var(--t1); background: var(--bg-3); border-left-color: var(--dot, var(--acc)); }
.nav__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--t3)); flex: none; }
.nav__group-label { font: 700 10px var(--f-ui); text-transform: uppercase; letter-spacing: .1em; color: var(--t3); padding: 14px 10px 4px; }
.nav__group-label:first-child { padding-top: 0; }
.content { min-width: 0; padding: 22px 22px 60px; display: grid; gap: 34px; }
.loading { padding: 80px 0; text-align: center; color: var(--t3); }
.section__head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.section__head h2 { font: 700 24px/1 var(--f-cond); letter-spacing: .01em; text-transform: uppercase; }
.section__head p { color: var(--t3); font-size: 13px; }
.section { border-left: 3px solid var(--line-2); padding-left: 16px; scroll-margin-top: 72px; }
.section--money { border-left-color: var(--acc); }
.section--player { border-left-color: var(--info); }
.section--mod { border-left-color: var(--bad); }
.section--econ { border-left-color: var(--purple); }
.section-group { display: grid; gap: 22px; }
.section-group + .section-group { padding-top: 12px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .nav { position: sticky; top: 60px; height: auto; flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); z-index: 10; gap: 4px; }
  .nav__group-label { display: none; }
  .nav__link { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; flex: none; }
  .nav__link.is-active { border-left-color: transparent; border-bottom-color: var(--dot, var(--acc)); }
  .bar__search { max-width: 160px; }
}

@media (max-width: 560px) {
  .bar { padding: 0 14px; gap: 10px; }
  .bar__brand .bar__label { display: none; }
  .bar__search { max-width: 120px; }
  .content { padding: 16px 14px 48px; gap: 26px; }
  .card { padding: 14px; }
  .stat__value { font-size: 26px; }
}

.grid { display: grid; gap: 14px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid--2 { grid-template-columns: 1.3fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid--2, .grid--3 { grid-template-columns: 1fr; } }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat__label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--t3); text-transform: uppercase; letter-spacing: .06em; }
.stat__label svg { width: 13px; height: 13px; stroke: var(--t3); flex: none; }
.stat__value { font: 800 32px/1.1 var(--f-cond); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 12px; color: var(--t3); line-height: 1.4; }
.stat--ok .stat__value { color: var(--ok); }
.stat--bad .stat__value { color: var(--bad); }
.stat--acc .stat__value { color: var(--acc); }
.stat--info .stat__value { color: var(--info); }
.stat--purple .stat__value { color: var(--purple); }

.panel__title { font: 700 15px var(--f-ui); margin-bottom: 12px; }

.bars { display: grid; gap: 8px; }
.bars__row { display: grid; grid-template-columns: 110px 1fr 60px; align-items: center; gap: 10px; font-size: 13px; }
.bars__label { color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { height: 10px; background: var(--bg-4); border-radius: 5px; overflow: hidden; }
.bars__fill { height: 100%; background: var(--acc); border-radius: 5px; }
.bars__val { text-align: right; font-variant-numeric: tabular-nums; color: var(--t2); }

/* liste alternative quand les valeurs sont égales/proches : une barre ne porterait aucune information */
.tally { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tally__item { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.tally__n { font: 800 22px/1 var(--f-cond); font-variant-numeric: tabular-nums; }
.tally__label { display: block; margin-top: 3px; color: var(--t2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--t3); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { transition: background-color .15s; }
tbody tr:nth-child(even) td { background: var(--bg-3); }
tbody tr:hover td { background: var(--bg-4); }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge--ok { background: rgba(76,195,138,.15); color: var(--ok); }
.badge--bad { background: rgba(229,83,75,.15); color: var(--bad); }
.badge--info { background: rgba(79,143,247,.15); color: var(--info); }

.spark { width: 100%; height: 90px; }
.spark path.line { fill: none; stroke: var(--acc); stroke-width: 2; }
.spark path.area { fill: rgba(240,180,41,.12); stroke: none; }

.empty { color: var(--t3); font-size: 13px; padding: 10px 0; }
.err-box { color: var(--bad); font-size: 13px; padding: 10px 0; }

/* ----------------------------------------------------------------- recherche joueur (résultats + fiche) */
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius); max-height: 320px; overflow-y: auto; z-index: 30; }
.search-results__item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results__item:last-child { border-bottom: none; }
.search-results__item:hover { background: var(--bg-4); }
.search-results__empty { padding: 10px 12px; color: var(--t3); font-size: 13px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: start center; padding: 60px 16px 40px; overflow-y: auto; z-index: 50; }
.modal { width: 100%; max-width: 640px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 24px; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal__title { font: 800 26px/1 var(--f-cond); text-transform: uppercase; }
.modal__subtitle { color: var(--t3); font-size: 13px; margin-top: 4px; }
.modal__close { background: var(--bg-4); border: 1px solid var(--line-2); color: var(--t1); width: 30px; height: 30px; border-radius: var(--radius); font-size: 16px; line-height: 1; }
.modal__close:hover { border-color: var(--bad); }
.modal__section { margin-top: 18px; }
.modal__section h3 { font: 700 12px var(--f-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--t3); margin-bottom: 8px; }
.modal .grid--stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

/* --------------------------------------------------------------------- inventaire joueur (modal) */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.inv-grid__item { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 12.5px; }
.inv-grid__count { color: var(--acc); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.inv-grid__label { color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

/* ------------------------------------------------------------------------- carte en direct (blips) */
.map__wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-2); }
.map__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map__blip { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--blip, var(--acc)); border: 2px solid var(--bg-2); transform: translate(-50%, -50%); cursor: default; }
