/* =====================================================
   Hockey Manager — design system (lot 1)
   Base sombre (variante A) + codes hockey (variante C)
   ===================================================== */

:root {
  /* Tokens couleur (section 4 du cahier des charges) */
  --bg: #0E1A24;
  --card: #16273A;
  --card-border: #2A425A;
  --text: #E8F1F5;
  --text-2: #9FB3C0;
  --ice: #F2F8FC;
  --ice-stripe: #C9DFEC;
  --red-line: #C8202F;
  --blue-line: #1B4F9C;
  --blue-light: #7FD1E8;
  --accent: #FF7A45;
  --gold: #E8B923;
  --led: #FFB000;
  --led-bg: #0D0D0D;
  --club-color: #C8202F; /* personnalisable par club */

  --font-title: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-jersey: 'Graduate', serif;
  --font-led: 'Orbitron', monospace;

  --radius: 10px;
  --tap: 44px; /* cible tactile minimale */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
}

/* ---------- Structure ---------- */
#app { max-width: 720px; margin: 0 auto; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

.screen { padding: 16px; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  * { transition: none !important; animation-duration: .01ms !important; }
}

h1, h2, h3 { font-family: var(--font-title); letter-spacing: .02em; text-transform: uppercase; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
h3 { font-size: 16px; font-weight: 600; color: var(--text-2); }

a { color: var(--blue-light); }

/* ---------- Barre d'état + bande de maillot ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding: 12px 16px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.topbar .brand {
  font-family: var(--font-title); font-weight: 700; font-size: 20px;
  text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand svg { width: 24px; height: 24px; }
.jersey-stripe {
  height: 8px;
  background: linear-gradient(to bottom, var(--gold) 0 2px, var(--club-color) 2px 6px, var(--gold) 6px 8px);
}

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card .card-title {
  font-family: var(--font-title); font-size: 15px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-2);
  margin-bottom: 8px;
}
.muted { color: var(--text-2); font-size: 13px; }

/* ---------- Boutons & formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  font-family: var(--font-title); font-size: 17px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent); color: #1A0E06;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: filter .15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--card-border); }
.btn-block { width: 100%; }
.btn-danger { background: var(--red-line); color: #fff; }

label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%; min-height: var(--tap);
  background: #0B141D; color: var(--text);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 0 12px; font-family: var(--font-body); font-size: 15px;
}
input:focus, select:focus { outline: 2px solid var(--blue-light); outline-offset: 1px; border-color: transparent; }
input[type="color"] { width: var(--tap); height: var(--tap); border: 1px solid var(--card-border); border-radius: var(--radius); background: none; padding: 4px; }

.form-error {
  background: rgba(200, 32, 47, .15); border: 1px solid var(--red-line);
  color: #FFB4BC; border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; margin-top: 12px;
}
.form-row { display: flex; gap: 10px; align-items: end; }
.form-row > div { flex: 1; }

/* ---------- Tableau d'affichage LED ---------- */
.scoreboard {
  background: var(--led-bg);
  border: 2px solid #26190A;
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--font-led);
  color: var(--led);
  box-shadow: inset 0 0 18px rgba(255, 176, 0, .08);
}
.scoreboard .team { font-size: 15px; font-weight: 700; letter-spacing: .1em; text-align: center; }
.scoreboard .score { font-size: 34px; font-weight: 700; text-shadow: 0 0 10px rgba(255,176,0,.5); }
.scoreboard .clock { font-size: 15px; letter-spacing: .12em; text-align: center; }
.scoreboard .period { font-size: 11px; color: #C98A00; letter-spacing: .2em; }

/* ---------- Tuiles maillot ---------- */
.jersey-tile {
  position: relative;
  width: 84px; min-height: 84px;
  background: linear-gradient(to bottom,
    var(--gold) 0 6px,
    var(--club-color) 6px calc(100% - 6px),
    var(--gold) calc(100% - 6px) 100%);
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 10px 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.jersey-tile .num { font-family: var(--font-jersey); font-size: 26px; line-height: 1; text-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.jersey-tile .name { font-family: var(--font-jersey); font-size: 9px; margin-top: 4px; letter-spacing: .04em; text-transform: uppercase; text-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.jersey-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Patinoire SVG ---------- */
.rink-wrap { width: 100%; }
.rink-wrap svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.player-dot { cursor: grab; }
.player-dot circle.puck-bg { fill: var(--club-color); stroke: var(--gold); stroke-width: 2.5; }
.player-dot text {
  font-family: var(--font-jersey); fill: #fff; font-size: 13px;
  text-anchor: middle; dominant-baseline: central;
  paint-order: stroke; stroke: rgba(0,0,0,.45); stroke-width: 2px;
}

/* ---------- Jauges segmentées ---------- */
.gauge { margin-bottom: 12px; }
.gauge .gauge-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.gauge .gauge-head .val { font-family: var(--font-title); font-weight: 700; font-size: 15px; }
.gauge .segments { display: flex; gap: 2px; height: 12px; position: relative; }
.gauge .seg { flex: 1; background: #0B141D; border-radius: 2px; }
.gauge .seg.on { background: var(--blue-light); }
.gauge .seg.neutral-zone { box-shadow: inset 0 0 0 1px rgba(232, 185, 35, .4); }
.gauge .seg.on.low { background: var(--red-line); }
.gauge .seg.on.high { background: #3CC878; }

/* ---------- Badges / pastilles ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px; border-radius: 99px;
  background: #0B141D; border: 1px solid var(--card-border); color: var(--text-2);
}
.pill.gold { border-color: var(--gold); color: var(--gold); }
.pill.accent { border-color: var(--accent); color: var(--accent); }

.tier-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 24px; padding: 0 6px;
  font-family: var(--font-title); font-weight: 700; font-size: 14px;
  background: var(--blue-line); color: #fff; border-radius: 6px;
}

/* ---------- Navigation basse ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: #0B141D; border-top: 1px solid var(--card-border);
  display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav button {
  flex: 1; min-height: 56px; max-width: 120px;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); font-family: var(--font-title); font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
}
.bottom-nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bottom-nav button.active { color: var(--accent); }

/* ---------- Listes ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(42, 66, 90, .5);
}
.list-item:last-child { border-bottom: none; }

/* ---------- Écran auth ---------- */
.auth-hero { text-align: center; padding: 36px 16px 12px; }
.auth-hero svg { width: 84px; height: 84px; margin-bottom: 10px; }
.auth-hero .tagline { color: var(--text-2); font-size: 14px; max-width: 300px; margin: 6px auto 0; }
.tabs { display: flex; gap: 0; border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.tabs button {
  flex: 1; min-height: var(--tap); background: none; border: none; cursor: pointer;
  color: var(--text-2); font-family: var(--font-title); font-size: 15px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.tabs button.active { background: var(--card); color: var(--text); }

.loading { text-align: center; padding: 48px 0; color: var(--text-2); }

@media (min-width: 640px) {
  body { font-size: 16px; }
  .screen { padding: 24px; }
}

/* ---- Match en direct (lot 4) ---- */
.segctl { display: flex; gap: 6px; flex-wrap: wrap; }
.segctl button { flex: 1 1 0; min-height: var(--tap, 44px); padding: 0 10px; border-radius: var(--radius, 8px); border: 1px solid var(--card-border); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.segctl button.on { background: var(--accent); border-color: var(--accent); color: #1A0E06; font-weight: 600; }
.live-rink svg { width: 100%; height: auto; display: block; }
.live-rink .sk, .live-rink #puck { transition: transform .9s ease-in-out; }
.live-rink #puck { transition-duration: .6s; }
@media (prefers-reduced-motion: reduce) { .live-rink .sk, .live-rink #puck { transition: none; } }
.ticker { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; min-height: 60px; font-size: 14px; }
.ticker .tick { padding: 6px 10px; border-radius: 6px; background: #0B141D; }
.ticker .tick.goal { border-left: 4px solid var(--gold); }
.ticker .tick.pen { border-left: 4px solid var(--red-line); }
.led { font-family: var(--font-led, 'Orbitron', monospace); color: #FFB000; background: #0D0D0D; padding: 2px 8px; border-radius: 4px; margin-left: 8px; }
