:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66737c;
  --line: #dfe6ea;
  --primary: #136f63;
  --primary-dark: #0e5148;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

.topbar {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  text-decoration: none;
  font-size: 20px;
}

.topbar nav,
.actions,
.tabs {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar nav a,
.tabs a {
  color: var(--muted);
  text-decoration: none;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto;
}

footer {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto;
  color: var(--muted);
  font-size: 13px;
}

.page-head,
.display-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0 0 8px;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 20px;
}

p {
  margin: 0;
  color: var(--muted);
}

.help {
  font-size: 13px;
  line-height: 1.4;
}

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

.flow > * + * {
  margin-top: 14px;
}

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

.participant-edit {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(110px, 0.7fr) minmax(180px, 1.5fr) minmax(110px, 0.7fr) minmax(86px, 0.5fr);
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.participant-edit:last-of-type {
  border-bottom: 0;
}

.participant-edit textarea {
  min-height: 42px;
}

.participant-edit-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.grid.two {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(8, 28px);
  gap: 8px;
  align-items: center;
}

.color-swatch {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.color-swatch:hover,
.color-swatch:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary);
}

.color-swatch span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.button,
button.button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 14px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

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

.button.small {
  min-height: 32px;
  padding: 6px 10px;
}

.link {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
}

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

.danger-button {
  color: var(--danger);
  border-color: #f1b8b2;
}

.wrap {
  flex-wrap: wrap;
}

.confirm-action {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.confirm-action label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confirm-action input[type="checkbox"] {
  width: auto;
}

.tabs {
  border-bottom: 1px solid var(--line);
  margin: 8px 0 18px;
}

.tabs a {
  padding: 12px 10px;
  border-bottom: 3px solid transparent;
}

.tabs a.active {
  color: var(--ink);
  border-color: var(--primary);
}

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

th,
td {
  text-align: left;
  padding: 11px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.participant-label {
  display: inline-grid;
  gap: 2px;
  min-width: 0;
  vertical-align: middle;
}

.participant-label strong {
  color: inherit;
  font: inherit;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-label small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-place .participant-label small {
  font-size: 14px;
}

.match-participants {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.match-participants em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.status,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #fbfcfc;
  white-space: nowrap;
}

.badge-draft,
.badge-scheduled,
.badge-score-empty {
  color: #665200;
  border-color: #f2d56b;
  background: #fff7cf;
}

.badge-configured,
.badge-score-draft {
  color: #754210;
  border-color: #f1b66d;
  background: #fff0de;
}

.badge-running {
  color: #064b75;
  border-color: #84c5ee;
  background: #e1f3ff;
}

.badge-finished,
.badge-score-ok {
  color: #0f5132;
  border-color: #8fd1ad;
  background: #dff7ea;
}

.badge-cancelled {
  color: #842029;
  border-color: #f1aeb5;
  background: #f8d7da;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stats div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stats strong {
  display: block;
  font-size: 30px;
}

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

.public-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.public-stats div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.public-stats strong {
  display: block;
  font-size: 30px;
}

.public-stats span {
  color: var(--muted);
}

.progress-block {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.progress-block > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.progress-block span {
  color: var(--muted);
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef1;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.public-highlight {
  display: grid;
  gap: 12px;
}

.public-highlight p {
  display: grid;
  gap: 4px;
}

.public-highlight strong {
  color: var(--ink);
}

.public-rules {
  display: grid;
  gap: 10px;
}

.public-rules p {
  color: var(--muted);
  font-weight: 700;
}

.public-rules ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.public-rules li {
  line-height: 1.45;
}

.public-qualified {
  display: grid;
  gap: 10px;
}

.public-qualified p {
  color: var(--muted);
  font-weight: 700;
}

.public-qualified ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.public-qualified li {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.public-qualified li:last-child {
  border-bottom: 0;
}

.public-qualified span,
.public-qualified em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.public-pool-standings {
  display: grid;
  gap: 12px;
}

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

.pool-ranking {
  display: grid;
  gap: 8px;
}

.pool-ranking h3 {
  margin: 0;
  font-size: 15px;
}

.compact-standings th,
.compact-standings td {
  padding: 7px 8px;
}

.compact-standings {
  table-layout: auto;
}

.compact-standings th:nth-child(2),
.compact-standings td:nth-child(2) {
  width: auto;
}

.compact-standings th:nth-child(1),
.compact-standings td:nth-child(1),
.compact-standings th:nth-child(3),
.compact-standings td:nth-child(3),
.compact-standings th:nth-child(4),
.compact-standings td:nth-child(4),
.compact-standings th:nth-child(5),
.compact-standings td:nth-child(5) {
  width: 1%;
  white-space: nowrap;
}

.is-temporary-qualified {
  background: #e8f7f2;
}

.qualifier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #136f63;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.qualifier-badge-detail {
  justify-content: flex-start;
}

.finished-view {
  display: grid;
  gap: 18px;
}

.podium {
  display: grid;
  gap: 16px;
}

.podium-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.podium-place {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  text-align: center;
}

.podium-rank {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #e8eef1;
  font-size: 22px;
  font-weight: 900;
}

.podium-place strong {
  font-size: 18px;
}

.podium-place-1 {
  order: 2;
  min-height: 156px;
  border-color: #f4c542;
  background: #fff8d7;
}

.podium-place-1 .podium-rank {
  background: #f4c542;
  color: #332500;
}

.podium-place-2 {
  order: 1;
  min-height: 128px;
}

.podium-place-3 {
  order: 3;
  min-height: 112px;
}

.final-ranking {
  overflow-x: auto;
}

.final-bracket {
  display: grid;
  gap: 14px;
  overflow-x: auto;
}

.bracket-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 54px;
  align-items: stretch;
  min-width: max-content;
  padding: 6px 18px 6px 0;
}

.bracket-round {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  min-width: 220px;
}

.bracket-round h3 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.bracket-round-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 24px;
  min-height: 220px;
}

.bracket-count-1 .bracket-round-matches {
  justify-content: center;
}

.bracket-count-2 .bracket-round-matches {
  min-height: 260px;
}

.bracket-count-4 .bracket-round-matches {
  min-height: 460px;
}

.bracket-match {
  display: grid;
  gap: 6px;
  position: relative;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.has-next-round .bracket-match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -55px;
  width: 55px;
  border-top: 2px solid #c8d2d8;
}

.has-next-round .bracket-match:nth-child(odd)::before,
.has-next-round .bracket-match:nth-child(even)::before {
  content: "";
  position: absolute;
  right: -55px;
  width: 28px;
  border-right: 2px solid #c8d2d8;
}

.has-next-round .bracket-match:nth-child(odd)::before {
  top: 50%;
  bottom: -50%;
}

.has-next-round .bracket-match:nth-child(even)::before {
  top: -50%;
  bottom: 50%;
}

.has-next-round.bracket-count-1 .bracket-match::before {
  display: none;
}

.bracket-match small {
  color: var(--muted);
}

.bracket-match p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.bracket-match .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket-match .team-score {
  text-align: right;
}

.bracket-match p.winner {
  color: #0f5132;
  font-weight: 800;
}

.bracket-match strong {
  color: inherit;
}

.final-next-bracket {
  display: grid;
  gap: 14px;
}

.next-bracket-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 44px;
  align-items: stretch;
}

.next-bracket-round {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-width: 0;
}

.next-bracket-round h3 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.next-bracket-matches {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
  min-height: 0;
}

.next-bracket-match {
  display: grid;
  gap: 6px;
  position: relative;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.next-bracket-round:first-child .next-bracket-match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -45px;
  width: 45px;
  border-top: 2px solid #c8d2d8;
}

.next-bracket-match small {
  color: var(--muted);
}

.next-bracket-match p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.next-bracket-match p.winner {
  color: var(--primary);
  font-weight: 800;
}

.next-bracket-match .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-bracket-match .team-score {
  text-align: right;
}

.field-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}

.field-card {
  display: grid;
  gap: 16px;
}

.field-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.field-card header span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.field-current {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #84c5ee;
  border-radius: 8px;
  background: #f0f8ff;
}

.field-current strong {
  font-size: 18px;
}

.field-current small {
  color: var(--muted);
}

.field-current .score-form {
  grid-template-columns: 64px 14px 64px auto;
}

.field-current .autosave-state {
  grid-column: 1 / -1;
}

.field-list {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.field-list h3 {
  margin: 0;
  font-size: 14px;
}

.field-list p {
  display: grid;
  gap: 2px;
}

.field-list span {
  color: var(--muted);
  font-size: 12px;
}

.empty.compact {
  padding: 10px;
}

.score-form {
  display: grid;
  grid-template-columns: 74px 16px 74px auto minmax(98px, 1fr);
  gap: 8px;
  align-items: center;
}

.autosave-state {
  color: var(--muted);
  font-size: 12px;
}

.autosave-state[data-state="ok"] {
  color: #0f5132;
}

.autosave-state[data-state="error"] {
  color: var(--danger);
}

.autosave-state[data-state="saving"],
.autosave-state[data-state="pending"] {
  color: #754210;
}

.flash {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  background: #fff8e1;
  border: 1px solid #f0d98c;
  border-radius: 8px;
  padding: 12px 14px;
}

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

.qr-image {
  width: 132px;
  height: 132px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.display {
  background: #101820;
  color: #f8fbfc;
  overflow: hidden;
}

.display .topbar,
.display footer {
  display: none;
}

.display main {
  width: calc(100vw - 32px);
  height: calc(100vh - 24px);
  margin: 12px 16px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) minmax(0, 0.48fr);
  gap: 10px;
  overflow: hidden;
}

.display-complete main {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.display p,
.display th {
  color: #aebbc2;
}

.display .participant-label {
  gap: 3px;
}

.display .participant-label small {
  color: #aebbc2;
  font-size: clamp(10px, 0.62vw, 12px);
}

.display .podium-place .participant-label {
  gap: 7px;
}

.display .podium-place .participant-label small {
  color: #dce6ea;
  font-size: clamp(16px, 1.1vw, 24px);
  font-weight: 700;
}

.display .match-participants {
  gap: 10px;
}

.display .panel {
  background: #17242d;
  border-color: #2e424e;
  box-shadow: none;
  min-width: 0;
  margin-bottom: 0;
  overflow: hidden;
  padding: 12px;
}

.display .badge {
  border-color: #2e424e;
}

.display table {
  display: table;
  width: 100%;
  table-layout: fixed;
  font-size: clamp(13px, 0.78vw, 16px);
}

.display th,
.display td {
  overflow: hidden;
  padding: 7px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display table th {
  color: #d6e1e6;
  font-size: clamp(11px, 0.68vw, 13px);
  text-transform: uppercase;
}

.display .public-stats div,
.display .progress-block {
  background: #17242d;
  border-color: #2e424e;
  margin-bottom: 0;
}

.display .public-stats strong {
  color: #ffffff;
  font-size: clamp(28px, 2.15vw, 40px);
}

.display .public-stats span,
.display .progress-block span {
  color: #aebbc2;
  font-size: clamp(13px, 0.78vw, 16px);
}

.display .progress-bar {
  background: #2e424e;
}

.display .progress-bar span {
  background: #49c5a9;
}

.display .public-highlight strong {
  color: #ffffff;
}

.display .public-rules p {
  color: #aebbc2;
  font-size: clamp(14px, 0.82vw, 16px);
}

.display .public-rules li {
  color: #f8fbfc;
  font-size: clamp(13px, 0.78vw, 16px);
}

.display .public-qualified p,
.display .public-qualified span,
.display .public-qualified em {
  color: #aebbc2;
}

.display .public-qualified strong {
  color: #f8fbfc;
}

.display .public-qualified li {
  border-bottom-color: #2e424e;
  grid-template-columns: 70px 1fr auto;
  padding: 5px 0;
}

.display .public-pool-standings {
  gap: 8px;
}

.display .pool-standings-grid {
  gap: 10px;
}

.display .pool-ranking {
  gap: 5px;
}

.display .pool-ranking h3 {
  color: #f8fbfc;
  font-size: clamp(15px, 0.9vw, 17px);
}

.display .compact-standings th,
.display .compact-standings td {
  padding: 5px 6px;
}

.display .compact-standings {
  table-layout: auto;
}

.display .compact-standings th,
.display .compact-standings td {
  overflow: visible;
  text-overflow: clip;
}

.display .compact-standings th:nth-child(1),
.display .compact-standings td:nth-child(1) {
  width: 28px;
}

.display .compact-standings th:nth-child(3),
.display .compact-standings td:nth-child(3),
.display .compact-standings th:nth-child(4),
.display .compact-standings td:nth-child(4),
.display .compact-standings th:nth-child(5),
.display .compact-standings td:nth-child(5) {
  width: 42px;
  text-align: right;
}

.display .compact-standings th:nth-child(6),
.display .compact-standings td:nth-child(6) {
  width: 132px;
  text-align: right;
}

.display .is-temporary-qualified {
  background: rgba(73, 197, 169, 0.14);
}

.display .qualifier-badge {
  background: #49c5a9;
  color: #09231d;
  font-size: clamp(9px, 0.58vw, 11px);
}

.display .qualifier-badge-detail {
  max-width: 100%;
}

.display .finished-view {
  gap: 8px;
  min-height: 0;
}

.display .completed-display {
  display: grid;
  grid-template-rows: minmax(0, 0.46fr) minmax(0, 0.54fr);
}

.display .podium {
  gap: 8px;
  min-height: 0;
  padding: 10px;
}

.display .podium-steps {
  gap: 14px;
  min-height: 0;
}

.display .podium-place {
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  padding: 10px 12px;
  border-width: 2px;
  border-color: #3d5360;
  background: #1b2a34;
  color: #f8fbfc;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.display .podium-place .participant-label {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
}

.display .podium-place .participant-label strong {
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  overflow: visible;
  text-overflow: clip;
}

.display .podium-place .participant-label small {
  display: block;
  max-width: 92%;
  color: #e5edf1;
  font-size: clamp(13px, 0.85vw, 17px);
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-shadow: none;
}

.display .podium-rank {
  width: 42px;
  height: 42px;
  background: #6d7d87;
  color: #f8fbfc;
  font-size: clamp(22px, 1.55vw, 32px);
}

.display .podium-place strong {
  font-size: clamp(22px, 1.75vw, 34px);
  line-height: 1.05;
}

.display .podium-place-1 {
  min-height: 130px;
  border-color: #f4c542;
  background: linear-gradient(180deg, #4a3b12 0%, #2f2919 100%);
  box-shadow: 0 0 0 1px rgba(244, 197, 66, 0.35), 0 0 28px rgba(244, 197, 66, 0.18);
}

.display .podium-place-1 .podium-rank {
  background: #f4c542;
  color: #332500;
}

.display .podium-place-1 strong {
  font-size: clamp(28px, 2.25vw, 44px);
}

.display .podium-place-2 {
  min-height: 112px;
  border-color: #b9c7cf;
  background: linear-gradient(180deg, #354751 0%, #22313a 100%);
}

.display .podium-place-2 .podium-rank {
  background: #d7e0e5;
  color: #172026;
}

.display .podium-place-3 {
  min-height: 108px;
  border-color: #c9914b;
  background: linear-gradient(180deg, #4a3320 0%, #2d261f 100%);
}

.display .podium-place-3 .podium-rank {
  background: #d79a4b;
  color: #221407;
}

.display .final-ranking {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 10px 12px;
}

.final-standing-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.final-standing-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.final-standing-card > span {
  color: var(--muted);
  font-weight: 800;
}

.final-standing-card em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.display .final-standing-cards {
  gap: 6px 10px;
  min-height: 0;
  overflow: hidden;
}

.display .final-standing-card {
  padding: 4px 8px;
  border-color: #2e424e;
  background: #101820;
  min-height: 0;
}

.display .final-standing-card .participant-label small {
  font-size: clamp(9px, 0.54vw, 11px);
}

.display .final-standing-card em {
  color: #aebbc2;
  font-size: clamp(11px, 0.62vw, 13px);
}

.display .final-ranking h2 {
  margin-bottom: 5px;
}

@media (min-width: 1500px) {
  .display-complete .final-standing-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.display .final-bracket {
  gap: 7px;
  overflow: hidden;
}

.display .bracket-grid {
  grid-auto-columns: minmax(132px, 1fr);
  gap: 24px;
  min-width: 0;
  padding-right: 0;
}

.display .bracket-round {
  gap: 7px;
  min-width: 0;
}

.display .bracket-round-matches {
  gap: 9px;
  min-height: 110px;
}

.display .bracket-count-2 .bracket-round-matches {
  min-height: 150px;
}

.display .bracket-count-4 .bracket-round-matches {
  min-height: 240px;
}

.display .bracket-round h3,
.display .bracket-match small {
  color: #aebbc2;
}

.display .bracket-round h3 {
  font-size: clamp(11px, 0.68vw, 13px);
}

.display .bracket-match {
  gap: 4px;
  padding: 7px;
  border-color: #2e424e;
  background: #101820;
}

.display .has-next-round .bracket-match::after {
  right: -25px;
  width: 25px;
  border-top-color: #536671;
}

.display .has-next-round .bracket-match:nth-child(odd)::before,
.display .has-next-round .bracket-match:nth-child(even)::before {
  right: -25px;
  width: 12px;
  border-right-color: #536671;
}

.display .bracket-match p {
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  padding: 4px 0;
  border-top-color: #2e424e;
  color: #f8fbfc;
  font-size: clamp(12px, 0.78vw, 15px);
}

.display .bracket-match p.winner {
  color: #49c5a9;
}

.display .final-next-bracket {
  gap: 8px;
  align-content: start;
}

.display .next-bracket-grid {
  grid-auto-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 0;
}

.display .next-bracket-round {
  gap: 7px;
}

.display .next-bracket-round h3,
.display .next-bracket-match small {
  color: #aebbc2;
}

.display .next-bracket-round h3 {
  font-size: clamp(12px, 0.72vw, 14px);
}

.display .next-bracket-matches {
  gap: 10px;
  min-height: 0;
}

.display .next-bracket-match {
  gap: 4px;
  padding: 7px;
  border-color: #2e424e;
  background: #101820;
}

.display .next-bracket-match.is-upcoming {
  border-color: #49c5a9;
  background: #17332f;
}

.display .next-bracket-round:first-child .next-bracket-match::after {
  right: -23px;
  width: 23px;
  border-top-color: #536671;
}

.display .next-bracket-match p {
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  padding: 3px 0;
  border-top-color: #2e424e;
  color: #f8fbfc;
  font-size: clamp(13px, 0.82vw, 16px);
}

.display .next-bracket-match p.winner {
  color: #49c5a9;
}

.display .display-head {
  align-items: start;
  flex-direction: row;
  margin-bottom: 0;
}

.display-head h1 {
  font-size: clamp(32px, 3.2vw, 52px);
  line-height: 1;
  margin-bottom: 6px;
}

.display-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
  min-height: 0;
}

.display-grid.secondary {
  grid-template-columns: 1.05fr 0.75fr 0.95fr;
}

.display h2 {
  font-size: clamp(18px, 1.1vw, 22px);
  margin-bottom: 8px;
}

.display .public-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.display .public-stats div {
  padding: 10px 12px;
}

.display .progress-block {
  padding: 10px 12px;
}

.display .progress-block > div:first-child {
  margin-bottom: 6px;
}

.display .progress-bar {
  height: 9px;
}

.display .public-highlight,
.display .public-rules,
.display .public-qualified {
  gap: 7px;
}

.display .public-highlight p,
.display .public-rules p,
.display .public-rules li,
.display .public-qualified p,
.display .public-qualified li {
  font-size: clamp(11px, 0.7vw, 13px);
}

.display .public-rules ul,
.display .public-qualified ul {
  gap: 5px;
}

.display-qr {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: #f8fbfc;
  font-size: clamp(14px, 1.1vw, 20px);
  font-weight: 800;
}

.display-qr img {
  width: clamp(96px, 8.5vw, 150px);
  height: clamp(96px, 8.5vw, 150px);
  border: 8px solid #fff;
  border-radius: 8px;
  background: #fff;
}

.mobile-head {
  margin-bottom: 18px;
}

@media (max-width: 760px) {
  .topbar,
  .page-head,
  .display-head {
    flex-direction: column;
    align-items: stretch;
  }

  .grid.two,
  .stats,
  .public-stats,
  .display-grid {
    grid-template-columns: 1fr;
  }

  .participant-edit {
    grid-template-columns: 1fr;
  }

  .participant-edit-actions {
    justify-content: flex-start;
  }

  .mobile-link {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  .pool-standings-grid {
    grid-template-columns: 1fr;
  }

  .podium-steps {
    gap: 10px;
  }

  .podium-place {
    padding: 12px 8px;
  }

  .podium-place strong {
    font-size: 16px;
  }

  .podium-place .participant-label {
    max-width: 100%;
  }

  .podium-place .participant-label small {
    font-size: 11px;
  }

  .final-ranking {
    overflow-x: visible;
  }

  .final-standing-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .final-standing-card {
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas:
      "rank team"
      "rank meta";
    gap: 2px 10px;
    padding: 9px 10px;
  }

  .final-standing-card > span {
    grid-area: rank;
  }

  .final-standing-card .participant-label {
    grid-area: team;
    width: 100%;
  }

  .final-standing-card em {
    grid-area: meta;
    white-space: normal;
  }

  .color-palette {
    grid-template-columns: repeat(4, 28px);
  }
}
