/* PAESI FC — styles. Mobile d'abord (référence 390 × 844, utilisable dès 360 px). */
:root {
  --navy: #173A6B;
  --navy-dark: #0E1B30;
  --blue: #1F4E8C;
  --sun: #FFC531;
  --orange: #FF7A3D;
  --red: #E8492F;
  --green: #2E9E5B;
  --sky: #E8F0FA;
  --paper: #FFFDF8;
  --ink: #0E1B30;
  --muted: #5B6676;
  --radius: 16px;
  --shadow: 0 4px 0 rgba(14, 27, 48, 0.18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: linear-gradient(180deg, #FFE7B8 0, #FFF6E5 220px, var(--paper) 480px) fixed;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--blue); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0.4em 0; }
h2 { font-size: 1.15rem; margin: 0 0 0.6em; }
h3 { font-size: 1rem; margin: 1em 0 0.4em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 14px; background: var(--navy); color: #fff;
  border-bottom: 4px solid var(--sun);
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 900; letter-spacing: 0.04em; font-size: 1.15rem; }
.topbar-user { display: flex; align-items: center; gap: 8px; margin: 0; }
.coach-name { font-size: 0.85rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page { max-width: 720px; margin: 0 auto; padding: 14px; }

/* Cartes */
.card {
  background: #fff; border: 3px solid var(--navy-dark); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin: 0 0 16px;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.list { display: grid; gap: 12px; margin-bottom: 16px; }

/* Boutons : grands, tactiles, sans dépendance au survol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 3px solid var(--navy-dark); font: inherit; font-weight: 800; text-decoration: none;
  cursor: pointer; box-shadow: var(--shadow); transition: transform 0.05s;
  color: var(--ink); background: #fff;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(14, 27, 48, 0.18); }
.btn:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-secondary { background: var(--sun); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; box-shadow: none; }
.btn-danger { background: #fff; color: #B3261E; border-color: #B3261E; }
.btn-big { width: 100%; min-height: 54px; font-size: 1.05rem; }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: 0.85rem; }
.btn[disabled], .btn.is-loading { opacity: 0.65; pointer-events: none; }
.stack { display: grid; gap: 12px; margin: 20px 0; }

/* Formulaires */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 700; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit;
  border: 3px solid var(--navy-dark); border-radius: 12px; background: #fff;
}
input[type=color] { width: 100%; height: 48px; border: 3px solid var(--navy-dark); border-radius: 12px; padding: 2px; background: #fff; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-error { color: #B3261E; font-weight: 600; font-size: 0.9rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 800; margin-bottom: 8px; }

/* Messages */
.flash { padding: 12px 14px; border-radius: 12px; border: 3px solid var(--navy-dark); margin-bottom: 14px; font-weight: 600; background: #fff; }
.flash-success { background: #DDF5E6; }
.flash-error { background: #FDE2DE; }
.flash-info { background: var(--sky); }

/* Accueil public */
.hero { text-align: center; padding-top: 8px; }
.hero-logo { width: 200px; height: auto; filter: drop-shadow(0 6px 0 rgba(14, 27, 48, 0.2)); }
.lead { font-size: 1.05rem; }
.error-code { font-size: 3rem; font-weight: 900; margin: 0; color: var(--red); }

/* Carrières */
.career-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin: 0; }
.career-card.archived { opacity: 0.6; }
.career-card-body { display: grid; flex: 1; }
.chevron { font-size: 2rem; color: var(--muted); }
.club-header {
  display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 14px;
  border-radius: var(--radius); border: 3px solid var(--navy-dark); box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--club) 0 62%, var(--club2) 62% 100%); color: #fff;
}
.club-header h1 { margin: 0; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.club-header p { margin: 0; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.crest { flex: none; }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 3px solid var(--navy-dark); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; }
.stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.stat strong { font-size: 1.05rem; }
.alerts p { margin: 0.3em 0; }

.opponents { display: grid; gap: 8px; }
.opponent { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 10px; padding: 8px 10px; border: 3px solid #D6DCE5; border-radius: 14px; cursor: pointer; font-weight: 400 !important; }
.opponent span { display: grid; }
.opponent input { width: 22px; height: 22px; accent-color: var(--red); flex: none; }
.opponent:has(input:checked) { border-color: var(--red); background: #FFF1EE; }

.results { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.results a { display: grid; padding: 10px 12px; border-radius: 12px; background: var(--sky); text-decoration: none; color: inherit; }
.score-line strong { font-size: 1.1rem; padding: 0 6px; }
.danger-zone summary { cursor: pointer; font-weight: 700; color: #B3261E; min-height: 32px; }

/* Effectif */
.section-title { margin-top: 18px; }
.player-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px;
  background: #fff; border: 3px solid var(--navy-dark); border-radius: 14px; text-decoration: none; color: inherit;
}
.player-card.unavailable { background: #F3F3F3; }
.player-main { display: grid; flex: 1; min-width: 0; }
.player-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shirt { display: inline-block; min-width: 1.8em; text-align: center; background: var(--navy); color: #fff; border-radius: 6px; font-size: 0.8rem; padding: 0 4px; }
.ratings { display: flex; gap: 6px; }
.rating { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--sun); border: 3px solid var(--navy-dark); font-weight: 900; }
.rating.form { background: var(--sky); }
.bar { display: block; height: 8px; background: #E2E6EC; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; border-radius: 99px; }
.bar .high { background: var(--green); }
.bar .mid { background: var(--sun); }
.bar .low { background: var(--red); }
.badge { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 0.75rem; font-weight: 800; }
.badge-red { background: var(--red); color: #fff; }
.player-head { display: flex; gap: 14px; align-items: center; }
.player-head h1 { font-size: 1.3rem; }
.attributes { list-style: none; padding: 0; display: grid; gap: 8px; }
.attributes li { display: grid; grid-template-columns: 8.5em 1fr 2.2em; align-items: center; gap: 8px; }
.attributes .bar { margin: 0; height: 12px; }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 7px 6px; border-bottom: 1px solid #E2E6EC; text-align: left; }
.table .num { text-align: right; white-space: nowrap; }
.team-stats th { text-align: center; color: var(--muted); font-weight: 700; }
.team-stats td:first-child { text-align: left; }
.pos { color: var(--green); }
.neg { color: #B3261E; }

/* Match */
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; border: 3px solid var(--navy-dark); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 10px; margin-bottom: 12px; text-align: center;
}
.scoreboard .team { display: grid; justify-items: center; gap: 6px; font-weight: 700; font-size: 0.85rem; }
.scoreboard .score { display: grid; gap: 2px; }
.scoreboard .score strong { font-size: 2.4rem; line-height: 1; }
.scoreboard .muted { color: #C9D4E5; }
.clock { font-weight: 800; color: var(--sun); }
.replay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ev { display: grid; grid-template-columns: 3.4em 1.6em 1fr; gap: 6px; align-items: start; padding: 6px 8px; border-radius: 10px; background: #F6F8FB; }
.ev.side-away { background: #FFF5EC; }
.ev-goal { background: #FFF1B8 !important; font-weight: 800; }
.ev-full_time, .ev-half_time, .ev-end_of_regulation { background: var(--sky) !important; font-weight: 700; }
.ev-min { font-weight: 800; color: var(--muted); }
.ev.is-hidden, [data-after-replay].is-hidden { display: none; }
.ev.is-new { animation: pop 0.35s ease-out; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ev.is-new { animation: none; } .btn { transition: none; } }

/* Navigation basse (carrière) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 3px solid var(--navy-dark);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-decoration: none; min-height: 56px; }
.bottom-nav a span { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--red); }

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  h1 { font-size: 2rem; }
}
