:root {
  color-scheme: dark;
  --bg: #070708;
  --surface: #121214;
  --surface-2: #1d1a1c;
  --ink: #fff8f4;
  --text: #fff8f4;
  --muted: #c7b8b6;
  --line: #3a2528;
  --accent: #c3162d;
  --accent-strong: #ff3f55;
  --accent-deep: #8e0d20;
  --on-accent: #ffffff;
  --danger: #e34949;
  --body-background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.13), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(195, 22, 45, 0.2), transparent 34%),
    linear-gradient(145deg, #050505 0%, #120608 46%, #050505 100%);
  --surface-hover: #2a2022;
  --danger-hover: #991f27;
  --control-border: #4b3436;
  --control-hover: #2a2224;
  --control-hover-border: #76505a;
  --selected-gradient: linear-gradient(135deg, #ffffff, #ffe8ec 48%, var(--accent-strong));
  --selected-hover-gradient: linear-gradient(135deg, #ffffff, #ffc8d0 48%, var(--accent-strong));
  --selected-text: #17080b;
  --focus-ring: rgba(255, 63, 85, 0.16);
  --row-alt: linear-gradient(135deg, #32171d, #4a1f27);
  --row-alt-text: #fff8f4;
  --row-alt-badge: #ffd7dc;
  --row-alt-action: #ff8b98;
  --connector: #c8b8b6;
  --slot-primary-bg: linear-gradient(135deg, #171315, #24191c);
  --slot-primary-border: #5a353d;
  --slot-secondary-bg: linear-gradient(135deg, #32171d, #4a1f27);
  --slot-secondary-border: #8a2d3b;
  --slot-secondary-seed: #ffadb8;
  --panel-background: linear-gradient(180deg, rgba(29, 26, 28, 0.96), rgba(18, 18, 20, 0.98));
  --loss-marker: #cf2239;
  --tie-marker: #b48d8f;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.52);
}

:root[data-theme="pokemon"] {
  --bg: #08142c;
  --surface: #101f3f;
  --surface-2: #162b55;
  --ink: #fff8d8;
  --text: #fff8d8;
  --muted: #c7d7ff;
  --line: #284b8f;
  --accent: #ffcb05;
  --accent-strong: #3b4cca;
  --accent-deep: #c79200;
  --on-accent: #16224a;
  --danger: #ee4035;
  --body-background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(circle at 78% 10%, rgba(255, 203, 5, 0.22), transparent 34%),
    linear-gradient(145deg, #08142c 0%, #123b7a 48%, #071025 100%);
  --surface-hover: #1f3970;
  --danger-hover: #b92d25;
  --control-border: #365ea8;
  --control-hover: #203f7e;
  --control-hover-border: #ffcb05;
  --selected-gradient: linear-gradient(135deg, #ffffff, #fff2a8 45%, #ffcb05);
  --selected-hover-gradient: linear-gradient(135deg, #ffffff, #ffe066 45%, #ffcb05);
  --selected-text: #16224a;
  --focus-ring: rgba(255, 203, 5, 0.22);
  --row-alt: linear-gradient(135deg, #162b55, #203f7e);
  --row-alt-text: #fff8d8;
  --row-alt-badge: #ffed84;
  --row-alt-action: #ffdf54;
  --connector: #8db3ff;
  --slot-primary-bg: linear-gradient(135deg, #101f3f, #18386f);
  --slot-primary-border: #3b4cca;
  --slot-secondary-bg: linear-gradient(135deg, #3b3008, #6f5908);
  --slot-secondary-border: #ffcb05;
  --slot-secondary-seed: #ffed84;
  --panel-background: linear-gradient(180deg, rgba(22, 43, 85, 0.96), rgba(8, 20, 44, 0.98));
  --loss-marker: #ee4035;
  --tie-marker: #ffcb05;
}

:root[data-theme="rawDeal"] {
  --bg: #05070b;
  --surface: #101820;
  --surface-2: #18232d;
  --ink: #f4f7fb;
  --text: #f4f7fb;
  --muted: #9fb1c4;
  --line: #2c4255;
  --accent: #ef2c18;
  --accent-strong: #ffffff;
  --accent-deep: #8e1510;
  --on-accent: #ffffff;
  --danger: #ff3b24;
  --body-background:
    radial-gradient(circle at 22% 4%, rgba(255, 255, 255, 0.16), transparent 24%),
    radial-gradient(circle at 76% 12%, rgba(238, 44, 24, 0.28), transparent 30%),
    linear-gradient(112deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 22px),
    linear-gradient(145deg, #030407 0%, #0a1420 42%, #101820 68%, #030407 100%);
  --surface-hover: #243241;
  --danger-hover: #a91a12;
  --control-border: #314d63;
  --control-hover: #202d3a;
  --control-hover-border: #ef2c18;
  --selected-gradient: linear-gradient(135deg, #ffffff, #cfd8e4 42%, #ef2c18);
  --selected-hover-gradient: linear-gradient(135deg, #ffffff, #e8edf5 42%, #ff4a32);
  --selected-text: #071019;
  --focus-ring: rgba(239, 44, 24, 0.24);
  --row-alt: linear-gradient(135deg, #162638, #2a3949);
  --row-alt-text: #f4f7fb;
  --row-alt-badge: #ffffff;
  --row-alt-action: #ff6a54;
  --connector: #dbe4ee;
  --slot-primary-bg: linear-gradient(135deg, #101820, #22313f);
  --slot-primary-border: #44647e;
  --slot-secondary-bg: linear-gradient(135deg, #311511, #621b14);
  --slot-secondary-border: #ef2c18;
  --slot-secondary-seed: #ffffff;
  --panel-background: linear-gradient(180deg, rgba(24, 35, 45, 0.96), rgba(5, 7, 11, 0.98));
  --loss-marker: #ef2c18;
  --tie-marker: #8fa4b8;
}

:root[data-theme="vs2pcg"] {
  --bg: #041014;
  --surface: #0b1b21;
  --surface-2: #122b34;
  --ink: #f3f8f9;
  --text: #f3f8f9;
  --muted: #a6c7cf;
  --line: #244650;
  --accent: #53c8e8;
  --accent-strong: #eef6f8;
  --accent-deep: #0c6072;
  --on-accent: #041014;
  --danger: #d3483d;
  --body-background:
    radial-gradient(circle at 50% 3%, rgba(224, 244, 250, 0.18), transparent 22%),
    radial-gradient(circle at 48% 24%, rgba(83, 200, 232, 0.22), transparent 31%),
    radial-gradient(circle at 82% 10%, rgba(29, 92, 105, 0.3), transparent 34%),
    linear-gradient(115deg, rgba(238, 246, 248, 0.08) 0 2px, transparent 2px 26px),
    linear-gradient(145deg, #020708 0%, #06252d 45%, #0a343e 64%, #020708 100%);
  --surface-hover: #18343d;
  --danger-hover: #8f2f29;
  --control-border: #2e5964;
  --control-hover: #17323a;
  --control-hover-border: #9ce8f6;
  --selected-gradient: linear-gradient(135deg, #ffffff, #cce8ed 42%, #53c8e8);
  --selected-hover-gradient: linear-gradient(135deg, #ffffff, #e7f2f4 42%, #9ce8f6);
  --selected-text: #041014;
  --focus-ring: rgba(83, 200, 232, 0.24);
  --row-alt: linear-gradient(135deg, #102b33, #1b4650);
  --row-alt-text: #f3f8f9;
  --row-alt-badge: #d9e7ea;
  --row-alt-action: #9ce8f6;
  --connector: #b7d9e0;
  --slot-primary-bg: linear-gradient(135deg, #0b1b21, #16404b);
  --slot-primary-border: #2e5964;
  --slot-secondary-bg: linear-gradient(135deg, #123846, #1d6b7b);
  --slot-secondary-border: #53c8e8;
  --slot-secondary-seed: #d9e7ea;
  --panel-background: linear-gradient(180deg, rgba(18, 43, 52, 0.96), rgba(4, 16, 20, 0.98));
  --loss-marker: #d3483d;
  --tie-marker: #a6b9bd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--body-background);
  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 {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ghost-button {
  background: var(--surface-2);
  color: var(--ink);
}

.ghost-button:hover {
  background: var(--surface-hover);
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: var(--danger-hover);
}

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

.auth-page {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.auth-page[hidden],
.create-account-page[hidden],
.forgot-password-page[hidden],
.reset-password-page[hidden],
.app-shell[hidden] {
  display: none;
}

.auth-card {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 480px;
  width: min(100%, 480px);
}

.auth-card h1 {
  font-size: clamp(1.85rem, 5.4vw, 3.05rem);
  line-height: 1;
  margin: 0;
}

.logo {
  display: inline-block;
  line-height: 1;
  margin: 0;
  max-width: min(100%, 650px);
}

.logo-image {
  display: block;
  height: auto;
  max-height: 98px;
  max-width: 100%;
  object-fit: contain;
  width: auto;
}

.auth-card .logo {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

.auth-card .logo-image {
  max-height: 84px;
  width: 100%;
}

.auth-note,
.auth-message {
  color: var(--muted);
  margin: 8px 0 0;
}

.auth-message {
  color: var(--danger);
  min-height: 1.2em;
}

.auth-message.is-success {
  color: #49d48d;
}

.auth-reset-dev-link {
  color: var(--accent-strong);
  display: inline-block;
  margin-top: 6px;
}

.auth-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.auth-link-button {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--accent);
  justify-self: center;
  padding: 6px 10px;
  text-transform: none;
}

.auth-link-button:hover {
  background: color-mix(in srgb, var(--accent), transparent 88%);
  border-color: color-mix(in srgb, var(--accent), transparent 55%);
  box-shadow: none;
}

.auth-name-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.user-label {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.player-name-with-avatar {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.player-avatar {
  align-items: center;
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 0;
  border-radius: 999px;
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: transparent;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
  position: relative;
  text-transform: uppercase;
  width: 24px;
}

.player-avatar.is-placeholder {
  background: url("Assets/ProfilePortalPlaceholder.png") center / contain no-repeat;
  box-shadow: none;
  overflow: visible;
}

.player-avatar.has-image {
  background: transparent;
}

.player-avatar img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

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

.topbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-bottom: 20px;
  position: relative;
  text-align: center;
}

.brand-row {
  align-items: center;
  display: block;
  justify-content: center;
  min-width: 0;
}

.brand-row > div:first-child {
  min-width: 0;
  text-align: center;
}

.topbar h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.heading-with-tip {
  cursor: help;
  display: inline-block;
}

.topbar h1 {
  font-size: clamp(1.9rem, 4.2vw, 3.8rem);
  line-height: 0.98;
  margin-top: 2px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.topbar-actions {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  justify-self: stretch;
  max-width: none;
}

.tournament-toolbar {
  justify-self: center;
  margin-bottom: 12px;
  max-width: 650px;
  width: min(100%, 650px);
}

.tournament-controls,
.account-controls {
  align-items: center;
  gap: 10px;
}

.tournament-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

#newTournament {
  background:
    linear-gradient(135deg, #fff8c9 0%, #ffd236 45%, #f2a900 100%);
  border: 1px solid rgba(255, 248, 201, 0.9);
  box-shadow:
    0 0 0 2px rgba(0, 174, 255, 0.18),
    0 10px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: #111521;
  font-size: 0.8rem;
  font-weight: 900;
  justify-self: auto;
  letter-spacing: 0.02em;
  min-height: 36px;
  padding: 0 12px;
  text-transform: uppercase;
}

#newTournament:hover {
  background:
    linear-gradient(135deg, #ffffff 0%, #ffe56b 45%, #ffc400 100%);
  box-shadow:
    0 0 0 2px rgba(0, 191, 255, 0.3),
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(0, 191, 255, 0.22);
}

.account-controls {
  display: grid;
  position: absolute;
  right: 0;
  top: 0;
  justify-items: end;
  z-index: 2;
  transform: scale(0.94);
  transform-origin: top right;
}

.session-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.tournament-select {
  min-height: 42px;
  min-width: 210px;
  width: min(420px, 56vw);
}

.app-body {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}

.top-nav-icons {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  justify-content: center;
}

.top-user-label {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.84rem;
  min-height: 38px;
  padding: 9px 10px;
}

.top-user-label .player-avatar {
  height: 25px;
  width: 25px;
}

.top-user-name {
  max-width: 148px;
}

.top-user-label:hover,
.top-user-label.is-active {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  color: var(--ink);
}

.nav-icon-button {
  align-items: center;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(0, 0, 0, 0.82);
  border-radius: 7px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 5px 12px rgba(0, 0, 0, 0.22);
  color: var(--ink);
  display: inline-flex;
  font-size: 1.28rem;
  height: 38px;
  justify-content: center;
  min-height: 38px;
  padding: 0;
  position: relative;
  width: 38px;
}

.nav-message-badge {
  align-items: center;
  background: linear-gradient(180deg, var(--danger), var(--danger-hover));
  border: 2px solid var(--surface);
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  color: #ffffff;
  display: inline-flex;
  font-size: 0.62rem;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  line-height: 1;
  min-width: 18px;
  padding: 0 4px;
  pointer-events: none;
  position: absolute;
  right: -7px;
  top: -7px;
}

.nav-message-badge[hidden] {
  display: none;
}

.nav-icon-svg {
  display: block;
  fill: currentColor;
  height: 26px;
  width: 26px;
}

.nav-icon-stroke {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.nav-icon-button:hover,
.nav-icon-button.is-active {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  border-color: rgba(255, 255, 255, 0.34);
  color: var(--ink);
}

.nav-icon-button.is-active {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 14px var(--focus-ring);
}

.danger-icon-button {
  border-color: rgba(0, 0, 0, 0.82);
  color: #ffd4d4;
}

.danger-icon-button:hover {
  background: linear-gradient(135deg, var(--danger), var(--danger-hover));
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.content-area {
  min-width: 0;
}

.panel-actions {
  align-items: flex-end;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.view-switch {
  display: flex;
  gap: 6px;
}

.view-switch[hidden] {
  display: none;
}

.view-switch button {
  background: #1a1a1d;
  border: 1px solid var(--control-border);
  color: var(--ink);
  min-height: 34px;
  padding: 0 10px;
}

.view-switch button:hover {
  background: var(--control-hover);
  border-color: var(--control-hover-border);
}

.view-switch button.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-color: var(--accent-strong);
  color: var(--on-accent);
}

.print-slips-button {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.06) 42%, rgba(0, 191, 255, 0.22)),
    linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: 1px solid rgba(255, 214, 74, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.72),
    0 6px 14px rgba(0, 0, 0, 0.28);
  color: var(--on-accent);
}

.print-slips-button:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.1) 42%, rgba(0, 191, 255, 0.28)),
    linear-gradient(135deg, var(--accent-strong), var(--accent));
  border-color: #ffe07a;
}

.popout-button {
  border: 2px solid rgba(0, 0, 0, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.16);
}

.popout-button:hover {
  border-color: rgba(0, 0, 0, 0.95);
}

.round-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 12px;
}

.round-tabs[hidden] {
  display: none;
}

.round-tabs button {
  background: #1a1a1d;
  border: 1px solid var(--control-border);
  color: var(--ink);
  min-height: 34px;
  padding: 0 12px;
}

.round-tabs button:hover {
  background: var(--control-hover);
  border-color: var(--control-hover-border);
}

.round-tabs button.is-active {
  background: var(--selected-gradient);
  border-color: var(--accent-strong);
  color: var(--selected-text);
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  min-width: 0;
}

.main-panel-shell {
  display: block;
  position: relative;
}

.main-panel-shell[hidden],
.tournament-toolbar[hidden],
.layout[hidden] {
  display: none;
}

.panel-stack {
  min-width: 0;
}

.section-tabs {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  left: 0;
  position: absolute;
  top: 0;
  transform: translateX(calc(-100% - 14px));
  z-index: 2;
}

.section-tabs[hidden] {
  display: none;
}

.section-tab {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  color: var(--on-accent);
  font-size: 0.76rem;
  font-weight: 900;
  min-height: 34px;
  padding: 0 12px;
  text-transform: uppercase;
}

.panel {
  background: var(--panel-background);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  padding: 18px;
}

.setup-panel,
.round-panel,
.standings-panel,
.bracket-panel {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='62' viewBox='0 0 72 62'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.095' stroke-width='1.2'%3E%3Cpath d='M18 1 36 11 36 31 18 41 0 31 0 11Z'/%3E%3Cpath d='M54 1 72 11 72 31 54 41 36 31 36 11Z'/%3E%3Cpath d='M36 21 54 31 54 51 36 61 18 51 18 31Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 72px 62px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.08)),
    var(--panel-background);
}

.settings-page {
  margin-bottom: 18px;
}

.account-page {
  margin-bottom: 18px;
}

.account-logout {
  border: 1px solid rgba(0, 0, 0, 0.82);
  min-height: 36px;
  padding: 0 12px;
}

.account-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.profile-picture-editor {
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 12px;
}

.profile-picture-preview {
  align-items: center;
  display: flex;
  justify-content: center;
}

.profile-picture-avatar {
  font-size: 1.4rem;
  height: 74px;
  width: 74px;
}

.profile-picture-fields {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.profile-picture-fields input[type="file"] {
  padding: 9px;
}

.profile-picture-fields .ghost-button {
  justify-self: start;
  min-height: 34px;
  padding: 0 12px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, 0.72);
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 50;
}

.modal-backdrop:not([hidden]) {
  display: flex;
}

.profile-crop-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12)),
    var(--panel-background);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62);
  display: grid;
  gap: 14px;
  max-width: min(460px, 100%);
  padding: 18px;
  width: 100%;
}

.profile-crop-card .panel-heading p {
  color: var(--muted);
  margin: 4px 0 0;
}

.profile-crop-canvas {
  aspect-ratio: 1;
  background: #050505;
  border: 0;
  border-radius: 10px;
  cursor: grab;
  display: block;
  justify-self: center;
  max-width: min(320px, 100%);
  touch-action: none;
  width: 100%;
}

.profile-crop-canvas:active {
  cursor: grabbing;
}

.profile-crop-controls {
  display: grid;
  gap: 10px;
}

.profile-crop-controls input[type="range"] {
  accent-color: var(--accent-strong);
}

.profile-crop-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.feedback-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12)),
    var(--panel-background);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62);
  display: grid;
  gap: 14px;
  max-width: min(460px, 100%);
  padding: 18px;
  width: 100%;
}

.feedback-card .panel-heading p {
  color: var(--muted);
  margin: 4px 0 0;
}

.feedback-form {
  display: grid;
  gap: 12px;
}

.feedback-form textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-status {
  color: var(--muted);
  margin: 0;
  min-height: 1.2em;
  font-size: 0.92rem;
}

.feedback-status.is-error {
  color: var(--danger);
}

.feedback-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.account-actions.compact-actions {
  justify-content: flex-end;
}

.account-change-panel {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.account-change-panel[hidden],
.two-factor-form[hidden] {
  display: none;
}

.two-factor-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.two-factor-heading h3 {
  margin-bottom: 4px;
}

.two-factor-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.two-factor-form .auth-reset-dev-link {
  justify-self: start;
  margin-top: -4px;
}

.account-message {
  margin-top: 0;
}

.account-message.is-success {
  color: #49d48d;
}

.settings-note {
  color: var(--muted);
  margin: -2px 0 0;
  max-width: 720px;
}

.settings-note.is-success {
  color: #49d48d;
}

.standings-heading-actions {
  align-items: flex-end;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.standings-notice {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 8px;
  color: var(--text);
  display: grid;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 5px;
  justify-items: end;
  line-height: 1.2;
  margin: 0;
  max-width: min(360px, 48vw);
  padding: 6px 8px;
  text-align: right;
}

.standings-notice[hidden] {
  display: none;
}

.standings-notice-label {
  color: var(--muted);
  text-align: right;
}

.head-to-head-chip-rows {
  display: grid;
  gap: 4px;
}

.head-to-head-chip-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.head-to-head-chip {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--line));
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  min-height: 20px;
  padding: 4px 7px;
  text-align: center;
}

.head-to-head-chip:hover {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  transform: translateY(-1px);
}

.toast-message {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--line));
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.36);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.35;
  max-width: min(420px, calc(100vw - 32px));
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  position: fixed;
  right: 18px;
  top: 18px;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 1000;
}

.toast-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-message.is-fading {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-message[hidden] {
  display: none;
}

.board-list {
  display: grid;
  gap: 12px;
}

.tournaments-page {
  display: grid;
  gap: 24px;
  margin: 0 auto;
  max-width: 980px;
  padding: 12px 0 30px;
}

.tournaments-page[hidden] {
  display: none;
}

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

.tournaments-hero h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-style: italic;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  margin: 0;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.38);
}

#dashboardNewTournament {
  background: linear-gradient(135deg, #fff8c9 0%, #ffd236 42%, #f2a900 100%);
  border: 1px solid rgba(255, 248, 201, 0.9);
  border-radius: 999px;
  box-shadow:
    0 0 0 2px rgba(0, 174, 255, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.3);
  color: #111521;
  min-width: 210px;
  text-transform: uppercase;
}

.tournament-dashboard-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

.tournament-dashboard-tab {
  background: transparent;
  border-radius: 0;
  color: var(--muted);
  font-style: italic;
  font-weight: 950;
  min-height: 32px;
  padding: 0 14px;
  position: relative;
  text-transform: uppercase;
}

.tournament-dashboard-tab::after {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
  bottom: -8px;
  content: "";
  height: 4px;
  left: 14px;
  opacity: 0;
  position: absolute;
  right: 14px;
  transform: scaleX(0.35);
  transform-origin: left center;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.tournament-dashboard-tab:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tournament-dashboard-tab.is-active {
  color: var(--ink);
}

.tournament-dashboard-tab.is-active > * ,
.tournament-dashboard-tab.is-active {
  text-shadow: none;
}

.tournament-dashboard-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.tournament-dashboard-tab span {
  color: var(--ink);
  margin-left: 6px;
}

.tournament-search input {
  background: rgba(0, 0, 0, 0.36);
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 0;
  min-height: 42px;
}

.tournament-dashboard-list {
  display: grid;
  gap: 12px;
}

.tournament-dashboard-row {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 5px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 74px;
  padding: 12px 14px;
}

.tournament-dashboard-row.status-pending { border-left-color: var(--tie-marker); }
.tournament-dashboard-row.status-inProgress { border-left-color: #38c8ff; }
.tournament-dashboard-row.status-complete { border-left-color: #35f29a; }
.tournament-dashboard-row.status-archived { border-left-color: var(--muted); opacity: 0.86; }

.tournament-dashboard-icon {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-weight: 950;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.tournament-dashboard-row.status-inProgress .tournament-dashboard-icon {
  border-color: rgba(56, 200, 255, 0.54);
  color: #38c8ff;
}

.tournament-dashboard-row.status-pending .tournament-dashboard-icon {
  border-color: rgba(255, 202, 24, 0.54);
  color: var(--tie-marker);
}

.tournament-dashboard-row.status-complete .tournament-dashboard-icon {
  border-color: rgba(53, 242, 154, 0.54);
  color: #35f29a;
}

.tournament-dashboard-main h3 {
  margin: 0;
}

.tournament-dashboard-main p,
.tournament-dashboard-meta {
  color: var(--muted);
}

.tournament-dashboard-main p {
  margin: 4px 0 0;
}

.tournament-dashboard-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  gap: 12px;
  justify-content: flex-end;
  min-width: 230px;
}

.tournament-dashboard-actions {
  display: flex;
  gap: 8px;
}

.tournament-dashboard-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.tournament-dashboard-empty {
  min-height: 140px;
}

.join-code-form {
  align-items: end;
  display: grid;
  gap: 10px 12px;
  grid-template-columns: minmax(180px, 280px) max-content;
  margin-bottom: 24px;
  max-width: 520px;
}

.join-code-form .field {
  margin-bottom: 0;
}

.join-code-form button {
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.join-code-display {
  align-items: center;
  display: flex;
  gap: 8px;
}

.join-code-display strong {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  display: inline-flex;
  letter-spacing: 0.08em;
  padding: 3px 8px;
}

.join-code-expiration,
.board-expiration {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.join-code-expiration.is-expired,
.board-expiration.is-expired {
  color: var(--danger);
}

.board-card {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.board-card p {
  color: var(--muted);
  margin: 5px 0 0;
}

.board-card .board-hosted-by {
  font-size: 0.82rem;
  opacity: 0.82;
}

.board-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.messages-page {
  max-width: 1180px;
}

.messages-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.messages-sidebar,
.message-thread-panel {
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 14px;
}

.message-user-search {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.message-user-search .field {
  margin-bottom: 0;
}

.message-user-search button {
  min-height: 44px;
}

.message-user-search-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.message-sidebar-heading {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  margin: 18px 0 8px;
  text-transform: uppercase;
}

.message-thread-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.message-user-result,
.message-thread-button {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 4px;
  justify-items: start;
  min-height: 44px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.message-user-result:hover,
.message-thread-button:hover,
.message-thread-button.is-active {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  border-color: var(--accent);
}

.message-thread-preview {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-thread-panel {
  display: grid;
  gap: 12px;
  grid-template-rows: auto minmax(320px, 56vh) auto;
}

.message-thread-header {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, auto);
}

.message-thread-contact {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  min-width: 0;
}

.message-invite-controls {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(150px, 1fr) auto;
}

.message-invite-controls select {
  min-width: 0;
}

.message-list {
  align-content: start;
  display: grid;
  gap: 10px;
  overflow: auto;
  padding: 4px;
}

.message-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  justify-self: start;
  max-width: min(640px, 92%);
  padding: 10px 12px;
}

.message-bubble.is-own {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), var(--surface-2));
  border-color: rgba(255, 255, 255, 0.26);
  justify-self: end;
}

.message-meta {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.message-bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-invite-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
}

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

.message-invite-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.message-invite-status {
  color: var(--accent-strong) !important;
  font-weight: 900;
  text-transform: uppercase;
}

.message-invite-card.status-accepted {
  border-color: #38d57a;
}

.message-invite-card.status-declined {
  border-color: var(--danger);
}

.message-invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-invite-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.message-compose {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.message-compose button {
  min-height: 44px;
}

.empty-state.compact {
  min-height: auto;
  padding: 10px;
}

@media (max-width: 780px) {
  .messages-layout,
  .message-thread-header,
  .message-compose,
  .message-user-search {
    grid-template-columns: 1fr;
  }

  .message-thread-panel {
    grid-template-rows: auto minmax(280px, 48vh) auto;
  }

  .message-invite-controls {
    grid-template-columns: 1fr auto;
  }
}

.setup-panel {
  container-type: inline-size;
  min-height: 240px;
  position: relative;
}

.setup-join-code {
  align-items: center;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.82);
  border-radius: 7px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 6px 14px rgba(0, 0, 0, 0.22);
  color: var(--muted);
  display: inline-grid;
  font-size: 0.74rem;
  font-weight: 900;
  gap: 4px 8px;
  grid-template-columns: 24px auto auto;
  min-height: 34px;
  padding: 0 10px;
  position: absolute;
  right: 18px;
  text-transform: uppercase;
  top: 18px;
  z-index: 3;
}

.copy-join-code {
  align-items: center;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(0, 0, 0, 0.82);
  border-radius: 5px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.9rem;
  height: 24px;
  justify-content: center;
  line-height: 1;
  min-height: 24px;
  min-width: 24px;
  padding: 0;
  width: 24px;
}

.copy-join-code:hover {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  border-color: rgba(255, 255, 255, 0.34);
}

.setup-join-code strong {
  color: var(--accent-strong);
  letter-spacing: 0.08em;
}

.setup-join-code .join-code-expiration {
  grid-column: 1 / -1;
  letter-spacing: 0;
  text-transform: none;
}

.setup-join-code[hidden] {
  display: none;
}

.round-panel {
  position: relative;
}

.pairings-utility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: absolute;
  right: 18px;
  top: 18px;
  width: 286px;
  z-index: 2;
}

.auto-pair-toggle,
.hide-new-pairings-toggle {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(0, 0, 0, 0.82);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 6px 14px rgba(0, 0, 0, 0.24);
  color: var(--ink);
  flex: 1 1 132px;
  font-size: 0.68rem;
  min-height: 28px;
  padding: 0 8px;
}

.auto-pair-toggle:hover,
.hide-new-pairings-toggle:hover {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  border-color: rgba(255, 255, 255, 0.34);
}

.auto-pair-toggle.is-active,
.hide-new-pairings-toggle.is-active {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 14px var(--focus-ring);
}

.setup-panel .panel-actions {
  min-width: 132px;
}

.setup-panel #generateRound {
  min-height: 38px;
  padding: 0 12px;
  width: 100%;
}

.round-panel .panel-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: absolute;
  right: 18px;
  top: 52px;
  width: 286px;
  z-index: 2;
}

.round-panel .panel-actions button {
  min-height: 34px;
  padding: 0 8px;
  width: 100%;
}

.round-panel #revealPairingRound {
  background: linear-gradient(135deg, #fff3a6, #f3c433 54%, #b77808);
  border-color: rgba(0, 0, 0, 0.78);
  color: #170f02;
  grid-column: 1;
  order: 1;
  text-shadow: none;
}

.round-panel #revealPairingRound:hover {
  background: linear-gradient(135deg, #fff8c8, #ffd94d 54%, #c98c0c);
}

.round-panel #revealPairingRound.is-hide-mode {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: var(--ink);
}

.round-panel #revealPairingRound.is-hide-mode:hover {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  border-color: rgba(255, 255, 255, 0.72);
}

.round-panel #generatePairingRound {
  grid-column: 2;
  order: 2;
}

.round-panel #editRound {
  border: 2px solid rgba(255, 255, 255, 0.46);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.72),
    0 0 12px rgba(255, 255, 255, 0.12);
  grid-column: 1 / -1;
  order: 3;
}

.round-panel #editRound:hover {
  border-color: rgba(255, 255, 255, 0.72);
}

.round-panel .panel-heading {
  padding-right: 304px;
}

.panel.is-collapsed {
  display: none;
}

.panel-heading {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading p {
  color: var(--muted);
  margin: 5px 0 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span,
.compact-field span,
.section-title span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.compact-field {
  display: grid;
  gap: 7px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #09090a;
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
  width: 100%;
}

.readonly-value {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  min-height: 44px;
  padding: 0 12px;
  width: 100%;
}

select {
  appearance: none;
  background: #09090a linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 14px center / 7px 7px no-repeat;
  min-width: 116px;
  padding-right: 34px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid var(--focus-ring);
}

.autocomplete-field {
  position: relative;
}

.autocomplete-menu {
  background: linear-gradient(180deg, rgba(22, 22, 24, 0.98), rgba(8, 8, 10, 0.98));
  border: 1px solid var(--control-border);
  border-radius: 8px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.38);
  left: 0;
  max-height: 256px;
  overflow-y: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
}

.autocomplete-menu[hidden] {
  display: none;
}

.autocomplete-option {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 10px;
  text-align: left;
  width: 100%;
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--control-hover-border);
}

.autocomplete-option.is-custom {
  color: var(--row-alt-action);
}

textarea {
  line-height: 1.35;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

.add-player {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.add-player .field {
  margin-bottom: 0;
}

.add-player button {
  align-self: end;
  min-height: 44px;
}

.add-player[hidden],
.field[hidden],
.settings-grid[hidden] {
  display: none;
}

.setup-summary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
  margin: 0 0 14px;
  overflow: hidden;
}

.setup-summary[hidden] {
  display: none;
}

.setup-summary div[hidden] {
  display: none;
}

.setup-summary div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 36px;
  padding: 7px 10px;
}

.setup-summary div:last-child {
  border-bottom: 0;
}

.setup-summary dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-summary dd {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-toggle-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 6px;
}

.custom-result-settings .settings-grid {
  display: none;
}

.custom-result-settings.is-expanded .settings-grid {
  display: grid;
}

.custom-result-name-field {
  grid-column: 1 / -1;
}

.toggle-field {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
}

.toggle-field input {
  accent-color: var(--accent);
  min-height: auto;
  width: auto;
}

.toggle-field span {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.hosted-toggle-timer {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong) !important;
  font-size: 0.78rem !important;
  margin-left: auto;
  padding: 4px 9px;
  white-space: nowrap;
}

.hosted-toggle-timer.is-expired {
  color: var(--danger) !important;
}

.hosted-toggle-timer[hidden] {
  display: none;
}

.section-title {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  margin: 8px 0 10px;
}

.section-title > :last-child {
  justify-self: end;
}

.section-toggle {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(0, 0, 0, 0.82);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 6px 14px rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 12px;
  min-height: 34px;
  padding: 0 10px;
  position: static;
  text-transform: uppercase;
  transform: none;
  white-space: nowrap;
  z-index: 2;
}

.section-toggle:hover {
  background: linear-gradient(180deg, var(--control-hover), var(--surface-2));
  border-color: rgba(255, 255, 255, 0.34);
}

.panel-content[hidden],
.setup-content[hidden] {
  display: none;
}

.player-list {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  list-style: none;
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 0;
}

.decklist-viewer-open {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent), var(--accent-deep));
  border: 1px solid var(--accent-strong);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  color: var(--on-accent);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  min-height: 36px;
  padding: 0 16px;
  text-transform: uppercase;
}

.decklist-viewer-open:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong), var(--accent-deep));
  border-color: var(--ink);
  transform: translateY(-1px);
}

@container (min-width: 560px) {
  .player-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.player-list li {
  align-items: center;
  background: var(--surface-2);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.player-list-name {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.player-list-display {
  flex: 1 1 auto;
}

.player-list-actions {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.decklist-view {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 0.68rem;
  min-height: 26px;
  padding: 0 7px;
}

.decklist-view {
  align-items: center;
  color: var(--accent-strong);
  display: inline-flex;
  gap: 4px;
  text-transform: uppercase;
}

.decklist-view.has-decklist::after {
  color: #48b985;
  content: "✓";
  font-size: 0.78rem;
  font-weight: 900;
}

.decklist-view:hover {
  background: var(--surface-hover);
  border-color: var(--accent-strong);
}

.decklist-open {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 0.72rem;
  min-height: 30px;
  padding: 0 8px;
  text-transform: uppercase;
}

.decklist-open:hover {
  background: var(--surface-hover);
  border-color: var(--accent-strong);
}

.remove-player {
  background: transparent;
  color: var(--danger);
  min-height: 30px;
  padding: 0 6px;
}

.remove-player:hover {
  background: rgba(177, 66, 52, 0.08);
}

.pairings {
  display: grid;
  gap: 8px;
}

.pairings:not(.empty-state) {
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  justify-content: stretch;
}

.pairings.is-short-round:not(.empty-state) {
  grid-template-columns: repeat(auto-fit, minmax(156px, 220px));
  justify-content: center;
}

.empty-state {
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  min-height: 180px;
  padding: 24px;
  text-align: center;
}

.match {
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.72),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  min-width: 0;
  padding: 6px;
}

.match-title {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.match-players {
  display: grid;
  font-size: 0.88rem;
  font-weight: 800;
  gap: 4px;
  margin-bottom: 7px;
}

.match-player-line {
  align-items: center;
  background: #151517;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  min-height: 33px;
  padding: 4px 6px;
}

.match-player-line:nth-child(even) {
  background: var(--row-alt);
  color: var(--row-alt-text);
}

.match-player-line:nth-child(even) .player-badge {
  background: #14090b;
  color: var(--row-alt-badge);
}

.match-player-line:nth-child(even) .drop-player {
  color: var(--row-alt-action);
}

.match-player-name {
  align-items: center;
  display: inline-flex;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-player-display {
  min-width: 0;
}

.match-player-display .player-avatar,
.standings-player-display .player-avatar,
.bracket-player-display .player-avatar {
  height: 21px;
  width: 21px;
}

.player-badge {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  margin-left: 5px;
  padding: 1px 4px;
  text-transform: uppercase;
  vertical-align: middle;
}

.match-player-controls {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
}

.drop-player {
  background: transparent;
  color: var(--danger);
  flex: 0 0 auto;
  font-size: 0.68rem;
  min-height: 22px;
  padding: 0 4px;
  width: 38px;
}

.drop-player:hover:not(:disabled) {
  background: rgba(177, 66, 52, 0.08);
}

.drop-player:disabled {
  color: var(--muted);
  cursor: default;
}

.match-actions {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(2, 1fr);
}

.match-actions button {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06) 58%, rgba(255, 255, 255, 0.12));
  border: 1px solid var(--control-hover-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 0.8rem;
  min-height: 30px;
  min-width: 0;
  padding: 0 5px;
}

.match-actions button:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.1) 58%, rgba(255, 255, 255, 0.18));
  border-color: var(--accent-strong);
}

.match-actions button[data-result="p1"] {
  grid-column: 1;
  grid-row: 1;
}

.match-actions button[data-result="p2"] {
  grid-column: 2;
  grid-row: 1;
}

.match-actions button[data-result="tie"] {
  grid-column: 1;
  grid-row: 2;
}

.match-actions button[data-result="dl"] {
  grid-column: 2;
  grid-row: 2;
}

.match-actions.has-double-loss:not(.has-tie) button[data-result="dl"] {
  grid-column: 1;
}

.match-actions button[data-result="custom-p1"] {
  grid-column: 1;
  grid-row: 2;
}

.match-actions button[data-result="custom-p2"] {
  grid-column: 2;
  grid-row: 2;
}

.match-actions button[data-result="custom-tie"] {
  grid-column: 1 / -1;
  grid-row: 3;
}

.match-actions.has-custom-win button[data-result="tie"],
.match-actions.has-custom-win button[data-result="dl"] {
  grid-row: 3;
}

.match-actions.has-custom-win button[data-result="custom-tie"] {
  grid-row: 4;
}

.match-actions.has-custom-win:not(.has-standard-secondary) button[data-result="custom-tie"] {
  grid-row: 3;
}

.match-actions:not(.has-custom-win).has-standard-secondary button[data-result="custom-tie"] {
  grid-row: 3;
}

.match-actions:not(.has-custom-win):not(.has-standard-secondary) button[data-result="custom-tie"] {
  grid-row: 2;
}

.match-actions.is-best-of-three button[data-result="p1"][data-p2-game-wins="0"] {
  grid-column: 1;
  grid-row: 1;
}

.match-actions.is-best-of-three button[data-result="p2"][data-p1-game-wins="0"] {
  grid-column: 2;
  grid-row: 1;
}

.match-actions.is-best-of-three button[data-result="p1"][data-p2-game-wins="1"] {
  grid-column: 1;
  grid-row: 2;
}

.match-actions.is-best-of-three button[data-result="p2"][data-p1-game-wins="1"] {
  grid-column: 2;
  grid-row: 2;
}

.match-actions.is-best-of-three button[data-result="custom-p1"] {
  grid-column: 1;
  grid-row: 3;
}

.match-actions.is-best-of-three button[data-result="custom-p2"] {
  grid-column: 2;
  grid-row: 3;
}

.match-actions.is-best-of-three:not(.has-custom-win) button[data-result="tie"],
.match-actions.is-best-of-three:not(.has-custom-win) button[data-result="dl"] {
  grid-row: 3;
}

.match-actions.is-best-of-three.has-custom-win button[data-result="tie"],
.match-actions.is-best-of-three.has-custom-win button[data-result="dl"] {
  grid-row: 4;
}

.match-actions.is-best-of-three.has-double-loss:not(.has-tie) button[data-result="dl"] {
  grid-column: 1;
}

.match-actions.is-best-of-three.has-custom-win.has-standard-secondary button[data-result="custom-tie"] {
  grid-row: 5;
}

.match-actions.is-best-of-three.has-custom-win:not(.has-standard-secondary) button[data-result="custom-tie"],
.match-actions.is-best-of-three:not(.has-custom-win).has-standard-secondary button[data-result="custom-tie"] {
  grid-row: 4;
}

.match-actions.is-best-of-three:not(.has-custom-win):not(.has-standard-secondary) button[data-result="custom-tie"] {
  grid-row: 3;
}

.match-actions button.is-selected {
  background: var(--selected-gradient);
  border-color: var(--accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 5px 14px var(--focus-ring);
  color: var(--selected-text);
}

.match-actions button.is-selected:hover {
  background: var(--selected-hover-gradient);
  color: var(--selected-text);
}

.match-result {
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  cursor: help;
  font-size: 0.78rem;
  text-transform: uppercase;
}

th:nth-child(1),
td:nth-child(1),
th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8),
th:nth-child(9),
td:nth-child(9),
th:nth-child(10),
td:nth-child(10) {
  text-align: center;
}

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

td:first-child,
th:first-child {
  width: 52px;
}

.standings-panel th,
.standings-panel td {
  padding-left: 8px;
  padding-right: 8px;
}

.standings-panel th:nth-last-child(-n + 4),
.standings-panel td:nth-last-child(-n + 4) {
  min-width: 56px;
  text-align: center;
}

.bracket-panel {
  margin-top: 18px;
}

.bracket {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.bracket-covered {
  min-height: 220px;
  overflow: hidden;
  place-items: center;
}

.bracket-cover-card {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 38px rgba(0, 0, 0, 0.34);
  display: grid;
  gap: 12px;
  justify-items: center;
  max-width: 420px;
  min-height: 164px;
  padding: 24px;
  text-align: center;
  width: min(100%, 420px);
}

.bracket-cover-eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bracket-cover-title {
  color: var(--ink);
  font-size: clamp(1.4rem, 4vw, 2.3rem);
  font-weight: 900;
  line-height: 1;
}

.bracket-cover-reveal {
  min-width: 132px;
}

.bracket-podium {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(146px, 200px));
  justify-content: center;
  margin: 0 auto 8px;
  max-width: 720px;
  width: 100%;
}

.podium-card {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.018)),
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.26);
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: 166px;
  overflow: hidden;
  padding: 10px 12px 12px;
  position: relative;
  text-align: center;
}

.podium-card-1 {
  border-color: rgba(246, 201, 67, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 1px rgba(246, 201, 67, 0.2),
    0 14px 28px rgba(0, 0, 0, 0.3);
}

.podium-card-2 {
  border-color: rgba(207, 214, 223, 0.72);
}

.podium-card-3 {
  border-color: rgba(200, 121, 52, 0.72);
}

.podium-badge {
  border: 0;
  display: block;
  height: 118px;
  object-fit: contain;
  width: 118px;
}

.podium-badge-1 {
  transform: scale(1.06);
}

.podium-name {
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.05;
  margin-top: 2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.bracket-grid {
  --slot-height: 46px;
  --slot-gap: 7px;
  --match-gap: 14px;
  --round-gap: 46px;
  align-items: stretch;
  display: flex;
  gap: var(--round-gap);
  min-width: min-content;
  padding: 4px 18px 8px 0;
  position: relative;
}

.bracket-grid-full {
  --slot-height: 42px;
  --slot-gap: 6px;
  --match-gap: 4px;
  --round-gap: 26px;
  --full-list-height: calc((var(--first-round-matches) * var(--slot-height)) + ((var(--first-round-matches) - 1) * var(--match-gap)));
  gap: var(--round-gap);
}

.bracket-grid-swiss {
  --slot-height: 36px;
  --slot-gap: 4px;
  --match-gap: 8px;
  --round-gap: 24px;
  gap: var(--round-gap);
}

.bracket-grid-pairings {
  --slot-height: 34px;
  --slot-gap: 4px;
  --match-gap: 8px;
  --round-gap: 0px;
  display: block;
  min-width: 0;
  padding: 4px 0 8px;
  width: 100%;
}

.bracket-lines {
  inset: 0;
  overflow: visible;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.bracket-line {
  fill: none;
  stroke: #91a1ad;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 2;
}

.bracket-round {
  display: flex;
  flex: 0 0 176px;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.bracket-round-title,
.bracket-round-matches {
  width: 100%;
}

.bracket-round-title {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.bracket-round-matches {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  justify-content: space-around;
  min-height: calc((var(--first-round-matches) * ((var(--slot-height) * 2) + var(--slot-gap))) + ((var(--first-round-matches) - 1) * var(--match-gap)));
}

.bracket-grid-full .bracket-round:first-of-type .bracket-round-matches {
  justify-content: flex-start;
  min-height: var(--full-list-height);
}

.bracket-grid-full .bracket-round:not(:first-of-type) .bracket-round-matches {
  min-height: var(--full-list-height);
}

.bracket-grid-full .bracket-round:first-of-type {
  flex-basis: 150px;
}

.bracket-grid-full .bracket-match {
  gap: 0;
}

.bracket-grid-swiss .bracket-round {
  flex-basis: 154px;
}

.bracket-grid-swiss .bracket-round-matches {
  justify-content: flex-start;
  min-height: 0;
}

.bracket-grid-swiss .bracket-match {
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 0;
  margin-bottom: var(--match-gap);
  overflow: hidden;
}

.bracket-grid-swiss .bracket-slot {
  border: 0;
  border-radius: 0;
}

.bracket-grid-swiss .bracket-match.has-two-slots .bracket-slot + .bracket-slot {
  border-top: 1px solid var(--line);
}

.bracket-grid-pairings .bracket-lines {
  display: none;
}

.bracket-grid-pairings .bracket-round {
  display: grid;
  flex: 1 1 auto;
  gap: 9px;
  width: 100%;
}

.bracket-grid-pairings .bracket-round-matches {
  display: grid;
  gap: var(--match-gap);
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  justify-content: stretch;
  min-height: 0;
}

.bracket-grid-pairings.is-short-round .bracket-round-matches {
  grid-template-columns: repeat(auto-fit, minmax(148px, 220px));
  justify-content: center;
}

.bracket-grid-pairings .bracket-match {
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.72),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  gap: 0;
  overflow: hidden;
}

.bracket-grid-pairings .bracket-slot {
  border: 0;
  border-radius: 0;
  min-height: var(--slot-height);
  padding: 5px 8px;
}

.bracket-grid-pairings .bracket-match.has-two-slots .bracket-slot + .bracket-slot {
  border-top: 1px solid var(--line);
}

.bracket-grid-pairings .bracket-seed {
  display: none;
}

.bracket-match-title {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 5px 8px;
  text-transform: uppercase;
}

.bracket-match {
  display: grid;
  gap: var(--slot-gap);
  position: relative;
}

.bracket-match::before,
.bracket-match::after {
  background: var(--connector);
  content: "";
  height: 2px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: calc(var(--round-gap) / 2);
}

.bracket-match.has-left-connector::before {
  left: calc((var(--round-gap) / -2) - 1px);
}

.bracket-match.has-right-connector::after {
  right: calc((var(--round-gap) / -2) - 1px);
}

.bracket-match:not(.has-left-connector)::before,
.bracket-match:not(.has-right-connector)::after {
  display: none;
}

.bracket-match::before,
.bracket-match::after,
.bracket-match.has-right-connector .bracket-slot::after,
.bracket-champion::before {
  display: none;
}

.bracket-slot {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 2px;
  min-height: var(--slot-height);
  padding: 6px 8px;
  position: relative;
}

.bracket-slot-primary {
  background: var(--slot-primary-bg);
  border-color: var(--slot-primary-border);
}

.bracket-slot-secondary {
  background: var(--slot-secondary-bg);
  border-color: var(--slot-secondary-border);
  color: var(--row-alt-text);
}

.bracket-slot-secondary .bracket-seed {
  color: var(--slot-secondary-seed);
}

.bracket-match.has-right-connector .bracket-slot::after {
  background: var(--connector);
  content: "";
  height: calc((var(--slot-height) + var(--slot-gap)) / 2);
  position: absolute;
  right: calc((var(--round-gap) / -2) - 1px);
  width: 2px;
}

.bracket-match.has-right-connector .bracket-slot:first-child::after {
  top: 50%;
}

.bracket-match.has-right-connector .bracket-slot:last-child::after {
  bottom: 50%;
}

.bracket-seed {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.bracket-name {
  font-size: 0.88rem;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket-player-display {
  min-width: 0;
}

.bracket-name-row {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  min-width: 0;
}

.result-marker {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.66rem;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  padding: 0;
  width: 18px;
}

.result-marker-w {
  background: #48b985;
  color: #07160f;
}

.result-marker-l {
  background: var(--loss-marker);
  color: #fff8f4;
}

.result-marker-t {
  background: var(--tie-marker);
  color: #170e10;
}

.result-marker-c {
  background: var(--accent);
  color: var(--on-accent);
}

.result-marker-b {
  background: #f4f7f8;
  color: #11171c;
}

.bracket-champion-round {
  flex-basis: 150px;
}

.bracket-champion {
  align-items: center;
  background: linear-gradient(135deg, #fff5a8, #f1c84b 48%, #b98613);
  border-radius: 7px;
  color: #181100;
  display: flex;
  font-size: 0.78rem;
  font-weight: 900;
  justify-content: center;
  min-height: var(--slot-height);
  position: relative;
  text-transform: uppercase;
}

.bracket-champion::before {
  background: var(--connector);
  content: "";
  height: 2px;
  left: calc((var(--round-gap) / -2) - 1px);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: calc(var(--round-gap) / 2);
}

.bracket-match::before,
.bracket-match::after,
.bracket-match.has-right-connector .bracket-slot::after,
.bracket-champion::before {
  display: none;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .standings-panel,
  .bracket-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-shell {
    padding: 10px;
  }

  .app-body {
    gap: 12px;
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 8px;
    margin-bottom: 12px;
    text-align: center;
  }

  .logo {
    max-width: 100%;
  }

  .logo-image {
    max-height: 64px;
    width: min(100%, 430px);
  }

  .brand-row {
    flex-wrap: wrap;
  }

  .account-controls {
    position: static;
    transform: none;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .top-nav-icons {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(6, 38px) minmax(84px, auto);
    justify-content: center;
    width: 100%;
  }

  .nav-icon-button {
    border-radius: 7px;
    font-size: 1.05rem;
    height: 38px;
    min-height: 38px;
    width: 38px;
  }

  .nav-icon-svg {
    height: 23px;
    width: 23px;
  }

  .top-user-label {
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    min-height: 38px;
    overflow: hidden;
    padding: 0 10px;
  }

  .top-user-name {
    max-width: 92px;
  }

  .profile-picture-editor {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .profile-picture-fields {
    width: 100%;
  }

  .profile-picture-fields .ghost-button {
    justify-self: center;
  }

  .tournament-controls,
  .account-controls {
    display: grid;
    justify-content: stretch;
    justify-items: stretch;
  }

  .tournament-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  #newTournament {
    min-height: 40px;
    width: 100%;
  }

  .section-tabs {
    flex-direction: row;
    margin: 0 0 12px;
    overflow-x: auto;
    padding-bottom: 2px;
    position: static;
    transform: none;
    width: 100%;
  }

  .section-tab {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
  }

  .session-controls {
    display: grid;
    justify-content: stretch;
    width: 100%;
  }

  .topbar-actions,
  .tournament-controls,
  .account-controls,
  .session-controls,
  .panel-actions,
  .tournament-select {
    width: 100%;
  }

  .panel {
    padding: 12px;
  }

  .panel-heading {
    gap: 10px;
    margin-bottom: 12px;
  }

  .panel-heading p {
    font-size: 0.92rem;
  }

  .layout {
    gap: 12px;
  }

  .section-toggle {
    min-height: 32px;
    padding: 0 9px;
    width: auto;
  }

  .pairings-utility-actions,
  .round-panel .panel-actions {
    position: static;
    width: 100%;
  }

  .pairings-utility-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 12px;
  }

  .auto-pair-toggle,
  .hide-new-pairings-toggle {
    flex-basis: auto;
    min-height: 32px;
  }

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

  .round-panel .panel-heading {
    padding-right: 0;
  }

  .round-tabs {
    flex-wrap: nowrap;
    margin: 10px -2px 12px;
    overflow-x: auto;
    padding: 0 2px 4px;
  }

  .round-tabs button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 11px;
  }

  .auth-actions,
  .auth-name-grid,
  .join-code-form,
  .tournaments-hero {
    grid-template-columns: 1fr;
  }

  .tournaments-hero {
    align-items: stretch;
    display: grid;
    gap: 12px;
    padding-top: 2px;
  }

  .tournaments-page {
    gap: 14px;
    padding-bottom: 16px;
  }

  .tournament-dashboard-tabs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin: 0 -2px;
    overflow-x: auto;
    padding: 0 2px 4px;
  }

  .tournament-dashboard-tab {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
  }

  .tournament-dashboard-row {
    align-items: stretch;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 11px 12px;
  }

  .tournament-dashboard-icon {
    height: 36px;
    width: 36px;
  }

  .tournament-dashboard-main h3 {
    font-size: 1rem;
    line-height: 1.12;
  }

  .tournament-dashboard-main p {
    font-size: 0.9rem;
  }

  .tournament-dashboard-meta,
  .tournament-dashboard-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .tournament-dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  }

  .tournament-dashboard-meta {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: flex-start;
    min-width: 0;
    padding-top: 8px;
  }

  .board-card {
    align-items: stretch;
    display: grid;
  }

  .board-actions {
    display: grid;
  }

  .panel-actions {
    justify-items: stretch;
  }

  .view-switch {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .view-switch button {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .bracket-actions {
    width: 100%;
  }

  .bracket-switch {
    width: 100%;
  }

  .print-slips-button,
  .popout-button {
    min-height: 38px;
  }

  .layout,
  .add-player,
  .settings-grid,
  .pairings:not(.empty-state) {
    grid-template-columns: 1fr;
  }

  .section-title {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .section-title h3 {
    grid-column: 1;
  }

  .section-title .decklist-viewer-open {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
  }

  .section-title span {
    grid-column: 2;
  }

  .player-list {
    max-height: 320px;
  }

  .player-list li {
    align-items: stretch;
    display: grid;
    gap: 8px;
  }

  .player-list-actions {
    justify-content: flex-start;
  }

  .match {
    padding: 8px;
  }

  .match-title {
    font-size: 0.72rem;
  }

  .match-player-line {
    min-height: 36px;
  }

  .match-actions button {
    font-size: 0.82rem;
    min-height: 36px;
  }

  .standings-heading-actions {
    justify-items: stretch;
    width: 100%;
  }

  .standings-notice {
    max-width: 100%;
    text-align: left;
  }

  .table-wrap,
  .bracket {
    -webkit-overflow-scrolling: touch;
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
  }

  table {
    font-size: 0.86rem;
  }

  th,
  td,
  .standings-panel th,
  .standings-panel td {
    padding: 9px 7px;
  }

  .bracket-panel {
    margin-top: 12px;
  }

  .bracket-podium {
    grid-template-columns: 1fr;
  }

  .bracket-grid,
  .bracket-grid-full,
  .bracket-grid-swiss {
    --slot-width: 138px;
    --round-gap: 44px;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 8px;
  }

  .logo-image {
    max-height: 54px;
  }

  .top-nav-icons {
    gap: 5px;
    grid-template-columns: repeat(6, 34px) minmax(60px, auto);
  }

  .nav-icon-button {
    height: 34px;
    min-height: 34px;
    width: 34px;
  }

  .nav-icon-svg {
    height: 21px;
    width: 21px;
  }

  .top-user-label {
    font-size: 0.72rem;
    min-height: 34px;
    padding: 0 8px;
  }

  .panel {
    padding: 10px;
  }

  .pairings-utility-actions,
  .round-panel .panel-actions,
  .match-actions {
    grid-template-columns: 1fr;
  }

  .match-actions button[data-result] {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }

  .round-panel #generatePairingRound,
  .round-panel #revealPairingRound,
  .round-panel #editRound {
    grid-column: 1;
  }

  .add-player {
    gap: 8px;
  }

  .tournament-dashboard-row {
    border-left-width: 4px;
  }

  .tournament-dashboard-meta {
    gap: 8px;
  }

  .setup-summary div {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .bracket-grid,
  .bracket-grid-full,
  .bracket-grid-swiss {
    --slot-width: 128px;
    --round-gap: 36px;
  }
}
