@font-face { font-family: Cinzel; src: url("../fonts/cinzel-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: Jost; src: url("../fonts/jost-latin.woff2") format("woff2"); font-weight: 300 600; font-display: swap; }

:root { --blue: #4984be; --yellow: #fdb830; --red: #af3227; }
[data-theme="pergamino"] { --bg: #f4ead2; --panel: #fbf5e4; --panel2: #efe2c3; --ink: #2b0d12; --dim: #4a1520b8; --line: #4a152026; --gold: #8f7433; --land: #e4d6b4; --accent: #6d222e; --blue-t: #2f6aa3; --red-t: #af3227; --on-accent: #fbf4e4; }
[data-theme="vino"] { --bg: #2b0d12; --panel: #3a121a; --panel2: #4a1720; --ink: #fbf4e4; --dim: #fbf4e4a8; --line: #ffffff24; --gold: #d6c499; --land: #54232c; --accent: #fdb830; --blue-t: #7fb3e4; --red-t: #f0735f; --on-accent: #2b0d12; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 Jost, system-ui, sans-serif; }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; font-weight: 600; margin: 0; letter-spacing: .02em; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.loading { padding: 40px; text-align: center; color: #4a1520b8; }

.stripe { height: 5px; background: linear-gradient(90deg, var(--blue) 0 33.3%, var(--yellow) 33.3% 66.6%, var(--red) 66.6%); }
.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: calc(100vh - 5px); }

.side { position: sticky; top: 0; align-self: start; height: calc(100vh - 5px); display: flex; flex-direction: column; gap: 14px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 0 6px; }
.brand b { display: block; font: 600 16px/1.2 Cinzel, serif; }
.brand small { display: block; font-size: 12.5px; color: var(--dim); }
.balloons { display: flex; gap: 2px; }
.balloons i { width: 9px; height: 13px; border-radius: 50% 50% 50% 50%/42% 42% 58% 58%; background: var(--blue); }
.balloons i:nth-child(2) { background: var(--yellow); }
.balloons i:nth-child(3) { background: var(--red); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; text-decoration: none; color: var(--dim); min-height: 40px; }
.side nav a:hover { background: var(--panel2); color: var(--ink); }
.side nav a[aria-current] { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.ic { width: 18px; text-align: center; }
.next { margin-top: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--dim); }
.next b { display: block; color: var(--ink); font: 600 16px Cinzel, serif; }
.next small { display: block; }

.content { min-width: 0; padding: 14px 20px 10px; }
.bar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 0; }
.search input { width: 100%; padding: 10px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; outline: 0; min-height: 44px; }
.search input:focus { border-color: var(--accent); }
.results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; max-height: 400px; overflow: auto; box-shadow: 0 18px 40px #0005; }
.results a { display: flex; gap: 11px; align-items: center; padding: 8px 13px; text-decoration: none; min-height: 48px; }
.results a:hover { background: var(--line); }
.results small { display: block; color: var(--dim); font-size: 13px; }
.results em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }
.none { padding: 13px; margin: 0; color: var(--dim); }
.themes { display: flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; flex: none; }
.themes button { background: none; border: 0; padding: 6px 13px; font-size: 14px; min-height: 40px; color: var(--dim); }
.themes button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 500; }

.head { margin: 2px 0 12px; }
.head h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; }
.head p { margin: 2px 0 0; color: var(--dim); }
.profile { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.profile h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; }
.profile p { margin: 2px 0 0; color: var(--dim); }
.profile a { color: var(--dim); }

.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; min-width: 0; }
.card h2 { font-size: 15.5px; }
.card .sub { color: var(--dim); font-size: 14px; margin: 2px 0 8px; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; } .s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; } .s12 { grid-column: span 12; }
.plot { width: 100%; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 10px 14px; text-decoration: none; min-width: 0; }
a.kpi:hover { border-color: var(--accent); }
.kpi b { display: block; font: 600 25px/1.2 Cinzel, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi b.long { font-size: 15.5px; line-height: 1.25; white-space: normal; min-height: 30px; }
.kpi span { color: var(--dim); font-size: 14px; }
.kpi:nth-child(3n+1) b { color: var(--blue-t); } .kpi:nth-child(3n+2) b { color: var(--accent); } .kpi:nth-child(3n) b { color: var(--red-t); }

.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; padding: 9px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; font-size: 14.5px; color: var(--dim); }
.filters label { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; }
select { color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; min-height: 40px; max-width: min(100%, 290px); }
.combo { position: relative; display: inline-block; width: calc(var(--combo-ch, 12) * 1ch); max-width: 100%; }
.combo input { width: 100%; color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 24px 6px 9px; min-height: 40px; outline: 0; text-overflow: ellipsis; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(-45deg, transparent 50%, var(--dim) 50%); background-size: 5px 5px; background-position: calc(100% - 13px) 55%, calc(100% - 8px) 55%; background-repeat: no-repeat; }
.combo input:focus { border-color: var(--accent); }
.combo input:disabled { opacity: .55; }
.combo-list { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(88vw, 440px); max-height: 300px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px #0004; color: var(--ink); font-size: 14.5px; }
.combo-list li { padding: 7px 9px; border-radius: 7px; cursor: pointer; min-height: 34px; }
.combo-list li:hover, .combo-list li.on { background: var(--panel2); }
.combo-list li[aria-selected="true"] { font-weight: 500; color: var(--accent); }
.combo-list li.none { color: var(--dim); cursor: default; background: none; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: none; min-height: 40px; padding: 5px 11px; color: var(--dim); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.hb { list-style: none; margin: 0; padding: 0; }
.hb a, .hb .row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 50px; gap: 2px 7px; align-items: center; padding: 4px 2px; text-decoration: none; min-height: 34px; }
.hb a:hover { background: var(--line); }
.hb .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb .v { text-align: right; font-variant-numeric: tabular-nums; }
.hb .ix { color: var(--dim); font-size: 13.5px; }
.hb .bar { grid-column: 2/4; display: block; height: 4px; border-radius: 3px; background: var(--line); }
.hb .bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.tablew { overflow: auto; max-height: var(--table-h, 480px); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--dim); font-weight: 400; position: sticky; top: 0; background: var(--panel); }
.n { text-align: right; font-variant-numeric: tabular-nums; }
td small { color: var(--dim); }
.tablew td:last-child:not(.n) { min-width: 170px; }
td a { text-decoration-color: var(--line); text-underline-offset: 3px; }

.champs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.champ { flex: 0 0 106px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 7px; text-align: center; font-size: 13px; line-height: 1.25; text-decoration: none; }
.champ:hover { border-color: var(--accent); }
.champ b { display: block; font: 600 15px Cinzel, serif; color: var(--accent); }
.champ span { display: block; margin-top: 5px; height: 3.75em; overflow: hidden; }
img.crest { object-fit: contain; }
.ficha { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 7px; font-size: 15.5px; }
.ficha li { padding-left: 2px; }
.ficha b { font-weight: 500; color: var(--accent); }
.ficha a { text-decoration-color: var(--line); text-underline-offset: 3px; }
.ficha .medal { vertical-align: -5px; }
.medal { flex: none; }
.medals { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.medal-rows { list-style: none; margin: 0; padding: 0; }
.medal-rows a { display: grid; grid-template-columns: minmax(120px, 15em) minmax(0, 1fr); gap: 3px 10px; align-items: center; padding: 5px 4px; text-decoration: none; border-bottom: 1px solid var(--line); min-height: 34px; }
.medal-rows a:hover { background: var(--panel2); }
.medal-rows .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.medal-case { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 12px; }
.medal-case li { display: grid; grid-template-columns: 2.2em 3.6em minmax(0, 1fr); gap: 6px; align-items: center; }
.medal-case b { font: 600 22px Cinzel, serif; }
.medal-case span { color: var(--dim); font-size: 14px; }
.region-podium { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.region-podium a { display: grid; justify-items: center; gap: 4px; padding: 12px; text-align: center; text-decoration: none; border: 1px solid var(--line); height: 100%; box-sizing: border-box; }
.region-podium a:hover { background: var(--panel2); }
.region-podium b { font: 600 20px Cinzel, serif; }
.region-podium small { color: var(--dim); }
.region-tables { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px; align-items: start; }
.region-tables > .tablew { --table-h: 560px; }
.region-finals table { min-width: 560px; }
@media (max-width: 760px) { .region-tables { grid-template-columns: minmax(0, 1fr); } }
.winners { --table-h: 620px; }
.winners table { min-width: 560px; }
.winners tbody th { position: sticky; left: 0; background: var(--panel); font: 600 14px Cinzel, serif; color: var(--ink); }
.winners td { min-width: 128px; font-size: 13px; line-height: 1.2; }
.winners td a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 6px; align-items: center; text-decoration: none; }
.winners td a:hover span { text-decoration: underline; }
.winners td span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.winners td small { grid-column: 2; display: flex; gap: 4px; align-items: center; }
.crest { vertical-align: middle; flex: none; }
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.wall a { padding: 5px 2px; font-size: 12px; line-height: 1.2; color: var(--dim); text-decoration: none; text-align: center; border: 1px solid transparent; border-radius: 10px; min-height: 84px; }
.wall a:hover { border-color: var(--line); color: var(--ink); }
.note { font-size: 13.5px; color: var(--dim); margin: 8px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 14px; min-height: 36px; text-decoration: none; max-width: 100%; }
.chip:hover { border-color: var(--accent); }
.chip button { border: 0; background: none; padding: 0 0 0 4px; color: var(--dim); }
.callout { background: var(--panel2); border-left: 4px solid var(--red-t); border-radius: 0 12px 12px 0; padding: 10px 14px; margin: 8px 0 0; }
.callout b { font-weight: 500; color: var(--accent); }
.heat { --cell: 25px; border-collapse: separate; border-spacing: 2px; font-size: 12.5px; width: auto; }
.heat th { padding: 0; text-align: center; font-size: 11px; position: static; }
.heat td { padding: 0; border: 0; }
.heat td.u { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.heat td.c { width: var(--cell); height: 21px; border-radius: 4px; text-align: center; font-size: 10.5px; font-weight: 500; }
.heat td.c.empty { outline: 1px solid var(--line); outline-offset: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 13px; font-size: 13.5px; color: var(--dim); margin-top: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.seq { width: 100%; height: auto; display: block; }
.prose { max-width: 76ch; }
.prose h2 { margin: 16px 0 3px; font-size: 16px; }
.prose p, .prose ul { margin: 4px 0 8px; }
footer { color: var(--dim); font-size: 14px; padding: 12px 0 20px; display: flex; flex-wrap: wrap; gap: 4px 10px; }

@media (max-width: 980px) {
  .s3, .s4 { grid-column: span 6; }
  .s5, .s6, .s7, .s8, .s9 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; padding-bottom: 3px; }
  .side nav a { white-space: nowrap; flex: none; }
  .next { margin: 0 0 0 auto; padding: 4px 10px; }
  .next b { display: inline; font-size: 13.5px; margin-left: 4px; }
  .next small { display: none; }
  .content { padding: 10px 10px 6px; }
  .bar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .s3, .s4 { grid-column: span 12; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 21px; }
  .medal-rows a { grid-template-columns: minmax(0, 1fr); }
}
.chance-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.chance-cards div { padding: 10px; border: 1px solid var(--line); font-size: 13px; color: var(--dim); }
.chance-cards b { display: block; font: 600 22px Cinzel, serif; color: var(--ink); }
.place-slider { display: grid; gap: 6px; }
.place-slider input { width: 100%; height: 30px; accent-color: var(--accent); }
.region-chances { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.region-chances section { border: 1px solid var(--line); padding: 12px; min-width: 0; }
.region-chances h3 { margin: 0 0 2px; font: 600 15px Cinzel, serif; }
.region-chances p { margin: 0 0 8px; font-size: 13px; color: var(--dim); }
.leader { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; margin-bottom: 7px; font-size: 13.5px; }
.leader i { grid-column: 1 / -1; height: 5px; background: var(--accent); border-radius: 3px; }
.leader small { color: var(--dim); }
