:root {
  --green: #006847;
  --green-dark: #004b34;
  --red: #ce1126;
  --red-dark: #9d0c1c;
  --gold: #c9a227;
  --navy: #12362f;
  --navy-2: #09231d;
  --ink: #12231e;
  --muted: #65746f;
  --line: #d7e3dc;
  --paper: #f4f8f5;
  --white: #ffffff;
  --soft-green: #e6f4ee;
  --soft-blue: #edf6f2;
  --soft-red: #fff0f2;
  --warning: #fff7df;
  --shadow: 0 18px 45px rgba(0, 65, 45, 0.13);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 10%, rgba(206, 17, 38, 0.16), transparent 26%),
    radial-gradient(circle at 88% 18%, rgba(0, 104, 71, 0.2), transparent 28%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.32) 49.8%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0.32) 50.2%),
    repeating-linear-gradient(0deg, rgba(0, 104, 71, 0.055) 0 2px, transparent 2px 74px),
    linear-gradient(180deg, #eef7f1 0%, #fbfdfb 36%, #f2f7f4 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 92px auto auto 50%;
  z-index: -1;
  width: min(520px, 80vw);
  aspect-ratio: 1;
  border: 2px solid rgba(0, 104, 71, 0.09);
  border-radius: 50%;
  transform: translateX(-50%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.auth-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(18px, 4vw, 42px);
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(0, 75, 52, 0.96) 0%, rgba(0, 104, 71, 0.9) 42%, rgba(206, 17, 38, 0.82) 100%),
    linear-gradient(90deg, #006847 0 33%, #ffffff 33% 66%, #ce1126 66% 100%);
}

.auth-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
  gap: 24px;
  width: min(980px, 100%);
  padding: clamp(18px, 4vw, 32px);
  color: var(--white);
  background: rgba(9, 35, 29, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  box-shadow: 0 28px 90px rgba(5, 22, 38, 0.34);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.auth-card::after {
  content: "";
  position: absolute;
  right: clamp(18px, 5vw, 56px);
  bottom: clamp(18px, 5vw, 42px);
  width: 150px;
  aspect-ratio: 1;
  border: 12px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.16),
    inset 34px 0 0 rgba(255, 255, 255, 0.05),
    inset -34px 0 0 rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.auth-copy h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.auth-copy p {
  max-width: 600px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
}

.auth-hints {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.auth-hints span {
  width: fit-content;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.auth-form {
  display: grid;
  align-self: center;
  gap: 14px;
  padding: 18px;
  color: var(--ink);
  background: var(--white);
  border-radius: var(--radius);
  border-top: 5px solid var(--red);
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: #b42318;
  font-weight: 800;
}

.guest-mode .layout {
  grid-template-columns: 1fr;
}

.guest-mode .leaderboard {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(16px, 3vw, 34px);
  color: var(--white);
  background:
    linear-gradient(90deg, var(--green) 0 32%, #ffffff 32% 34%, var(--red) 34% 36%, var(--navy-2) 36% 100%);
  box-shadow: 0 10px 28px rgba(0, 65, 45, 0.18);
}

.topbar h1,
.topbar p,
.section-heading h2,
.hero h2,
.leaderboard h2,
.rule-card h3,
.thirds-panel h3 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.layout {
  display: grid;
  grid-template-columns: minmax(250px, 310px) 1fr;
  gap: 22px;
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 22px clamp(12px, 2vw, 26px) 40px;
}

.leaderboard {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.leaderboard::before {
  content: "";
  display: block;
  height: 5px;
  margin: -16px -16px 14px;
  background: linear-gradient(90deg, var(--green), var(--white), var(--red));
  border-radius: var(--radius) var(--radius) 0 0;
}

.workspace {
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 65, 45, 0.08);
}

.tab {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--navy);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--green-dark));
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero,
.section-heading,
.thirds-panel,
.participant-panel,
.summary-panel,
.admin-panel,
.group-card,
.round-column {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(20px, 4vw, 34px);
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 42%, rgba(255,255,255,.18) 0 64px, transparent 66px),
    linear-gradient(90deg, rgba(255,255,255,.14) 49.7%, rgba(255,255,255,.55) 50%, rgba(255,255,255,.14) 50.3%),
    linear-gradient(110deg, rgba(0, 75, 52, 0.98), rgba(0, 104, 71, 0.94) 58%, rgba(206, 17, 38, 0.88));
  color: var(--white);
  border: 0;
}

.hero::after {
  content: "";
  position: absolute;
  right: clamp(20px, 5vw, 70px);
  top: 50%;
  width: clamp(92px, 14vw, 150px);
  aspect-ratio: 1;
  border: 10px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h2 {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  line-height: 1;
}

.hero p {
  max-width: 760px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.rule-card {
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 65, 45, 0.06);
}

.rule-card h3 {
  color: var(--navy);
  font-size: 1.1rem;
}

.rule-card p {
  color: var(--muted);
  line-height: 1.55;
}

.rule-card.accent {
  background: linear-gradient(180deg, #fff 0%, var(--soft-green) 100%);
  border-color: #b8decf;
}

.admin-settings-card {
  margin-bottom: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 14px;
  align-items: end;
}

.settings-input {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

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

.status-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 850;
  font-size: 0.82rem;
}

.status-pill.open {
  color: var(--green-dark);
  background: var(--soft-green);
}

.status-pill.closed {
  color: var(--red-dark);
  background: #ffe8eb;
}

.rule-note {
  margin-top: 12px;
  color: var(--green-dark);
  font-weight: 850;
}

.tutorial-card {
  position: relative;
  min-height: 150px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--red));
  border-radius: 50%;
  font-weight: 950;
}

.plain-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.score-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.score-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.base-prize {
  margin-top: 16px;
  color: var(--green-dark);
  font-weight: 900;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 18px;
}

.section-heading h2 {
  color: var(--navy);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

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

.primary-button,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 850;
}

.primary-button {
  border: 1px solid var(--green);
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 8px 18px rgba(0, 104, 71, 0.2);
}

.primary-button:hover {
  background: var(--green-dark);
}

.whatsapp-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  text-decoration: none;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--navy);
  background: var(--white);
}

.ghost-button:hover {
  border-color: rgba(206, 17, 38, 0.35);
  color: var(--red-dark);
}

.full {
  width: 100%;
}

.participant-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  justify-content: flex-end;
}

.session-name {
  text-align: right;
}

.session-name strong {
  display: block;
}

.session-name span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.85rem;
}

.group-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.group-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--navy);
  background: var(--white);
  font-weight: 900;
}

.group-button.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--red));
  border-color: transparent;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}

.metric {
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-left: 4px solid var(--green);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.metric strong {
  color: var(--navy);
  font-size: 1.1rem;
}

.group-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.group-card {
  padding: 16px;
}

.group-card h3 {
  margin: 0 0 12px;
  color: var(--navy);
}

.match-list {
  display: grid;
  gap: 10px;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 58px 20px 58px minmax(90px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #fff, var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.match-row .team.home {
  text-align: right;
}

.match-row .versus {
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.score-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  font-weight: 900;
  background: var(--white);
}

.standings-table,
.participant-table table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table th,
.standings-table td,
.participant-table th,
.participant-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.standings-table th,
.participant-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper);
  font-weight: 900;
}

.rank-pill.pass {
  color: var(--green-dark);
  background: var(--soft-green);
}

.rank-pill.third {
  color: var(--navy);
  background: var(--soft-blue);
}

.rank-pill.pass {
  border: 1px solid #a9d9bf;
}

.rank-pill.third {
  border: 1px solid #d7c690;
}

.soft-note {
  color: var(--muted);
  font-weight: 750;
}

.thirds-panel {
  margin-bottom: 14px;
  padding: 16px;
}

.side-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.thirds-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.third-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.third-card.qualifies {
  background: var(--soft-green);
  border-color: #b8e6cc;
}

.third-card strong,
.third-card span {
  display: block;
}

.third-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.bracket {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.round-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.round-tab {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 10px;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}

.round-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.round-tab strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.round-tab.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--red));
  border-color: transparent;
}

.round-tab.active strong {
  color: rgba(255, 255, 255, 0.78);
}

.round-focus {
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.round-focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.round-focus-header h3 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.round-focus-header > span {
  padding: 8px 10px;
  color: var(--green-dark);
  background: var(--soft-green);
  border-radius: 999px;
  font-weight: 900;
}

.round-path {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 4px;
}

.round-path span {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.round-path span.current {
  color: var(--white);
  background: var(--red);
  border-color: var(--red);
}

.round-match-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
}

.round-match-grid.compact-round {
  grid-template-columns: repeat(2, minmax(280px, 420px));
  justify-content: center;
}

.round-column {
  padding: 14px;
}

.round-column h3 {
  margin: 0 0 12px;
  color: var(--navy);
}

.knockout-match {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  background:
    linear-gradient(90deg, rgba(0, 104, 71, 0.08), transparent 34%, transparent 66%, rgba(206, 17, 38, 0.08)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.match-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.ko-team-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 8px;
}

.ko-team {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.advance-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.advance-row.selected {
  background: var(--soft-green);
  border-color: #a8dfbf;
  box-shadow: inset 4px 0 0 var(--green);
}

.advance-row.selected .ghost-button {
  color: var(--white);
  background: var(--green);
  border-color: var(--green);
}

.penalty-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 850;
}

.penalty-toggle input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.ko-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.penalty-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.penalty-row > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.penalty-score-row {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 48px 12px 48px minmax(70px, 1fr);
  gap: 6px;
  align-items: center;
}

.penalty-score-row span:nth-child(1),
.penalty-score-row span:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 850;
}

.penalty-score-row span:nth-child(3) {
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.winner-note {
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.ranking-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ranking-list strong {
  display: block;
}

.ranking-list span {
  color: var(--muted);
  font-size: 0.84rem;
}

.participant-panel {
  padding: 16px;
}

.table-note {
  margin-bottom: 14px;
  padding: 12px;
  color: var(--navy);
  background: linear-gradient(90deg, var(--soft-green), #fff, var(--soft-red));
  border: 1px solid #c9ddf3;
  border-radius: var(--radius);
  font-weight: 750;
}

.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.locked-label {
  display: inline-flex;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.participant-form {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 150px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-weight: 850;
}

input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--white);
  color: var(--ink);
}

select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--white);
  color: var(--ink);
}

.summary-selector {
  min-width: min(320px, 100%);
}

.summary-panel {
  padding: 16px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  color: var(--white);
  background: linear-gradient(110deg, var(--green-dark), var(--green), var(--red));
  border-radius: var(--radius);
}

.summary-header h3,
.summary-header p {
  margin: 0;
}

.summary-score {
  min-width: 130px;
  padding: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}

.summary-score span {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  opacity: 0.82;
}

.summary-score strong {
  display: block;
  font-size: 2rem;
}

.summary-sheet {
  display: grid;
  gap: 18px;
  padding: 14px;
  background:
    linear-gradient(90deg, transparent 0 24px, rgba(18, 59, 99, 0.04) 24px 25px, transparent 25px),
    var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
}

.summary-group-card,
.summary-round {
  border: 2px solid var(--green);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.summary-group-card h4,
.summary-round h4 {
  margin: 0;
  padding: 7px 10px;
  color: var(--green-dark);
  background: linear-gradient(90deg, var(--soft-green), #fff);
  border-bottom: 2px solid var(--green);
  font-size: 1rem;
}

.summary-match {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 34px 34px minmax(90px, 1fr);
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  min-height: 34px;
}

.summary-match span:first-child {
  text-align: left;
}

.summary-match span:last-child {
  text-align: right;
}

.summary-match strong,
.summary-ko-match strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 2px solid var(--green);
  color: var(--navy);
  background: #fff;
}

.summary-bracket {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.summary-ko-match {
  display: grid;
  grid-template-columns: minmax(95px, 1fr) 34px 34px minmax(95px, 1fr);
  gap: 6px;
  align-items: center;
  padding: 7px 8px;
  border-bottom: 1px solid #ffe0d1;
}

.summary-ko-match span:last-of-type {
  text-align: right;
}

.summary-ko-match em {
  grid-column: 1 / -1;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.admin-panel {
  padding: 16px;
}

.admin-locked {
  max-width: 560px;
  padding: 20px;
}

.admin-locked h3,
.admin-locked p {
  margin: 0 0 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.admin-ko {
  margin-top: 14px;
}

.admin-bracket {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 12px;
}

.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--white);
  background: var(--red);
  font-weight: 900;
}

.tooltip:hover::after,
.tooltip:focus::after {
  content: attr(aria-label);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(260px, 80vw);
  padding: 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}

.login-dialog {
  width: min(440px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(15, 44, 73, 0.5);
}

.login-box {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 22px;
}

.login-box h2,
.login-box p {
  margin: 0;
}

.login-box p {
  color: var(--muted);
  line-height: 1.45;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--white);
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 40;
  transform: translateX(-50%) translateY(18px);
  max-width: min(520px, calc(100vw - 24px));
  padding: 12px 16px;
  color: var(--white);
  background: linear-gradient(135deg, var(--green-dark), var(--red-dark));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1120px) {
  .auth-card {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .leaderboard {
    position: static;
  }

  .status-strip,
  .thirds-list,
  .summary-groups,
  .round-tabs,
  .round-match-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .round-match-grid.compact-round {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .summary-bracket,
  .admin-bracket {
    grid-template-columns: repeat(2, minmax(290px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar,
  .hero,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .session-card,
  .inline-actions {
    justify-content: flex-start;
  }

  .rules-grid,
  .group-grid,
  .bracket,
  .participant-form,
  .status-strip,
  .thirds-list,
  .summary-groups,
  .summary-bracket,
  .admin-grid,
  .admin-bracket,
  .round-tabs,
  .round-match-grid,
  .round-match-grid.compact-round {
    grid-template-columns: 1fr;
  }

  .round-focus-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-header {
    align-items: stretch;
    flex-direction: column;
  }

  .match-row {
    grid-template-columns: 1fr 52px 16px 52px 1fr;
  }
}
