:root {
  --blue: #0364c2;
  --blue-dark: #024f9b;
  --magenta: #f02ed0;
  --line: #80b8df;
  --ink: #161616;
  --muted: #6d747c;
  --paper: #ffffff;
  --wash: #f4f8fb;
  --shadow: rgba(11, 64, 111, 0.16);
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f7f5;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 32px 0 56px;
}

.page-head,
.category-tabs,
.category-panel {
  width: min(1320px, calc(100% - 36px));
  margin-inline: auto;
}

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

.head-brand {
  display: grid;
  gap: 10px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: clamp(3rem, 7vw, 6.6rem);
  font-weight: 800;
  line-height: 0.84;
  text-transform: uppercase;
}

.head-meta {
  display: grid;
  gap: 5px;
  min-width: 260px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: right;
}

.contact-link {
  color: var(--blue-dark);
  font-weight: 900;
  text-decoration: none;
}

.contact-link:hover,
.contact-link:focus-visible {
  text-decoration: underline;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
}

.category-tab {
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--blue);
  background: var(--paper);
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.category-tab.is-active {
  background: var(--blue);
  color: white;
}

.loading-card,
.category-sheet {
  background: white;
  box-shadow: 0 16px 46px var(--shadow);
}

.loading-card {
  padding: 28px;
  color: var(--muted);
  font-weight: 800;
}

.category-sheet {
  padding: 0;
}

.sheet-header {
  display: grid;
  gap: 8px;
  padding: 18px 18px 12px;
  text-align: center;
}

.sheet-brand-strip {
  display: grid;
  grid-template-columns: minmax(150px, 0.28fr) minmax(360px, 1fr);
  gap: 8px;
  align-items: stretch;
}

.sheet-brand-strip img {
  width: 100%;
  border: 1px solid var(--line);
}

.sheet-lvp-logo {
  max-height: 92px;
  object-fit: contain;
  padding: 12px;
  background: #0e2a38;
}

.sheet-havas-logo {
  max-height: 92px;
  object-fit: contain;
  background: var(--blue);
}

.sheet-header div {
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: clamp(1.4rem, 2.8vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  padding: 5px 10px;
  text-transform: uppercase;
}

.sheet-body {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(420px, 1fr);
  grid-template-areas:
    "groups matches"
    "final final";
  gap: 20px 28px;
  padding: 8px 18px 28px;
}

.groups-area {
  grid-area: groups;
  display: grid;
  gap: 18px;
  align-content: start;
}

.matches-area {
  grid-area: matches;
  display: grid;
  gap: 18px;
  align-content: start;
}

.final-area {
  grid-area: final;
  border: 1px solid var(--line);
  background: white;
  overflow: hidden;
}

.final-area h2 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  padding: 9px 12px;
  text-align: center;
  text-transform: uppercase;
}

.mini-table {
  border: 1px solid var(--line);
  background: white;
  overflow: hidden;
}

.group-table {
  width: 100%;
  max-width: 430px;
  justify-self: start;
}

.group-table table {
  table-layout: fixed;
}

.mini-table h2 {
  margin: 0;
  background: var(--blue);
  color: white;
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1;
  padding: 8px 12px;
  text-transform: uppercase;
}

.phase-stack {
  display: grid;
  gap: 18px;
}

.phase-stack > h2 {
  margin: 0;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  padding: 9px 12px;
  text-align: center;
  text-transform: uppercase;
}

.phase-title {
  background: var(--blue);
  color: white;
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  padding: 8px 10px;
  text-align: center;
  text-transform: uppercase;
}

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

th,
td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--magenta);
  color: white;
  font-size: 0.76rem;
  font-weight: 900;
}

.phase-table {
  border-color: var(--line);
}

.phase-table th,
.phase-table td {
  border-color: var(--line);
  border-width: 1px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.phase-table th {
  background: var(--magenta);
  color: white;
}

.phase-table td:nth-child(4) {
  min-width: 110px;
}

td {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
}

.group-table th:first-child,
.group-table td:first-child {
  width: 44px;
  text-align: center;
}

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

.group-table td {
  padding-block: 4px;
}

.group-table td:nth-child(2) {
  font-size: 0.78rem;
  line-height: 1.16;
}

.group-table th:nth-child(3),
.group-table th:nth-child(4),
.group-table td:nth-child(3),
.group-table td:nth-child(4) {
  width: 52px;
  text-align: center;
}

.code {
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 900;
}

.score {
  font-size: 0.95rem;
  font-weight: 900;
}

.final-area table th,
.final-area table td {
  text-align: center;
}

.final-area table th:nth-child(5),
.final-area table th:nth-child(6),
.final-area table td:nth-child(5),
.final-area table td:nth-child(6) {
  text-align: left;
}

.empty-box {
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 800;
  padding: 14px;
  text-align: center;
}

.terms-sheet {
  overflow: hidden;
}

.terms-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 10px 18px 28px;
}

.terms-section {
  border: 1px solid var(--line);
  background: white;
}

.terms-section:first-child,
.terms-section:nth-child(2) {
  grid-column: span 1;
}

.terms-section:nth-child(3),
.terms-section:nth-child(4),
.terms-section:nth-child(5) {
  grid-column: 1 / -1;
}

.terms-section h2 {
  margin: 0;
  background: var(--blue);
  color: white;
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  padding: 9px 12px;
  text-transform: uppercase;
}

.terms-section p,
.terms-section li {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.42;
}

.terms-section p {
  margin: 12px 14px;
}

.terms-section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 18px 14px 32px;
}

.terms-section strong {
  font-weight: 900;
}

.terms-note {
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 10px 14px;
}

@media (min-width: 1180px) {
  .category-panel {
    width: min(1180px, calc(100% - 36px));
  }
}

@media (max-width: 980px) {
  .page-head {
    display: grid;
  }

  .head-meta {
    text-align: left;
  }

  .sheet-body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "groups"
      "matches"
      "final";
  }

  .sheet-brand-strip {
    grid-template-columns: 1fr;
  }

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

  .terms-section {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-top: 14px;
  }

  .page-head,
  .category-tabs,
  .category-panel {
    width: min(100% - 12px, 1320px);
  }

  h1 {
    font-size: 2.65rem;
  }

  .sheet-header,
  .sheet-body {
    padding-inline: 6px;
  }

  .sheet-body {
    gap: 14px;
  }

  .sheet-brand-strip {
    gap: 6px;
  }

  .sheet-lvp-logo {
    max-height: 72px;
    padding: 9px;
  }

  .sheet-havas-logo {
    max-height: 72px;
  }

  .sheet-header div {
    font-size: clamp(1.18rem, 7vw, 1.75rem);
  }

  .mini-table h2,
  .phase-title,
  .phase-stack > h2,
  .final-area h2 {
    font-size: 1.42rem;
    padding: 7px 8px;
  }

  th,
  td {
    padding: 4px 4px;
  }

  .group-table table,
  .phase-table table,
  .final-area table {
    min-width: 0;
    table-layout: fixed;
  }

  .group-table,
  .phase-table,
  .final-area {
    width: 100%;
    max-width: none;
    overflow: hidden;
  }

  .group-table th:first-child,
  .group-table td:first-child {
    width: 32px;
  }

  .group-table th:nth-child(3),
  .group-table th:nth-child(4),
  .group-table td:nth-child(3),
  .group-table td:nth-child(4) {
    width: 42px;
  }

  .group-table td:nth-child(2) {
    font-size: 0.68rem;
    line-height: 1.12;
  }

  .code,
  .score {
    font-size: 0.82rem;
  }

  .phase-table th,
  .phase-table td {
    font-size: 0.62rem;
    line-height: 1.12;
    word-break: break-word;
  }

  .phase-table td:nth-child(1),
  .phase-table th:nth-child(1) {
    width: 19%;
  }

  .phase-table td:nth-child(2),
  .phase-table th:nth-child(2) {
    width: 23%;
  }

  .phase-table td:nth-child(3),
  .phase-table th:nth-child(3) {
    width: 17%;
  }

  .phase-table td:nth-child(4),
  .phase-table th:nth-child(4) {
    width: 25%;
    min-width: 0;
  }

  .phase-table td:nth-child(5),
  .phase-table th:nth-child(5) {
    width: 16%;
  }

  .final-area table th,
  .final-area table td {
    font-size: 0.54rem;
    line-height: 1.08;
    padding: 3px 2px;
    word-break: break-word;
  }
}
