/* ============================================================
   World Cup 2026 — Best Badge  ·  styles
   ============================================================ */

:root {
  --bg-0:   #07120c;
  --bg-1:   #0c1d13;
  --bg-2:   #123322;
  --panel:  rgba(180, 230, 195, 0.045);
  --panel-2:rgba(180, 230, 195, 0.085);
  --line:   rgba(130, 205, 160, 0.16);
  --card:   rgba(8, 22, 14, 0.74);
  --ink:    #eef6ef;
  --ink-dim:#9bb8a6;
  --gold:   #ffcf45;
  --green:  #16d986;
  --red:    #ff5a6e;
  --accent: #36b465;
  --accent-2: #6fe6a4;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    /* warm stadium-light glow */
    radial-gradient(1100px 560px at 50% -8%, rgba(90, 210, 140, 0.14), transparent 60%),
    /* faint pitch centre-circle hint */
    radial-gradient(520px 520px at 50% 42%, rgba(120, 230, 165, 0.05), transparent 62%),
    /* mown grass stripes */
    repeating-linear-gradient(102deg,
      rgba(255, 255, 255, 0.022) 0 70px,
      rgba(0, 0, 0, 0.06) 70px 140px),
    /* deep grass base */
    linear-gradient(168deg, #0a1810 0%, #0e2316 55%, #071009 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout shell ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; }

header.app-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 2px 18px;
}
.crest-trophy {
  font-size: 40px;
  filter: drop-shadow(0 4px 10px rgba(255, 204, 51, 0.4));
}
.titles h1 {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 34px);
  letter-spacing: 0.5px;
  font-weight: 800;
  background: linear-gradient(90deg, #fff, var(--gold) 60%, #ff9e3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.titles p { margin: 2px 0 0; color: var(--ink-dim); font-size: 13.5px; }
.spacer { flex: 1; }
.btn-reset {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
}
.btn-reset:hover { color: var(--red); border-color: var(--red); }

/* ---------- stepper ---------- */
.stepper {
  display: flex;
  gap: 8px;
  background: var(--card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.step {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: 0.18s;
  border: none;
  background: transparent;
}
.step .num {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--panel-2);
  margin-right: 7px;
  font-size: 12px;
}
.step.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #052914; box-shadow: var(--shadow); }
.step.active .num { background: rgba(255,255,255,0.25); }
.step.done { color: var(--green); }
.step.locked { opacity: 0.45; cursor: not-allowed; }

/* ---------- generic panel + section intro ---------- */
.view { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }
.view.hidden { display: none; }

.intro { margin-bottom: 18px; }
.intro h2 { margin: 0 0 4px; font-size: 21px; }
.intro p { margin: 0; color: var(--ink-dim); font-size: 14px; max-width: 760px; line-height: 1.5; }

.action-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 26px;
}
.btn {
  border: none;
  background: linear-gradient(90deg, var(--green), #2fe39a);
  color: #03291b;
  font-weight: 800;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s, filter 0.12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
.hint { color: var(--ink-dim); font-size: 13px; }
.hint b { color: var(--gold); }

/* ============================================================
   CREST  (badge with home-kit background)
   ============================================================ */
/* A crest = the nation's real federation badge on a tile coloured like their home kit.
   The badge sits on a light inner plate so it never clashes with the kit colour,
   which stays visible as the surrounding frame. */
.crest-wrap { flex: 0 0 auto; display: inline-block; line-height: 0; }
.crest {
  width: var(--sz, 54px);
  height: var(--sz, 54px);
  background: var(--pri);
  border-radius: 24%;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.12),
              0 2px 7px rgba(0, 0, 0, 0.4);
}
.crest::before {
  content: "";
  position: absolute;
  inset: 11%;
  background: radial-gradient(circle at 50% 38%, #ffffff, #eef1f6);
  border-radius: 18%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.crest-img {
  width: 64%;
  height: 64%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}
.crest-wrap.zoomable { cursor: zoom-in; transition: transform 0.12s; }
.crest-wrap.zoomable:hover { transform: scale(1.06); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(5, 8, 16, 0.82);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.18s;
  z-index: 50;
}
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox-card {
  text-align: center;
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.lightbox .lb-name { font-size: 24px; font-weight: 800; margin-top: 18px; }
.lightbox .lb-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }

/* ============================================================
   GROUP STAGE
   ============================================================ */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.group-card {
  background: var(--card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.group-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-card h3 .gletter {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #052914;
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800;
}
.group-card .sub { font-size: 11.5px; color: var(--ink-dim); margin: 0 0 12px; }
.touched-pill {
  margin-left: auto;
  font-size: 11px;
  color: var(--green);
}

.team-list { display: flex; flex-direction: column; gap: 8px; }
.team-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: grab;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.team-row:active { cursor: grabbing; }
.team-row.dragging { opacity: 0.5; border-style: dashed; }
.team-row.qualify { border-color: rgba(0,210,122,0.55); background: rgba(0,210,122,0.08); }
.team-row.playoff { border-color: rgba(255,204,51,0.5); background: rgba(255,204,51,0.07); }
.team-row.out { opacity: 0.65; }

.rank {
  width: 22px; text-align: center;
  font-weight: 800; font-size: 15px; color: var(--ink-dim);
}
.team-row.qualify .rank { color: var(--green); }
.team-row.playoff .rank { color: var(--gold); }
.tname { font-weight: 600; font-size: 14px; flex: 1; }
.tstatus { font-size: 10.5px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.4px; }
.team-row.qualify .tstatus { color: var(--green); }
.team-row.playoff .tstatus { color: var(--gold); }

.movers { display: flex; flex-direction: column; gap: 2px; }
.mover {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-dim); width: 22px; height: 18px;
  border-radius: 5px; cursor: pointer; font-size: 10px; line-height: 1;
  display: grid; place-items: center; padding: 0;
}
.mover:hover { color: var(--ink); border-color: var(--accent); }
.mover:disabled { opacity: 0.25; cursor: default; }

/* ============================================================
   BEST THIRDS
   ============================================================ */
.thirds-list {
  display: flex; flex-direction: column; gap: 8px;
  max-width: 640px;
}
.third-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: grab; user-select: none;
}
.third-row.dragging { opacity: 0.5; border-style: dashed; }
.third-row.in { border-color: rgba(0,210,122,0.55); background: rgba(0,210,122,0.08); }
.third-row.outline { opacity: 0.6; }
.third-row .seed { width: 26px; font-weight: 800; text-align: center; color: var(--ink-dim); }
.third-row.in .seed { color: var(--green); }
.third-row .meta { flex: 1; }
.third-row .meta .nm { font-weight: 600; font-size: 14px; }
.third-row .meta .gp { font-size: 11.5px; color: var(--ink-dim); }
.third-row .tag { font-size: 11px; font-weight: 700; }
.third-row.in .tag { color: var(--green); }
.third-row.outline .tag { color: var(--red); }
.cutline {
  display: flex; align-items: center; gap: 10px;
  color: var(--gold); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 4px 0; max-width: 640px;
}
.cutline::before, .cutline::after {
  content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ============================================================
   KNOCKOUT BRACKET
   ============================================================ */
.bracket-scroll { overflow-x: auto; padding-bottom: 16px; }
.bracket {
  display: flex;
  gap: 26px;
  min-width: max-content;
  align-items: stretch;
  position: relative;
}
/* connector lines layer (behind the cards) */
.bracket-lines { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; overflow: visible; }
.bracket-lines .bline { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 2; }
.bracket-lines .bline.done { stroke: rgba(0, 210, 122, 0.65); stroke-width: 2.5; }
.bracket-col { display: flex; flex-direction: column; min-width: 234px; position: relative; z-index: 1; }
.col-head {
  font-size: 12px; font-weight: 800; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--gold);
  text-align: center; margin-bottom: 12px;
}
.col-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 14px;
}

.match {
  background: var(--card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px;
  box-shadow: var(--shadow);
}
.match .mhead {
  display: flex; justify-content: space-between;
  font-size: 9.5px; color: var(--ink-dim);
  padding: 0 4px 5px; letter-spacing: 0.3px;
}
.side {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 7px;
  border-radius: 7px;
  transition: background 0.12s;
}
.side + .side { margin-top: 3px; }
.side.empty { color: var(--ink-dim); }
.side.winner { background: rgba(0,210,122,0.14); box-shadow: inset 0 0 0 1px rgba(0,210,122,0.5); }
.side.eliminated { opacity: 0.45; }
.side .sname { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .placeholder { font-size: 11.5px; color: var(--ink-dim); font-style: italic; flex: 1; }

/* winner-select checkbox */
.pick-btn {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 7px;
  border: 2px solid var(--line);
  background: transparent;
  color: transparent;
  font-size: 13px; font-weight: 800; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: 0.12s;
}
.pick-btn:hover { border-color: var(--green); color: rgba(0,210,122,0.6); }
.side.winner .pick-btn { background: var(--green); border-color: var(--green); color: #03291b; }

/* champion column */
.champ-col { justify-content: center; min-width: 240px; }
.champ-box {
  text-align: center;
  background: linear-gradient(160deg, rgba(255,204,51,0.16), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,204,51,0.4);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
}
.champ-box .cap { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.champ-box .crest-wrap { margin: 12px auto; }
.champ-box .cname { font-size: 18px; font-weight: 800; margin-top: 6px; }
.champ-box .pending { color: var(--ink-dim); font-size: 13px; padding: 14px 0; }

/* ---------- winner / results final screen ---------- */
.podium {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  margin: 10px 0 30px;
}
.podium .slot { text-align: center; }
.podium .slot .crest-wrap { margin: 0 auto 8px; }
.podium .slot .lbl { font-weight: 700; }
.podium .slot .place { font-size: 12px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.champion-hero {
  text-align: center;
  background: radial-gradient(600px 300px at 50% 0%, rgba(255,204,51,0.18), transparent 70%);
  padding: 30px 16px 10px;
}
.champion-hero .crown { font-size: 46px; }
.champion-hero h2 {
  font-size: clamp(26px, 5vw, 44px); margin: 6px 0 0;
  background: linear-gradient(90deg, var(--gold), #fff 60%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.champion-hero .crest-wrap { margin: 18px auto 4px; }
.champion-hero .sub { color: var(--ink-dim); }

.empty-state {
  background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 40px; text-align: center; color: var(--ink-dim);
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #06210f; color: var(--green); border: 1px solid rgba(0,210,122,0.5);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .stepper .step .lbl { display: none; }
  .step { min-width: 0; }
}
