:root{
  --bg:#070707;
  --blue:#061842;
  --orange:#ff8800;
  --muted:rgba(255,255,255,.58);
  --green:#51d38a;
  --red:#ff4040;
  --yellow:#efff45;
  --footer-h:68px;
  --header-full-h:132px;
  --header-compact-h:52px;
  --scroll-progress:0; /* 0 = tout en haut, 1 = header complètement compact (mis à jour en JS) */
  --header-h:calc(var(--header-full-h) - (var(--header-full-h) - var(--header-compact-h)) * var(--scroll-progress));
}

*{box-sizing:border-box}
html,body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:#fff;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  overscroll-behavior:none;
}

body.client .admin-footer,
body.client .admin-badge{display:none}

button,input,select{font:inherit}
button{border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
input,select{
  width:100%;
  border:1px solid #ddd;
  border-radius:12px;
  padding:12px;
  background:#f7f7f7;
  color:#111;
  outline:none;
}
label{
  display:block;
  margin-bottom:6px;
  font-size:12px;
  font-weight:900;
  transition:font-size .16s cubic-bezier(.2,.8,.2,1), padding .16s cubic-bezier(.2,.8,.2,1), min-width .16s cubic-bezier(.2,.8,.2,1);
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#555;
}

.app{
  min-height:100dvh;
  padding-top:var(--header-h);
  padding-bottom:calc(var(--footer-h) + env(safe-area-inset-bottom,0px));
}

body.client .app{padding-bottom:0}

.admin-badge{
  position:fixed;
  top:8px;
  left:8px;
  z-index:70;
  padding:7px 10px;
  border-radius:999px;
  background:rgba(0,0,0,.48);
  border:1px solid rgba(255,255,255,.12);
  color:rgba(255,255,255,.8);
  backdrop-filter:blur(10px);
  font-size:11px;
  font-weight:900;
}

.hero{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:60;
  height:var(--header-h);
  padding:calc(10px - 10px * var(--scroll-progress)) 8px calc(10px - 10px * var(--scroll-progress));
  display:grid;
  align-items:stretch;
  background:#050505;
  box-shadow:0 10px 24px rgba(0,0,0,.38);    
}

/* Barre complète : s'efface et glisse légèrement vers le haut au fil du scroll,
   plutôt que de rétrécir sur place (c'est ce rétrécissement en direct qui écrasait
   le texte). Piloté uniquement par --scroll-progress (calc), pas de transition CSS
   qui viendrait courir après une valeur qui change à chaque frame. */
.hero-card{
  position:relative;
  display:grid;
  align-content:center;
  align-items:center;
  overflow:hidden;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.10);
  background:
    linear-gradient(rgba(0,0,0,.10), rgba(0,0,0,.76)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='250' viewBox='0 0 1200 250'%3E%3Crect width='1200' height='250' fill='%23040b13'/%3E%3Cellipse cx='600' cy='62' rx='560' ry='132' fill='none' stroke='%23456577' stroke-width='13' opacity='.32'/%3E%3Cellipse cx='600' cy='84' rx='500' ry='104' fill='none' stroke='%238fb0c8' stroke-width='3' opacity='.24'/%3E%3Cpath d='M0 200 C240 155 460 155 600 176 C790 207 985 170 1200 199 L1200 250 L0 250 Z' fill='%23070a0e'/%3E%3C/svg%3E");
  background-size:cover;
  background-position:center;
  padding:18px 10px;
  height:100%;
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06);
  opacity:calc(1 - var(--scroll-progress));
  transform:translateY(calc(var(--scroll-progress) * -10px));
}

body.header-compact .hero-card{
  pointer-events:none; /* purement pour désactiver les clics une fois quasi invisible, le visuel est déjà géré par calc() ci-dessus */
}

.hero-grid{
  width:min(960px,100%);
  margin:0 auto;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:10px;
  align-items:end;
}

.scorebox,
.date{
  grid-column:2; /* même case : un seul des deux visible à la fois, basculé en JS */
}

.team{
  display:grid;
  justify-items:center;
  gap:7px;
  min-width:0;
}

.logo{
  width:44px;
  height:44px;
  border-radius:50%;
  background:white;
  display:grid;
  place-items:center;
  color:#111;
  box-shadow:0 0 13px rgba(255,255,255,.62);
  font-weight:1000;
  overflow:hidden;
  font-size:10px;
}
.logo svg{width:33px;height:33px}
.logo img{width:100%;height:100%;object-fit:cover}

.team-name{
  font-family:Georgia,serif;
  font-size:15px;
  font-weight:900;
  text-align:center;
  text-shadow:0 2px 5px black;
  overflow-wrap:anywhere;
}

.scorebox{
  align-self:center;
  display:grid;
  justify-items:center;
  transform:translateY(3px);
}

.score-main{
  background:var(--orange);
  color:white;
  border-radius:6px 6px 0 0;
  padding:5px 12px;
  font-size:28px;
  font-weight:1000;
  line-height:1;
  font-variant-numeric:tabular-nums;
  box-shadow:0 8px 24px rgba(0,0,0,.35);
}
.score-status{
  background:white;
  color:#d16e00;
  padding:5px 10px;
  border-radius:0 0 6px 6px;
  font-size:12px;
  font-weight:700;
  width:80px;
  text-align:center;
}
.score-status em {
    font-size: 10px;
    font-style: normal;
}
.score-status.clignote::after,
.hero-mini-chrono.clignote::after {
    content: "'";
    animation: clignoter 1s infinite;
}
@keyframes clignoter {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

.date{
  align-self:center;
  display:grid;
  justify-items:center;
  gap:1px;
  transform:translateY(3px);
}

.date .heure{
  font-family:Georgia,serif;
  font-weight:900;
  font-size:26px;
  color:white;
}

.date .jour{
  font-size:11px;
  color:rgba(255,255,255,.6);
  text-transform:uppercase;
  letter-spacing:.04em;
}

/* Mini-barre compacte : logo/score/logo à gauche, chrono à droite. Apparaît en
   fondu au fil du scroll (--scroll-progress), en même temps que la barre complète
   s'efface — jamais de transition CSS séparée, toujours en phase avec le scroll. */
.hero-mini{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  opacity:var(--scroll-progress);
  transform:translateY(calc((1 - var(--scroll-progress)) * -8px));
  pointer-events:none;
}

body.header-compact .hero-mini{
  pointer-events:auto; /* purement pour activer les clics une fois quasi visible */
}

.hero-mini-teams{
  display:flex;
  align-items:center;
  gap:8px;
}

.logo-mini{
  width:26px;
  height:26px;
  border-radius:50%;
  background:white;
  display:grid;
  place-items:center;
  overflow:hidden;
  font-size:8px;
  font-weight:1000;
  color:#111;
}
.logo-mini img{width:100%;height:100%;object-fit:cover}

.hero-mini-score{
  font-family:Georgia,serif;
  font-weight:900;
  font-size:16px;
  color:white;
  font-variant-numeric:tabular-nums;
}

.hero-mini-chrono{
  font-weight:900;
  font-size:13px;
  color:var(--orange);
  font-variant-numeric:tabular-nums;
}

.tabs{
  position:sticky;
  top:var(--header-h);
  z-index:30;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:5px;
  padding:calc(10px - 10px * var(--scroll-progress)) 7px 0;
  background:#050505;
  max-height:calc(60px - 60px * var(--scroll-progress));
  opacity:calc(1 - var(--scroll-progress));
  overflow:hidden;
}

body.header-compact .tabs{
  pointer-events:none; /* purement pour désactiver les clics une fois replié, le visuel est déjà géré par calc() ci-dessus */
}

.tab{
  height:38px;
  background:#171717;
  color:white;
  font-family:Georgia,serif;
  font-weight:900;
  border-radius:5px;
  font-size:14px;
    border-bottom: 2px solid #171717;
}
.tab.active{border-bottom: 2px solid var(--orange)}

.content{
  width:min(960px,100%);
  margin:0 auto;
  padding:12px 6px 26px;
}
.panel{display:none}
.panel.active{display:block}

.timeline{
  position:relative;
  background:#1d1d1d;
  border-radius:12px 12px 0 0;
  padding:16px 0 22px;
  min-height:calc(100svh - 190px); /* filet de sécurité avant que JS ne calcule la vraie valeur */
}
.roster-label{
  display:grid;
  align-items:center;
  gap:12px;
  color:rgba(255,255,255,.62);
  font-family:Georgia,serif;
  margin: 14px 5px;
  padding:10px;
  font-size:14px;
    background-color: #000000;
    text-align: center;
    border-radius: 10px;
}
.section-label{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:12px;
  color:rgba(255,255,255,.62);
  font-family:Georgia,serif;
  /*text-transform:uppercase;*/
  margin:0 0 14px;
  padding:0 7px;
  font-size:14px;
}

.section-label SPAN {
  height:1px;
  background:rgba(255,255,255,.38);
}

.event-row{
  position:relative;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:12px;
  margin:9px 0;
  min-height:47px;
  align-items:center;
}
.minute{
  justify-self:center;
  z-index:2;
  min-width:30px;
  padding:7px 8px;
  border-radius:999px;
  background:#303030;
  color:white;
  font-weight:1000;
  text-align:center;
  box-shadow:0 3px 10px rgba(0,0,0,.22);
  font-variant-numeric:tabular-nums;
  font-size:14px;
}
.event-row .minute EM {
    font-size: 8px;
    font-style: normal;
}
.event-row.highlight .minute{background:white;color:#111}

.event{
  min-height:47px;
  background:linear-gradient(90deg,var(--blue),#06133a);
  border-top:1px solid rgba(64,148,255,.62);
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 8px;
  font-family:Georgia,serif;
  font-weight:900;
  position:relative;
  overflow:hidden;
  -webkit-touch-callout:none;
  -webkit-user-select:none;
  user-select:none;
  touch-action:manipulation;
}
.event.left{
  grid-column:1;
  justify-self:stretch;
  justify-content:flex-end;
  text-align:right;
  border-radius:0 5px 5px 0;
}
.event.right{
  grid-column:3;
  justify-self:stretch;
  justify-content:flex-start;
  text-align:left;
  border-radius:5px 0 0 5px;
}
.event.card-yellow{border-top-color:var(--yellow)}
.event.card-yellow-red{border-top-color:var(--red)}
.event.sub{border-top-color:var(--green)}
.event.red-card{border-top-color:var(--red)}
.event.long-pressing{filter:brightness(1.35);outline:2px solid var(--orange)}
.event-main{display:grid;gap:1px;min-width:0}
.player{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:13px;
}
.subline{
  color:rgba(255,255,255,.56);
  font-family:system-ui,sans-serif;
  font-size:11px;
  font-weight:800;
}
.icon{
  flex:0 0 auto;
  width:20px;
  height:20px;
  display:grid;
  place-items:center;
  font-size:19px;
  line-height:1;
}
.yellow-card-icon,.red-card-icon{
  width:14px;height:20px;border-radius:4px;display:inline-block;
}
.yellow-card-icon{background:var(--yellow)}
.red-card-icon{background:var(--red)}
.ball{font-size:16px}

.yellow-red-icon{position:relative;width:20px;height:22px;display:inline-block}
.yellow-red-icon .yellow-card-icon{position:absolute;top:0;left:0;width:12px;height:17px}
.yellow-red-icon .red-card-icon{position:absolute;bottom:0;right:0;width:12px;height:17px;border:2px solid var(--blue)}

.sub-ico{position:relative;width:25px;height:25px}
.sub-ico:before,.sub-ico:after{
  position:absolute;
  width:15px;height:15px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:10px;
  font-weight:1000;
}
.sub-ico:before{content:"↑";background:var(--green);top:0;left:0;color:#001e10}
.sub-ico:after{content:"↓";background:var(--red);bottom:-2px;right:-2px;color:white; border: 2px solid var(--blue);}

.composition{
  background:#101010;
  border-radius:12px 12px 0 0;
  padding:12px 0;
  min-height:480px;
}
.comp-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:start;}
.comp-team{
  background:#0b0b0b;
  /*border:1px solid rgba(255,255,255,.09);
  border-radius:14px;*/
  overflow:hidden;
}
.comp-head{
  min-height:48px;
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background:linear-gradient(90deg,var(--blue),#06133a);
  border-top:3px solid var(--orange);
  font-family:Georgia,serif;
  font-weight:1000;
}
.comp-count{
  color:rgba(255,255,255,.58);
  font-family:system-ui,sans-serif;
  font-size:11px;
  font-weight:900;
  white-space:nowrap;
}
.role-title{
  padding:9px 11px 6px;
  color:var(--orange);
  font-size:11px;
  font-weight:1000;
  text-transform:uppercase;
  letter-spacing:.06em;
  background:#080808;
  border-top:1px solid rgba(255,255,255,.08);
}
.player-card{
  display:grid;
  grid-template-columns:28px 1fr;
  align-items:center;
  gap:9px;
  min-height:43px;
  padding:4px 5px;
}
.player-card.player-out{opacity:.6}
.player-sub-note{
  font-family:system-ui,sans-serif;
  font-size:11px;
  font-weight:800;
}
.player-sub-note.out{color:var(--orange)}
.player-sub-note.in{color:var(--green)}
.player-sub-note.off{color:var(--red)}
.player-sub-note em{font-size:9px;font-style:normal}
.number{
  width:25px;height:25px;border-radius:9px;
  display:grid;place-items:center;
  background:white;color:#111;font-weight:1000;
  font-variant-numeric:tabular-nums;font-size:13px;
}
.pname{
  font-family:Georgia,serif;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:12px;
}
.empty-comp{padding:16px;color:rgba(255,255,255,.54);font-weight:800;text-align:center}

.admin-footer{
  position:fixed;
  left:0;right:0;bottom:0;
  height:calc(var(--footer-h) + env(safe-area-inset-bottom,0px));
  padding:7px 5px calc(7px + env(safe-area-inset-bottom,0px));
  background:white;
  border-radius:15px 15px 0 0;
  z-index:40;
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:3px;
  box-shadow:0 -10px 30px rgba(0,0,0,.32);
}
.foot-btn{
  background:white;
  border-radius:12px;
  display:grid;
  place-items:center;
  align-content:center;
  gap:1px;
  color:#222;
  font-weight:1000;
  font-size:8px;
  min-width:0;
}
.foot-btn .ficon{font-size:21px;line-height:1}
.foot-btn.green{color:#49bf82}
.foot-btn.yellow{color:#cfb400}
.foot-btn.blue{color:#408ae0}
.foot-btn.main{
  color:white;
  background:var(--orange);
  box-shadow:0 5px 16px rgba(255,136,0,.28);
}

.overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.52);
  z-index:80;opacity:0;pointer-events:none;transition:.18s;
}
.overlay.open{opacity:1;pointer-events:auto}
.sheet{
  position:fixed;
  left:0;right:0;bottom:0;
  z-index:90;
  background:white;
  color:#111;
  border-radius:22px 22px 0 0;
  transform:translateY(105%);
  transition:.22s;
  max-height:84dvh;
  display:grid;
  grid-template-rows:auto auto 1fr;
  overflow:hidden;
}
.sheet.open{transform:translateY(0)}
.sheet-head{
  padding:10px 15px 8px;
  border-bottom:1px solid #eee;
  touch-action:none;
}
.grab{
  width:44px;height:5px;background:#ddd;border-radius:99px;
  margin:0 auto 10px;
  cursor:grab;
  touch-action:none;
}
.sheet-title{
  display:flex;justify-content:space-between;align-items:center;gap:10px;
}
.sheet-title h2{margin:0;font-size:19px}
.close{
  width:36px;height:36px;border-radius:50%;background:#f0f0f0;font-size:23px;
}

.sheet-tabs{
  display:none;
  grid-template-columns:1fr 1fr 1fr;
  gap:6px;
  padding:8px 12px;
  background:#fff;
  border-bottom:1px solid #eee;
}
.sheet-tabs.visible{display:grid}
.sheet-tab{
  min-height:38px;
  border-radius:12px;
  background:#f0f0f0;
  font-weight:1000;
  color:#222;
}
.sheet-tab.active{
  background:var(--orange);
  color:white;
}

.sheet-body{padding:15px;overflow:auto}
.sheet-grid{display:grid;gap:12px}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.twoo{display:grid;grid-template-columns:1fr 100px;gap:10px}
.big-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.action{
  min-height:68px;
  border-radius:16px;
  background:#f0f3f8;
  color:#111;
  display:grid;
  place-items:center;
  font-weight:1000;
  gap:3px;
  padding:9px;
}
.action span{font-size:25px}
.action.orange{background:var(--orange);color:white}
.action.blue{background:#4e95e8;color:white}
.action.yellow{background:#f8ed4d;color:#111}
.action.red{background:#ef4444;color:white}
.action.green{background:#45c878;color:white}
.roster-editor{display:grid;gap:12px}
.roster-team{border:1px solid #eee;border-radius:15px;overflow:hidden}
.roster-title{
  padding:11px;background:#f6f6f6;font-weight:1000;
  display:flex;justify-content:space-between;
}
.player-line{
  display:grid;
  grid-template-columns:44px 1fr 40px 40px;
  gap:6px;
  align-items:center;
  padding:8px;
  border-top:1px solid #eee;
    position: relative;
}
.player-line > span{
  color:#999;
  font-size:11px;
  font-weight:900;
  text-align:center;
    position: absolute;
    top: 0;
    left: 0;
    background: #dedede;
    border-radius: 0 999px 999px 0;
    width: 20px;
    height: 20px;
    display: grid;
    align-content: center;
}
.player-tag{font-size:13px;margin-left:2px}

.role-toggle,
.tag-toggle{
  height:36px;
  border-radius:10px;
  font-weight:1000;
  font-size:13px;
  color:white;
  padding:0;
}
.role-toggle.role-T{background:var(--orange)}
.role-toggle.role-R{background:#8a8a8a}
.tag-toggle{background:#e2e2e2;color:#444;font-size:15px}
.tag-toggle.tag-gardien{background:#45c878}
.tag-toggle.tag-capitaine{background:#4e95e8}

.save-row{display:grid; grid-template-columns: 1fr 100px;gap:9px;margin-top:12px}
.save{
  min-height:44px;
  padding:9px 15px;
  border-radius:13px;
  background:#eee;
  font-weight:1000;
}
.save.primary{background:var(--orange);color:white}
.save.green{background:#33b96b;color:white}
.save.red{background:#ef4444;color:white}
.hint{font-size:13px;color:#666;line-height:1.35}

.input-with-btn{position:relative}
.input-with-btn input{padding-right:44px}
.quick-fill{
  position:absolute;
  right:5px;
  top:50%;
  transform:translateY(-50%);
  width:32px;
  height:32px;
  border-radius:50%;
  background:var(--orange);
  color:white;
  font-weight:1000;
  font-size:10px;
  padding:0;
}

.logo-upload{
  display:grid;
  justify-items:center;
  gap:6px;
  cursor:pointer;
  width:fit-content;
}
.logo-upload-preview{
  width:64px;
  height:64px;
  border-radius:50%;
  background:#f0f0f0;
  border:2px dashed #ccc;
  display:grid;
  place-items:center;
  overflow:hidden;
  transition:border-color .18s, background .18s;
}
.logo-upload:hover .logo-upload-preview,
.logo-upload:active .logo-upload-preview{
  border-color:var(--orange);
  background:#fff3e6;
}
.logo-upload-preview img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.logo-upload-icon{font-size:22px;opacity:.5}
.logo-upload-label{
  font-size:11px;
  font-weight:900;
  color:var(--orange);
  text-transform:uppercase;
  letter-spacing:.03em;
}

@media(max-width:720px){
  :root{--header-full-h:106px}
  .hero-grid{gap:7px}
  .team-name{font-size:12px}
  .score-main{font-size:27px;padding:6px 12px}
  .score-status{font-size:12px}
  .date .heure{font-size:14px}
  /*.comp-grid{grid-template-columns:1fr}*/
  .foot-btn .ficon{font-size:19px}
  .foot-btn{font-size:7.5px}
  .big-actions{grid-template-columns:1fr}
    .big-actions.twoo {
        grid-template-columns:1fr 1fr;
    }
  .player-line{grid-template-columns:44px 1fr 36px 36px; gap:4px}
}