:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #0f172a;
  background: #f8fafc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #f8fafc;
  --surface: rgb(255 255 255 / 30%);
  --surface-soft: #f1f5f9;
  --muted: #64748b;
  --prime: #12355B;
  --sec: #D4AF37;
  --sec-hover: #C9A227;
  --tournament-action-max-width: 136px;
  --ink: #1E293B;
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #DC2626;
  --line: #e2e8f0;
  --board-ink: var(--prime);
  --board-opacity: .03;
  --shadow: 0 12px 34px rgb(15 23 42 / 5%);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(212 175 55 / 55%);
  outline-offset: 2px;
}

.app-frame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 38px;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.topbar,
.bottombar {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.step-controls [hidden] { display: none; }
.step-controls.is-first-step { justify-content: flex-end; }

.topbar {
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: #111827;
}

.brand img {
  display: block;
  width: 187px;
  height: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.language-indicator {
  display: grid;
  min-width: 28px;
  height: 35px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
  cursor: pointer;
}

.language-indicator:hover {
  background: transparent;
  color: #64748b;
}

.header-divider {
  width: 1px;
  height: 22px;
  margin: 0 5px 0 2px;
  background: var(--line);
}

.icon-button {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.service-indicator {
  color: #64748b;
}

.service-indicator[role="img"] {
  cursor: default;
}

.service-indicator.is-muted {
  color: #94a3b8;
}

.service-indicator.is-checking {
  color: #94a3b8;
}

.service-indicator.is-idle {
  color: var(--warning);
}

.service-indicator.is-available {
  color: var(--success);
}

.service-indicator.is-unavailable {
  color: var(--error);
}

.service-indicator:disabled {
  opacity: 1;
  cursor: default;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--prime);
}

.icon-button.service-indicator:hover {
  background: transparent;
}

.icon-button.service-indicator.is-muted:hover { color: #94a3b8; }
.icon-button.service-indicator.is-checking:hover { color: #94a3b8; }
.icon-button.service-indicator.is-idle:hover { color: var(--warning); }
.icon-button.service-indicator.is-available:hover { color: var(--success); }
.icon-button.service-indicator.is-unavailable:hover { color: var(--error); }

.icon-button svg,
.button svg,
.back-button svg,
.leave-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.avatar-button {
  margin-left: 4px;
  border-color: var(--line);
  background: #f8fafc;
}

.main-content {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.view {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.view[hidden] {
  display: none;
}

.view.is-active {
  animation: view-enter 220ms ease-out both;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-overview {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(100%, 1370px);
  margin: 0 auto;
  padding: clamp(20px, 3.7vh, 38px) clamp(22px, 4vw, 58px) 24px;
}

.overview-heading,
.surface-heading,
.overview-actions,
.step-toolbar,
.step-controls,
.settings-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.overview-heading {
  gap: 28px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--prime);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Segoe UI", Arial, sans-serif;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -.045em;
}

.subheading,
.muted {
  margin-bottom: 0;
  color: var(--muted);
}

.subheading {
  font-size: 14px;
}

.overview-actions {
  flex-shrink: 0;
  gap: 10px;
}

.button,
.back-button,
.leave-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--prime);
  color: #fff;
  box-shadow: 0 5px 13px rgb(109 92 231 / 18%);
}

.button-primary:hover:not(:disabled) {
  background: var(--prime);
  box-shadow: 0 7px 17px rgb(109 92 231 / 25%);
}

.button-danger {
  border-color: #fecaca;
  background: #fff;
  color: #b91c1c;
}

.button-danger:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fef2f2;
}

.button-quiet,
.back-button {
  border-color: var(--line);
  background: #fff;
  color: #334155;
}

.button-quiet:hover,
.back-button:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.button-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.button-small svg {
  width: 15px;
  height: 15px;
}

.button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.stat-icon-prime { background: #f0edff; color: var(--prime); }
.stat-icon-green { background: #e8fbf4; color: #059669; }
.stat-icon-gold { background: #fff6e5; color: #d97706; font-size: 18px; }
.stat-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; }
.stat-card strong { font-family: "Segoe UI", Arial, sans-serif; font-size: 22px; letter-spacing: -.03em; color: var(--sec); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(16 185 129 / 13%);
}

.tournament-surface,
.surface {
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.tournament-surface {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
}

.surface-heading {
  padding: 19px 22px 17px;
  border-bottom: 1px solid #eef2f7;
}

.surface-heading h2 {
  margin-bottom: 4px;
  font-size: 16px;
  letter-spacing: -.02em;
}

.surface-heading p {
  font-size: 12px;
}

.connection-state {
  display: none;
  padding: 8px 22px;
  border-bottom: 1px solid #eef2f7;
  color: var(--muted);
  font-size: 11px;
}

.connection-state.is-visible {
  display: block;
}

.connection-state.status-ok { color: #047857; }
.connection-state.status-error { color: #b91c1c; }

.tournament-list {
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
}

.tournament-row {
  display: grid;
  grid-template-areas: "name date winner status action";
  grid-template-columns: minmax(180px, 1fr) max-content minmax(0, 1fr) max-content max-content;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 12px 22px;
  border-bottom: 1px solid #eef2f7;
}

.tournament-row:last-child { border-bottom: 0; }
.tournament-row:hover { background: #fbfaff; }
.tournament-name { grid-area: name; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.row-label { display: none; color: var(--muted); font-size: 10px; }
.row-value { overflow: hidden; color: #475569; text-overflow: ellipsis; white-space: nowrap; }
.row-date { grid-area: date; }
.row-winner { grid-area: winner; }
.row-status { grid-area: status; }
.row-winner:empty { display: none; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  padding: 5px 9px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.status-pill::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  content: "";
}

.status-pill.is-running { background: #e8fbf4; color: #047857; }
.status-pill.is-running::before { background: var(--success); }
.status-pill.is-finished { background: #f0edff; color: #5b4acb; }
.status-pill.is-finished::before { background: var(--prime); }
.status-pill.is-open { background: #fff6e5; color: #a16207; }
.status-pill.is-open::before { background: var(--warning); }

.row-open {
  grid-area: action;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: var(--tournament-action-max-width);
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: var(--sec);
  color: var(--prime);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  justify-self: end;
}

#refreshButton { max-width: var(--tournament-action-max-width); }
.row-open svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row-open:hover { background: var(--sec-hover); }

.empty-state,
.loading-state {
  display: flex;
  height: 100%;
  min-height: 240px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.loading-state { min-height: 120px; color: var(--muted); }
.empty-state h3 { margin: 13px 0 6px; font-size: 16px; }
.empty-state p { margin-bottom: 17px; color: var(--muted); font-size: 12px; }

.empty-logo {
  display: block;
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 4px solid;
  font-size: 14px;
}

.alert-info { border-color: var(--prime); background: #e0e7f1; color: var(--prime); }
.alert-success { border-color: var(--success); background: #dcfce7; color: #14532d; }
.alert-warning { border-color: var(--warning); background: #fef3c7; color: #78350f; }
.alert-error { border-color: var(--error); background: #fee2e2; color: #7f1d1d; }

.notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 4;
  max-width: min(440px, calc(100vw - 40px));
  flex: initial;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 7px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.notice.show { opacity: 1; transform: translate(-50%, 0); }

.settings-view {
  display: flex;
  flex-direction: column;
  padding: 22px clamp(20px, 4vw, 58px);
}

.settings-topline { flex: 0 0 44px; }
.settings-topline .section-kicker { margin: 0; }
.back-button { min-height: 36px; padding: 0 10px 0 2px; border: 0; background: transparent; }
.back-button svg { transform: rotate(180deg); }

.settings-content {
  display: flex;
  width: min(100%, 1120px);
  flex: 1;
  flex-direction: column;
  justify-content: flex-start;
  align-self: center;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 32px;
}

.settings-content h1 { margin-top: 0; }
.general-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-top: 20px;
}
.settings-category { min-width: 0; padding: 20px; }
.settings-category h2 { margin: 0 0 7px; font-size: 16px; }
.settings-help { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.settings-field label { color: #475569; font-size: 11px; font-weight: 600; }
.settings-user-category { grid-column: 1 / -1; }
.settings-user-header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 16px; }
.settings-avatar-editor { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-avatar-editor > button { margin-left: auto; }
.settings-avatar-preview { display: flex; min-width: 0; align-items: center; gap: 10px; }
.settings-avatar-preview img { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; }
.settings-avatar-preview div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.settings-avatar-preview strong { font-size: 12px; }
.settings-avatar-preview span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.settings-person-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.settings-field input,
.settings-field select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.settings-field input:disabled,
.settings-field select:disabled { background: #f1f5f9; color: #94a3b8; }
.settings-person-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.settings-rule-grid,
.settings-rule-fields,
.settings-ranking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-timing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.settings-person-fields { margin-top: 12px; }
.settings-form { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.settings-form .settings-category { grid-column: 1 / -1; }
.settings-rules-category { grid-column: 1 / -1; }
.settings-rule-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: rgb(248 250 252 / 70%); }
.settings-rule-card h3,
.settings-ranking h3 { margin: 0 0 10px; font-size: 13px; }
.settings-ranking { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: rgb(248 250 252 / 70%); }
.settings-ranking .settings-help { margin-bottom: 10px; }
.settings-form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.settings-form .settings-category .settings-form-actions { margin-top: 16px; }
.settings-category .button { min-height: 38px; }

@media (max-width: 760px) {
  .settings-content { width: 100%; }
  .general-settings-grid,
  .settings-form { grid-template-columns: minmax(0, 1fr); }
  .settings-rules-category { grid-column: auto; }
  .settings-user-header { grid-template-columns: minmax(0, 1fr); }
  .settings-person-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-category { padding: 16px; }
  .settings-rule-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .settings-timing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .settings-ranking-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-person-fields { grid-template-columns: minmax(0, 1fr); }
  .settings-timing-grid { grid-template-columns: minmax(0, 1fr); }
}

.settings-placeholder {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
  padding: clamp(24px, 4vw, 42px);
}

.placeholder-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--sec);
  color: var(--prime);
}
.placeholder-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.settings-placeholder h2 { margin-bottom: 0; font-size: 19px; }
.settings-placeholder p { max-width: 560px; margin-bottom: 10px; color: var(--muted); line-height: 1.6; }
.database-reset-panel { display: flex; align-items: flex-start; flex-direction: column; gap: 0; margin-top: 16px; padding: 0; }
.database-reset-panel[hidden] { display: none; }
.database-reset-panel p { max-width: 560px; margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.workflow-view {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  background: transparent;
}

body::before {
  z-index: 0;
}

.step-sidebar {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 25px 14px 17px;
  border-right: 1px solid var(--line);
}

.sidebar-context {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0 7px 24px;
}

.sidebar-context > img {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.sidebar-context strong { min-width: 0; max-width: 170px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.step-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.step-nav-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 4px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
  text-align: left;
  cursor: pointer;
}

.step-nav-button:hover { background: #f8fafc; color: var(--ink); }
.step-nav-button[aria-current="step"] { background: var(--sec); color: var(--prime); font-weight: 700; }
.step-nav-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.step-nav-label { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.leave-button {
  justify-content: flex-start;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 9px;
  border-color: #fee2e2;
  background: #fff7f7;
  color: #b91c1c;
  font-size: 11px;
}
.leave-button:hover { background: #fef2f2; }
.leave-button svg { width: 16px; height: 16px; }

.step-main {
  display: grid;
  grid-template-rows: minmax(58px, auto) minmax(0, 1fr) 62px;
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(22px, 4vw, 54px);
}

.step-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.tournament-metrics { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 7px; }
.tournament-metric-badge { flex: 0 0 auto; padding: 6px 9px; border: 1px solid var(--sec); border-radius: 20px; background: var(--sec); color: var(--prime); font-size: 9px; font-weight: 700; white-space: nowrap; }
.tournament-status-badge { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; background: white; color: #64748b; font-size: 10px; font-weight: 700; }
.tournament-status-badge .status-dot { width: 6px; height: 6px; background: #94a3b8; box-shadow: none; }
.tournament-status-badge[data-status="open"] .status-dot { background: var(--warning); }
.tournament-status-badge[data-status="running"] .status-dot { background: var(--success); }
.tournament-status-badge[data-status="finished"] .status-dot { background: var(--prime); }

.step-content {
  min-height: 0;
  padding: clamp(19px, 3vh, 31px) 0 14px;
  overflow: auto;
  scrollbar-width: none;
}

.step-heading { margin-bottom: 22px; }
.step-heading h1 { margin-bottom: 6px; font-size: clamp(23px, 2.6vw, 30px); }
.step-heading p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.step-content h2 { margin-bottom: 6px; font-size: 15px; }
.step-content .subtle-copy { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

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

.form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tournament-form {
  grid-template-areas:
    "name logo"
    "date logo"
    "actions actions";
}
.tournament-form .tournament-name { grid-area: name; }
.tournament-form .tournament-date { grid-area: date; }
.tournament-form .logo-field { grid-area: logo; }
.tournament-form .tournament-actions { grid-area: actions; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.field[hidden] { display: none; }
.field.full-width { grid-column: 1 / -1; }
.field label,
.field-label { color: #334155; font-size: 11px; font-weight: 700; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 41px;
  padding: 9px 11px;
  border: 1px solid #dbe2eb;
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font-size: 12px;
}
.field textarea { min-height: 74px; resize: none; }
.field input::placeholder,
.field textarea::placeholder { color: #a0aec0; }
.field input[readonly],
.field input:disabled { background: #f1f5f9; color: var(--muted); cursor: not-allowed; }
.field-hint { color: var(--muted); font-size: 10px; }

.logo-upload-card {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  min-height: 124px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.logo-upload-card > img { width: 64px; height: 64px; flex: 0 0 64px; }
.logo-upload-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.logo-upload-copy strong { font-size: 10px; }
.logo-upload-copy span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.logo-upload-control { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #eef2f7; color: #94a3b8; font-size: 9px; font-weight: 700; cursor: not-allowed; }
.surface-inset {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.form-section { margin-bottom: 16px; }
.form-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.inline-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.person-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.person-form [hidden] { display: none !important; }
.person-form .person-team-name { grid-column: auto; justify-content: flex-end; }
.person-form .team-preview-field { grid-column: 1 / -1; }
.participant-preview-field { justify-content: flex-end; }
.participant-preview { display: flex; min-width: 0; align-items: center; gap: 9px; }
.participant-preview img { width: 41px; height: 41px; flex: 0 0 41px; border-radius: 50%; }
.team-preview-field .participant-preview img { width: 68px; flex-basis: 68px; }
.participant-preview span { overflow: hidden; color: #334155; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.team-preview-field .participant-preview span { overflow-wrap: anywhere; white-space: normal; }
.person-form .person-nickname { grid-column: 1 / -1; }
.person-form .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.form-actions .button { min-height: 37px; font-size: 11px; }
.person-avatar-control { display: flex; min-height: 41px; align-items: center; gap: 9px; }
.person-avatar-control img { width: 41px; height: 41px; flex: 0 0 41px; border-radius: 50%; }
.participant-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.participant-tile {
  display: flex;
  min-width: 0;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.participant-tile-avatar { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; }
.participant-tile-avatar.is-team { width: 68px; flex-basis: 68px; border-radius: 0; }
.participant-tile-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.participant-tile-copy strong { display: -webkit-box; overflow: hidden; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.participant-tile-copy span { color: var(--muted); font-size: 9px; }
.participant-tile-remove {
  display: inline-flex;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: #fef2f2;
  color: var(--error);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.participant-tile-remove:hover { background: #fee2e2; }
.participation-fee-card .form-section-header { align-items: center; margin-bottom: 0; }
.participation-fee-card.is-enabled .form-section-header { margin-bottom: 12px; }
.participation-fee-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.participation-fee-badge { gap: 7px; border-color: var(--line); cursor: pointer; }
.participation-fee-badge span { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.participation-fee-badge svg { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.participation-fee-badge.is-paid { border-color: var(--success); background: #dcfce7; color: #15803d; }
.participation-fee-badge:disabled { cursor: wait; opacity: .65; }
.table-empty { padding: 13px 7px; color: #94a3b8; font-size: 11px; }
.text-action { padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; color: #b91c1c; font-size: 10px; font-weight: 700; cursor: pointer; }
.text-action:hover { background: #fef2f2; }

.section-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 12px; }
.mode-card-grid > .surface-inset { min-width: 0; height: 100%; }
.phase-card-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.phase-card-header { align-items: flex-start; gap: 10px; }
.phase-card-header > div:first-child { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.phase-card-header .toggle { margin: 4px 0 0 12px; }
.phase-card-tools { display: flex; align-items: center; gap: 7px; margin: 0 0 0 12px; }
.phase-card-tools .toggle { margin: 0; }
.toggle:has(input:disabled) { opacity: .5; }
.toggle:has(input:disabled) .toggle-track { cursor: not-allowed; }
.phase-reset-button { width: 30px; height: 30px; flex: 0 0 30px; border-color: var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.phase-reset-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phase-reset-button:hover { background: var(--surface-soft); color: var(--prime); }
.group-settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.group-settings .field { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(100px, .8fr); align-items: center; column-gap: 12px; }
.group-settings .field input { min-width: 0; }
.group-settings .field-hint { grid-column: 2; }
.phase-card { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.phase-title { display: flex; align-items: center; margin-bottom: 13px; }
.phase-title strong { font-size: 12px; }
.compact-field { display: flex; flex-direction: column; gap: 5px; }
.compact-field label { color: var(--muted); font-size: 9px; font-weight: 600; }
.compact-field select,
.compact-field input { width: 100%; min-height: 34px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 10px; }
.compact-field select.is-invalid { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.compact-field select.is-invalid:focus-visible { outline-color: var(--error); }
.phase-controls { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: start; gap: 9px; }
.radio-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.radio-field legend { margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 600; }
.radio-options { display: flex; min-height: 34px; flex-direction: column; gap: 4px; }
.radio-options label { position: relative; display: flex; min-height: 30px; align-items: center; justify-content: center; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 7px; background: linear-gradient(#fff, #f1f5f9); box-shadow: 0 2px 0 #cbd5e1; color: var(--ink); font-size: 9px; line-height: 1.2; text-align: center; cursor: pointer; transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease; }
.radio-options label:has(input:checked) { border-color: var(--prime); background: #e0e7f1; box-shadow: inset 0 2px 4px rgb(18 53 91 / 18%), 0 1px 0 #cbd5e1; color: var(--prime); font-weight: 700; transform: translateY(1px); }
.radio-options label:focus-within { outline: 2px solid var(--prime); outline-offset: 2px; }
.radio-options input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.group-scoring { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.group-scoring h3 { margin: 0 0 4px; font-size: 11px; }
.group-scoring .summary-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.group-ranking-error { margin: 0 0 9px; font-size: 11px; }
.placement-rounds { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

@media (max-width: 1200px) {
  .phase-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .mode-card-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .group-settings { grid-template-columns: minmax(0, 1fr); }
}

.option-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid #eef2f7; }
.option-row:last-child { border-bottom: 0; }
.broadcast-divider { height: 4px; margin: 8px 0; border-radius: 2px; background: var(--sec); }
.option-copy strong { display: block; margin-bottom: 3px; font-size: 11px; }
.option-copy span { color: var(--muted); font-size: 10px; }
.toggle { position: relative; width: 35px; height: 20px; flex: 0 0 35px; }
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track { position: absolute; inset: 0; border-radius: 20px; background: #cbd5e1; cursor: pointer; transition: background 120ms ease; }
.toggle-track::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: white; content: ""; transition: transform 120ms ease; }
.toggle input:checked + .toggle-track { background: var(--prime); }
.toggle input:checked + .toggle-track::after { transform: translateX(15px); }

.draw-workspace { display: grid; gap: 16px; }
.draw-entries-panel .form-section-header { align-items: center; margin-bottom: 12px; }
.draw-entries-panel h2,
.draw-section > h2 { margin: 0 0 5px; font-size: 13px; }
.draw-entries-panel .subtle-copy { margin: 4px 0 0; }
.draw-participant-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.draw-participant-badges[hidden] { display: none; }
.draw-player-badge { display: inline-flex; max-width: 100%; align-items: center; padding: 5px 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.draw-player-badge.is-disqualified { border-color: var(--error); background: #fee2e2; color: #b91c1c; }
.draw-empty { color: var(--muted); font-size: 10px; }
.draw-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.draw-entries-panel .button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.group-card { min-width: 0; min-height: 96px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.group-card h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 9px; font-size: 11px; }
.group-letter { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 7px; background: var(--sec); color: var(--prime); font-size: 10px; }
.group-players { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 5px; }
.group-players .draw-player-badge { justify-content: center; padding: 5px 9px; }
.group-players .draw-empty { overflow-wrap: anywhere; }
.draw-section { min-width: 0; }
.draw-bracket-pair { display: grid; grid-template-columns: minmax(0, 1fr) 5px minmax(0, 1fr); align-items: stretch; gap: 18px; }
.draw-bracket-divider { border-radius: 3px; background: var(--prime); }
.draw-bracket { display: grid; grid-template-columns: minmax(0, 1fr) 4px minmax(0, 1fr); align-items: stretch; gap: 14px; padding: 4px 0 8px; }
.draw-bracket-single-round { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bracket-side { display: flex; min-width: 0; flex-direction: column; }
.bracket-matches { display: flex; flex: 1; flex-direction: column; justify-content: space-around; gap: 8px; }
.bracket-match { display: flex; align-items: center; gap: 7px; }
.bracket-match .draw-player-badge { flex: 0 1 auto; }
.bracket-vs { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.bracket-side:last-child .bracket-matches { align-items: flex-end; }
.bracket-side:last-child .bracket-match { align-items: center; justify-content: flex-end; }
.bracket-side:last-child .bracket-match .draw-player-badge { text-align: right; }
.bracket-omitted-rounds { align-self: stretch; border-radius: 2px; background: var(--sec); }
.draw-player-badge-bye { border-style: dashed; background: #e2e8f0; color: var(--muted); opacity: .6; }

@media (max-width: 1100px) {
  .draw-bracket-pair,
  .draw-bracket { grid-template-columns: minmax(0, 1fr); }
  .draw-bracket-divider,
  .bracket-omitted-rounds { width: 100%; height: 4px; }
  .draw-bracket-divider { background: var(--sec); }
  .bracket-side:last-child .bracket-matches { align-items: flex-start; }
  .bracket-side:last-child .bracket-match { justify-content: flex-start; }
  .bracket-side:last-child .bracket-match .draw-player-badge { text-align: left; }
  .bracket-match { flex-wrap: wrap; }
}

.info-banner { margin-bottom: 14px; }
.info-banner-after { margin-top: 14px; margin-bottom: 0; }
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.board-setup-content { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: center; gap: 20px; }
.board-number { max-width: 260px; }
.client-qr-panel { display: flex; min-width: 0; flex-direction: column; align-items: flex-end; justify-content: flex-start; gap: 7px; }
.client-qr-code { display: grid; width: 120px; height: 120px; flex: 0 0 120px; place-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.client-qr-code svg { display: block; width: 100%; height: 100%; }
.client-qr-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 10px; text-align: right; }
.client-qr-copy strong { font-size: 12px; }
.client-qr-copy a { overflow-wrap: anywhere; color: var(--prime); }
.client-qr-copy span { color: var(--muted); }
.client-connections { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: white; }
.client-connection-row { display: grid; grid-template-columns: minmax(140px, .7fr) minmax(0, 1.3fr) 40px; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border-top: 1px solid var(--line); }
.client-connection-row:first-child { border-top: 0; }
.client-connection-header { min-height: 36px; background: var(--surface-soft); color: var(--muted); font-size: 9px; font-weight: 700; }
.client-board-label { font-size: 11px; font-weight: 650; }
.client-id { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }
.client-connection-action { width: 40px; }
.client-disconnect-button { justify-self: end; color: var(--error); }
.client-disconnect-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.client-connections-empty { padding: 18px 12px; color: var(--muted); font-size: 11px; text-align: center; }

.deferred-panel { display: flex; align-items: flex-start; gap: 15px; padding: 21px; }
.deferred-mark { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 13px; background: #fff6e5; color: #b77908; font-size: 18px; }
.deferred-panel h2 { margin: 2px 0 6px; }
.deferred-panel p { max-width: 590px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-bottom: 15px; }
.summary-chip { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.summary-chip span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.summary-chip strong { font-family: "Segoe UI", Arial, sans-serif; font-size: 17px; }
.match-table { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.match-row { display: block; padding: 0; border: 0; background: transparent; }
.match-row-action,
.match-row-static { display: grid; grid-template-columns: 65px minmax(110px, .7fr) minmax(0, 1.8fr); align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); text-align: left; }
.match-row-action { cursor: pointer; }
.match-row-action:hover { border-color: var(--prime); background: white; }
.match-number { color: var(--ink); font-size: 11px; font-weight: 700; }
.match-phase { color: var(--muted); font-size: 10px; }
.match-players { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; color: var(--ink); font-size: 11px; font-weight: 600; }
.match-players span { min-width: 0; overflow-wrap: anywhere; }
.match-players span:last-child { text-align: right; }
.match-versus { color: var(--muted); font-size: 10px; font-weight: 400; }
.match-result { grid-column: 3; color: var(--prime); font-size: 10px; font-weight: 700; text-align: right; }
.match-placeholder { display: grid; min-height: 102px; place-items: center; border: 1px dashed #cbd5e1; border-radius: 10px; color: var(--muted); font-size: 11px; text-align: center; }
.match-result-dialog { width: min(520px, calc(100vw - 28px)); max-width: none; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); box-shadow: 0 24px 70px rgb(15 23 42 / 25%); }
.match-result-dialog::backdrop { background: rgb(15 23 42 / 50%); }
.match-result-dialog .form-section-header { margin-bottom: 15px; }
.match-result-dialog h2 { margin: 0 0 4px; font-size: 17px; }
.match-result-dialog .subtle-copy { margin: 0; }
.match-result-grid { display: grid; gap: 7px; margin-bottom: 12px; }
.match-result-header,
.match-result-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px; align-items: center; gap: 8px; }
.match-result-header { color: var(--muted); font-size: 10px; text-align: center; }
.match-result-row { font-size: 11px; font-weight: 600; }
.match-result-row span { overflow-wrap: anywhere; }
.match-result-row input { min-width: 0; width: 100%; }
.match-result-error { margin: 10px 0; }

@media (max-width: 600px) {
  .match-row-action,
  .match-row-static { grid-template-columns: auto minmax(0, 1fr); gap: 5px 10px; }
  .match-players { grid-column: 1 / -1; }
  .match-result { grid-column: 1 / -1; text-align: left; }
  .match-result-dialog { padding: 15px; }
  .match-result-header,
  .match-result-row { grid-template-columns: minmax(0, 1fr) 58px 58px; gap: 6px; }
}

.bottombar {
  position: relative;
  padding: 0 27px;
  border-top: 1px solid var(--line);
  color: #94a3b8;
  font-size: 10px;
}
.footer-spacer { width: 80px; }
.footer-credit { position: absolute; left: 50%; display: inline-flex; align-items: center; gap: 4px; color: #64748b; transform: translateX(-50%); white-space: nowrap; }
.footer-credit strong { color: #475569; font-weight: 700; }
.footer-icon { display: inline-block; width: 13px; height: 13px; flex: 0 0 auto; vertical-align: middle; }
.footer-heart { fill: #ff1744; }
.footer-beer { width: 16px; height: 16px; overflow: visible; }
.beer-liquid { fill: #f2b632; }
.beer-foam { fill: #fff3bd; }
.beer-outline { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.footer-copilot { fill: var(--ink); }
.footer-version { min-width: 80px; color: #64748b; text-align: right; }

@media (max-height: 740px) and (min-width: 761px) {
  .view-overview { gap: 15px; padding-top: 17px; padding-bottom: 14px; }
  .stat-card { min-height: 70px; }
  .step-sidebar { padding-top: 16px; padding-bottom: 10px; }
  .sidebar-context { margin-bottom: 13px; }
  .step-nav { gap: 0; }
  .step-nav-button { min-height: 33px; }
  .step-main { grid-template-rows: 48px minmax(0, 1fr) 54px; }
  .step-content { padding-top: 16px; }
  .step-heading { margin-bottom: 15px; }
  .form-section { margin-bottom: 10px; }
  .surface-inset { padding: 13px; }
}

@media (max-width: 900px) {
  .topbar { padding: 0 20px; }
  .view-overview { padding-right: 24px; padding-left: 24px; }
  .workflow-view { grid-template-columns: 205px minmax(0, 1fr); }
  .step-main { padding-right: 24px; padding-left: 24px; }
  .step-nav-label { font-size: 10px; }
}

@media (max-width: 760px) {
  .app-frame { grid-template-rows: 56px minmax(0, 1fr) 34px; }
  .topbar { padding: 0 13px; }
  .brand img { width: 155px; }
  .topbar-actions { gap: 2px; }
  .icon-button { width: 31px; height: 31px; }
  .view-overview { gap: 14px; padding: 20px 14px 12px; }
  .overview-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .overview-heading h1 { font-size: 26px; }
  .overview-actions { width: 100%; }
  .overview-actions .button { flex: 1; padding-right: 9px; padding-left: 9px; font-size: 11px; }
  .overview-stats { gap: 7px; }
  .stat-card { min-height: 66px; gap: 7px; padding: 9px; }
  .stat-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; font-size: 9px; }
  .stat-label { min-height: 24px; font-size: 9px; line-height: 1.2; }
  .stat-card strong { font-size: 17px; }
  .surface-heading { padding: 14px; }
  .surface-heading h2 { font-size: 14px; }
  .surface-heading p { max-width: 210px; font-size: 10px; line-height: 1.4; }
  .surface-heading .button { gap: 4px; padding: 0 8px; font-size: 10px; }
  .connection-state { padding: 7px 14px; font-size: 10px; }
  .tournament-row { grid-template-areas: "name status" "date date" "winner winner" ". action"; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; min-height: 76px; padding: 10px 14px; }
  .row-label { display: inline; margin-right: 5px; }
  .status-pill { font-size: 9px; }
  .workflow-view { grid-template-columns: 1fr; grid-template-rows: 113px minmax(0, 1fr); }
  .step-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 29px; grid-template-rows: 32px 35px; align-content: center; column-gap: 8px; row-gap: 4px; min-height: 0; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-context { grid-column: 1 / -1; min-height: 32px; margin: 0 2px; }
  .sidebar-context > img { width: 27px; height: 27px; flex-basis: 27px; }
  .sidebar-context strong { max-width: 190px; font-size: 12px; }
  .step-nav { grid-column: 1; grid-row: 2; min-width: 0; flex: initial; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .step-nav-button { display: flex; width: auto; min-width: 34px; min-height: 32px; justify-content: center; padding: 3px; }
  .step-nav-button svg { width: 18px; height: 18px; flex: 0 0 18px; }
  .step-nav-label { display: none; }
  .leave-button { position: static; grid-column: 2; grid-row: 2; display: inline-flex; width: 29px; min-height: 29px; justify-content: center; margin: 0; padding: 0; font-size: 9px; }
  .leave-button svg { width: 13px; height: 13px; }
  .step-main { grid-template-rows: minmax(39px, auto) minmax(0, 1fr) 53px; padding: 0 14px; }
  .step-toolbar { gap: 6px; }
  .tournament-metrics { gap: 4px; }
  .tournament-metric-badge { padding: 4px 6px; font-size: 8px; }
  .tournament-status-badge { padding: 4px 7px; font-size: 8px; }
  .step-content { padding: 12px 0 9px; }
  .step-heading { margin-bottom: 12px; }
  .step-heading h1 { margin-bottom: 3px; font-size: 22px; }
  .step-heading p { font-size: 10px; line-height: 1.4; }
  .step-content h2 { font-size: 13px; }
  .step-content .subtle-copy { font-size: 10px; }
  .board-setup-content { grid-template-columns: minmax(0, 1fr); }
  .board-number { max-width: none; }
  .step-controls { border-top: 1px solid var(--line); }
  .step-controls .button { min-height: 36px; padding: 0 11px; font-size: 10px; }
  .form-grid,
  .form-grid.three-columns,
  .inline-form { gap: 9px; }
  .field { gap: 5px; }
  .field label,
  .field-label { font-size: 10px; }
  .field input,
  .field select { min-height: 36px; padding: 7px 8px; font-size: 10px; }
  .participant-preview-field .participant-preview { flex: 0 0 36px; min-height: 0; }
  .field textarea { min-height: 55px; padding: 7px 8px; font-size: 10px; }
  .surface-inset { padding: 11px; }
  .form-section-header { margin-bottom: 10px; }
  .form-actions { margin-top: 10px; }
  .form-actions .button { min-height: 33px; }
  .section-card-grid { gap: 7px; }
  .phase-card { padding: 9px; }
  .phase-title { margin-bottom: 8px; }
  .phase-title strong { font-size: 10px; }
  .phase-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .compact-field { gap: 3px; }
  .compact-field label { font-size: 8px; }
  .compact-field select,
  .compact-field input { min-height: 29px; padding: 4px 5px; font-size: 9px; }
  .radio-options { min-height: 29px; gap: 4px; }
  .radio-options label { min-height: 27px; padding: 4px 5px; font-size: 8px; }
  .board-layout { gap: 8px; }
  .draw-groups { gap: 6px; }
  .draw-bracket-pair { gap: 8px; }
  .draw-bracket { gap: 8px; }
  .group-card { min-height: 74px; padding: 7px; }
  .group-card h3 { margin-bottom: 5px; font-size: 9px; }
  .group-letter { width: 18px; height: 18px; font-size: 8px; }
  .info-banner { padding: 10px 12px; }
  .board-setup-content { gap: 10px; }
  .client-qr-panel { gap: 8px; }
  .client-qr-code { width: 90px; height: 90px; flex-basis: 90px; }
  .client-qr-copy { font-size: 8px; }
  .client-qr-copy strong { font-size: 10px; }
  .client-connection-row { grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr) 34px; gap: 7px; min-height: 40px; padding: 5px 8px; }
  .client-connection-header { min-height: 30px; }
  .client-connections-empty { padding: 13px 8px; font-size: 9px; }
  .summary-strip { gap: 5px; }
  .summary-chip { padding: 8px; }
  .summary-chip span { font-size: 8px; }
  .summary-chip strong { font-size: 14px; }
  .match-placeholder { min-height: 78px; font-size: 9px; }
  .settings-view { padding: 13px 16px; }
  .settings-topline { flex-basis: 36px; }
  .settings-topline .section-kicker { font-size: 8px; }
  .settings-content { padding-bottom: 25px; }
  .settings-content h1 { font-size: 28px; }
  .settings-content .subheading { font-size: 11px; }
  .settings-placeholder { gap: 8px; margin-top: 19px; padding: 22px; }
  .settings-placeholder h2 { font-size: 16px; }
  .settings-placeholder p { font-size: 11px; line-height: 1.5; }
  .bottombar { padding: 0 12px; font-size: 9px; }
  .footer-spacer,
  .footer-version { min-width: 55px; width: 55px; }
}

@media (max-width: 760px) and (orientation: portrait) {
  .leave-button span {
    display: none;
  }
}

@media (max-width: 420px) {
  .topbar { padding: 0 10px; }
  .brand img { width: 112px; }
  .topbar-actions { gap: 1px; }
  .phase-controls { grid-template-columns: minmax(0, 1fr); }
  .language-indicator { width: 22px; min-width: 22px; font-size: 11px; }
  .header-divider { height: 20px; margin: 0 3px 0 1px; }
  .topbar-actions .icon-button { width: 29px; height: 29px; }
  .overview-actions .button { gap: 5px; font-size: 10px; }
  .overview-actions .button svg { width: 15px; height: 15px; }
  .overview-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-card { align-items: flex-start; flex-direction: column; gap: 3px; }
  .stat-icon { display: none; }
  .form-grid,
  .form-grid.three-columns,
  .inline-form { grid-template-columns: 1fr; }
  .tournament-form {
    grid-template-areas:
      "name"
      "date"
      "logo"
      "actions";
  }
  .tournament-form .logo-upload-card { min-height: 70px; flex-direction: row; }
  .tournament-form .logo-upload-card > img { width: 48px; height: 48px; flex-basis: 48px; }
  .person-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person-form .field.full-width { grid-column: 1 / -1; }
  .field.full-width { grid-column: auto; }
  .board-setup-content { grid-template-columns: minmax(0, 1fr); }
  .board-number { max-width: none; }
  .group-card { min-height: 70px; }
  .client-qr-code { width: 76px; height: 76px; flex-basis: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
