:root {
  --ink: #050505;
  --paper: #ffffff;
  --muted: #707070;
  --line: rgba(255, 255, 255, 0.28);
  --violet: #7900ff;
  --blue: #3155ff;
  --green: #36b957;
  --lime: #b4ff00;
  --red: #ff2400;
  --pink: #e51b62;
  --aqua: #33e4d2;
  --orange: #ff7a00;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  font-family: "Arial", "Helvetica", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 95% 15%, rgba(180, 255, 0, 0.85) 0 8rem, transparent 8.2rem),
    linear-gradient(115deg, transparent 0 58%, rgba(49, 85, 255, 0.9) 58% 75%, rgba(54, 185, 87, 0.98) 75%),
    var(--ink);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(440px, 58vh, 650px);
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 3vw, 46px) 36px;
  isolation: isolate;
}

.hero__pattern {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(closest-side at 3% 89%, var(--lime) 0 26%, transparent 27%),
    radial-gradient(closest-side at 10% 72%, #ff947c 0 31%, transparent 32%),
    radial-gradient(closest-side at 15% 56%, var(--red) 0 36%, transparent 37%),
    radial-gradient(closest-side at 19% 43%, var(--violet) 0 42%, transparent 43%),
    radial-gradient(closest-side at 27% 31%, var(--blue) 0 46%, transparent 47%),
    linear-gradient(90deg, rgba(0, 0, 0, 0) 0 41%, var(--ink) 41% 100%);
}

.topbar,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 34px;
  line-height: 1;
}
.brand strong,
.brand small { display: block; }
.brand strong {
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}
.brand small {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.topbar__actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  padding: 11px 16px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.pill-button--light {
  background: var(--paper);
}

.hero__content {
  width: min(760px, 100%);
  margin-top: clamp(70px, 13vh, 150px);
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--lime);
  font-weight: 950;
}
h1 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(76px, 16vw, 196px);
  line-height: 0.78;
  letter-spacing: 0;
}
.hero__content p:last-child {
  max-width: 540px;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 800;
}

main {
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 2.4vw, 38px) 40px;
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: -74px;
  position: relative;
  z-index: 2;
}
.match-panel,
.admin-card {
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: #211d1f;
  color: var(--paper);
  font-weight: 950;
  text-transform: uppercase;
}
.section-heading span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.section-heading small {
  color: rgba(255, 255, 255, 0.68);
  text-align: right;
}
.section-heading--wide {
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 24px;
}

.mini-match-list {
  display: grid;
  gap: 1px;
  background: #d9d9d9;
}
.mini-match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  background: var(--paper);
}
.mini-match__team {
  min-width: 0;
  font-weight: 950;
  text-transform: uppercase;
}
.mini-match__team:last-child .team-name { justify-content: flex-end; }
.mini-match__score {
  min-width: 72px;
  text-align: center;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 30px;
}
.mini-match__meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.status-live {
  color: var(--red);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: 0.55; } to { opacity: 1; } }

.stage-section {
  margin-top: 20px;
}
.bracket-wrap {
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.86) 0 15%, transparent 15%),
    radial-gradient(circle at 96% 94%, var(--lime) 0 18%, transparent 18.2%),
    linear-gradient(180deg, #00513e 0 23%, var(--green) 23% 86%, #416bb7 86% 100%);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.bracket {
  min-width: 1380px;
  display: grid;
  grid-template-columns: 1.25fr 1.08fr 0.95fr 1.35fr 0.95fr 1.08fr 1.25fr;
  gap: 22px;
  align-items: stretch;
  padding: 34px;
}
.round {
  display: grid;
  gap: 16px;
  align-content: center;
  position: relative;
}
.round h3 {
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.round--r16 {
  gap: 42px;
}
.round--qf {
  gap: 112px;
}
.round--center {
  gap: 18px;
  padding: 0 8px;
}
.bracket-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  overflow: hidden;
  min-height: 84px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.bracket-card--final {
  outline: 4px solid rgba(180, 255, 0, 0.88);
  transform: scale(1.02);
}
.bracket-card--third {
  opacity: 0.95;
}
.bracket-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #211d1f;
  color: var(--paper);
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}
.bracket-card__head--violet { background: var(--violet); }
.bracket-card__head--blue { background: var(--blue); }
.bracket-card__head--green { background: #0a8f4b; }
.bracket-card__head--red { background: var(--red); }
.bracket-card__head--aqua { background: #008d85; }
.bracket-card__head--orange { background: var(--orange); color: var(--ink); }
.bracket-card__head--pink { background: var(--pink); }
.bracket-card__head--navy { background: #202982; }
.bracket-card__head--lime { background: var(--lime); color: var(--ink); }
.bracket-card__head--teal { background: #00513e; }
.bracket-card__head--coral { background: #ff947c; color: var(--ink); }
.bracket-card__head--royal { background: #416bb7; }
.bracket-card__body {
  padding: 10px;
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
}
.bracket-team {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.bracket-team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bracket-team small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
}
.bracket-team--placeholder {
  grid-template-columns: auto 1fr;
  color: var(--muted);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 16px;
  background: #201c1e;
  padding: 18px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.group-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}
.group-card h3 {
  margin: 0;
  padding: 10px 14px;
  background: #211d1f;
  color: var(--paper);
  text-align: center;
  text-transform: uppercase;
}
.group-card h3 i {
  margin-right: 7px;
}
.group-card--violet h3 { background: var(--violet); }
.group-card--blue h3 { background: var(--blue); }
.group-card--green h3 { background: #0a8f4b; }
.group-card--red h3 { background: var(--red); }
.group-card--aqua h3 { background: #008d85; }
.group-card--orange h3 { background: var(--orange); color: var(--ink); }
.group-card--pink h3 { background: var(--pink); }
.group-card--navy h3 { background: #202982; }
.group-card--lime h3 { background: var(--lime); color: var(--ink); }
.group-card--teal h3 { background: #00513e; }
.group-card--coral h3 { background: #ff947c; color: var(--ink); }
.group-card--royal h3 { background: #416bb7; }
.standing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.standing-table th,
.standing-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #ececec;
  text-align: center;
}
.standing-table th {
  color: var(--muted);
  font-size: 11px;
}
.standing-table td:first-child,
.standing-table th:first-child {
  text-align: left;
}
.standing-table tbody tr {
  transition: background 0.2s ease;
}
.rank-qualify {
  background: linear-gradient(90deg, rgba(54, 185, 87, 0.18), rgba(255, 255, 255, 0));
}
.rank-qualify td:first-child {
  border-left: 5px solid var(--lime);
}
.rank-third {
  background: linear-gradient(90deg, rgba(255, 122, 0, 0.16), rgba(255, 255, 255, 0));
}
.rank-third td:first-child {
  border-left: 5px solid var(--orange);
}
.rank-out td:first-child {
  border-left: 5px solid transparent;
}
.team-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.team-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flag {
  width: 24px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 3px;
  object-fit: cover;
}
.flag--empty {
  display: inline-block;
  background: #e8e8e8;
}

.app-shell--admin {
  background:
    radial-gradient(circle at 0 0, var(--red) 0 19rem, transparent 19.2rem),
    radial-gradient(circle at 100% 100%, var(--lime) 0 17rem, transparent 17.2rem),
    linear-gradient(140deg, var(--violet), var(--blue) 48%, var(--green));
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 2vw, 28px) 28px;
}
.admin-main {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 18px;
  padding: 24px 0 0;
}
.match-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.match-form label {
  display: grid;
  gap: 6px;
  color: #3b3b3b;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.match-form input,
.match-form select {
  width: 100%;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
}
.admin-table-wrap {
  max-height: calc(100vh - 150px);
  overflow: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #ececec;
  text-align: left;
}
.admin-table tbody tr {
  cursor: pointer;
}
.admin-table tbody tr:hover {
  background: #f3f3f3;
}

.empty {
  padding: 18px;
  background: var(--paper);
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1100px) {
  .group-grid { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
  .admin-main { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell {
    background:
      radial-gradient(circle at 100% 12%, rgba(180, 255, 0, 0.8) 0 5rem, transparent 5.2rem),
      linear-gradient(160deg, var(--violet), var(--blue) 42%, var(--green) 75%, var(--ink));
  }
  .hero {
    min-height: 510px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .hero__pattern {
    background:
      radial-gradient(closest-side at 0 82%, var(--lime) 0 25%, transparent 26%),
      radial-gradient(closest-side at 6% 70%, #ff947c 0 33%, transparent 34%),
      radial-gradient(closest-side at 13% 58%, var(--red) 0 38%, transparent 39%),
      radial-gradient(closest-side at 19% 46%, var(--violet) 0 43%, transparent 44%),
      radial-gradient(closest-side at 24% 34%, var(--blue) 0 48%, transparent 49%),
      linear-gradient(90deg, transparent 0 50%, var(--ink) 50%);
  }
  .topbar,
  .admin-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .brand__mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 28px;
  }
  .topbar__actions {
    max-width: none;
    width: 100%;
    justify-content: flex-start;
  }
  .pill-button {
    padding: 10px 12px;
    font-size: 13px;
  }
  h1 {
    max-width: 100%;
    font-size: clamp(64px, 19vw, 88px);
    overflow-wrap: break-word;
  }
  .hero__content p:last-child {
    max-width: min(100%, 360px);
  }
  .ticker-grid {
    grid-template-columns: 1fr;
    margin-top: -50px;
  }
  .mini-match {
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    padding: 13px 12px;
  }
  .mini-match__team { font-size: 12px; }
  .mini-match__meta {
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .mini-match__score {
    min-width: 56px;
    font-size: 24px;
  }
  .group-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .section-heading small {
    text-align: left;
  }
  .admin-table {
    min-width: 720px;
  }
}
