/* =========================
   WC2026 Simulator — CSS CLEAN (single source of truth)
   ========================= */

* { box-sizing: border-box; }

body{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  background: #f3f4f6;
  color: #111827;
}

h1{ text-align:center; font-size:28px; margin:0 0 8px; }
p{
  text-align:center;
  margin-bottom:24px;
  color:#4b5563;
  font-size:14px;
}
h2{ font-size:18px; margin:0; }
h3{ font-size:15px; margin:0; }

img{ max-width:100%; height:auto; }

.hidden{ display:none !important; }

/* ===== Buttons ===== */
button{
  cursor:pointer;
  border-radius:999px;
  border:1px solid #d1d5db;
  background:#fff;
  padding:6px 10px;
  font-size:11px;
  white-space:nowrap;
}

.btn-next{
  background:#2563eb;
  color:#fff;
  border-color:#1d4ed8;
}

/* ===== App Header (sticky) ===== */
.app-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e6e6e6;
  padding: 10px 12px 12px;
}

.app-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.app-title{
  margin:0;
  font-size:26px;
  font-weight:800;
  line-height:1.1;
  text-align:left;
}

/* Language buttons (flags) */
.lang-switch{
  display:flex;
  gap:8px;
}

.lang-btn{
  padding:6px;
  border-radius:999px;
  border:1px solid #dcdcdc;
  background:#fff;
  cursor:pointer;
  opacity:0.6;
  line-height:1;
}

.lang-btn.active{
  opacity:1;
  border-color:#4f5bd5;
  box-shadow:0 0 0 2px rgba(79,91,213,0.15);
}

.lang-flag{
  width:18px;
  height:12px;
  display:block;
  border-radius:2px;
}

/* Toolbar */
.app-toolbar{
  margin-top:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.actions button{
  border:1px solid #dcdcdc;
  background:#fff;
}

/* Stepper */
.stepper{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:center;
}

.stepper-item{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #dcdcdc;
  background:#fff;
  font-size:11px;
}

.stepper-item.active{
  background:#2563eb;
  color:#fff;
  border-color:#1d4ed8;
}

/* Tournament odds panel — sits in normal flow right below the sticky header */
.tournament-panel{
  background: #f8fafc;
  border-bottom: 1px solid #e6e6e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 10px 20px 16px;
}

.tournament-controls{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.mc-close-btn{
  margin-left: auto;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  line-height: 1.6;
}
.mc-close-btn:hover{ background: #f3f4f6; color: #111; }

/* ===== Sections / Wizard ===== */
.step-section{ margin-top:16px; }
.step-hidden{ display:none; }

.step-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
  flex-wrap:wrap;
}

.step-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top:14px;
  flex-wrap:wrap;
}
.step-footer .spacer{ flex:1; }

/* ===== Blocks ===== */
.round-block,
.group-block,
.standings-block{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:10px;
  box-shadow:0 1px 2px rgba(0,0,0,0.05);
  overflow:hidden;
}

.block-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:6px;
  gap:10px;
  flex-wrap:wrap;
}

/* Main grids */
#playoffs,
#groups,
#standings,
#knockout{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap:14px;
}

/* ===== Match rows (SINGLE SOURCE OF TRUTH) ===== */
.match-row{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:10px;
  min-width:0;
}
.match-row *{ min-width:0; }

.match-title-line{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  min-width:0;
}

.match-title-line strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.prob-chip{
  font-size:10px;
  background:#f3f4f6;
  padding:1px 6px;
  border-radius:999px;
  white-space:nowrap;
}

/* Desktop/tablet: teamL | score | teamR | button */
.match-line2{
  display:grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  min-width:0;
}

.col-team-left,
.col-team-right{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  overflow:hidden;
  font-size:12px;
}

.col-team-right{
  justify-content:flex-end;
  text-align:right;
}

/* Name + rank as 2 lines (never truncated) */
.team-label-block{
  display:flex;
  flex-direction:column;
  line-height:1.15;
  min-width:0;
}

.team-name{
  font-weight:600;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

.team-rank{
  font-size:11px;
  color:#6b7280;
  margin-top:2px;
  white-space:nowrap;
  display:block;
}

.col-score-zone{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  white-space:nowrap;
  flex:0 0 auto;
}

.score-input{
  width:34px;
  text-align:center;
  font-size:12px;
  padding:2px 4px;
}

.team-flag{
  width:18px;
  height:12px;
  object-fit:cover;
  display:inline-block;
  flex:0 0 auto;
  border-radius:2px;
  margin-right:6px; /* space between flag and label */
}

.pen-chip{
  width:16px;
  height:16px;
  font-size:10px;
  border-radius:50%;
  border:1px solid #6b7280;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.col-button{
  justify-self:end;
  display:flex;
  flex:0 0 auto;
}

/* If you have group/knockout rows using .match-inputs */
.match-inputs{
  display:grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto
    auto
    auto
    auto
    auto
    minmax(0, 1fr)
    auto;
  align-items:center;
  gap:6px;
  min-width:0;
}

.team-label{
  min-width:0;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  overflow-wrap:anywhere;
}

/* ===== Tables ===== */
table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

th, td{
  border:1px solid #e5e7eb;
  padding:4px;
  text-align:center;
}

/* Standings: team column(s) left-aligned */
.standings-table td:nth-child(1),
.standings-table th:nth-child(1){
  text-align:left;
}
.standings-table td:nth-child(2),
.standings-table th:nth-child(2){
  text-align:left;
}

/* Third-placed teams NOT qualified (rows 9–12) */
.standings-table tr.third-elim td{
  color:#b91c1c !important;
  background-color:#fef2f2;
}
.standings-table tr.third-elim td *{
  color:#b91c1c !important;
  opacity:1 !important;
}

/* ===== Footer ===== */
footer{
  text-align:center;
  margin-top:40px;
  font-size:12px;
}

/* ===== Responsive ===== */
@media (max-width: 900px){
  #playoffs,
  #groups,
  #standings,
  #knockout{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px){
  .app-toolbar{ justify-content:flex-start; }
  .app-title{ font-size:22px; }
}

/* Mobile portrait: teams side-by-side, score under, button under */
@media (max-width: 480px){
  .match-line2{
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    grid-template-areas:
      "teamL teamR"
      "score score"
      "btn btn";
    row-gap:6px;
  }

  .col-team-left{ grid-area: teamL; }
  .col-team-right{ grid-area: teamR; justify-content:flex-end; }
  .col-score-zone{ grid-area: score; }
  .col-button{ grid-area: btn; justify-content:flex-end; }

  /* On mobile, avoid ellipsis in match title */
  .match-title-line strong{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }
}

/* Slightly smaller flags if you want */
@media (max-width: 360px){
  .team-flag{ width:16px; height:11px; }
  .score-input{ width:32px; }
}

.match-title-line{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
}

.odds-inline{
  margin-left:10px;
  font-size:10px;
  color:#6b7280;
  font-weight:400;
}

.col-score-zone{
  display:flex;
  flex-direction:column;
  align-items:center;
  line-height:1.1;
}

.score-main{
  display:flex;
  align-items:center;
  gap:4px;
}

.penalties-line{
  margin-top:2px;
  font-size:10px;
  color:#9ca3af;
  font-weight:400;
  letter-spacing:0.2px;
  line-height:1;
}

/* GROUP STAGE — score horizontal (pas de pénos ici) */
#groups .col-score-zone{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:4px;
}

#knockout .pen-chip{ margin-left:8px; }

/* Match rows: plus d'air */
.match-row{
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.06);
}

/* Alternance */
.match-row.alt{
  background: rgba(0,0,0,.03);
}

/* Sépare mieux le titre du match du contenu */
.match-title-line{
  margin-bottom: 6px;
}

/* Odds plus petit, style "ancien" */
.odds-inline{
  font-size: 12px;
  opacity: .75;
  margin-left: 8px;
  white-space: nowrap;
}

/* Top4 bloc (dans Knockout) */
#final4.final4-block{
  margin: 6px 0 14px 0;
}

.final4-card{
  width: 260px;
  border: 1px solid #e6e6e6;
  background: #fff;
  border-radius: 14px;
  padding: 10px 10px 8px 10px;
}

.final4-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}

.final4-title{
  font-weight: 800;
  font-size: 14px;
}

.final4-share{
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}

.final4-table{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.final4-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f7f7f8;
}

.final4-pos{
  width: 16px;
  text-align:right;
  font-weight: 700;
  font-size: 12px;
  opacity: .8;
}

.final4-team{
  display:flex;
  align-items:center;
  gap:8px;
  min-width: 0;
}

.final4-flag{
  width: 18px;
  height: 12px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.final4-name{
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#final4.final4-block{
  width: 100%;
}
.final4-card{
  width: 100%;
  max-width: 320px;
}

#final4 { margin-top: 16px; }

.seo-copy{
  max-width: 980px;
  margin: 10px auto 18px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  text-align: left;
}

.seo-lead{
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #4b5563;
}

.seo-p2{
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #4b5563;
}

.seo-links{
  margin: 10px 0 0;
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.seo-links a{
  color: #2563eb;
  text-decoration: none;
}
.seo-links a:hover{ text-decoration: underline; }

.seo-details{
  margin-top: 8px;
}

.seo-details summary{
  cursor: pointer;
  font-size: 12px;
  color: #2563eb;
  user-select: none;
}

.seo-bullets{
  margin: 8px 0 0 18px;
  padding: 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 640px){
  .seo-copy{ margin: 8px 0 14px; }
}

.block-header {
  position: relative;
  z-index: 5;
}

.block-header button {
  pointer-events: auto !important;
}

.round-block {
  position: relative;
  z-index: 1;
}

.match-row {
  pointer-events: auto;
}

.final4-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.final4-team {
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;

  font-size: 14px;
  line-height: 1.2;

  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.final4-team:nth-child(even) {
  background: #f7f7f7;
}

.final4-team strong,
.final4-team span.rank {
  font-weight: 600;
}

@media (max-width: 768px) {
  .final4-team {
    font-size: 13px;
    padding: 8px 12px;
  }
}

.final4-pos {
  font-weight: 700;
}

.final4-name {
  padding-left: 6px;
}

.final4-rank {
  opacity: 0.7;
  font-size: 12px;
}

#final4 .final4-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:10px 12px 12px;
}

#final4 .final4-team{
  display:grid;
  grid-template-columns: 24px 1fr auto;
  align-items:center;
  padding:8px 10px;
  border-radius:10px;
  background: rgba(0,0,0,0.03);
}

#final4 .final4-team.alt{
  background: rgba(0,0,0,0.06);
}

.final4-block { margin-top: 14px; }
.final4-table { display:flex; flex-direction:column; gap:6px; padding:10px 12px; }
.final4-row { display:grid; grid-template-columns:28px 1fr auto; align-items:center; gap:10px;
  padding:8px 10px; border-radius:10px; background:rgba(0,0,0,0.03); }
.final4-pos { opacity:.8; font-weight:600; }
.final4-namewrap { display:flex; align-items:center; gap:8px; }
.final4-rank { opacity:.75; font-size:12px; }

.ads-container {
  margin: 16px 0;
  text-align: center;
}

/* Quick AdSense safety cap: prevent oversized creatives from covering content */
#adsense-wrap {
  max-height: 260px; /* cap tall creatives */
  overflow: hidden;
  position: relative;
}

#adsense-wrap ins {
  display: block !important;
  max-height: 260px !important;
  overflow: hidden !important;
}

/* Small close button for users to dismiss large creatives */
.ads-close {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 60;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 14px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ads-close:focus{ outline: 2px solid rgba(255,255,255,0.9); }

/* Cache la boîte vide quand Google n'a pas d'annonce à servir */
ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

/* ===== TOP 4 (style identique aux rounds) ===== */

.final4-block {
  margin-top: 16px;
}

.final4-block .block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.final4-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

/* Monte Carlo panel */
.mc-wrap{
  max-width: 720px;
  margin-top: 10px;
}

.mc-block{
  margin-top: 12px;
}

.mc-title{
  font-weight: 800;
  margin: 8px 0 6px;
}

.mc-table{
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
}

.mc-table td{
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.mc-table tr:last-child td{ border-bottom: none; }

.mc-team{
  text-align: left;
}

.mc-val{
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mc-teamline{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mc-flag{
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}

.mc-rank{
  opacity: .65;
  font-weight: 600;
  margin-left: 6px;
}

/* === Méthodologie link (header + footer) === */
.methodology-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:#374151;
  text-decoration:none;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #dcdcdc;
  background:#fff;
  white-space:nowrap;
}

.methodology-link:hover{
  border-color:#9ca3af;
}

.methodology-link .info{
  font-size:13px;
  line-height:1;
}

/* Lang flags: keep visible on mobile */
.lang-switch {
  display: flex !important;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 64px;
}

.lang-switch button,
.lang-switch a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 10px;
}

.lang-switch img,
.lang-switch svg {
  width: 24px !important;
  height: 18px !important;
  display: block !important;
}

/* Si ton header coupe */
header, .topbar, .header {
  overflow: visible;
}

/* Si le header est en flex et ça wrap mal */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* --- Monte Carlo bars (scoped, no conflicts) --- */
#mc-bars .mc-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

@media (min-width: 820px) {
  #mc-bars .mc-row {
    grid-template-columns: 340px 1fr;
    align-items: center;
  }
}

#mc-bars .mc-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#mc-bars .mc-flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  flex: 0 0 auto;
}

#mc-bars .mc-name { min-width: 0; }

#mc-bars .mc-country {
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#mc-bars .mc-rank {
  font-weight: 500;
  opacity: 0.65;
  margin-left: 6px;
}

#mc-bars .mc-badges {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#mc-bars .mc-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
  white-space: nowrap;
}

#mc-bars .mc-badge-fav { font-weight: 700; }
#mc-bars .mc-badge-chal { font-weight: 600; }
#mc-bars .mc-badge-out { font-weight: 600; opacity: 0.9; }

#mc-bars .mc-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  #mc-bars .mc-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#mc-bars .mc-metric {
  display: grid;
  grid-template-columns: 54px 1fr 52px;
  align-items: center;
  gap: 8px;
}

#mc-bars .mc-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
}

#mc-bars .mc-val {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
}

#mc-bars .mc-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  overflow: hidden;
  position: relative;
}

#mc-bars .mc-fill {
  height: 100%;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  transition: width 180ms ease;
}

/* hover highlight */
#mc-bars .mc-row:hover .mc-fill {
  background: rgba(0,0,0,0.72);
}

#mc-bars .mc-row:hover {
  background: rgba(0,0,0,0.02);
}

#btnMcStopLive{
  border-color:#ef4444;
  color:#ef4444;
}
#btnMcStopLive:not(.hidden){
  background:#fff;
}

#btnMcStopLive{ display:inline-flex; align-items:center; }
#btnMcStopLive.hidden { display:none; }

.ads-container {
  margin: 16px 0;
  text-align: center;
}

.btn-secondary {
  border: 1px solid #d0d7de;
  background: transparent;
  color: #0366d6;
}

.btn-secondary:hover {
  background: #f6f8fa;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.app-toolbar .actions button {
  padding: 6px 12px;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}

.app-toolbar .actions button,
.app-toolbar .actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

/* Simulate remaining count badge */
.sim-rest-count {
  opacity: 0.7;
  font-size: 10px;
  margin-left: 2px;
}
.sim-rest-done {
  color: #16a34a;
  opacity: 1;
}
.btn-step-sim-all:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== Group Stage Tiebreaker Visualization ===== */

/* Position colour bars (left border on standing rows) */
.standings-pos-1 { border-left: 3px solid #16a34a; }  /* green  – 1st qualifier */
.standings-pos-2 { border-left: 3px solid #2563eb; }  /* blue   – 2nd qualifier */
.standings-pos-3 { border-left: 3px solid #f59e0b; }  /* amber  – best 3rd (conditional) */
.standings-pos-4 { border-left: 3px solid #d1d5db; }  /* gray   – eliminated */

/* Dashed separator between 2nd and 3rd place */
.standings-cut-top td {
  border-top: 2px dashed #d1d5db;
}

/* Tiebreaker badges */
.tb-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 14px;
  cursor: default;
  white-space: nowrap;
}
.tb-gd    { background: #dbeafe; color: #1e40af; }
.tb-gf    { background: #dcfce7; color: #14532d; }
.tb-alpha { background: #fef3c7; color: #92400e; }

/* Legend below the standings table */
.tb-legend {
  font-size: 10px;
  color: #6b7280;
  padding: 4px 6px 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Team cell — keep badge from wrapping awkwardly */
.td-team {
  white-space: nowrap;
}

/* ===== Team Strength Editor ===== */
.se-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.se-panel {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.se-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.se-header h2 { font-size: 16px; margin: 0; }

.se-header-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

.se-btn-reset-all {
  font-size: 12px;
  padding: 5px 10px;
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
  border-radius: 6px;
}

.se-btn-close {
  font-size: 18px;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.se-note {
  font-size: 12px;
  color: #6b7280;
  margin: 8px 20px 4px;
  text-align: left;
}

.se-body {
  overflow-y: auto;
  padding: 8px 20px 12px;
  flex: 1;
}

.se-group {
  margin-bottom: 16px;
}

.se-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 6px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}

.se-group:first-child .se-group-title {
  border-top: none;
  padding-top: 0;
}

.se-team-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}

.se-modified .se-team-name {
  color: #1d4ed8;
  font-weight: 600;
}

.se-flag {
  width: 20px;
  height: 14px;
  flex-shrink: 0;
}

.se-team-name {
  font-size: 13px;
  width: 140px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.se-placeholder {
  color: #9ca3af;
  font-style: italic;
}

.se-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.se-slider {
  flex: 1;
  min-width: 80px;
  height: 4px;
  accent-color: #2563eb;
  cursor: pointer;
}

.se-val {
  font-size: 12px;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

.se-base {
  font-size: 11px;
  color: #9ca3af;
  min-width: 44px;
}

.se-reset-one {
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
  line-height: 1;
}

.se-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.se-done {
  font-size: 13px;
  padding: 8px 20px;
}

/* ===== Theme toggle button ===== */
.theme-toggle-btn {
  font-size: 16px;
  padding: 4px 7px;
  line-height: 1;
}

/* ===== Hook bar ===== */
/* Dark mode (default) */
.hook-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 16px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}
.hook-stat b { color: #fbbf24; font-weight: 700; }
.hook-sep { color: #475569; }
.hook-cta {
  background: #2563eb;
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 999px;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.hook-cta:hover { background: #1d4ed8; }

/* Light mode */
[data-theme="light"] .hook-bar {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
  color: #374151;
}
[data-theme="light"] .hook-stat b { color: #1d4ed8; font-weight: 700; }
[data-theme="light"] .hook-sep    { color: #9ca3af; }

/* ===== Champion CTA ===== */
.champion-cta {
  margin: 24px 0 8px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
}
.cta-champion-name {
  font-size: 20px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cta-flag { width: 28px; height: 20px; border-radius: 3px; }
.cta-champion-sub {
  margin: 8px 0 20px;
  color: #94a3b8;
  font-size: 14px;
}
.cta-champion-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.cta-btn-primary {
  background: #2563eb;
  color: #fff !important;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
}
.cta-btn-primary:hover { background: #1d4ed8; }
.cta-btn-secondary {
  background: transparent;
  color: #94a3b8;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid #475569;
  font-size: 14px;
  cursor: pointer;
}
.cta-btn-secondary:hover { color: #f1f5f9; border-color: #64748b; }

[data-theme="light"] .champion-cta {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
}
[data-theme="light"] .cta-champion-name { color: #1e293b; }
[data-theme="light"] .cta-champion-sub  { color: #6b7280; }
[data-theme="light"] .cta-btn-secondary { color: #6b7280; border-color: #d1d5db; }
[data-theme="light"] .cta-btn-secondary:hover { color: #1e293b; border-color: #9ca3af; }

/* ===== Dark Mode ===== */

/* Fill the full viewport with dark bg (outside the max-width body) */
[data-theme="dark"] {
  background: #0f172a;
  color-scheme: dark;
}

[data-theme="dark"] body {
  background: #0f172a;
  color: #f1f5f9;
}

[data-theme="dark"] p          { color: #94a3b8; }
[data-theme="dark"] .team-rank { color: #94a3b8; }
[data-theme="dark"] .odds-inline     { color: #94a3b8; }
[data-theme="dark"] .penalties-line  { color: #64748b; }
[data-theme="dark"] .score-suffix    { color: #94a3b8; }
[data-theme="dark"] footer           { color: #94a3b8; }
[data-theme="dark"] footer a         { color: #93c5fd; }

/* ── Header ── */
[data-theme="dark"] .app-header {
  background: rgba(15,23,42,0.95);
  border-bottom-color: #1e293b;
}

[data-theme="dark"] .lang-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
[data-theme="dark"] .lang-btn.active {
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129,140,248,0.2);
}

/* ── Buttons (all generic buttons) ── */
[data-theme="dark"] button {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}
[data-theme="dark"] .btn-next {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}
[data-theme="dark"] .stepper-item        { background: #1e293b; border-color: #475569; color: #f1f5f9; }
[data-theme="dark"] .stepper-item.active { background: #2563eb; border-color: #1d4ed8; color: #fff; }
[data-theme="dark"] .btn-secondary       { background: transparent; border-color: #475569; color: #93c5fd; }
[data-theme="dark"] a.btn                { color: #93c5fd; border-color: #475569; }

[data-theme="dark"] #btnMcStopLive {
  border-color: #f87171;
  color: #f87171;
  background: #1e293b;
}

/* ── Blocks / Cards ── */
[data-theme="dark"] .round-block,
[data-theme="dark"] .group-block,
[data-theme="dark"] .standings-block {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

[data-theme="dark"] .match-row          { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .match-row.alt      { background: rgba(255,255,255,0.04); }

[data-theme="dark"] .tournament-panel   { background: rgba(15,23,42,0.97); border-bottom-color: #1e293b; }
[data-theme="dark"] .mc-close-btn      { border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .mc-close-btn:hover{ background: #1e293b; color: #f1f5f9; }

/* ── Inputs & selects ── */
[data-theme="dark"] .score-input,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"] {
  background: #0f172a;
  border: 1px solid #475569;
  color: #f1f5f9;
}
[data-theme="dark"] select {
  background: #1e293b;
  border: 1px solid #475569;
  color: #f1f5f9;
}
[data-theme="dark"] input[type="range"] { accent-color: #3b82f6; }

/* ── Tables ── */
[data-theme="dark"] th, [data-theme="dark"] td { border-color: #334155; }
[data-theme="dark"] th { background: #0f172a; color: #f1f5f9; }

[data-theme="dark"] .standings-table tr.third-elim td {
  color: #fca5a5 !important;
  background-color: rgba(127,29,29,0.35);
}
[data-theme="dark"] .standings-table tr.third-elim td * { color: #fca5a5 !important; }

/* ── Chips & badges ── */
[data-theme="dark"] .prob-chip { background: #0f172a; color: #94a3b8; }

/* ── SEO section ── */
[data-theme="dark"] .seo-copy    { background: rgba(15,23,42,0.85); border-color: #1e293b; }
[data-theme="dark"] .seo-lead    { color: #94a3b8; }
[data-theme="dark"] .seo-p2     { color: #94a3b8; }
[data-theme="dark"] .seo-bullets { color: #94a3b8; }
[data-theme="dark"] .seo-details summary { color: #93c5fd; }
[data-theme="dark"] .seo-links a { color: #93c5fd; }

/* ── Monte Carlo ── */
[data-theme="dark"] .mc-table               { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .mc-table td            { border-bottom-color: #334155; }
[data-theme="dark"] #mc-bars .mc-row        { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] #mc-bars .mc-row:hover  { background: rgba(255,255,255,0.04); }
[data-theme="dark"] #mc-bars .mc-bar        { background: rgba(255,255,255,0.1); }
[data-theme="dark"] #mc-bars .mc-fill       { background: rgba(255,255,255,0.75); }
[data-theme="dark"] #mc-bars .mc-row:hover .mc-fill { background: #f1f5f9; }
[data-theme="dark"] #mc-bars .mc-badge      { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); }

/* ── Methodology link ── */
[data-theme="dark"] .methodology-link       { background: #1e293b; border-color: #475569; color: #f1f5f9; }
[data-theme="dark"] .methodology-link:hover { border-color: #64748b; }

/* ── Final 4 ── */
[data-theme="dark"] .final4-team              { background: #0f172a; color: #f1f5f9; }
[data-theme="dark"] .final4-team:nth-child(even) { background: #1e293b; }
[data-theme="dark"] #final4 .final4-team      { background: rgba(255,255,255,0.04); }
[data-theme="dark"] #final4 .final4-team.alt  { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .final4-card              { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .final4-row               { background: rgba(255,255,255,0.05); }

/* ── Tiebreaker badges ── */
[data-theme="dark"] .tb-gd    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .tb-gf    { background: #14532d; color: #86efac; }
[data-theme="dark"] .tb-alpha { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .tb-legend { color: #64748b; }
[data-theme="dark"] .standings-cut-top td { border-top-color: #475569; }

/* ── Strength editor ── */
[data-theme="dark"] .se-overlay           { background: rgba(0,0,0,0.72); }
[data-theme="dark"] .se-panel             { background: #1e293b; color: #f1f5f9; }
[data-theme="dark"] .se-header            { border-bottom-color: #334155; }
[data-theme="dark"] .se-header h2         { color: #f1f5f9; }
[data-theme="dark"] .se-note              { color: #94a3b8; }
[data-theme="dark"] .se-group-title       { color: #94a3b8; border-top-color: #334155; }
[data-theme="dark"] .se-team-name         { color: #f1f5f9; }
[data-theme="dark"] .se-modified .se-team-name { color: #93c5fd; }
[data-theme="dark"] .se-val               { color: #f1f5f9; }
[data-theme="dark"] .se-base              { color: #475569; }
[data-theme="dark"] .se-reset-one         { background: #0f172a; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .se-btn-reset-all     { background: #451a03; border-color: #92400e; color: #fcd34d; }
[data-theme="dark"] .se-btn-close         { background: #334155; border-color: #475569; color: #f1f5f9; }
[data-theme="dark"] .se-footer            { border-top-color: #334155; }
