/* KICKOFF · styles de la coque et des écrans (Agent C).
   Les tokens (couleurs, .btn, .card, .pill, .crest, .input...) vivent dans tokens.css. */

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(232, 0, 13, .10), transparent 65%),
    var(--ink);
  min-height: 100dvh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#screen {
  flex: 1;
  width: 100%;
  padding: 18px 16px 48px;
}
body.chrome #screen { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

.view { animation: viewIn .28s ease both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.screen-title { font-size: 26px; margin: 2px 0 4px; }

/* ---------- header ---------- */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(13, 13, 13, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
body.chrome .topbar { display: flex; }
.topbar-wm { font-size: 21px; }

.notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--txt);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease;
}
.notif-btn:active { transform: scale(.92); }
.notif-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 10px rgba(232, 0, 13, .65);
}

/* ---------- nav basse ---------- */
.tabbar {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  z-index: 50;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  background: rgba(16, 16, 18, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
}
body.chrome .tabbar { display: grid; }

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0 3px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--disp);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--txt); }
.tab.active svg {
  color: var(--red-glow);
  filter: drop-shadow(0 2px 8px rgba(232, 0, 13, .55));
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--ink-3);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--txt);
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s ease, transform .3s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast.success { border-color: rgba(34, 197, 94, .5); }
.toast.error { border-color: rgba(232, 0, 13, .55); }

/* ---------- génériques ---------- */
.screen-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  padding: 64px 0;
  font-size: 13px;
}
.screen-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--red);
  animation: spin .8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.error-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 28px 16px;
  margin-top: 24px;
}

.field { margin-bottom: 14px; }
.form-error {
  color: var(--red-glow);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
}

/* segments (onglets) */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--disp);
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 13px;
  padding: 10px 6px;
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.seg-btn.active {
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: #fff;
  box-shadow: var(--glow-red);
}

/* mini stats */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.stat {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.stat-v {
  font-family: var(--disp);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
}
.stat-l {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
}

/* ---------- écran auth ---------- */
.auth {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 7vh;
}
.auth-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.auth-wm {
  font-size: clamp(46px, 15vw, 66px);
  line-height: 1;
  text-shadow: 0 12px 50px rgba(232, 0, 13, .35);
}
.auth-tag { letter-spacing: .28em; }
.auth-foot {
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- onboarding ---------- */
.onb { display: flex; flex-direction: column; gap: 16px; }
.onb-head { display: flex; flex-direction: column; gap: 6px; }
.onb-title { font-size: 27px; line-height: 1.05; }
.onb-sub { font-size: 13.5px; }

.onb-league { margin-top: 4px; }
.onb-league .kicker { display: block; margin: 10px 0 8px 2px; }

.club-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.club-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 6px 10px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  color: var(--txt);
  transition: border-color .15s ease, transform .12s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.club-pick:active { transform: scale(.96); }
.club-pick.sel {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red), var(--glow-red);
  background: var(--ink-3);
}
.club-pick-name {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  line-height: 1.25;
}
.club-pick.sel .club-pick-name { color: var(--txt); }

.onb-foot {
  position: sticky;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(16, 16, 18, .95);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
}
.onb-sel {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
}
.onb-sel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.onb-foot .btn { width: auto; flex: none; padding: 12px 20px; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.avatar-pick {
  font-size: 30px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.avatar-pick:active { transform: scale(.92); }
.avatar-pick.sel {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 8px 24px rgba(244, 195, 59, .22);
  background: var(--ink-3);
}

.onb-actions { display: flex; gap: 10px; margin-top: 6px; }
.onb-actions .btn.ghost { width: auto; flex: none; padding-left: 18px; padding-right: 18px; }
.onb-actions .btn:not(.ghost) { flex: 1; }

.onb-recap {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
}
.onb-recap-av {
  font-size: 34px;
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  flex: none;
}
.onb-recap-club {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.onb-recap-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  font-size: 14px;
  min-width: 0;
}
.onb-recap-txt .muted { font-size: 12px; }

/* ---------- dashboard ---------- */
.club-hero-top { display: flex; align-items: center; gap: 14px; }
.club-hero-id {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 0;
}
.club-hero-name { font-size: 22px; line-height: 1.08; }

.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
}
.match-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.match-club {
  font-family: var(--disp);
  font-weight: 700;
  font-style: italic;
  font-size: 14px;
  letter-spacing: .04em;
}
.match-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.vs {
  font-size: 20px;
  color: var(--red-glow);
  text-shadow: 0 0 14px rgba(232, 0, 13, .5);
}
.match-date { font-size: 12px; font-weight: 700; }
.match-cd { font-size: 11px; }

.grille-cd { font-size: 13px; margin: 10px 0 12px; }
.grille-card .btn.ghost { margin-top: 2px; }

.me-row { display: flex; align-items: center; gap: 12px; }
.me-avatar {
  font-size: 26px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 13px;
  flex: none;
}
.me-id {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  min-width: 0;
  font-size: 14px;
}
.me-id .muted { font-size: 12px; }

/* fil d'actu (partagé dashboard / profil) */
.feed-list { display: flex; flex-direction: column; gap: 8px; }
.feed-row {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.feed-ico { font-size: 17px; flex: none; }
.feed-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.feed-date { font-size: 11px; font-weight: 500; }
.feed-pts {
  font-family: var(--disp);
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  flex: none;
}
.feed-empty { padding: 4px 2px; font-size: 13px; }

/* ---------- leaderboard ---------- */
.lb-me { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.lb-list { display: flex; flex-direction: column; gap: 7px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
}
.lb-row.mine {
  border-color: rgba(232, 0, 13, .55);
  background: linear-gradient(135deg, rgba(232, 0, 13, .14), var(--ink-2));
  box-shadow: 0 4px 18px rgba(232, 0, 13, .15);
}
.lb-rank {
  font-family: var(--disp);
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  width: 26px;
  text-align: center;
  color: var(--muted);
  flex: none;
}
.lb-rank.r1 { color: var(--gold); }
.lb-rank.r2 { color: #C9CCD6; }
.lb-rank.r3 { color: #C9884B; }
.lb-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.lb-pts {
  font-family: var(--disp);
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  flex: none;
}
.lb-av {
  font-size: 19px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex: none;
}

/* ---------- profil ---------- */
.pf-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 14px 0 6px;
}
.pf-avatar {
  font-size: 44px;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 26px;
  background: var(--ink-3);
  border: 1px solid var(--line-2);
}
.pf-name { font-size: 27px; line-height: 1; }
.pf-club {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.badge-list { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(244, 195, 59, .08);
  border: 1px solid rgba(244, 195, 59, .35);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
}

.btn.danger {
  background: transparent;
  color: var(--red-glow);
  box-shadow: 0 0 0 1px rgba(232, 0, 13, .4) inset;
}

/* ---------- notifications ---------- */
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.rem-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, rgba(232, 0, 13, .12), var(--ink-2));
  border: 1px solid rgba(232, 0, 13, .4);
  border-radius: 13px;
  padding: 12px;
  cursor: pointer;
  color: var(--txt);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease;
}
.rem-row:active { transform: scale(.98); }
.rem-row .chev {
  margin-left: auto;
  color: var(--red-glow);
  font-size: 22px;
  line-height: 1;
  flex: none;
}
.notif-row {
  display: flex;
  gap: 10px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  opacity: .72;
}
.notif-row.unread {
  opacity: 1;
  border-color: var(--line-2);
  background: var(--ink-3);
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(232, 0, 13, .8);
  flex: none;
  margin-top: 7px;
  visibility: hidden;
}
.notif-row.unread .notif-dot { visibility: visible; }
.notif-body { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ================================================================
   INTÉGRATION (post-agents) : vrais logos + cadre téléphone desktop
   ================================================================ */

/* vrai logo club sur pastille claire, par-dessus le monogramme (repli auto) */
.crest-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 11%;
  background: #F4F4F6;
  border-radius: inherit;
  box-sizing: border-box;
}

/* Sur grand écran : l'app vit dans un cadre de téléphone, posée sur une scène sombre.
   Le client voit exactement le rendu mobile depuis un ordinateur. */
@media (min-width: 920px) {
  html, body { height: 100%; }
  body {
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
      radial-gradient(1000px 540px at 50% -10%, rgba(232, 0, 13, .14), transparent 60%),
      #060607;
  }
  body::after {
    content: "Aperçu mobile · sur téléphone, KickOff s'installe comme une vraie app";
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font: italic 700 12px/1 var(--disp);
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #4a4a52;
    pointer-events: none;
  }
  #app {
    position: relative;
    width: 402px;
    height: min(874px, 88vh);
    border-radius: 46px;
    overflow: hidden;
    border: 1px solid #2e2e34;
    box-shadow:
      0 0 0 10px #0f0f12,
      0 0 0 11px #33333a,
      0 60px 120px rgba(0, 0, 0, .72),
      0 0 90px rgba(232, 0, 13, .10);
    background: var(--ink);
  }
  #screen {
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #2e2e34 transparent;
  }
  body.chrome #screen { padding-bottom: 28px; }
  .tabbar {
    position: static;
    transform: none;
    flex: none;
    width: 100%;
    max-width: none;
    left: auto;
  }
  .toasts { position: absolute; }
}

/* ---------- ambiance de fond globale (braises + projecteurs) ---------- */
#ambient {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#app > *:not(#ambient):not(.pitch-lines):not(#screen-wm) {
  position: relative;
  z-index: 1;
}
@media (min-width: 920px) {
  /* dans le cadre téléphone, l'ambiance vit à l'intérieur du châssis */
  #ambient { position: absolute; }
}

/* ---------- badges avatars (SVG) ---------- */
.pf-avatar .avatar-badge,
.me-avatar .avatar-badge,
.onb-recap-av .avatar-badge { display: block; }
.avatar-badge svg { width: 100%; height: 100%; display: block; }
.avatar-pick .avatar-badge { pointer-events: none; }
.pf-av-grid { margin-top: 4px; max-height: 280px; overflow-y: auto; }
.pf-edit .label { display: block; }
