:root {
  color: #152532;
  background: #edf2f4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #152532;
  --muted: #5e6d78;
  --paper: #fff;
  --line: #c9d4da;
  --brand: #0b5c5a;
  --brand-dark: #073f3e;
  --blue: #173f73;
  --gold: #bd7d00;
  --danger: #9b2929;
  --shadow: 0 0.6rem 1.8rem rgb(21 37 50 / 7%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button,
select {
  font: inherit;
}

.site-header,
.quick-nav,
.page-shell,
.site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.5rem, 4vw, 3.5rem) 0 1.2rem;
}

.brand-block {
  min-width: 0;
}

.brand-logo {
  display: block;
  margin-bottom: 0.75rem;
  object-fit: contain;
  object-position: left center;
}

#event-id:empty,
#updated-at:empty {
  display: none;
}

.site-header h1,
.section-heading h2 {
  margin: 0;
  color: #102a43;
}

.site-header h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.section-heading h2 {
  font-size: clamp(1.15rem, 2vw, 1.65rem);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.header-meta {
  display: grid;
  justify-items: end;
  gap: 0.45rem;
  text-align: right;
}

.status {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.status--live {
  color: #fff;
  border-color: #17613b;
  background: #18864c;
}

.status--stale {
  color: #604600;
  border-color: #d2a43c;
  background: #fff3c9;
}

.status--offline,
.status--error {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.status--loading {
  color: #244456;
  background: #dfe9ee;
}

.status--neutral {
  color: var(--brand-dark);
  background: #e4f4eb;
}

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-bottom: 1rem;
}

.quick-nav a {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-dark);
  background: rgb(255 255 255 / 65%);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
}

.quick-nav a:hover,
.quick-nav a:focus-visible {
  border-color: var(--brand);
  background: #e4f4eb;
}

.page-shell {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 2rem;
}

.page-shell > section,
.panel,
.queue-panel,
.match-layout > div {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.page-shell > section:not(.match-layout),
.panel,
.queue-panel,
.match-layout > div {
  padding: 1rem;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-left: 0.35rem solid var(--brand);
  color: #244456;
  background: #f2f9f8;
}

.notice h2,
.notice p {
  margin: 0;
}

.notice p:not(.eyebrow) {
  margin-top: 0.35rem;
}

.read-only-badge {
  flex: 0 0 auto;
  padding: 0.35rem 0.5rem;
  border: 1px solid #8abdb5;
  border-radius: 0.35rem;
  color: var(--brand-dark);
  background: #e4f4eb;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.section-description {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.filter-control {
  display: grid;
  gap: 0.25rem;
  min-width: 10rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.filter-control select {
  min-height: 2.25rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--ink);
  background: #fff;
}

.filter-control select:focus-visible,
.secondary-button:focus-visible,
.quick-nav a:focus-visible,
.tournament-card a:focus-visible,
.stream-card a:focus-visible {
  outline: 3px solid #e2ae40;
  outline-offset: 2px;
}

.tournament-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
}

.catalog-retry {
  margin-top: 0.75rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--brand);
  border-radius: 0.45rem;
  color: var(--brand-dark);
  background: var(--paper);
  font-weight: 750;
  cursor: pointer;
}

.tournament-card {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #f7fafb;
}

.tournament-card__heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.65rem;
}

.tournament-card h3 {
  margin: 0;
  color: #102a43;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.tournament-card time {
  font-size: 0.9rem;
}

.tournament-card__status {
  flex: 0 0 auto;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  color: #17613b;
  background: #e4f4eb;
  font-size: 0.65rem;
  font-weight: 900;
}

.tournament-card__status--stale {
  color: #604600;
  background: #fff3c9;
}

.tournament-card__status--offline {
  color: #fff;
  background: var(--danger);
}

.tournament-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.2rem;
}

.tournament-card__actions a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--brand);
  border-radius: 0.45rem;
  color: var(--brand-dark);
  background: var(--paper);
  font-size: 0.875rem;
  font-weight: 750;
  text-decoration: none;
}

.tournament-card__actions a:first-child {
  color: var(--paper);
  background: var(--brand);
}

.tournament-card__actions a:hover,
.catalog-retry:hover {
  text-decoration: underline;
}

.site-link {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.registration-shell {
  display: grid;
  gap: 1.25rem;
  width: min(820px, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 2rem;
}

.registration-card {
  padding: clamp(1rem, 4vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.registration-form {
  display: grid;
  gap: 0.9rem;
}

.registration-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.registration-form__row--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.registration-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.registration-form input,
.registration-form select {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid #9bb5ba;
  border-radius: 0.55rem;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.registration-form input:focus-visible,
.registration-form select:focus-visible,
.registration-form button:focus-visible {
  outline: 3px solid #e2ae40;
  outline-offset: 2px;
}

.registration-form .registration-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.registration-consent input {
  flex: 0 0 auto;
  width: 1.15rem;
  min-height: 1.15rem;
  margin-top: 0.1rem;
}

.registration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding-top: 0.3rem;
}

.registration-actions button {
  min-height: 2.7rem;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 0.55rem;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.registration-actions button:hover:not(:disabled) {
  background: var(--brand-dark);
}

.registration-actions button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.registration-actions .secondary-button {
  border: 1px solid #6e9293;
  color: var(--brand-dark);
  background: #edf8f4;
}

.registration-actions .secondary-button:hover:not(:disabled) {
  color: #fff;
  background: var(--brand-dark);
}

.payment-summary {
  margin-top: 1rem;
  padding: 0.8rem;
  border: 1px solid #a8d5c4;
  border-radius: 0.6rem;
  color: var(--brand-dark);
  background: #edf8f4;
}

.tatami-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.7rem;
}

.tatami-card {
  display: grid;
  gap: 0.4rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #f7fafb;
}

.tatami-card__heading,
.stream-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tatami-card strong {
  color: #102a43;
  font-size: 1.1rem;
}

.tatami-card span:not(.tatami-card__state) {
  color: var(--muted);
  font-size: 0.82rem;
}

.tatami-card__state {
  display: inline-flex;
  width: fit-content;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: #17613b;
  background: #e4f4eb;
  font-size: 0.72rem;
  font-weight: 850;
}

.match-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(16rem, 0.75fr);
  gap: 1.25rem;
}

.match-layout > div {
  min-width: 0;
}

.match-grid {
  display: grid;
  gap: 0.75rem;
}

.match-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid #aebec7;
  border-radius: 0.7rem;
  background: linear-gradient(100deg, #f8fafb, #eef4f8);
}

.match-card__side {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.match-card__side--blue {
  text-align: right;
}

.match-card__side strong {
  overflow-wrap: anywhere;
  color: #102a43;
  font-size: clamp(1rem, 2vw, 1.45rem);
}

.match-card__side span:not(.match-card__label) {
  color: var(--muted);
  font-size: 0.8rem;
}

.match-card__label {
  color: var(--brand);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.match-card__score {
  min-width: 4.5rem;
  padding: 0.5rem;
  border-radius: 0.6rem;
  color: #fff;
  background: var(--brand-dark);
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
}

.match-card__meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: center;
}

.queue-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.6rem;
}

.queue-list li {
  position: relative;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #f7fafb;
}

.queue-list strong,
.queue-list span {
  display: block;
}

.queue-list strong {
  color: #102a43;
}

.queue-list span {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.queue-item__number {
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.result-list,
.bracket-list,
.competitor-grid,
.stream-grid {
  display: grid;
  gap: 0.55rem;
}

.result-card,
.bracket-card,
.competitor-card {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #f7fafb;
}

.competitor-grid {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.competitor-card {
  display: grid;
  gap: 0.3rem;
}

.competitor-card__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.competitor-card__heading strong:last-child {
  color: #102a43;
}

.competitor-card__record {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.result-card {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.result-card strong {
  color: #102a43;
}

.result-card span {
  color: var(--brand-dark);
  font-weight: 800;
  text-align: right;
}

.bracket-card h3 {
  margin: 0 0 0.5rem;
  color: #102a43;
  font-size: 0.95rem;
}

.bracket-card .bracket-match {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid #e0e7eb;
  color: var(--muted);
  font-size: 0.8rem;
}

.streams-panel {
  scroll-margin-top: 1rem;
}

.stream-summary {
  display: grid;
  justify-items: end;
  gap: 0.25rem;
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 850;
  text-align: right;
}

.stream-summary .muted {
  font-size: 0.72rem;
  font-weight: 500;
}

.stream-grid {
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.stream-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid #aebec7;
  border-radius: 0.65rem;
  background: #0e1c28;
  color: #fff;
}

.stream-card__heading strong {
  color: #fff;
}

.stream-card__state {
  padding: 0.22rem 0.4rem;
  border-radius: 999px;
  font-size: 0.63rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.stream-card__state--connecting {
  color: #ffe6a0;
  background: #5c491f;
}

.stream-card__state--live {
  color: #d8ffe9;
  background: #17613b;
}

.stream-card__state--error {
  color: #ffe0e0;
  background: #7b2020;
}

.stream-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 8rem;
  border-radius: 0.35rem;
  background: #050b10;
  object-fit: contain;
}

.stream-card__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.55rem;
}

.stream-card a {
  color: #a8e7de;
  font-size: 0.78rem;
}

.stream-card .secondary-button {
  padding: 0.35rem 0.55rem;
  border: 1px solid #78909c;
  border-radius: 0.35rem;
  color: #fff;
  background: #263b4a;
  cursor: pointer;
  font-size: 0.75rem;
}

.stream-card .secondary-button:hover {
  background: #345467;
}

.empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed #9eafb9;
  border-radius: 0.55rem;
  color: var(--muted);
  background: #f7fafb;
}

.site-footer {
  padding: 0 0 2rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .registration-form__row,
  .registration-form__row--three {
    grid-template-columns: 1fr;
  }

  .registration-actions {
    display: grid;
  }

  .site-header {
    align-items: start;
    flex-direction: column;
  }

  .header-meta {
    justify-items: start;
    text-align: left;
  }

  .notice,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .filter-control {
    width: 100%;
  }

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

  .match-card {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.45rem;
    padding: 0.7rem;
  }

  .match-card__side strong {
    font-size: 0.95rem;
  }

  .stream-summary {
    justify-items: start;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
    transition: none;
  }
}

#selected-tournament-view {
  min-width: 0;
}

.team-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.team-table-scroll:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.team-results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.team-results-table caption {
  text-align: left;
  padding: 0.75rem 0;
  font-weight: 700;
}
.team-results-table th,
.team-results-table td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.team-results-table small {
  display: block;
  color: var(--muted);
  font-weight: 400;
}
.team-encounter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.8rem;
}
.team-encounter-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  overflow-wrap: anywhere;
}
.team-encounter-card h4 {
  margin: 0 0 0.6rem;
}
#team-results-content h3 {
  margin-top: 1.5rem;
}

[data-live-section][hidden],
#results-nav[hidden] {
  display: none;
}
