:root {
  color-scheme: light;
  --ink: #1d2524;
  --muted: #66706e;
  --paper: #f7f3ea;
  --panel: #fffaf0;
  --line: #d8cbb8;
  --brand: #7a1f18;
  --brand-strong: #4d120e;
  --green: #1f6b4c;
  --shadow: 0 12px 30px rgb(47 38 25 / 12%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.hero {
  position: relative;
  min-height: 330px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #e9dfcf;
}

.hero__art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgb(247 243 234 / 24%), rgb(247 243 234 / 42%)),
    url("/web/static/img/tripulemus-hero.png") center / cover no-repeat;
}

.hero__content {
  position: relative;
  text-align: center;
  padding: 32px;
  text-shadow: 0 2px 0 rgb(255 255 255 / 50%);
}

.auth-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.hero__eyebrow {
  margin: 0 0 10px;
  color: var(--brand-strong);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 13vw, 8.4rem);
  line-height: 0.9;
}

.hero__year {
  margin: 16px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 3.8rem);
  font-weight: 700;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 54px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.round-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.round-tab,
.button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgb(47 38 25 / 8%);
}

.round-tab[aria-selected="true"],
.button--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.button--quiet {
  min-height: 34px;
  border-color: rgb(77 18 14 / 18%);
  background: rgb(255 250 240 / 54%);
  color: rgb(77 18 14 / 72%);
  padding: 0 11px;
  box-shadow: none;
  backdrop-filter: blur(2px);
}

.button--quiet:hover {
  background: rgb(255 250 240 / 82%);
  color: var(--brand-strong);
}

.button--danger {
  border-color: #9f1d1d;
  color: #9f1d1d;
}

.button--danger:hover {
  background: #9f1d1d;
  color: white;
}

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

.admin-panel h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

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

.admin-panel textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
}

.admin-panel__actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.message {
  min-height: 1.4em;
  color: var(--muted);
}

.bracket {
  display: grid;
  grid-auto-columns: minmax(300px, 340px);
  grid-auto-flow: column;
  gap: 22px;
  align-items: start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 18px;
  scrollbar-color: var(--line) transparent;
}

.round {
  display: grid;
  min-width: 0;
  gap: 14px;
}

@media (min-width: 701px) {
  .bracket {
    grid-auto-columns: minmax(320px, 360px);
    min-height: 1000px;
  }

  .round {
    --bracket-row: 118px;
    grid-template-rows: auto repeat(17, var(--bracket-row));
    gap: 0;
  }

  .round h2 {
    align-self: start;
  }

  .match {
    align-self: center;
  }
}

.round h2 {
  margin: 0 0 2px;
  font-size: 1rem;
  color: var(--brand-strong);
}

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

.match__title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 8px 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.team span {
  min-width: 0;
}

.team + .team {
  border-top: 0;
}

.team:first-of-type {
  border-radius: 8px 8px 0 0;
}

.team:last-of-type {
  border-radius: 0 0 8px 8px;
}

.team--winner {
  border-color: rgb(31 107 76 / 45%);
  background: rgb(31 107 76 / 10%);
  color: var(--green);
  font-weight: 700;
}

.match__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.match__form select {
  grid-column: 1 / -1;
}

.match__form select,
.match__form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fffdf8;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 700px) {
  .hero {
    min-height: 280px;
  }

  .layout {
    width: min(100% - 20px, 1180px);
  }

  .bracket {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 0;
  }

  .round .match {
    grid-row: auto !important;
  }

  .match__form {
    grid-template-columns: 1fr;
  }
}
