/* OEC Playoffs: public bracket (.oecp) and staff editor (.oecp-admin).
   Everything is scoped, and fonts are inherited from the host page.
   Re-colour by overriding the variables below on .oecp / .oecp-admin. */

.oecp, .oecp-admin {
  --oecp-card: #14161c;
  --oecp-card-2: #1b1e26;
  --oecp-line: #2c313c;
  --oecp-text: #f2f4f8;
  --oecp-muted: #8b93a3;
  --oecp-accent: #8b5cf6;
  --oecp-win: #34d399;
  --oecp-live: #ef4444;
  --oecp-danger: #f87171;
  color: var(--oecp-text);
  font: inherit;
  box-sizing: border-box;
}
.oecp *, .oecp-admin * { box-sizing: border-box; }

/* ── Public bracket ── */
.oecp-bracket { margin: 0 0 32px; }
.oecp-btitle {
  margin: 0 0 12px; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--oecp-accent);
}
.oecp-rounds {
  position: relative; display: flex; gap: 44px; overflow-x: auto; padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch;
}
.oecp-lines { position: absolute; top: 0; left: 0; pointer-events: none; }
.oecp-lines path { fill: none; stroke: var(--oecp-line); stroke-width: 2; }
.oecp-round { display: flex; flex-direction: column; flex: 0 0 250px; min-width: 0; }
.oecp-rtitle {
  margin: 0 0 10px; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--oecp-muted); font-weight: 600;
}
.oecp-col { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }

.oecp-match {
  position: relative; background: var(--oecp-card); border: 1px solid var(--oecp-line);
  border-radius: 10px; overflow: hidden;
}
.oecp-match.is-live { border-color: var(--oecp-live); }
.oecp-match header {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--oecp-card-2); font-size: 0.7rem; color: var(--oecp-muted);
}
.oecp-mlabel { font-weight: 700; color: var(--oecp-text); letter-spacing: 0.04em; white-space: nowrap; }
.oecp-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oecp-badge {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; background: var(--oecp-line); color: var(--oecp-text);
}
.oecp-badge--live { background: var(--oecp-live); color: #fff; }

.oecp-team {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 44px;
  border-top: 1px solid var(--oecp-line);
}
.oecp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.oecp-score { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 1.2em; text-align: right; color: var(--oecp-muted); }
.oecp-team.is-winner { background: color-mix(in srgb, var(--oecp-win) 10%, transparent); }
.oecp-team.is-winner .oecp-score { color: var(--oecp-win); }
.oecp-team.is-loser .oecp-name, .oecp-team.is-loser .oecp-logo { opacity: 0.45; }
.oecp-team.is-tbd .oecp-name { color: var(--oecp-muted); font-weight: 400; font-style: italic; font-size: 0.85em; }

.oecp-logo {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 6px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--oecp-card-2); font-size: 0.65rem; font-weight: 700; color: var(--oecp-muted);
}
.oecp-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.oecp-logo--empty { border: 1px dashed var(--oecp-line); background: transparent; }

.oecp-match footer { border-top: 1px solid var(--oecp-line); padding: 6px 10px; font-size: 0.75rem; }
.oecp-match footer a { color: var(--oecp-accent); text-decoration: none; font-weight: 600; }
.oecp-match footer a:hover { text-decoration: underline; }

.oecp-champion {
  display: inline-flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 12px;
  border: 1px solid var(--oecp-win); background: color-mix(in srgb, var(--oecp-win) 10%, var(--oecp-card));
}
.oecp-champion .oecp-logo { flex-basis: 44px; width: 44px; height: 44px; font-size: 0.9rem; }
.oecp-champion-k { display: block; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--oecp-win); }
.oecp-champion-n { display: block; font-size: 1.25rem; font-weight: 800; }
.oecp-empty { color: var(--oecp-muted); }

@media (max-width: 640px) {
  .oecp-rounds { gap: 28px; }
  .oecp-round { flex-basis: 220px; }
}

/* ── Staff editor ── */
.oecp-admin { display: block; }
.oecp-abar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.oecp-spacer { flex: 1; }
.oecp-save { font-size: 0.85rem; color: var(--oecp-muted); }
.oecp-save.is-ok { color: var(--oecp-win); }
.oecp-save.is-err { color: var(--oecp-danger); font-weight: 600; }
.oecp-warn {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; font-size: 0.9rem;
  border: 1px solid #b45309; background: rgba(180, 83, 9, 0.15); color: #fcd34d;
}
.oecp-hint { color: var(--oecp-muted); font-size: 0.9rem; margin: 0 0 12px; }

.oecp-asec { margin: 0 0 28px; }
.oecp-ahead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.oecp-ahead h3 { margin: 0; font-size: 1rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--oecp-accent); }
.oecp-ahead h4 { margin: 0; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--oecp-muted); }
.oecp-around { margin: 0 0 18px; }

.oecp-trow, .oecp-amatch {
  background: var(--oecp-card); border: 1px solid var(--oecp-line); border-radius: 10px;
  padding: 12px; margin: 0 0 10px;
}
.oecp-trow, .oecp-arow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.oecp-arow + .oecp-arow { margin-top: 10px; }
.oecp-aname { align-self: center; min-width: 84px; font-size: 0.95rem; }
.oecp-trow .oecp-logo { align-self: center; flex-basis: 36px; width: 36px; height: 36px; }

.oecp-admin label {
  display: flex; flex-direction: column; gap: 4px; font-size: 0.7rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--oecp-muted); min-width: 0;
}
.oecp-admin label.oecp-grow, .oecp-admin label.oecp-slot { flex: 1 1 220px; }
.oecp-admin label.oecp-sc { flex: 0 0 76px; }
.oecp-now { text-transform: none; letter-spacing: 0; font-size: 0.75rem; color: var(--oecp-win); }

.oecp-admin input, .oecp-admin select {
  font: inherit; font-size: 0.9rem; text-transform: none; letter-spacing: 0;
  color: var(--oecp-text); background: var(--oecp-card-2); border: 1px solid var(--oecp-line);
  border-radius: 6px; padding: 8px 10px; min-height: 38px; width: 100%; min-width: 0;
  color-scheme: dark;
}
.oecp-admin input[type="number"] { width: 76px; }
.oecp-admin input:focus-visible, .oecp-admin select:focus-visible, .oecp-btn:focus-visible {
  outline: 2px solid var(--oecp-accent); outline-offset: 1px;
}

.oecp-btn {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--oecp-text); background: var(--oecp-card-2); border: 1px solid var(--oecp-line);
  border-radius: 6px; padding: 8px 12px; min-height: 38px;
}
.oecp-btn:hover { border-color: var(--oecp-muted); }
.oecp-btn--primary { background: var(--oecp-accent); border-color: var(--oecp-accent); color: #fff; }
.oecp-btn--primary:hover { filter: brightness(1.1); border-color: var(--oecp-accent); }
.oecp-btn--danger { color: var(--oecp-danger); margin-left: auto; }
.oecp-btn--danger:hover { border-color: var(--oecp-danger); }
.oecp-preview { padding: 16px; border: 1px dashed var(--oecp-line); border-radius: 10px; }

/* ── Team logo uploads (staff editor) ── */
.oecp-tlogo { position: relative; align-self: center; flex: 0 0 44px; width: 44px; height: 44px; }
.oecp-tlogo .oecp-logo { width: 44px; height: 44px; flex-basis: 44px; transition: opacity .25s ease; }
.oecp-trow.is-uploading .oecp-tlogo .oecp-logo { opacity: .55; }
.oecp-spinner {
  position: absolute; inset: 8px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18); border-top-color: var(--oecp-accent);
  animation: oecpSpin .8s linear infinite;
}
@keyframes oecpSpin { to { transform: rotate(360deg); } }
.oecp-logo-tools { display: flex; flex-direction: column; gap: 5px; flex: 0 1 auto; min-width: 180px; }
.oecp-logo-k { font-size: 0.7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--oecp-muted); }
.oecp-logo-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.oecp-admin label.oecp-upload { position: relative; display: inline-flex; flex-direction: row; gap: 0; min-width: 0; flex: 0 0 auto; align-items: center; cursor: pointer; overflow: hidden; font-size: 0.8rem; font-weight: 600; color: #fff; letter-spacing: 0; text-transform: none; }
.oecp-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; font-size: 0; }
.oecp-upload.is-disabled { opacity: .55; pointer-events: none; }
.oecp-logo-note { font-size: 0.7rem; color: var(--oecp-muted); max-width: 260px; line-height: 1.35; }
.oecp-logo-note.is-ok { color: var(--oecp-win); }
.oecp-logo-note.is-err { color: var(--oecp-danger); }
.oecp-trow { transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease; }
.oecp-trow.is-dragover { border-color: var(--oecp-accent); background: rgba(139, 92, 246, .1); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.oecp-logo img { animation: oecpLogoIn .3s ease both; }
@keyframes oecpLogoIn { from { opacity: 0; transform: scale(.92); } }
@media (prefers-reduced-motion: reduce) { .oecp-spinner, .oecp-logo img { animation: none; } }
