/* ============================================================
   FanBoard — tableau de bord fantasy TV
   Scène fixe 960×540 mise à l'échelle du viewport (diffusion TV :
   rien n'est jamais coupé, quel que soit l'écran).
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; background: #000; }

body {
  font-family: "Arial Narrow", "Helvetica Neue Condensed", "HelveticaNeue-CondensedBold",
               "Franklin Gothic Medium", "Arial", sans-serif;
  font-stretch: condensed;
  color: #f2f2f4;
  overflow: hidden;
}

#viewport {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 50% 0%, #0c0c10 0%, #000 70%);
  overflow: hidden;
}

/* ---------- Scène TV 960×540 ---------- */
#scene {
  position: relative;
  width: 960px; height: 540px; flex: 0 0 auto;
  transform-origin: center center;
  background: linear-gradient(180deg, #050506 0%, #0a0a0c 55%, #0b0b0e 100%);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, .9);
}

/* ---------- Bandeau de score ---------- */
#topbar {
  height: 46px; flex: 0 0 46px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #22d3ee, #f97316);
  color: #050506; font-weight: 900; font-size: 19px; line-height: 1;
}
.brand-name { font-weight: 900; font-size: 22px; letter-spacing: 2px; }
.live-badge {
  display: flex; align-items: center; gap: 6px;
  background: #e11d2e; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 1px;
  padding: 4px 9px; border-radius: 4px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.topbar-center { flex: 1; text-align: center; font-size: 14px; letter-spacing: 1px; color: #b9bcc4; font-weight: 700; text-transform: uppercase; }
.topbar-clock { display: flex; align-items: baseline; gap: 10px; }
#clock { font-size: 20px; font-weight: 900; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
#dateline { font-size: 12px; color: #9a9da6; font-weight: 700; text-transform: capitalize; }

/* ---------- Panneaux ---------- */
#panels {
  position: relative;
  height: 430px; flex: 0 0 430px;
  display: flex; gap: 8px; padding: 8px;
}
.panel {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.panel.nhl { box-shadow: 0 0 22px rgba(34, 211, 238, .28), inset 0 0 0 1px rgba(34, 211, 238, .12); }
.panel.nfl { box-shadow: 0 0 22px rgba(249, 115, 22, .28), inset 0 0 0 1px rgba(249, 115, 22, .12); }

.panel-head {
  height: 32px; flex: 0 0 32px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, .05);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sport-badge { font-size: 12px; font-weight: 900; letter-spacing: 1px; padding: 3px 7px; border-radius: 4px; color: #050506; }
.nhl-badge { background: #22d3ee; }
.nfl-badge { background: #f97316; }
.league-name { font-size: 16px; font-weight: 900; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-select {
  margin-left: auto;
  background: rgba(0, 0, 0, .55); color: #dfe1e6;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 4px; max-width: 108px;
}
.source-select option { color: #111; }
.status { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .4px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #f5c542; flex: 0 0 auto; }
.status.ok .status-dot { background: #34d399; }
.status.offline .status-dot { background: #ef4444; }
.status.pending .status-dot { background: #f5c542; }
.status.ok .status-text { color: #34d399; }
.status.offline .status-text { color: #f87171; }
.status.pending .status-text { color: #f5c542; }

/* Matchup */
.matchup {
  height: 74px; flex: 0 0 74px;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 4px;
}
.mu-team { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.mu-team:last-child { align-items: center; }
.mu-name { font-size: 15px; font-weight: 900; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mu-name.me { color: #7dd3fc; }
.panel.nfl .mu-name.me { color: #fdba74; }
.mu-record { font-size: 11px; color: #9a9da6; font-weight: 700; }
.mu-score { font-size: 30px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.mu-vs { font-size: 12px; font-weight: 900; color: #6b6e77; letter-spacing: 1px; }

/* Titulaires */
.starters-label {
  height: 18px; flex: 0 0 18px;
  padding: 0 10px; font-size: 11px; font-weight: 900; letter-spacing: 2px; color: #9a9da6;
}
.starters { flex: 1; display: flex; flex-direction: column; padding: 0 8px; }
.starter-row {
  flex: 1; min-height: 0;
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  padding: 2px 2px;
}
.avatar {
  position: relative; width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #2a2a30, #141416);
  border: 2px solid rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
}
.panel.nhl .avatar { border-color: rgba(34, 211, 238, .55); }
.panel.nfl .avatar { border-color: rgba(249, 115, 22, .55); }
.avatar .initials { font-size: 13px; font-weight: 900; color: #c9ccd4; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #141416; }
.starter-info { flex: 1; min-width: 0; }
.starter-name { font-size: 14px; font-weight: 900; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.starter-sub { font-size: 11px; color: #9a9da6; font-weight: 700; }
.starter-pts { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.starter-pts small { font-size: 10px; color: #9a9da6; font-weight: 700; }

.standings {
  flex: 0 0 40px; height: 40px;
  padding: 4px 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 11.5px; font-weight: 700; color: #b9bcc4; line-height: 1.45;
  overflow: hidden;
}
.standings b { color: #fff; }
.standings .rank-me { color: #7dd3fc; font-weight: 900; }
.panel.nfl .standings .rank-me { color: #fdba74; }

.panel-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 12px;
  font-size: 13px; font-weight: 700; color: #9a9da6; line-height: 1.5;
}

/* Mode 3 panneaux : on resserre les textes */
#scene.three-panels .mu-name { font-size: 13px; }
#scene.three-panels .mu-score { font-size: 24px; }
#scene.three-panels .starter-name { font-size: 12.5px; }
#scene.three-panels .avatar { width: 32px; height: 32px; flex-basis: 32px; }
#scene.three-panels .source-select { max-width: 84px; }
#scene.three-panels .league-name { font-size: 14px; }

/* ---------- Pied de page ---------- */
#statusbar {
  height: 28px; flex: 0 0 28px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, .03);
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 12px; font-weight: 700; color: #b9bcc4;
}
#updated { color: #e8e9ec; }
.statusbar-sep { color: #55585f; }
.spacer { flex: 1; }
#statusbar button {
  background: rgba(255, 255, 255, .08); color: #e8e9ec;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 5px;
  font: inherit; font-size: 11px; font-weight: 800;
  padding: 3px 8px; cursor: pointer; white-space: nowrap;
}
#statusbar button:hover { background: rgba(255, 255, 255, .16); }
#statusbar button.active { background: #22d3ee; color: #050506; border-color: #22d3ee; }

/* ---------- Ticker ---------- */
#ticker {
  height: 36px; flex: 0 0 36px;
  overflow: hidden; position: relative;
  background: #e11d2e;
  display: flex; align-items: center;
}
#ticker::before {
  content: "SCORES"; flex: 0 0 auto; z-index: 2;
  background: #050506; color: #fff; font-weight: 900; font-size: 13px; letter-spacing: 1px;
  height: 100%; display: flex; align-items: center; padding: 0 12px;
}
.ticker-track {
  display: inline-flex; gap: 0; white-space: nowrap;
  font-size: 14px; font-weight: 800; color: #fff; letter-spacing: .3px;
  animation: ticker 45s linear infinite;
  padding-left: 16px;
}
.ticker-track span { padding-right: 48px; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Mode ambiant ---------- */
#ambient {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(5, 5, 6, .97);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 20px;
}
.ambient-title { font-size: 15px; font-weight: 900; letter-spacing: 3px; color: #9a9da6; }
#ambient-scores { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.ambient-row { display: flex; align-items: center; justify-content: center; gap: 22px; }
.ambient-league { font-size: 13px; font-weight: 900; letter-spacing: 2px; color: #9a9da6; width: 120px; text-align: right; }
.ambient-team { font-size: 22px; font-weight: 900; width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ambient-team.right { text-align: right; }
.ambient-score { font-size: 64px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; min-width: 90px; text-align: center; }
.ambient-row.nhl .ambient-score { color: #22d3ee; text-shadow: 0 0 24px rgba(34, 211, 238, .5); }
.ambient-row.nfl .ambient-score { color: #f97316; text-shadow: 0 0 24px rgba(249, 115, 22, .5); }
.ambient-note { font-size: 12px; color: #6b6e77; font-weight: 700; }

/* ---------- Pop-up GROS JEU (lower third) ---------- */
#popup {
  position: absolute; left: 50%; bottom: 78px; z-index: 8;
  transform: translateX(-50%);
  width: 600px; min-height: 132px;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  background: rgba(10, 10, 12, .92);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 0 34px rgba(34, 211, 238, .35), 0 10px 40px rgba(0, 0, 0, .7);
  animation: popup-in .35s ease-out;
}
#popup.nfl-glow { box-shadow: 0 0 34px rgba(249, 115, 22, .4), 0 10px 40px rgba(0, 0, 0, .7); }
@keyframes popup-in { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.popup-face {
  position: relative; width: 104px; height: 104px; flex: 0 0 104px;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #2a2a30, #141416);
  border: 3px solid #22d3ee;
  display: flex; align-items: center; justify-content: center;
}
#popup.nfl-glow .popup-face { border-color: #f97316; }
.popup-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.popup-initials { font-size: 34px; font-weight: 900; color: #c9ccd4; }
.popup-body { flex: 1; min-width: 0; }
.popup-tag { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.popup-gros {
  background: #e11d2e; color: #fff; font-weight: 900; font-size: 15px; letter-spacing: 2px;
  padding: 3px 10px; border-radius: 4px;
}
#popup-demo { background: #f5c542; color: #111; font-weight: 900; font-size: 12px; letter-spacing: 1px; padding: 3px 8px; border-radius: 4px; }
.popup-name { font-size: 30px; font-weight: 900; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-team { font-size: 14px; font-weight: 700; color: #b9bcc4; margin-top: 2px; }
.popup-points { text-align: center; }
.popup-points span:first-child { display: block; font-size: 44px; font-weight: 900; color: #34d399; line-height: 1; font-variant-numeric: tabular-nums; }
.popup-pts-label { font-size: 12px; font-weight: 900; letter-spacing: 2px; color: #9a9da6; }

/* ---------- Réglages ---------- */
#settings {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, .72);
  display: flex; align-items: center; justify-content: center;
}
.settings-card {
  width: 620px; max-height: 500px;
  background: #111114; border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .8);
  display: flex; flex-direction: column; overflow: hidden;
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; font-size: 17px; font-weight: 900; letter-spacing: 2px;
  background: rgba(255, 255, 255, .05); border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.settings-head button, .settings-foot button, #yahoo-connect {
  background: #22d3ee; color: #050506; border: none; border-radius: 6px;
  font: inherit; font-size: 13px; font-weight: 900; padding: 7px 14px; cursor: pointer;
}
.settings-head button { background: rgba(255, 255, 255, .1); color: #e8e9ec; }
.settings-body { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.settings-row { display: flex; align-items: center; gap: 10px; }
.settings-row label { flex: 0 0 250px; font-size: 13px; font-weight: 800; color: #dfe1e6; }
.settings-row label .opt { font-weight: 600; color: #9a9da6; font-size: 11px; }
.settings-row select, .settings-row input {
  flex: 1; min-width: 0;
  background: rgba(0, 0, 0, .55); color: #f2f2f4;
  border: 1px solid rgba(255, 255, 255, .2); border-radius: 6px;
  font: inherit; font-size: 13px; padding: 7px 9px;
}
.yahoo-row { flex-wrap: wrap; }
.yahoo-status { flex: 1 1 100%; font-size: 12px; font-weight: 700; color: #f5c542; padding-left: 260px; }
.settings-note { font-size: 11.5px; line-height: 1.5; color: #9a9da6; font-weight: 600; }
.settings-foot { padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; justify-content: flex-end; }

[hidden] { display: none !important; }
