:root {
  --paper: #FAF7EF;
  --card: #FFFFFF;
  --ink: #12100B;
  --ink-70: rgba(18, 16, 11, 0.7);
  --ink-55: rgba(18, 16, 11, 0.55);
  --ink-45: rgba(18, 16, 11, 0.45);
  --ink-10: rgba(18, 16, 11, 0.1);
  --red: #C8102E;
  --green: #0A8F3C;
  --blue: #1D4ED8;
  --gold: #C9A227;
  --anton: 'Anton', Impact, sans-serif;
  --archivo: 'Archivo', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: #E7E3D8; }
body { font-family: var(--archivo); color: var(--ink); -webkit-font-smoothing: antialiased; }

.poster {
  position: relative;
  max-width: 1500px;
  margin: 0 auto;
  background: var(--paper);
  overflow: hidden;
  min-height: 100vh;
}
@media (min-width: 981px) {
  /* keep the whole poster within one screen on desktop */
  html, body { height: 100%; overflow: hidden; }
  .poster { height: 100vh; }
}

.stripe { display: flex; height: 12px; position: relative; z-index: 2; }
.stripe > div { flex: 1; }

.ribbons {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.9;
}

.content {
  position: relative; z-index: 1;
  padding: clamp(10px, 1.2vw, 16px) clamp(20px, 3vw, 48px) clamp(8px, 1vw, 14px);
  display: flex; flex-direction: column; gap: clamp(6px, 0.9vw, 12px);
}
@media (min-width: 981px) { .content { height: 100%; } }

/* ---- compact header ---- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.mh-left { display: inline-flex; align-items: center; gap: 12px; }
.logo-dots { display: flex; gap: 4px; }
.logo-dots span { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.logo-word { font-family: var(--anton); font-size: 15px; letter-spacing: 0.08em; color: var(--ink); }
.mh-sep { width: 1px; height: 20px; background: var(--ink-10); margin: 0 2px; }
.mh-title { margin: 0; font-family: var(--anton); font-weight: 400; font-size: clamp(20px, 2.2vw, 30px); line-height: 1; letter-spacing: 0.01em; color: var(--ink); }
.title-bars { display: flex; gap: 5px; }
.title-bars > div { width: 26px; height: 5px; }
.masthead-right {
  display: inline-flex; align-items: center; gap: 20px;
  font-family: var(--archivo); font-size: 10.5px; font-weight: 800; letter-spacing: 0.15em; color: var(--ink-55);
}
.live-flag { display: inline-flex; align-items: center; gap: 7px; color: var(--red); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.live-flag.is-live .live-dot { animation: blink 1.4s ease-in-out infinite; }
.live-flag.is-stale { color: #B8860B; }
.live-flag.is-stale .live-dot { background: #B8860B; animation: none; }

@media (max-width: 620px) { .mh-colourway { display: none; } }

/* ---- round-status strip ---- */
.status-strip {
  display: flex; flex-wrap: wrap; gap: 6px 26px; border-top: 1.5px solid var(--ink); padding-top: 7px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.13em; color: var(--ink-45); background: var(--paper);
}
.status-strip .done { color: var(--ink); }
.status-strip .active { color: var(--green); }

/* ---- main layout ---- */
.main { display: flex; gap: clamp(24px, 4vw, 60px); align-items: center; justify-content: center; flex-wrap: wrap; }
@media (min-width: 981px) { .main { flex: 1; min-height: 0; } }

.bracket-frame { position: relative; width: min(1040px, 100%); aspect-ratio: 1 / 1; flex: none; }
.bracket-scale { position: absolute; top: 0; left: 0; width: 1040px; height: 1040px; transform-origin: top left; transform: scale(var(--s, 1)); }
.bracket-scale svg { position: absolute; inset: 0; display: block; }
.bracket-overlay { position: absolute; inset: 0; }

/* nodes (absolutely positioned circles) */
.node {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
  transition: opacity 0.2s, box-shadow 0.2s; box-sizing: border-box;
}
.node img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; pointer-events: none; display: block; }
.node .node-label { font-family: var(--archivo); font-weight: 800; letter-spacing: 0.08em; line-height: 1.35; pointer-events: none; padding: 4px; }
.node.clickable { cursor: pointer; }

.ring-label {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-family: var(--archivo); font-size: 10px; font-weight: 800; letter-spacing: 0.14em;
  padding: 4px 12px; border-radius: 999px; background: var(--card); color: var(--ink-70); border: 1px solid var(--ink-45);
}

/* ---- side panel (compact, secondary to the bracket) ---- */
.panel { flex: 0 1 340px; min-width: 260px; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }

.match-card {
  background: var(--card); border: 2px solid var(--ink); box-shadow: 5px 5px 0 rgba(18, 16, 11, 0.1);
  padding: 15px 17px; display: flex; flex-direction: column; gap: 12px;
}
.mc-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.mc-round { color: var(--ink-55); }
.mc-status { color: var(--green); }
.mc-status.live { color: var(--red); }
.mc-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mc-team { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 66px; }
.mc-team img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--ink); display: block; }
.mc-team .mc-tbd { width: 38px; height: 38px; border-radius: 50%; border: 2px dashed var(--ink-45); box-sizing: border-box; }
.mc-team .mc-code { font-family: var(--anton); font-size: 14px; letter-spacing: 0.05em; color: var(--ink); }
.mc-team.win .mc-code { color: var(--green); }
.mc-score { font-family: var(--anton); font-size: 26px; color: var(--ink); white-space: nowrap; }
.mc-pens { display: block; text-align: center; font-size: 10px; font-weight: 700; color: var(--ink-55); letter-spacing: 0.04em; }
.mc-meta { font-size: 11px; font-weight: 600; color: var(--ink-55); text-align: center; letter-spacing: 0.02em; }

/* goalscorers inside the match card */
.mc-goals { display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--ink-10); padding-top: 11px; }
.mc-gcol { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mc-gcol.l { align-items: flex-end; }
.mc-gcol.r { align-items: flex-start; }
.mc-ball { font-size: 13px; line-height: 1; padding-top: 1px; opacity: 0.85; }
.mc-g { display: flex; align-items: baseline; gap: 5px; max-width: 100%; }
.mc-g-name { font-size: 11.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-g-min { font-size: 11px; font-weight: 800; color: var(--ink-55); font-variant-numeric: tabular-nums; }
.mc-g-mark { font-size: 8.5px; font-weight: 800; letter-spacing: 0.05em; color: #fff; background: var(--ink-45); border-radius: 3px; padding: 1px 3px; }

/* Golden Boot leaderboard */
.gb-card { background: var(--card); border: 2px solid var(--ink); box-shadow: 5px 5px 0 rgba(18, 16, 11, 0.1); padding: 13px 15px; }
.gb-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); margin-bottom: 10px; }
.gb-ball { font-size: 14px; }
.gb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.gb-list li { display: flex; align-items: center; gap: 9px; }
.gb-rank { width: 13px; text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-45); font-variant-numeric: tabular-nums; }
.gb-flag { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 1px solid var(--ink-10); flex: none; background: var(--paper); }
.gb-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-goals { font-family: var(--anton); font-size: 16px; color: var(--ink); min-width: 16px; text-align: right; }
.gb-list li.lead .gb-rank { color: var(--gold); }
.gb-list li.lead .gb-goals { color: var(--gold); }
.gb-list li.lead .gb-flag { border-color: var(--gold); box-shadow: 0 0 0 1.5px var(--gold); }

.trace-banner {
  cursor: pointer; align-self: flex-start; display: inline-flex; align-items: center; gap: 10px;
  background: var(--green); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.11em; padding: 7px 12px;
}

.progress { display: flex; flex-direction: column; gap: 8px; background: var(--paper); padding: 2px 0; }
.pg-row { display: flex; align-items: center; gap: 10px; font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; }
.pg-name { width: 92px; }
.pg-track { flex: 1; height: 3px; background: var(--ink-10); }
.pg-fill { height: 100%; }
.pg-count { width: 34px; text-align: right; }

.panel-hint { margin: 0; font-size: 11px; font-weight: 500; line-height: 1.5; color: var(--ink-45); background: var(--paper); text-wrap: pretty; }

/* ---- colophon ---- */
.colophon {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1.5px solid var(--ink); padding-top: 8px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink-45); background: var(--paper);
}

.error {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #fff; border: 2px solid var(--red); color: var(--red);
  padding: 10px 16px; font-size: 13px; font-weight: 700;
}
.hidden { display: none !important; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

@media (max-width: 980px) {
  .main { justify-content: center; }
  .panel { min-width: 100%; }
}
