:root {
  color-scheme: dark;
  --bg: #0c0b09;
  --ink: #ffffff;
  --muted: #d4c6b5;
  --line: #5a4228;
  --panel: #1d1915;
  --panel-strong: #2a2118;
  --accent: #f2b35d;
  --accent-dark: #ffd08a;
  --accent-soft: #3a2615;
  --accent-2: #ffffff;
  --danger: #ff5c65;
  --gold: #f2b35d;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --button-ink: #130d07;
  --hero-bg: #050403;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent), rgba(29, 25, 21, 0.96);
  --table-bg: rgba(29, 25, 21, 0.98);
  --tab-bg: rgba(255, 255, 255, 0.08);
  --stat-bg: rgba(255, 255, 255, 0.075);
  --row-alt: rgba(255, 255, 255, 0.035);
  --round-heading-bg: rgba(255, 255, 255, 0.06);
  --avatar-bg: #3a3027;
  --free-bg: linear-gradient(90deg, rgba(242, 179, 93, 0.2), rgba(255, 255, 255, 0.06));
  --waiting-ink: #ffffff;
  --finished-bg: #1a2b19;
  --finished-ink: #9ee493;
  --notice-line: rgba(242, 179, 93, 0.44);
  --body-glow-primary: rgba(242, 179, 93, 0.2);
  --body-glow-secondary: rgba(255, 255, 255, 0.08);
  --body-glow-tertiary: rgba(242, 179, 93, 0.08);
  --org-logo-bg: #ffffff;
}

:root[data-theme="classic-light"] {
  color-scheme: light;
  --bg: #f5efe4;
  --ink: #17120d;
  --muted: #6f604f;
  --line: #dcc39b;
  --panel: #fffaf2;
  --panel-strong: #f1e5d2;
  --accent: #d88b26;
  --accent-dark: #7a430d;
  --accent-soft: #fff0d6;
  --accent-2: #17120d;
  --danger: #b32632;
  --gold: #a96413;
  --shadow: 0 18px 42px rgba(82, 53, 24, 0.16);
  --button-ink: #ffffff;
  --hero-bg: #120e0a;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent), rgba(255, 250, 242, 0.96);
  --table-bg: rgba(255, 250, 242, 0.98);
  --tab-bg: rgba(255, 255, 255, 0.68);
  --stat-bg: rgba(216, 139, 38, 0.12);
  --row-alt: rgba(216, 139, 38, 0.07);
  --round-heading-bg: rgba(216, 139, 38, 0.1);
  --avatar-bg: #ead8bf;
  --free-bg: linear-gradient(90deg, rgba(216, 139, 38, 0.18), rgba(255, 255, 255, 0.68));
  --waiting-ink: #17120d;
  --finished-bg: #e8f5df;
  --finished-ink: #2f6f28;
  --notice-line: rgba(216, 139, 38, 0.46);
  --body-glow-primary: rgba(242, 179, 93, 0.2);
  --body-glow-secondary: rgba(255, 255, 255, 0.08);
  --body-glow-tertiary: rgba(242, 179, 93, 0.08);
  --org-logo-bg: transparent;
}

:root[data-theme="twisted-light"] {
  color-scheme: light;
  --bg: #eefbf8;
  --ink: #003d34;
  --muted: #4c8077;
  --line: #87bdb3;
  --panel: #ffffff;
  --panel-strong: #c4fcf0;
  --accent: #ff7e22;
  --accent-dark: #b94b00;
  --accent-soft: #fff0e5;
  --accent-2: #005246;
  --danger: #b52c2c;
  --gold: #d85d06;
  --shadow: 0 18px 42px rgba(0, 82, 70, 0.15);
  --button-ink: #2b1300;
  --hero-bg: #003d34;
  --card-bg: linear-gradient(180deg, rgba(196, 252, 240, 0.5), transparent), rgba(255, 255, 255, 0.98);
  --table-bg: rgba(255, 255, 255, 0.98);
  --tab-bg: rgba(196, 252, 240, 0.72);
  --stat-bg: rgba(255, 126, 34, 0.12);
  --row-alt: rgba(196, 252, 240, 0.34);
  --round-heading-bg: #c4fcf0;
  --avatar-bg: #c4fcf0;
  --free-bg: linear-gradient(90deg, rgba(255, 126, 34, 0.16), rgba(196, 252, 240, 0.62));
  --waiting-ink: #005246;
  --finished-bg: #005246;
  --finished-ink: #c4fcf0;
  --notice-line: #4c8077;
  --body-glow-primary: rgba(255, 126, 34, 0.14);
  --body-glow-secondary: rgba(196, 252, 240, 0.76);
  --body-glow-tertiary: rgba(76, 128, 119, 0.12);
  --org-logo-bg: transparent;
}

:root[data-theme="twisted-dark"] {
  color-scheme: dark;
  --bg: #002f28;
  --ink: #f2fffc;
  --muted: #9dd8cc;
  --line: #4c8077;
  --panel: #00473d;
  --panel-strong: #005246;
  --accent: #ff7e22;
  --accent-dark: #ffb37d;
  --accent-soft: #603014;
  --accent-2: #c4fcf0;
  --danger: #ff8c8c;
  --gold: #ff9b55;
  --shadow: 0 18px 42px rgba(0, 20, 17, 0.42);
  --button-ink: #2b1300;
  --hero-bg: #001f1a;
  --card-bg: linear-gradient(180deg, rgba(196, 252, 240, 0.07), transparent), rgba(0, 71, 61, 0.98);
  --table-bg: rgba(0, 71, 61, 0.98);
  --tab-bg: rgba(196, 252, 240, 0.1);
  --stat-bg: rgba(255, 126, 34, 0.14);
  --row-alt: rgba(196, 252, 240, 0.055);
  --round-heading-bg: #005246;
  --avatar-bg: #4c8077;
  --free-bg: linear-gradient(90deg, rgba(255, 126, 34, 0.2), rgba(196, 252, 240, 0.07));
  --waiting-ink: #ffffff;
  --finished-bg: #c4fcf0;
  --finished-ink: #005246;
  --notice-line: #ff7e22;
  --body-glow-primary: rgba(255, 126, 34, 0.18);
  --body-glow-secondary: rgba(196, 252, 240, 0.08);
  --body-glow-tertiary: rgba(76, 128, 119, 0.2);
  --org-logo-bg: #ffffff;
}

:root[data-theme^="twisted-"] .main-menu {
  border-color: #4c8077;
  background: rgba(0, 82, 70, 0.96);
}

:root[data-theme^="twisted-"] .main-menu-item,
:root[data-theme^="twisted-"] .theme-switch,
:root[data-theme^="twisted-"] .main-menu-toggle {
  color: #c4fcf0;
}

:root[data-theme^="twisted-"] .main-menu-item:hover,
:root[data-theme^="twisted-"] .main-menu-item:focus-visible {
  color: #ffffff;
  background: #4c8077;
}

:root[data-theme^="twisted-"] .profile-dropdown {
  border-color: #4c8077;
  background: #005246;
}

:root[data-theme^="twisted-"] .profile-dropdown button {
  border-color: #4c8077;
  color: #c4fcf0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, var(--body-glow-primary), transparent 34%),
    linear-gradient(315deg, var(--body-glow-secondary), transparent 34%),
    linear-gradient(180deg, var(--body-glow-tertiary), transparent 44%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.event-hero {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hero-bg);
  box-shadow: var(--shadow);
}

.event-hero img {
  display: block;
  width: 100%;
  height: clamp(150px, 32vw, 420px);
  object-fit: contain;
}

.main-menu {
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  padding: 5px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.main-menu-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.main-menu-links {
  display: flex;
  gap: 4px;
  min-width: 0;
}

.main-menu-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.install-app-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  padding: 0 12px;
}

.install-app-button[hidden] {
  display: none;
}

.install-icon {
  position: relative;
  width: 16px;
  height: 18px;
  border-bottom: 2px solid currentColor;
}

.install-icon::before {
  content: "↓";
  position: absolute;
  top: -5px;
  left: 2px;
  font-size: 1.15rem;
  line-height: 1;
}

.install-dialog {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 16px;
}

.install-dialog[hidden] {
  display: none;
}

.install-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 58%);
}

.install-dialog-card {
  position: relative;
  display: grid;
  width: min(100%, 440px);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 24px;
}

.install-dialog-icon {
  width: 72px;
  height: 72px;
  border-radius: 8px;
}

.install-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.65rem;
}

.install-dialog-card h2 {
  font-size: 1.45rem;
}

.install-instructions {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.install-dialog-done {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--button-ink);
  font-weight: 900;
}

.install-dialog-open {
  overflow: hidden;
}

.main-menu-toggle {
  display: none;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  padding: 0 12px;
}

.hamburger-icon {
  display: grid;
  gap: 4px;
}

.hamburger-icon i {
  display: block;
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.main-menu-item {
  min-width: 120px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  padding: 0 20px;
}

.main-menu-item:hover,
.main-menu-item:focus-visible {
  color: var(--ink);
  background: var(--tab-bg);
}

.main-menu-item.active {
  background: var(--accent);
  color: var(--button-ink);
}

.app-section {
  display: none;
}

.app-section.active {
  display: block;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 26px;
}

.topbar-tools {
  display: flex;
  align-items: end;
  gap: 12px;
}

.header-leading {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.header-back-button {
  width: fit-content;
}

.header-back-button[hidden] {
  display: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.org-logo {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--org-logo-bg);
  border: 1px solid var(--line);
}

.eyebrow,
.label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.35rem;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  flex: 0 0 auto;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  padding: 0 9px;
  cursor: pointer;
}

.theme-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.theme-switch-track {
  display: flex;
  align-items: center;
  width: 42px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  padding: 2px;
  transition: background 160ms ease;
}

.theme-switch-track span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
  transition: transform 160ms ease;
}

.theme-switch input:checked + .theme-switch-track {
  background: var(--accent-soft);
}

.theme-switch input:checked + .theme-switch-track span {
  transform: translateX(18px);
}

.theme-switch input:focus-visible + .theme-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-menu {
  position: relative;
  flex: 0 0 auto;
}

.profile-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--button-ink);
  font-size: 0.82rem;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  display: grid;
  min-width: 160px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-dropdown button {
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 850;
  padding: 0 14px;
  text-align: left;
}

.profile-dropdown button:last-child {
  border-bottom: 0;
}

.profile-dropdown button:hover,
.profile-dropdown button:focus-visible {
  background: var(--tab-bg);
}

.tournament-form {
  display: grid;
  gap: 7px;
  min-width: min(340px, 100%);
}

.tournament-form label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-filter-menu {
  position: relative;
}

.filter-toggle {
  position: relative;
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
}

.filter-toggle:hover,
.filter-toggle:focus-visible,
.filter-toggle.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.filter-icon {
  position: relative;
  width: 20px;
  height: 18px;
}

.filter-icon::before,
.filter-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 7px currentColor, 0 14px currentColor;
}

.filter-icon::after {
  top: -2px;
  left: 5px;
  width: 4px;
  height: 6px;
  border: 2px solid currentColor;
  background: var(--panel-strong);
  box-shadow: 7px 7px 0 -2px var(--panel-strong), 7px 7px 0 0 currentColor, -3px 14px 0 -2px var(--panel-strong), -3px 14px 0 0 currentColor;
}

.filter-toggle:hover .filter-icon::after,
.filter-toggle:focus-visible .filter-icon::after,
.filter-toggle.active .filter-icon::after {
  background: var(--accent-soft);
}

.filter-count {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  color: var(--button-ink);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.filter-count[hidden],
.filter-panel[hidden] {
  display: none;
}

.filter-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(340px, calc(100vw - 32px));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 16px 40px rgb(0 0 0 / 18%);
  padding: 16px;
}

.filter-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-panel-heading strong {
  font-size: 1rem;
}

.filter-reset {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 850;
  padding: 4px;
}

.filter-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.filter-field select {
  width: 100%;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 12px;
}

textarea {
  min-height: 116px;
  padding: 12px;
  resize: vertical;
}

.input-row input {
  width: 100%;
}

.input-row button,
.ghost-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--button-ink);
  font-weight: 800;
  padding: 0 16px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
}

.cuescore-cta {
  display: inline-grid;
  place-items: center;
  min-width: 112px;
  padding: 5px 14px;
}

.cuescore-logo {
  display: block;
  width: auto;
  height: 30px;
}

.cuescore-logo-light {
  display: none;
}

:root[data-theme$="-light"] .cuescore-logo-light {
  display: block;
}

:root[data-theme$="-light"] .cuescore-logo-dark {
  display: none;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.summary-band > div {
  min-height: 92px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent), var(--panel);
}

.summary-band strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.15rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 26px 0 22px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--tab-bg);
  color: var(--muted);
  font-weight: 800;
  padding: 0 14px;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--button-ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 22px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
}

.section-title.compact {
  align-items: center;
}

.match-stack,
.team-grid,
.match-grid {
  display: grid;
  gap: 12px;
}

.match-card,
.team-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.match-card,
.team-card {
  padding: 14px;
}

.mvp-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: -8px 0 14px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.mvp-summary strong {
  color: var(--text);
  font-size: 1rem;
}

#mvp .search-input {
  width: 100%;
}

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

.mvp-mobile-status {
  padding: 28px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--muted);
  text-align: center;
}

.mvp-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.mvp-card.is-podium {
  border-left: 4px solid var(--accent);
  padding-left: 11px;
}

.mvp-card-heading {
  display: grid;
  grid-template-columns: 26px 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.mvp-card-heading .avatar {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}

.mvp-card-rank {
  color: var(--accent-dark);
  font-size: 1rem;
  font-weight: 950;
  text-align: center;
}

.mvp-card-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mvp-card-player-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 900;
  text-decoration: none;
}

.mvp-card-player-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mvp-card-team .participant-link {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.mvp-card-primary,
.mvp-card-secondary {
  display: grid;
  margin: 0;
}

.mvp-card-primary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.mvp-card-primary > div {
  min-width: 0;
  padding: 10px 5px;
  text-align: center;
}

.mvp-card-primary > div + div {
  border-left: 1px solid var(--line);
}

.mvp-card-secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mvp-card-secondary > div {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  text-align: center;
}

.mvp-card dt {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 850;
  text-transform: uppercase;
}

.mvp-card dd {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 950;
}

.mvp-table-wrap {
  display: none;
}

.mvp-table {
  min-width: 960px;
}

.mvp-table th:nth-child(n + 4),
.mvp-table td:nth-child(n + 4) {
  text-align: center;
}

.mvp-table th:nth-child(2),
.mvp-table td:nth-child(2) {
  min-width: 220px;
}

.mvp-table th:nth-child(3),
.mvp-table td:nth-child(3) {
  min-width: 180px;
}

.mvp-player,
.mvp-player .player-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mvp-player .player-name {
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.mvp-player .player-name:hover {
  color: var(--accent-dark);
}

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

.panel {
  padding: 16px;
}

.team-line,
.match-side,
.venue-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--avatar-bg);
  border: 1px solid var(--line);
}

.leader-rank {
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 900;
}

.leaderboard-table {
  min-width: 560px;
}

.leaderboard-table th:nth-child(2),
.leaderboard-participant {
  text-align: left;
}

.leaderboard-participant {
  min-width: 230px;
}

.leaderboard-participant .team-line > div {
  min-width: 0;
}

.leaderboard-empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 14px;
}

.team-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.team-name.has-country,
.player-country {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.participant-name-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-country-flag {
  width: 24px;
  height: 16px;
  flex: 0 0 24px;
  border: 1px solid rgba(127, 127, 127, 0.32);
  border-radius: 3px;
  object-fit: cover;
}

.participant-link {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.match-side.away .participant-link {
  text-align: left;
}

.participant-link:hover,
.participant-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.meta,
.score-meta {
  color: var(--muted);
  font-size: 0.87rem;
}

.leader-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.stat-box {
  border-radius: 8px;
  background: var(--stat-bg);
  padding: 9px;
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.stat-box strong {
  font-size: 1.05rem;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0 10px;
}

.status-pill.waiting {
  background: var(--avatar-bg);
  color: var(--waiting-ink);
}

.status-pill.finished {
  background: var(--finished-bg);
  color: var(--finished-ink);
}

.status-pill.playing {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--table-bg);
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.search-input {
  width: min(260px, 100%);
}

.dbrm-summary {
  margin-bottom: 26px;
}

.dbrm-leader-display,
.dbrm-leader-display > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dbrm-leader-display .avatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.dbr-event-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.next-event-card {
  display: grid;
  grid-template-columns: minmax(150px, 240px) 1fr;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--notice-line);
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 14px 16px;
}

.next-event-card {
  min-height: 112px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--accent-soft), var(--panel));
}

.next-event-card .button-link {
  flex: 0 0 auto;
}

.next-event-image,
.event-venue-image {
  width: 100%;
  object-fit: cover;
  background: var(--panel);
}

.next-event-image {
  height: 150px;
  border-radius: 6px;
}

.next-event-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.event-venue-name {
  display: block;
  margin-top: 10px;
}

.dbr-event-grid > .empty-state {
  grid-column: 1 / -1;
}

.dbr-event-card {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 18px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.event-venue-image {
  height: 150px;
  border-radius: 5px;
}

.dbr-event-card h2 {
  line-height: 1.25;
}

.dbr-event-card .button-link {
  width: 100%;
}

.dbr-event-link {
  color: var(--ink);
  text-decoration: none;
}

.dbr-event-card h2 .dbr-event-link:hover,
.dbr-event-card h2 .dbr-event-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.event-details {
  display: grid;
  gap: 9px;
  margin: 0;
}

.event-details div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.event-details div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.event-details dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.event-details dd {
  max-width: 65%;
  text-align: right;
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 800;
}

.dbrm-header {
  align-items: end;
}

.dbrm-table {
  min-width: 1120px;
}

.dbrm-table .event-column {
  min-width: 108px;
  text-align: center;
}

.event-column a {
  display: block;
  color: var(--ink);
  font-size: 0.83rem;
  text-decoration: none;
}

.event-column a:hover,
.event-column a:focus-visible,
.player-name:hover,
.player-name:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.event-column span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.dbrm-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.country-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 30px;
  flex: 0 0 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--stat-bg);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.player-name {
  display: block;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.event-result {
  text-align: center;
}

.event-result strong,
.event-result span {
  display: block;
}

.event-result .placing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52), 0 2px 7px rgba(0, 0, 0, 0.2);
  font-size: 0.78rem;
  line-height: 1;
}

.placing-badge.gold {
  border-color: #c99114;
  background: linear-gradient(135deg, #fff0a6, #e5ad25 58%, #b97808);
  color: #352000;
}

.placing-badge.silver {
  border-color: #9da5ad;
  background: linear-gradient(135deg, #ffffff, #cbd0d5 58%, #9299a0);
  color: #20262b;
}

.placing-badge.bronze {
  border-color: #8d4827;
  background: linear-gradient(135deg, #e5a070, #b9683d 58%, #7d3c20);
  color: #ffffff;
}

.event-result span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.event-result.empty {
  color: var(--muted);
}

.match-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#matchList.match-grid {
  grid-template-columns: 1fr;
}

.match-round-section {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--table-bg);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.round-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--round-heading-bg);
}

.round-heading h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.round-heading-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.match-round-body {
  padding: 16px;
}

.free-team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--free-bg);
  padding: 10px 12px;
}

.free-team-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.free-team-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.free-team-list .participant-link {
  width: auto;
}

.match-card {
  display: grid;
  gap: 12px;
}

.match-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.score-row {
  display: grid;
  grid-template-areas:
    "home score"
    "away score";
  grid-template-columns: minmax(0, 1fr) 70px;
  align-items: stretch;
  gap: 10px 12px;
}

.match-side:first-child {
  grid-area: home;
}

.match-side.away {
  grid-area: away;
  justify-content: flex-start;
  text-align: left;
}

.match-side.away .avatar {
  order: -1;
}

.score {
  display: grid;
  grid-area: score;
  grid-template-rows: 1fr 1fr;
  place-items: center;
  min-width: 70px;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  font-weight: 950;
  text-align: center;
  overflow: hidden;
}

.score-separator {
  display: none;
}

.score-value {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 48px;
}

.score-value:first-child {
  border-bottom: 1px solid #d8d8d8;
}

.match-card .team-name {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.match-card .participant-name-text {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

.team-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

.venue-details {
  display: grid;
  justify-items: start;
  gap: 7px;
  min-width: 0;
}

.venue-address {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: normal;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.team-roster {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.team-roster-title {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.team-roster-title strong {
  color: var(--text);
}

.team-roster-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roster-player {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.roster-player:hover {
  background: var(--panel);
}

.roster-player .avatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 6px;
}

.roster-player-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 800;
}

.roster-player-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.captain-pill {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.profile-summary {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.profile-avatar-large {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--button-ink);
  font-size: 1.35rem;
  font-weight: 950;
}

.profile-form,
.settings-form {
  display: grid;
  gap: 14px;
}

.profile-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-form label,
.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.profile-form .full-span {
  grid-column: 1 / -1;
}

.profile-form input,
.profile-form textarea,
.settings-form select {
  width: 100%;
}

.notice,
.empty-state {
  border: 1px solid var(--notice-line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  margin-bottom: 18px;
  padding: 14px;
}

.empty-state {
  display: grid;
  gap: 4px;
  color: var(--muted);
  background: var(--panel);
  border-color: var(--line);
}

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

  .next-event-card {
    grid-template-columns: 1fr;
  }

  .next-event-content {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-tools {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout,
  .profile-layout,
  .dbr-event-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .profile-form {
    grid-template-columns: 1fr;
  }

  .match-round-body .match-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .main-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .main-menu-panel {
    display: none;
    align-items: stretch;
    padding-top: 4px;
  }

  .main-menu.open .main-menu-panel {
    display: grid;
  }

  .main-menu-links {
    display: grid;
    gap: 4px;
  }

  .main-menu-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding: 8px 12px 4px;
  }

  .install-app-button {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .main-menu-item {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .theme-switch {
    justify-content: space-between;
    padding: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 10px;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .input-row {
    flex-direction: column;
  }

  .round-heading,
  .round-heading-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .free-team-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 761px) {
  #mvp .section-title {
    align-items: end;
    flex-direction: row;
  }

  #mvp .search-input {
    width: min(260px, 100%);
  }
}

@media (min-width: 640px) and (max-width: 1099px) {
  .mvp-mobile-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (min-width: 1100px) {
  .mvp-mobile-list {
    display: none;
  }

  .mvp-table-wrap {
    display: block;
  }
}
