/* ══════════════════════════════════════════════════════
   TOURNOI.CSS — PhysEdBoard
   Cards taille fixe, centrées, settings-panel header
══════════════════════════════════════════════════════ */

:root {
  --bg:            #061428;
  --surface:       #091e3c;
  --surface2:      #0d2040;
  --surface3:      #112548;
  --border:        rgba(255,255,255,0.06);
  --border-bright: rgba(255,255,255,0.12);
  --border-gold:   rgba(212,175,55,0.28);

  --gold:          #ffd43b;
  --gold-light:    #d1ab20;
  --gold-dim:      rgba(212,175,55,0.13);
  --gold-glow:     rgba(212,175,55,0.07);

  --win:           #4ade80;
  --red:           #f87171;

  --text:          #ffffff;
  --text-sub:      rgba(255,255,255,0.50);
  --text-muted:    rgba(255,255,255,0.22);

  --header-h:      64px;
  --status-h:      40px;

  --row-h:         28px;
  --match-w:       160px;
  --slot-seed-w:   26px;
  --slot-seed-fs:  13px;
  --slot-name-fs:  11px;
  --slot-score-fs: 14px;

  --radius-card:   6px;
  --radius-modal:  16px;
  --tr:            0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ════════ RESET ════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  height: 100dvh;
  display: flex; flex-direction: column;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(212,175,55,0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,175,55,0.014) 1px, transparent 1px);
  background-size: 48px 48px;
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 100% 90% at 50% 50%, transparent 10%, rgba(6,6,13,0.72) 80%, rgba(6,6,13,0.94) 100%);
}

/* ════════ APP WRAPPER ════════ */
.app-wrapper {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  width: 100%;
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
}

/* ════════ STATUS BAR ════════ */
.status-bar {
  flex-shrink: 0;
  height: var(--status-h);
  display: flex; align-items: center;
  padding: 0 clamp(16px, 2.5vw, 32px);
  background: rgba(4,10,22,0.85);
  border-bottom: 1px solid rgba(212,175,55,0.10);
  position: relative; z-index: 5;
  gap: 0;
}
.status-left {
  flex: 1; min-width: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px; letter-spacing: 0.14em;
  color: rgba(255,255,255,0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  white-space: nowrap; pointer-events: none;
}
.status-progress-track {
  width: clamp(80px, 12vw, 160px); height: 2px;
  background: rgba(255,255,255,0.06); border-radius: 1px; overflow: hidden;
}
.status-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.status-right { flex: 1; }

/* ════════ BRACKET AREA ════════ */
/*
  bracket-scroll : conteneur principal, prend tout l'espace restant.
  On sépare en deux lignes :
    1. label row (34px fixe, sticky en haut)
    2. canvas-wrap (tout le reste, flex pour centrer)
*/
.bracket-scroll {
  flex: 1; min-height: 0;
  overflow-x: auto;   /* scroll horizontal si bracket trop large  */
  overflow-y: hidden; /* pas de scroll vertical                    */
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.14) transparent;
}

/* Label row : 34px en haut, sticky horizontalement */
.bracket-label-row {
  position: sticky;
  top: 0; left: 0;
  flex-shrink: 0;
  height: 34px;
  pointer-events: none;
  z-index: 10;
  background: rgba(6,20,40,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  /* La largeur est fixée par JS (totalW) pour suivre le canvas */
}

/* Canvas wrap : remplit tout l'espace sous le label, centre le bracket */
.bracket-canvas-wrap {
  flex: 1; min-height: 0;
  display: flex;
  align-items: center;     /* centrage vertical   */
  justify-content: center; /* centrage horizontal */
  padding: 8px 20px;
  box-sizing: border-box;
  /* min-width garantit que le wrap ne rétrécit pas sous la taille du canvas */
  min-width: max-content;
}

.bracket-canvas {
  position: relative;
  flex-shrink: 0;
  isolation: isolate;
}

/* Empty state */
.bracket-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 60px 40px;
  text-align: center;
}
.bracket-empty .empty-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--gold-dim); border: 1px solid var(--border-gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--gold); opacity: 0.7;
}
.bracket-empty p {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--text-muted);
}

/* ════════ ROUND LABEL ROW ════════ */
.round-label-wrap {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  height: 34px; top: 0;
}
.round-label-pill {
  font-family: 'DM Mono', monospace;
  font-size: 8.5px; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  white-space: nowrap; padding: 2px 0;
}
.round-label-pill--finale {
  color: var(--gold-light);
  font-size: 9.5px; letter-spacing: 0.42em;
}

/* ════════ MATCH CARD ════════ */
.match-card {
  position: absolute;
  display: flex; flex-direction: column;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  transition: transform 0.16s cubic-bezier(0.4,0,0.2,1), border-color 0.16s, box-shadow 0.16s;
  cursor: default;
}
.match-card:not(.match-card--bye):not(.match-card--tbd):hover {
  transform: translateY(-2px);
  border-color: rgba(212,175,55,0.35);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,175,55,0.18);
}
.match-card--bye     { opacity: 0.22; pointer-events: none; }
.match-card--tbd     { opacity: 0.40; }
.match-card--done    { cursor: pointer; }

/* ════════ TEAM SLOTS ════════ */
.team-slot {
  display: flex; align-items: center;
  background: var(--surface2);
  transition: background 0.16s;
  position: relative; overflow: hidden; flex-shrink: 0;
}
.team-slot::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: rgba(255,255,255,0.04); pointer-events: none;
}
.team-slot--winner { background: rgba(74,222,128,0.10); }
.team-slot--winner::after { background: rgba(74,222,128,0.15); }
.team-slot--loser  { opacity: 0.22; filter: grayscale(0.4); }
.team-slot--tbd    { background: rgba(255,255,255,0.015); }
.team-slot--gold {
  background: linear-gradient(90deg, rgba(212,175,55,0.10) 0%, rgba(212,175,55,0.04) 100%);
  border: 1px solid rgba(212,175,55,0.30);
}

.team-slot-seed {
  align-self: stretch; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: var(--slot-seed-fs, 13px); letter-spacing: 0.02em;
  position: relative;
}
.team-slot-seed::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.09) 0%, transparent 55%);
  pointer-events: none;
}
.team-slot-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: var(--slot-name-fs, 11px); font-weight: 700;
  letter-spacing: 0.06em; color: rgba(255,255,255,0.88);
  padding: 0 7px; text-transform: uppercase;
}
.team-slot--tbd .team-slot-name { color: var(--text-muted); font-style: italic; font-weight: 400; letter-spacing: 0.08em; }
.team-slot-name--gold { color: rgba(240,208,96,0.92); }
.team-slot-score {
  font-family: 'Bebas Neue', sans-serif; font-size: var(--slot-score-fs, 15px);
  min-width: 26px; text-align: right; padding-right: 8px; flex-shrink: 0;
  color: rgba(255,255,255,0.40); letter-spacing: 0.02em;
}
.team-slot--winner .team-slot-score { color: var(--win); font-size: calc(var(--slot-score-fs, 15px) * 1.1); }

/* ════════ FINALE ════════ */
.finale-slot-card {
  border-color: rgba(212,175,55,0.42) !important;
  box-shadow: 0 0 0 1px rgba(212,175,55,0.16), 0 4px 18px rgba(0,0,0,0.5) !important;
}

/* ════════ TROPHY SLOT ════════ */
.trophy-slot {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
  /* z-index set inline: 0 = derrière cartes, 5 = devant avec champion */
}
.trophy-slot img {
  display: block;
  opacity: 0.16;
  animation: trophyFloat 3.2s ease-in-out infinite;
  filter: sepia(1) saturate(4) hue-rotate(5deg);
  transition: opacity 0.7s ease, filter 0.7s ease;
}
.trophy-slot--active img {
  opacity: 0.90;
  filter: sepia(1) saturate(5) hue-rotate(5deg)
          drop-shadow(0 0 28px rgba(212,175,55,0.70))
          drop-shadow(0 0 56px rgba(212,175,55,0.30));
}
.trophy-champ-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(18px, 2.8vw, 36px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  margin-bottom: 8px;
  opacity: 0;
  height: 0;
  margin-bottom: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.8s ease 0.15s, transform 0.8s cubic-bezier(0.16,1,0.3,1) 0.15s,
              height 0s 0s, margin-bottom 0s 0s;
  transform: translateY(6px);

  /* Dégradé or sur le texte */
  background: linear-gradient(
    160deg,
    #fff8dc 0%,
    var(--champ-color, #ffd43b) 35%,
    #ffd43b 55%,
    #d1ab20 80%,
    #fff0a0 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;

  /* Ombre dorée pour la profondeur */
  filter: drop-shadow(0 2px 12px rgba(212,175,55,0.60))
          drop-shadow(0 0 32px rgba(212,175,55,0.30));
}
.trophy-champ-name--visible {
  opacity: 1;
  height: auto;
  margin-bottom: 8px;
  transform: translateY(0);
}

/* ════════ SLOT SEPARATOR ════════ */
.match-sep {
  height: 1px;
  background: rgba(255,255,255,0.07);
  flex-shrink: 0;
}

/* ════════ BOUTONS ════════ */
.tb-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  border-radius: 8px; padding: 9px 18px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.18s; min-height: 38px;
  border: 1px solid transparent; white-space: nowrap;
}
.tb-btn--accent {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  color: #000;
  box-shadow: 0 4px 18px rgba(212,175,55,0.26), inset 0 1px 0 rgba(255,255,255,0.18);
}
.tb-btn--accent:hover { transform: translateY(-1px); box-shadow: 0 6px 26px rgba(212,175,55,0.38); }
.tb-btn--ghost { background: rgba(255,255,255,0.03); color: var(--text-sub); border-color: var(--border-bright); }
.tb-btn--ghost:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.22); color: var(--text); }
.tb-btn--danger { background: transparent; color: var(--red); border-color: rgba(248,113,113,0.25); }
.tb-btn--danger:hover { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.45); }
.tb-btn--sm { font-size: 11px; padding: 6px 13px; }
.tb-btn:active { transform: scale(0.97) translateY(1px) !important; }
.tb-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* ════════ MODAL ════════ */
.t-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(3,3,9,0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  align-items: center; justify-content: center;
  padding: 16px;
}
.t-overlay.visible { display: flex; animation: overlayIn 0.18s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.t-modal {
  position: relative;
  background: linear-gradient(170deg, #131320 0%, #0d0d1a 100%);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 20px;
  width: min(540px, 100%);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 32px 80px rgba(0,0,0,0.65);
  animation: modalIn 0.24s cubic-bezier(0.16,1,0.3,1);
}
.t-modal::before {
  content: ''; position: absolute; top: 0; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent);
  opacity: 0.45; z-index: 1; pointer-events: none;
}
.t-modal--config { width: min(520px, 96vw); max-height: min(88vh, 760px); }
.t-modal--score { width: min(550px, 98vw); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.t-modal-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.t-modal-header-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--gold-dim); border: 1px solid var(--border-gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 14px;
}
.t-modal-header-text { flex: 1; min-width: 0; }
.t-modal-title { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 0.08em; color: var(--text); line-height: 1; }
.t-modal-subtitle { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }
.t-modal-close {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.t-modal-close:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: var(--text); }

.t-modal-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; }
.t-modal-body--config { overflow-y: auto; padding: 0; flex: 1; min-height: 0; }

.t-modal-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.18); flex-shrink: 0;
}
.t-modal-footer-left  { flex: 1; display: flex; align-items: center; gap: 8px; }
.t-modal-footer-right { display: flex; align-items: center; gap: 8px; }

.t-section {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.t-section:last-child { border-bottom: none; padding-bottom: 4px; }
.t-section:first-child { padding-top: 4px; }
.t-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px; font-weight: 500; letter-spacing: 0.42em; text-transform: uppercase;
  color: var(--gold); opacity: 0.62;
  display: flex; align-items: center; justify-content: space-between;
}
.t-section-badge { font-family: 'Bebas Neue', sans-serif; font-size: 13px; letter-spacing: 0.05em; color: var(--text-sub); border-radius: 20px; padding: 1px 10px; }
.t-section-badge--warn { color: var(--red); border-color: rgba(248,113,113,0.25); background: rgba(248,113,113,0.07); }
.t-section-badge--ok   { color: var(--win); }

.t-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.t-type-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
  color: var(--text-muted); transition: all 0.18s;
  font-family: 'Barlow Condensed', sans-serif; text-align: left; position: relative; overflow: hidden;
}
.t-type-btn-label { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; }
.t-type-btn-desc  { font-size: 10px; opacity: 0.45; text-transform: none; letter-spacing: 0; line-height: 1.3; font-weight: 400; }
.t-type-btn:hover { border-color: rgba(212,175,55,0.3); color: var(--text); background: rgba(212,175,55,0.04); }
.t-type-btn.active {
  background: linear-gradient(135deg, rgba(212,175,55,0.10), rgba(212,175,55,0.04));
  border-color: rgba(212,175,55,0.42); color: var(--text);
  box-shadow: inset 0 1px 0 rgba(212,175,55,0.12);
}
.t-type-btn::after {
  content: ''; position: absolute; top: 9px; right: 9px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.1); transition: all 0.18s;
}
.t-type-btn.active::after {
  background: var(--gold); border-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23000' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 9px; background-position: center; background-repeat: no-repeat;
}

.t-board-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.t-board-action-btn { justify-content: center; width: 100%; min-height: 36px; font-size: 11px; padding: 7px 10px; }

.t-input {
  font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 9px; color: var(--text); padding: 10px 13px;
  outline: none; width: 100%; transition: border-color 0.18s, box-shadow 0.18s;
  letter-spacing: 0.04em;
}
.t-input:focus { border-color: rgba(212,175,55,0.45); background: rgba(212,175,55,0.04); box-shadow: 0 0 0 3px rgba(212,175,55,0.06); }
.t-input::placeholder { color: rgba(255,255,255,0.16); }
.t-input--flex { flex: 1; width: auto; min-width: 0; }

.t-teams-add { display: flex; gap: 8px; align-items: stretch; }
.t-btn-add {
  width: 42px; height: 42px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none; color: #000; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.18s;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(212,175,55,0.22);
}
.t-btn-add:hover { transform: scale(1.05); box-shadow: 0 5px 18px rgba(212,175,55,0.36); }

.t-bracket-info {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 9px;
}
.t-bracket-info-dots { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; }
.t-bracket-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.07); transition: background 0.2s; }
.t-bracket-dot--filled { background: var(--gold); }
.t-bracket-dot--bye    { background: rgba(212,175,55,0.22); }
.t-bracket-info-text { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.16em; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

.t-teams-list {
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden;
  max-height: 200px; overflow-y: auto;
}
.t-team-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s; animation: teamIn 0.2s ease;
}
@keyframes teamIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.t-team-item:last-child { border-bottom: none; }
.t-team-item:hover { background: rgba(255,255,255,0.03); }
.t-team-num  { font-family: 'Bebas Neue', sans-serif; font-size: 13px; color: var(--text-muted); min-width: 18px; text-align: right; flex-shrink: 0; }
.t-team-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.t-team-iname { flex: 1; min-width: 0; font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.t-team-del  { background: transparent; border: none; color: rgba(255,255,255,0.16); cursor: pointer; font-size: 11px; padding: 4px 6px; border-radius: 4px; transition: color 0.15s, background 0.15s; flex-shrink: 0; }
.t-team-del:hover { color: var(--red); background: rgba(248,113,113,0.1); }
.t-teams-empty { padding: 22px 16px; text-align: center; color: var(--text-muted); font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.26em; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.t-teams-empty-icon { font-size: 20px; opacity: 0.22; }

/* ════════ SCORE MODAL ════════ */
.t-modal--score { width: min(550px, 98vw); overflow: hidden; }
.score-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.score-modal-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px; font-weight: 500; letter-spacing: 0.4em; text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}
.score-arena { display: flex; align-items: stretch; min-height: 220px; flex: 1; }
.score-side { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.score-side-color { height: 5px; flex-shrink: 0; }
.score-side-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px 16px 24px; }
.score-team-name-wrap { width: 100%; display: flex; justify-content: center; }
.score-team-name-input {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(18px, 3vw, 26px);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff; text-align: center;
  background: transparent; border: none; border-bottom: 1px solid transparent;
  outline: none; width: 100%; padding: 2px 4px;
  transition: border-color 0.16s, background 0.16s; cursor: text;
}
.score-team-name-input:hover { border-bottom-color: rgba(255,255,255,0.18); }
.score-team-name-input:focus { border-bottom-color: var(--gold); background: rgba(212,175,55,0.05); }
.score-divider { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 5px; position: relative; }
.score-vs-label { font-family: 'Bebas Neue', sans-serif; font-size: 14px; letter-spacing: 0.14em; color: rgba(255,255,255,0.20); writing-mode: vertical-rl; }
.score-controls { display: flex; align-items: center; gap: 10px; }
.score-adj { background: transparent; border: none; cursor: pointer; color: rgba(255,255,255,0.30); transition: color 0.14s; display: flex; align-items: center; justify-content: center; border-radius: 6px; padding: 4px; }
.score-adj--big { font-size: 28px; font-weight: 300; width: 40px; height: 40px; font-family: 'Barlow Condensed', sans-serif; }
.score-adj--big:hover { color: var(--gold); background: rgba(212,175,55,0.10); }
.score-adj--big:active { transform: scale(0.94); }
.score-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(56px, 10vw, 80px);
  line-height: 1; letter-spacing: 0.02em;
  color: #fff; text-align: center;
  background: transparent; border: none;
  width: clamp(64px, 10vw, 88px);
  outline: none; padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.score-num::-webkit-outer-spin-button,
.score-num::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; }
.tb-btn--confirm { min-width: 180px; justify-content: center; }

/* ════════ CONFIG MODAL ════════ */
.t-cfg-section { padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.t-cfg-section:last-child { border-bottom: none; }
.t-cfg-section--actions { padding: 16px 24px; }
.t-cfg-label { font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 500; letter-spacing: 0.44em; text-transform: uppercase; color: rgba(212,175,55,0.55); margin-bottom: 12px; }
.t-cfg-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.t-cfg-label-row .t-cfg-label { margin-bottom: 0; }

.t-names-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
.t-names-list::-webkit-scrollbar { width: 3px; }
.t-names-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }
.t-name-row { display: flex; align-items: center; gap: 8px; }
.t-name-num { font-family: 'Bebas Neue', sans-serif; font-size: 15px; color: rgba(255,255,255,0.20); min-width: 22px; text-align: right; flex-shrink: 0; }
.t-name-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.t-name-input {
  flex: 1; min-width: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 7px; color: #fff; padding: 7px 10px; outline: none;
  transition: border-color 0.16s, background 0.16s;
}
.t-name-input:focus { border-color: rgba(212,175,55,0.42); background: rgba(212,175,55,0.05); }
.t-name-input::placeholder { color: rgba(255,255,255,0.18); font-weight: 400; text-transform: none; letter-spacing: 0; }

.t-count-stepper { display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; overflow: hidden; margin: 4px 0; }
.t-count-btn { background: transparent; border: none; color: rgba(255,255,255,0.45); font-size: 22px; font-weight: 300; width: 48px; height: 56px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: color 0.14s, background 0.14s; font-family: 'Barlow Condensed', sans-serif; user-select: none; -webkit-user-select: none; }
.t-count-btn:hover  { color: var(--gold); background: rgba(212,175,55,0.08); }
.t-count-btn:active { background: rgba(212,175,55,0.16); }
.t-count-display { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px 0; border-left: 1px solid rgba(255,255,255,0.06); border-right: 1px solid rgba(255,255,255,0.06); }
.t-count-value { font-family: 'Bebas Neue', sans-serif; font-size: 36px; line-height: 1; color: var(--gold-light); letter-spacing: 0.04em; }
.t-count-label { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.36em; text-transform: uppercase; color: rgba(255,255,255,0.30); }

/* ════════ FINALE HORIZONTALE (miroir) ════════ */
.finale-card { display: flex; align-items: stretch; border-radius: 8px; overflow: hidden; border: 1px solid rgba(212,175,55,0.35); box-shadow: 0 0 0 1px rgba(212,175,55,0.12), 0 4px 24px rgba(0,0,0,0.5); transition: transform 0.16s, box-shadow 0.16s; cursor: pointer; }
.finale-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(212,175,55,0.3), 0 8px 32px rgba(212,175,55,0.18); }
.finale-half { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: var(--surface2); border: none; padding: 0 8px; transition: background 0.2s; }
.finale-half--left  { flex-direction: row; justify-content: flex-start; }
.finale-half--right { flex-direction: row-reverse; justify-content: flex-start; }
.finale-half--winner { background: rgba(74,222,128,0.08) !important; }
.finale-half--loser  { opacity: 0.35; }
.finale-seed { flex-shrink: 0; width: var(--slot-seed-w, 28px); height: 100%; display: flex; align-items: center; justify-content: center; font-family: 'Bebas Neue', sans-serif; font-size: var(--slot-seed-fs, 14px); background: rgba(255,255,255,0.08); border-radius: 3px; }
.finale-name { flex: 1; min-width: 0; font-family: 'Barlow Condensed', sans-serif; font-size: var(--slot-name-fs, 12px); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finale-score { flex-shrink: 0; font-family: 'Bebas Neue', sans-serif; font-size: var(--slot-score-fs, 16px); color: rgba(255,255,255,0.5); min-width: 22px; text-align: center; }
.finale-score--win { color: var(--win); }
.finale-vs { flex-shrink: 0; width: 32px; display: flex; align-items: center; justify-content: center; background: rgba(212,175,55,0.08); border-left: 1px solid rgba(212,175,55,0.20); border-right: 1px solid rgba(212,175,55,0.20); }
.finale-vs span { font-family: 'Bebas Neue', sans-serif; font-size: 11px; letter-spacing: 0.14em; color: rgba(212,175,55,0.55); }

/* ════════ CHAMPION SLOT ════════ */

/* ════════ TOAST ════════ */
.t-toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: var(--surface3); border: 1px solid var(--border-bright); border-radius: 40px;
  padding: 9px 26px; font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-sub);
  opacity: 0; pointer-events: none; z-index: 99999;
  transition: opacity 0.22s, transform 0.22s cubic-bezier(0.4,0,0.2,1); white-space: nowrap;
  backdrop-filter: blur(20px); box-shadow: 0 8px 32px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
}
.t-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ════════ SCROLLBARS ════════ */
.bracket-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.bracket-scroll::-webkit-scrollbar-track { background: transparent; }
.bracket-scroll::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.12); border-radius: 3px; }
.bracket-scroll::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.26); }
.t-teams-list::-webkit-scrollbar { width: 3px; }
.t-teams-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 2px; }
.t-modal-body::-webkit-scrollbar { width: 3px; }
.t-modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 2px; }

/* ════════ ANIMATIONS ════════ */
@keyframes trophyFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ════════ RESPONSIVE ════════ */
@media (max-width: 700px) {
  .status-center { display: none; }
  .t-board-actions { grid-template-columns: 1fr; }
}

/* ════════ PRINT ════════ */
@page { size: landscape; margin: 8mm; }
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body::before, body::after { content: none !important; display: none !important; }
  settings-panel, .status-bar, .t-overlay, .t-toast, .bracket-label-row { display: none !important; }
  .app-wrapper { height: auto !important; overflow: visible !important; background: #fff !important; }
  .bracket-scroll { overflow: visible !important; background: #fff !important; padding: 0 !important; display: block !important; }
  .bracket-canvas-wrap { display: block !important; min-width: 0 !important; padding: 0 !important; }
  .bracket-canvas { background: #fff !important; transform-origin: top left !important; transform: scale(var(--print-scale,1)) !important; -webkit-print-color-adjust: economy !important; print-color-adjust: economy !important; }
  .team-slot { background: #fff !important; opacity: 1 !important; filter: none !important; border: 1.4px solid #000 !important; color: #000 !important; }
  .team-slot-name, .team-slot-seed, .team-slot-score { color: #000 !important; }
  .team-slot-seed { border-right: 1.4px solid #000 !important; }
  .bracket-canvas svg path { stroke: #000 !important; stroke-width: 1.8 !important; opacity: 1 !important; }
  .bracket-canvas svg circle { fill: #000 !important; opacity: 1 !important; }
  * { box-shadow: none !important; text-shadow: none !important; }
}