:root {
  --bg:      #0b0b10;
  --surface: rgba(24,24,39,.96);
  --surface2: rgba(18,18,27,.92);
  --ink:     #eef0ff;
  --muted:   #b7bce6;
  --ok:      #38d996;
  --warn:    #ffd35c;
  --danger:  #ff4d6d;
  --accent:  #12121b;
  --accent2: #eef0ff;
  --r:       16px;
  --shadow:  0 18px 42px rgba(0,0,0,.48);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
}

.root {
  height: 100vh;
  display: flex; flex-direction: column;
  max-width: 1600px; margin: 0 auto;
  padding: 12px; gap: 12px;
}

.hidden { display: none !important; }

/* TOPBAR */
.topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(18,18,27,.98), rgba(18,18,27,.88));
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.pill {
  width: 13px; height: 13px; border-radius: 999px;
  background: rgba(255,255,255,.2); transition: background .2s, box-shadow .2s;
}
.pill.connected { background: var(--ok); box-shadow: 0 0 0 5px rgba(56,217,150,.12); }
.pill.disconnected { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,77,109,.12); }
.brandTitle { font-weight: 1000; font-size: 14px; }
.brandSub   { color: var(--muted); font-size: 11px; margin-top: 1px; }

.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  color: var(--muted); border-radius: 10px;
  padding: 7px 13px; font-size: 12px; font-weight: 900;
  cursor: pointer; transition: all .12s;
}
.tab:hover { background: rgba(255,255,255,.10); color: var(--ink); }
.tab.active {
  background: rgba(238,240,255,.12); border-color: rgba(238,240,255,.25);
  color: var(--accent2);
}

.topRight { flex: 0 0 auto; }
.liveIndicator {
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255,77,109,.15); border: 1px solid rgba(255,77,109,.35);
  color: var(--danger); font-weight: 1000; font-size: 12px; letter-spacing: .8px;
  animation: pulseLive 1.4s ease-in-out infinite;
}
@keyframes pulseLive { 0%,100%{opacity:1} 50%{opacity:.65} }

/* PANELS */
.panels { flex: 1 1 auto; min-height: 0; position: relative; }

.panel {
  display: none; height: 100%;
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--surface), var(--surface2));
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel.active { display: flex; flex-direction: column; }

.panelInner {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.panelInner.twoCol {
  flex-direction: row; gap: 24px; overflow: hidden;
}

.panelHeader { display: flex; align-items: center; justify-content: space-between; }

/* TYPOGRAPHY */
.sectionTitle {
  font-weight: 1000; font-size: 13px;
  letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent2); margin-bottom: 4px;
}
.sectionTitle.small { font-size: 11px; margin-bottom: 2px; }
.sep { height: 1px; background: rgba(255,255,255,.06); margin: 4px 0; }

/* FORMS */
.formGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formField { display: flex; flex-direction: column; gap: 6px; }
.fieldLabel {
  font-size: 11px; font-weight: 1000; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted);
}
.row { display: flex; align-items: center; gap: 8px; }
.formActions { display: flex; gap: 10px; padding-top: 4px; }

.speakerHint {
  font-size: 12px; color: var(--muted); font-style: italic;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
}

/* Logo preview */
.logoPreviewArea { display: flex; flex-direction: column; gap: 8px; }
.logoPreviewLabel { font-size: 11px; color: var(--muted); font-weight: 1000; text-transform: uppercase; }
.logoPreviewBox {
  width: 120px; height: 80px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logoPreviewBox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logoPlaceholder { font-size: 11px; color: var(--muted); }

/* TEAMS */
.teamsList { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; overflow-y: auto; }

.teamCard {
  display: grid;
  grid-template-columns: 52px 1fr 80px 1fr 40px 36px;
  align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.teamCard:hover { border-color: rgba(238,240,255,.18); }

.teamLogoAvatar {
  width: 48px; height: 48px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.teamLogoAvatar img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* SPEAKERS */
.speakersList { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; overflow-y: auto; }

.speakerCard {
  display: grid;
  grid-template-columns: 52px 1fr 1fr 1fr 1fr 36px;
  align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.speakerCard:hover { border-color: rgba(238,240,255,.18); }

.speakerAvatar {
  width: 48px; height: 48px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 18px;
}
.speakerAvatar img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* SCHEDULE — grille régie : teamA | VS | teamB | time | format | stage | ▶ | ✕ */
.scheduleList { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; overflow-y: auto; }

.matchCard {
  display: grid;
  grid-template-columns: 1fr 28px 1fr 68px 52px 80px 36px 36px;
  align-items: center; gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.matchCard.status-live { background: rgba(255,77,109,.08); border-color: rgba(255,77,109,.25); }
.matchCard.status-done { opacity: .50; }

.matchVsLabel {
  text-align: center; font-size: 11px; font-weight: 900;
  color: var(--muted); user-select: none;
}

.matchLoadBtn {
  background: rgba(238,240,255,.10); border: 1px solid rgba(238,240,255,.20);
  color: var(--accent2); border-radius: 10px;
  padding: 6px 8px; font-size: 13px; font-weight: 1000;
  cursor: pointer; white-space: nowrap; transition: background .12s;
}
.matchLoadBtn:hover { background: rgba(238,240,255,.20); }

/* LIVE MATCH */
.liveLeft, .liveRight {
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; padding-right: 4px;
}
.liveLeft  { flex: 1.4; }
.liveRight { flex: 1; }

.scoreBoard {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(0,0,0,.30); border: 1px solid rgba(255,255,255,.08);
}
.scoreTeam { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.scoreTeamLogo {
  width: 64px; height: 64px; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.scoreTeamLogo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.scoreTeamName { font-weight: 1000; font-size: 15px; text-align: center; }
.scoreTeamTag  { font-size: 11px; font-weight: 1000; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }

.scoreCenter { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 0 0 auto; }
.scoreNumbers { display: flex; align-items: center; gap: 10px; }
.scoreDigit { display: flex; align-items: center; gap: 6px; }
.scoreValue { font-size: 56px; font-weight: 1000; font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; line-height: 1; color: var(--accent2); }
.scoreBtn { width: 32px; height: 32px; border-radius: 10px; border: none; font-size: 20px; font-weight: 1000; cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; transition: background .1s, transform .08s; }
.scoreBtn:active { transform: scale(.92); }
.scoreBtn.plus  { background: rgba(56,217,150,.18); color: var(--ok); }
.scoreBtn.plus:hover  { background: rgba(56,217,150,.32); }
.scoreBtn.minus { background: rgba(255,77,109,.14); color: var(--danger); }
.scoreBtn.minus:hover { background: rgba(255,77,109,.28); }
.scoreSep { font-size: 32px; font-weight: 1000; color: var(--muted); }
.scoreFormat { font-size: 13px; font-weight: 1000; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.scoreGame { font-size: 12px; color: var(--muted); font-weight: 900; }
.scoreActions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }



.statusBtns { display: flex; gap: 6px; }
.statusBtn { flex: 1; padding: 9px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); color: var(--muted); font-size: 12px; font-weight: 1000; cursor: pointer; transition: all .12s; }
.statusBtn.live { color: var(--danger); border-color: rgba(255,77,109,.25); background: rgba(255,77,109,.10); }
.statusBtn.active { outline: 2px solid rgba(255,211,92,.50); }

.fmtBtns { display: flex; gap: 6px; }
.fmtBtn { flex: 1; padding: 9px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); color: var(--muted); font-size: 13px; font-weight: 1000; cursor: pointer; transition: all .12s; }
.fmtBtn.active { background: rgba(238,240,255,.12); border-color: rgba(238,240,255,.25); color: var(--accent2); }

.liveInfo { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.20); border: 1px solid rgba(255,255,255,.06); }
.liveInfoRow { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.liveInfoRow span:first-child { color: var(--muted); font-weight: 900; }
.liveInfoRow span:last-child  { font-weight: 1000; font-variant-numeric: tabular-nums; }

/* LOWER THIRDS */
.ltLeft, .ltRight { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 4px; }
.ltLeft  { flex: 1.2; }
.ltRight { flex: 1; }

.layoutBtns { display: flex; gap: 4px; }
.layoutBtn { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); color: var(--muted); border-radius: 8px; padding: 6px 12px; font-size: 14px; cursor: pointer; transition: all .12s; }
.layoutBtn.active { background: rgba(238,240,255,.12); border-color: rgba(238,240,255,.25); color: var(--accent2); }

.ltSlots { display: flex; flex-direction: column; gap: 10px; }

.ltSlot {
  border-radius: 14px; border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03); overflow: hidden;
}
.ltSlot.active { border-color: rgba(56,217,150,.35); background: rgba(56,217,150,.05); }
.ltSlot.inactive { opacity: .40; pointer-events: none; }

.ltSlotHead {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.ltSlotNum {
  width: 22px; height: 22px; border-radius: 999px;
  background: rgba(238,240,255,.12); border: 1px solid rgba(238,240,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 1000; color: var(--accent2); flex: 0 0 auto;
}
.ltSlotStatus { flex: 1; font-size: 12px; color: var(--muted); font-weight: 900; }
.ltSlotStatus.on { color: var(--ok); }

.ltSlotBody { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }

/* Ligne de sélection + infos détaillées */
.ltSlotRow { display: flex; align-items: center; gap: 8px; }
.ltSlotRow label { font-size: 11px; font-weight: 900; color: var(--muted); white-space: nowrap; min-width: 80px; }

/* Position X/Y par slot */
.ltPosRow {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0 4px;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 4px;
}

/* D-PAD */
.ltDpad { flex: 0 0 auto; }

.ltDpadGrid {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows:    repeat(3, 28px);
  gap: 2px;
}

.ltDpadBtn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  color: var(--ink);
  font-size: 10px; line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background .08s, transform .06s;
  padding: 0;
  /* Arrondi manette selon position */
}

/* Arrondi selon direction — style croix manette */
.ltDpadBtn[data-dir="up"]    { border-radius: 6px 6px 2px 2px; }
.ltDpadBtn[data-dir="down"]  { border-radius: 2px 2px 6px 6px; }
.ltDpadBtn[data-dir="left"]  { border-radius: 6px 2px 2px 6px; }
.ltDpadBtn[data-dir="right"] { border-radius: 2px 6px 6px 2px; }

.ltDpadBtn:hover  { background: rgba(255,255,255,.20); }
.ltDpadBtn:active { background: rgba(255,255,255,.30); transform: scale(.90); }

.ltDpadCenter {
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  width: 28px; height: 28px;
}

/* Champs X/Y à droite du D-pad */
.ltPosFields {
  display: flex; flex-direction: column; gap: 5px;
}

.ltPosField {
  display: flex; align-items: center; gap: 6px;
}

.ltPosLabel {
  font-size: 11px; font-weight: 900; color: var(--muted); white-space: nowrap; min-width: 14px;
}

.ltPosInput { width: 62px; }

.ltPosHint {
  font-size: 10px; color: var(--muted); opacity: .55; font-style: italic;
  padding-top: 2px;
}

.ltSlotActions { padding: 0 14px 10px; display: flex; gap: 8px; }
.ltShowBtn { flex: 1; padding: 9px; border-radius: 10px; border: none; font-size: 12px; font-weight: 1000; cursor: pointer; background: rgba(56,217,150,.18); color: var(--ok); transition: background .12s; }
.ltShowBtn:hover { background: rgba(56,217,150,.30); }
.ltHideBtn { flex: 1; padding: 9px; border-radius: 10px; border: none; font-size: 12px; font-weight: 1000; cursor: pointer; background: rgba(255,77,109,.14); color: var(--danger); transition: background .12s; }
.ltHideBtn:hover { background: rgba(255,77,109,.28); }
.ltGlobalActions { padding-top: 4px; }

/* Preview LT */
.ltPreviewArea { border-radius: 14px; overflow: hidden; background: rgba(0,0,0,.30); border: 1px dashed rgba(255,255,255,.12); padding: 12px; min-height: 90px; display: flex; align-items: flex-end; }
.ltPreviewBg { width: 100%; }
.ltPreviewWidget { display: flex; align-items: center; gap: 0; border-radius: 10px; overflow: hidden; font-family: system-ui; }
.ltPreviewAccent { width: 6px; height: 56px; flex: 0 0 auto; background: #0d1b2a; }
.ltPreviewTexts { flex: 1; padding: 8px 12px; background: rgba(238,240,255,.92); display: flex; flex-direction: column; gap: 2px; }
.ltPreviewName { font-size: 16px; font-weight: 1000; color: #12121b; line-height: 1.1; }
.ltPreviewRole { font-size: 11px; color: rgba(18,18,27,.60); }
.ltPreviewOrg { padding: 8px 12px; background: rgba(238,240,255,.80); display: flex; align-items: center; gap: 6px; min-width: 80px; }
.ltPreviewOrg img { width: 24px; height: 24px; object-fit: contain; border-radius: 4px; }
.ltPreviewOrg span { font-size: 10px; font-weight: 1000; color: #12121b; white-space: nowrap; }

/* Style grid */
.styleGrid { display: flex; flex-direction: column; gap: 8px; }
.styleRow  { display: flex; align-items: center; gap: 10px; }
.styleLabel { font-size: 11px; font-weight: 1000; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); min-width: 90px; flex: 0 0 90px; }
.styleSelect { flex: 1; min-width: 0; }
.styleUnit   { font-size: 11px; color: var(--muted); white-space: nowrap; }
.styleCheck  { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.colorPicker { width: 38px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); cursor: pointer; padding: 2px; background: rgba(255,255,255,.05); }

/* SHARED */
.btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: var(--ink); border-radius: 12px; padding: 9px 14px; font-weight: 900; cursor: pointer; font-size: 13px; line-height: 1; white-space: nowrap; transition: background .12s; }
.btn:hover { background: rgba(255,255,255,.14); }
.btn.ok     { background: rgba(56,217,150,.14); border-color: rgba(56,217,150,.25); color: var(--ok); }
.btn.ok:hover { background: rgba(56,217,150,.24); }
.btn.danger { background: rgba(255,77,109,.12); border-color: rgba(255,77,109,.22); color: var(--danger); }
.btn.danger:hover { background: rgba(255,77,109,.22); }
.btn.resetAll {
  background: rgba(255,211,92,.10);
  border-color: rgba(255,211,92,.25);
  color: #ffd35c;
}
.btn.resetAll:hover { background: rgba(255,211,92,.20); }
.btn.small  { font-size: 11px; padding: 7px 10px; border-radius: 10px; }
.btn.wide   { width: 100%; text-align: center; }

.input { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10); color: var(--ink); border-radius: 12px; padding: 9px 11px; outline: none; font-size: 13px; }
.input.wide   { flex: 1; min-width: 0; }
.input.narrow { width: 68px; }

/* FOOTER */
.footerbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-radius: var(--r); background: linear-gradient(180deg, rgba(18,18,27,.98), rgba(18,18,27,.88)); border: 1px solid rgba(255,255,255,.06); box-shadow: var(--shadow); }
.footerLeft, .footerRight { display: flex; align-items: center; gap: 10px; }
.footerDot { width: 9px; height: 9px; border-radius: 999px; background: rgba(238,240,255,.85); box-shadow: 0 0 0 4px rgba(238,240,255,.10); }
.footerText  { color: rgba(238,240,255,.85); font-size: 11px; font-weight: 900; letter-spacing: .3px; }
.footerSep   { color: rgba(238,240,255,.30); font-weight: 900; font-size: 11px; }
