:root{
  --bg0:#070304;
  --bg1:#1a0704;
  --bg2:#2b0b06;

  --card:#1b0b09cc;
  --card2:#140807cc;

  --text:#f6f2ee;
  --muted:#d8c7bc;
  --muted2:#bda79a;

  --accent:#ffff;   /* or */
  --accent2:#ffcc4d;

  --shadow: 0 18px 40px rgba(0,0,0,.15);
  --stroke: 1px solid rgba(255,255,255,.08);
  --radius: 22px;
  --radius2: 16px;

  --max: 420px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);

  background:
    radial-gradient(1000px 800px at 15% 0%, rgba(255, 0, 40, .18), transparent 60%),
    radial-gradient(900px 700px at 85% 20%, rgba(180, 0, 0, .16), transparent 65%),
    radial-gradient(700px 700px at 50% 70%, rgba(120, 0, 0, .14), transparent 60%),
    linear-gradient(180deg, #050505 0%, #0d0003 45%, #140003 100%);

  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
}

body.route-standings #matchdayBar{
  display:none !important;
}

.app{
  display:flex;
  flex-direction:column;   /* <-- LA CORRECTION */
  min-height:100vh;
}
.top, .content{
  width:min(var(--max), 100%);
}

.top{
  position: sticky;
  top: 0;
  z-index: 1000;

  padding: calc(18px + var(--safeTop)) 16px 12px;

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  background: linear-gradient(
    180deg,
    rgba(20, 0, 0, 0.75),
    rgba(20, 0, 0, 0.55)
  );

  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: backdrop-filter .3s ease, background .3s ease;
}

.brand .club{
  font-weight:900;
  font-size:34px;
  letter-spacing:.6px;
  color:var(--accent);
  text-transform:uppercase;
  background: linear-gradient(-150deg, #ffffff, #f5dcdc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.seasonRow{
  margin-top:10px;
  position:relative;
}

.seasonBtn{
  appearance:none;
  border:0;
  background:transparent;
  color:var(--accent);
  font-weight:700;
  font-size:18px;
  padding:6px 0;
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
}

.chev{
  font-size:12px;
  transform: translateY(1px);
  opacity:.95;
}

.tabs{
  margin-top:14px;
  display:flex;
  gap:18px;
  padding-bottom:8px;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.tab{
  appearance:none;
  border:0;
  background:transparent;
  color:rgba(255,255,255,.55);
  font-weight:800;
  letter-spacing:.2px;
  text-transform:lowercase;
  font-size:16px;
  padding:10px 2px 12px;
  cursor:pointer;
  position:relative;
}

.tab.active{
  color:var(--text);
}

.tab.active::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-1px;
  height:3px;
  border-radius:3px;
  background:rgba(255,255,255,.9);
}

.content{
  padding: 0 16px 40px;
  padding-bottom: calc(40px + var(--safeBottom));
}

.matchdayBar{
  margin-top:8px;
  display:grid;
  grid-template-columns: 56px 1fr 56px;
  align-items:center;
  gap:10px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: var(--stroke);
  border-radius: 999px;
  padding:10px;
  backdrop-filter: blur(10px);
  color: white;
  font-weight: 800;
}

.navBtn{
  height:44px;
  border-radius:999px;
  border: 0;
  background: rgba(0,0,0,0);
  color: rgba(255,255,255,.9);
  font-size:28px;
  cursor:pointer;
}

.navBtn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.navBtn:active{ transform: scale(.98); }

.matchdayCenter{
  position:relative;
  display:flex;
  justify-content:center;
}

.matchdayBtn{
  width:100%;
  max-width:220px;
  height:44px;
  border-radius:999px;
  border:0;
  background: rgba(0,0,0,.22);
  color: var(--text);
  font-weight:800;
  letter-spacing:.2px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  cursor:pointer;
  border: var(--stroke);
}

.h2{
  margin:6px 2px 6px;
  font-size:26px;
  letter-spacing:.2px;
}

.sub{
  margin:0 2px 14px;
  color: rgba(255,255,255,.72);
  font-weight:700;
}

.cards{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.card{
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px 14px 14px;
  backdrop-filter: blur(10px);
}

.rowTop{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:12px;
  min-height:56px;
}

.team{
  font-weight:800;
  font-size:16px;
  line-height:1.15;
}

.team.right{ text-align:right; }

.mid{
  text-align:center;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.time{
  font-weight:900;
  letter-spacing:.4px;
  color: rgba(255,255,255,.9);
}

.score{
  font-weight:900;
  font-size:18px;
  letter-spacing:.6px;
}

.pill{
  margin-top:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(240,165,0,.35);
  color: var(--accent2);
  background: rgba(240,165,0,.10);
  font-weight:800;
  font-size:12px;
  width: fit-content;
}

.pillWrap{
  display:flex;
  justify-content:center;
}

.menu{
  position:absolute;
  top: calc(100% + 8px);
  left:0;
  min-width: 240px;
  max-width: 320px;
  padding:10px;
  border-radius: 16px;
  border: var(--stroke);
  background: rgba(10,5,5,.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  z-index:50;
}

.menuItem{
  width:100%;
  border:0;
  background:transparent;
  color: rgba(255,255,255,.92);
  padding:12px 10px;
  border-radius: 12px;
  font-weight:800;
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  gap:10px;
}

.menuItem:hover{
  background: rgba(255,255,255,.06);
}

.menuItem .meta{
  color: rgba(255,255,255,.55);
  font-weight:700;
}

.tableWrap{
  margin-top:14px;
  background: rgba(0,0,0,.20);
  border: var(--stroke);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

.table th, .table td{
  padding:12px 10px;
  border-bottom:1px solid rgba(255,255,255,.07);
}

.table th{
  text-align:left;
  color: rgba(255,255,255,.75);
  font-weight:900;
  background: rgba(255,255,255,.04);
}

.table td{ color: rgba(255,255,255,.92); }
.table td.num, .table th.num{ text-align:right; }

.hint{
  margin:14px 2px 0;
  color: rgba(255,255,255,.55);
  font-weight:700;
  font-size:13px;
}

/* Actions */
.actions{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.actionBtn{
  appearance:none;
  border:1px solid rgba(240,165,0,.35);
  background: rgba(240,165,0,.14);
  color: var(--accent2);
  font-weight:900;
  padding:10px 12px;
  border-radius: 999px;
  cursor:pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}

.actionBtn.ghost{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.88);
}

.actionBtn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.status{
  margin-top:10px;
  font-weight:800;
  color: rgba(255,255,255,.72);
  font-size:13px;
}

/* Focus */
button:focus-visible{
  outline: 2px solid rgba(240,165,0,.65);
  outline-offset: 2px;
  border-radius: 12px;
}

/* =======================
   Mobile / PWA polish
   ======================= */
:root{
  --safeTop: env(safe-area-inset-top, 0px);
  --safeBottom: env(safe-area-inset-bottom, 0px);
}

*{
  -webkit-tap-highlight-color: transparent;
}

.top{
  padding-top: calc(18px + var(--safeTop));
}

.content{
  padding-bottom: calc(40px + var(--safeBottom));
}

.filters{
  margin-top: 8px;
}

.status{
  margin-top: 8px;
}

/* Make dropdowns always appear above cards/tables */
.top, .content{
  isolation: isolate;
}

.matchdayBar{
  position: relative;
  z-index: 10;
}

.seasonRow,
.matchdayCenter{
  position: relative;
  z-index: 20;
}

.menu{
  z-index: 9999;
}

/* In case old buttons still exist somewhere */
.actions,
#importBtn,
#exportBtn{
  display:none !important;
}

/* A11y label (hidden but accessible) */
.srOnly{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

/* Native select styled like the previous button */
.matchdaySelect{
  width:100%;
  max-width:260px;
  height:44px;
  border-radius:999px;
  border: 0;
  background: rgba(0,0,0,0);
  color: var(--text);
  font-weight:800;
  letter-spacing:.2px;
  padding:0 14px;
  text-align: center;
  appearance:auto; /* important: keep native behavior */
}

/* iOS: avoid weird zoom on small font */
.matchdaySelect{
  font-size:15px;
}

.tabs .tab{
  text-decoration:none;
}


body.route-stats #matchdayBar{
  display:none !important;
}

/* Stats view */
.statsBar{
  margin-top:12px;
  display:flex;
  justify-content:center;
}

.playerSelect{
  width:100%;
  max-width:320px;
  height:44px;
  border-radius:999px;
  border: var(--stroke);
  background: rgba(0,0,0,.22);
  color: var(--text);
  font-weight:800;
  letter-spacing:.2px;
  padding:0 14px;
  appearance:auto;
  font-size:16px;
}

.statsGrid{
  margin-top:14px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.statCard{
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: var(--stroke);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding:14px 14px 12px;
  backdrop-filter: blur(10px);
}

.statLabel{
  color: rgba(255,255,255,.70);
  font-weight:900;
  letter-spacing:.25px;
  font-size:12px;
  text-transform:uppercase;
}

.statValue{
  margin-top:8px;
  font-size:20px;
  font-weight:950;
  letter-spacing:.4px;
}

.statMeta{
  margin-top:6px;
  color: rgba(255,255,255,.55);
  font-weight:800;
  font-size:12px;
}

.statCard.wide{
  grid-column: 1 / -1;
}

#statsPlayerName {
  margin-top: 10px;
}

/* Stats: avatar */
.avatarRow{
  display:flex;
  align-items:center;
  gap:12px;
}

.avatar {
  width: 100%;
  flex: 0 0 56px;
  border-radius: var(--radius2);
  border: var(--stroke);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  letter-spacing: .5px;
  background: rgba(0, 0, 0, .22);
}

.avatar img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;     /* ✅ l’image est recadrée si besoin */
  object-position:center;
}

.avatarInitials{
  font-size:18px;
}

.avatarName{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.avatarName .big{
  font-size:16px;
  font-weight:950;
}

.avatarName .small{
  font-size:12px;
  color: rgba(255,255,255,.60);
  font-weight:800;
}

/* Stats: valeur mise en avant (position classement) */
.statValue.rankValue{
  font-size:110px;
  line-height:1;
}


/* =======================
   Photo card special
   ======================= */

/* Supprime padding interne */
.photoCard{
  padding:0;
  overflow:hidden; /* important pour border-radius */
  aspect-ratio: 1 / 1;
}

/* Cache totalement le label vide */
.photoCard .statLabel{
  display:none;
}

/* Supprime margin de la value */
.photoCard .statValue{
  margin:0;
  height:100%;
  padding:0;
}

/* Supprime avatarRow si encore présent */
.photoCard .avatarRow{
  display:block;
}

/* Avatar prend toute la card */
.photoCard .avatar{
  width:100%;
  height:100%;
  border:none;
  border-radius: var(--radius2);
}

/* L’image remplit parfaitement */
.photoCard img,
.photoCard .playerPhoto{
  width:100% !important;
  height:100% !important;
  display:block;
  object-fit:cover;
}

.matchScoreCard .scoreBig{
  font-size:28px;
  letter-spacing:.8px;
}

.matchTableWrap{
  margin-top:14px;
}

.matchTable{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}

.matchTable td{
  padding:6px 4px;
  text-align:center;
}

.matchTable td:nth-child(2){
  font-weight:600;
  opacity:.75;
}

.matchTable tr:not(:last-child) td{
  border-bottom:1px solid rgba(255,255,255,.08);
}

.playerTableWrap{
  margin-top:12px;
}

.playerTable{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}

.playerTable td{
  padding:6px 4px;
}

.playerTable td:first-child{
  opacity:.75;
  font-weight:600;
  text-align:left;
}

.playerTable td:last-child{
  text-align:right;
  font-weight:700;
}

.playerTable tr:not(:last-child) td{
  border-bottom:1px solid rgba(255,255,255,.08);
}

.sectionTitle{
  margin: 10px 2px 2px;
  padding: 10px 12px;
  border-radius: 14px;
  border: var(--stroke);
  background: rgba(255,255,255,.04);
  font-weight: 950;
  letter-spacing: .3px;
  color: rgba(255,255,255,.82);
  text-transform: uppercase;
  font-size: 12px;
}

.seasonSelect{
  width:100%;
  max-width:260px;
  height:44px;
  border-radius:999px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: var(--stroke);
  color: var(--accent);
  font-weight:800;
  letter-spacing:.2px;
  padding:0 14px;
  appearance:auto; /* natif device */
  font-size:15px;  /* évite zoom iOS */
}

#seasonSelect option, .matchdaySelect option,
.playerSelect option {
  color: #200606;
  background-color: #fff;
}

/* ===== Standings sortable ===== */

.table th.sort{
  cursor:pointer;
  user-select:none;
  position:relative;
  padding-right:22px;
}

.table th.sort:hover{
  background: rgba(255,255,255,.06);
}

.table th .sortIcon{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  font-size:11px;
  opacity:.8;
}

.table th.sort.isAsc .sortIcon::before{ content:"▲"; }
.table th.sort.isDesc .sortIcon::before{ content:"▼"; }

/* Standings: nickname big + real name small */
.playerNick{
  font-weight: 950;
  letter-spacing: .2px;
  line-height: 1.05;
}

.playerReal{
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,.60);
  letter-spacing: .15px;
}

/* Standings: highlight top 6 (titulaires) */
.table tr.top6 td{
  background: rgb(255 255 255 / 10%);
}

.table tr.top6 td:first-child{
  font-weight: 950;
  color: rgba(255,255,255,.95);
}

.table tr.top6 .playerNick{
  text-shadow: 0 0 18px rgb(255 255 255 / 14%);
}