:root {
  --night: #090f17;
  --dusk: #142233;
  --stone: #18232f;
  --stone-hi: #24354a;
  --bronze: #8d703d;
  --gold: #f0c75e;
  --gold-hi: #ffe9a8;
  --cream: #efe3c6;
  --dim: #9d937d;
  --hp: #cf382e;
  --ok: #86d07e;
  --warn: #f2a64a;
  --bad: #ff7a69;
  --parch: #e8d6ab;
  --parch-lo: #cdb27c;
  --ink: #33240f;
  --serif: "Kreon", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  font-family: var(--serif); font-size: 16px; line-height: 1.3; color: var(--cream);
  background: var(--night); min-height: 100vh; overflow-x: hidden;
}
svg.ico { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.14em; flex: none; }

/* ------------------------------------------------------------ backdrop */
.backdrop {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 90% 45% at 50% 108%, rgba(255, 132, 56, .22), transparent 65%),
    radial-gradient(ellipse 120% 80% at 50% -10%, #2a4263 0%, var(--dusk) 40%, var(--night) 80%);
}
.stars {
  position: absolute; inset: 0; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff, transparent), radial-gradient(1px 1px at 31% 68%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 57% 14%, #ffe, transparent), radial-gradient(1px 1px at 76% 41%, #fff, transparent),
    radial-gradient(1px 1px at 91% 83%, #fff, transparent), radial-gradient(1.4px 1.4px at 22% 88%, #ffd, transparent),
    radial-gradient(1px 1px at 66% 59%, #fff, transparent), radial-gradient(1px 1px at 44% 36%, #fff, transparent);
  background-size: 460px 460px;
}
.spire {
  position: absolute; left: 50%; bottom: 0; width: 260px; height: 82vh; transform: translateX(-50%);
  background: linear-gradient(to top, rgba(6, 10, 16, .95), rgba(40, 58, 86, .28));
  clip-path: polygon(50% 0, 53% 10%, 51.500% 10%, 57% 32%, 54% 32%, 63% 60%, 59% 60%, 73% 100%, 27% 100%, 41% 60%, 37% 60%, 46% 32%, 43% 32%, 48.500% 10%, 47% 10%);
}

/* ------------------------------------------------------------ masthead */
.masthead { text-align: center; padding: 18px 16px 4px; }
.ribbon {
  display: inline-block; padding: 8px 64px 11px;
  background: linear-gradient(#b02a20, #7a150f);
  clip-path: polygon(0 0, 100% 0, calc(100% - 22px) 50%, 100% 100%, 0 100%, 22px 50%);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .45));
}
.ribbon h1 {
  margin: 0; font-size: clamp(1.500rem, 3.200vw, 2.600rem); font-weight: 700; letter-spacing: .05em;
  color: var(--gold-hi); text-shadow: 0 2px 0 #3d0a06;
}
.roundline { margin-top: 10px; font-size: 1.250rem; }
.roundline b { color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.roundline span { color: var(--cream); margin-left: 10px; }
.roundline.warmup b { color: var(--warn); }
.meta { margin-top: 2px; color: var(--dim); font-size: .850rem; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.link::before { content: "●"; margin-right: 5px; color: var(--ok); }
.link.down { color: var(--bad); }
.link.down::before { color: var(--bad); }

main { max-width: 1680px; margin: 0 auto; padding: 10px 18px 36px; }

/* ------------------------------------------------------------ stone slabs */
.slab, .team, .mapcard {
  background: linear-gradient(180deg, var(--stone-hi), var(--stone) 120px);
  border: 2px solid var(--bronze); border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .7), inset 0 0 0 3px rgba(255, 255, 255, .035), 0 10px 26px rgba(0, 0, 0, .5);
}
.slab { padding: 12px 16px 14px; margin-top: 16px; }
.slab h2 {
  margin: 0 0 10px; padding-bottom: 6px; font-size: 1.200rem; font-weight: 700; letter-spacing: .05em;
  color: var(--gold); border-bottom: 1px solid rgba(240, 199, 94, .22);
}
.slab h2 small { color: var(--dim); font-weight: 400; font-size: .800rem; letter-spacing: 0; margin-left: 8px; }

/* ------------------------------------------------------------ arena: team | map | team */
.arena { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(300px, .920fr) minmax(0, 1fr); align-items: start; }
.arena.many { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.maps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.team { padding: 0 14px 12px; border-color: color-mix(in srgb, var(--team) 55%, var(--bronze)); position: relative; }
.pennant {
  margin: 0 auto; width: fit-content; max-width: 100%; padding: 6px 30px 12px;
  background: linear-gradient(color-mix(in srgb, var(--team) 92%, #fff), color-mix(in srgb, var(--team) 70%, #000));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 9px), 0 100%);
  font-size: 1.300rem; font-weight: 700; letter-spacing: .04em; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}
.team.leading { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .7), 0 0 28px color-mix(in srgb, var(--gold) 45%, transparent), 0 10px 26px rgba(0, 0, 0, .5); }
.crown { position: absolute; top: -17px; left: 12px; font-size: 26px; color: var(--gold); filter: drop-shadow(0 2px 0 #000); display: none; }
.team.leading .crown { display: block; }
.total {
  text-align: center; font-size: clamp(3.200rem, 6vw, 5.200rem); font-weight: 700; line-height: 1.050; margin-top: 2px;
  color: var(--gold-hi); text-shadow: 0 4px 0 #4b3611, 0 0 26px rgba(240, 199, 94, .3); font-variant-numeric: tabular-nums;
}
.split { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin: 2px 0 10px; }
.chip {
  font-size: .780rem; padding: 1px 9px; border-radius: 999px; white-space: nowrap;
  background: rgba(0, 0, 0, .35); border: 1px solid rgba(240, 199, 94, .3);
}
.chip.neg { border-color: rgba(255, 122, 105, .5); color: #ffc6bd; }
.chip.warn { border-color: rgba(242, 166, 74, .6); color: #ffd9a8; }

.runbox { background: rgba(0, 0, 0, .28); border: 1px solid rgba(240, 199, 94, .18); border-radius: 6px; padding: 8px 10px; }
.runhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.where { font-weight: 700; font-size: 1.050rem; }
.where small { color: var(--dim); font-weight: 400; margin-left: 6px; }
.tag { font-size: .720rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 1px 8px; border-radius: 4px; border: 1px solid; }
.tag.in_progress { color: #bfdcff; border-color: #5c98d4; background: rgba(92, 152, 212, .18); }
.tag.combat { color: #ffd0c9; border-color: var(--hp); background: rgba(207, 56, 46, .2); }
.tag.victory { color: var(--gold-hi); border-color: var(--gold); background: rgba(240, 199, 94, .18); }
.tag.defeat, .tag.abandoned { color: #ffc0b8; border-color: var(--hp); background: rgba(207, 56, 46, .25); }
.tag.idle { color: var(--dim); border-color: #556; background: rgba(255, 255, 255, .04); }
.tally { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0 6px; }
.tally div { text-align: center; background: rgba(0, 0, 0, .3); border-radius: 5px; padding: 4px 2px 3px; }
.tally b { display: block; font-size: 1.300rem; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.tally span { font-size: .680rem; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.tally .asc b { color: #ff9a6e; }
.tally .dead b { color: #ffb0a6; }
.runpoints { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.runpoints b { font-size: 1.500rem; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.runpoints small { color: var(--dim); text-align: right; }
.notes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.waiting { color: var(--dim); font-style: italic; padding: 14px 4px; text-align: center; }

.party { display: grid; gap: 6px; margin-top: 10px; }
.hero { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 9px; align-items: center; padding: 5px 7px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .12)); border-radius: 6px; }
.hero.dead { filter: grayscale(.9); opacity: .7; }
.face {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  border: 2px solid var(--tint, var(--gold)); box-shadow: 0 0 0 2px #000; background: #101924;
}
.face.blank { font-weight: 700; color: #fff; background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--tint, #667) 70%, #fff), var(--tint, #667) 60%, color-mix(in srgb, var(--tint, #667) 55%, #000)); border-color: var(--gold); text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
.face.crest { color: #fff; border-color: var(--gold); background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--tint) 70%, #fff), var(--tint) 55%, color-mix(in srgb, var(--tint) 55%, #000)); }
.face.crest svg { width: 22px; height: 22px; fill: currentColor; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .6)); }
.portrait { width: 42px; height: 42px; position: relative; }
.portrait .face:not(.crest) { border-width: 3px; }
.portrait .klass { position: absolute; left: -5px; top: -5px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; background: var(--c); border: 1.5px solid #000; color: #fff; }
.portrait .klass svg { width: 11px; height: 11px; fill: currentColor; }
.portrait i { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: #555; border: 2px solid #000; }
.portrait i.on { background: var(--ok); }
.hero-name { display: flex; justify-content: space-between; gap: 6px; }
.hero-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-name span { color: var(--dim); font-size: .800rem; white-space: nowrap; }
.hp { height: 13px; background: #2a0d0b; border: 1px solid #000; border-radius: 7px; overflow: hidden; position: relative; margin: 2px 0; }
.hp i { display: block; height: 100%; background: linear-gradient(#ff6a55, var(--hp)); transition: width .6s; }
.hp span { position: absolute; inset: 0; text-align: center; font-size: .700rem; line-height: 12px; color: #fff; text-shadow: 0 1px 0 #000; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .800rem; color: var(--cream); font-variant-numeric: tabular-nums; }
.hero-stats span { white-space: nowrap; }
.hero-stats .g { color: var(--gold); }
.hero-stats .d { color: #ffb0a6; }
.hero-stats svg { color: var(--dim); }
.hero-stats .g svg { color: var(--gold); }
.foot { margin-top: 8px; color: var(--dim); font-size: .740rem; text-align: center; }

/* ------------------------------------------------------------ the map: ink on parchment */
.mapcard { padding: 8px; }
.parchment {
  border-radius: 4px; border: 2px solid #5a431f; color: var(--ink); padding: 6px 4px 4px;
  background:
    radial-gradient(ellipse at 28% 16%, rgba(255, 255, 255, .4), transparent 55%),
    radial-gradient(ellipse at 74% 92%, rgba(120, 80, 30, .3), transparent 60%),
    linear-gradient(135deg, var(--parch), var(--parch-lo));
  box-shadow: inset 0 0 34px rgba(84, 52, 14, .55);
}
.parchment h3 { margin: 0; text-align: center; font-size: 1rem; letter-spacing: .06em; color: #4b3517; }
.parchment .who { display: flex; justify-content: center; gap: 10px; font-size: .780rem; color: #5b4322; flex-wrap: wrap; }
.parchment .who i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; border: 1px solid #2a1c08; }
.parchment svg.map { display: block; width: 100%; height: auto; max-height: min(66vh, 680px); margin: 0 auto; }
.unrevealed { padding: 70px 12px; text-align: center; font-style: italic; color: #5d4526; }
.edge { stroke: #6e5433; stroke-width: 1.500; stroke-dasharray: 2 4; opacity: .55; fill: none; }
.trail { fill: none; stroke-width: 3.200; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.trail-under { fill: none; stroke: rgba(40, 26, 8, .55); stroke-width: 5.200; stroke-linecap: round; stroke-linejoin: round; }
.node { color: #46331b; }
.node.fog { opacity: .62; }
.node.elite { color: #7c2014; }
.node.boss { color: #5b0f09; }
.node use { fill: currentColor; }
.cut { fill: var(--parch); }
.cut-line { fill: none; stroke: var(--parch); stroke-width: 1.500; stroke-linecap: round; }
.line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.line.thick { stroke-width: 3; }
.pin circle.body { stroke: #fff; stroke-width: 1.800; }
.pin text { font: 700 7.5px var(--serif); fill: #fff; text-anchor: middle; dominant-baseline: central; }
.pin .ring { fill: none; stroke-width: 2; opacity: .8; animation: ping 1.600s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ping { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.900); opacity: 0; } }

/* ------------------------------------------------------------ awards
   Reading order per tile: the number (largest) > who holds it > which award > the rest. */
.awards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.award {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 9px 15px; border-radius: 6px; position: relative; overflow: hidden;
  background: rgba(0, 0, 0, .3); border: 1px solid rgba(240, 199, 94, .2);
}
.award::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--team, transparent); }
.award.banked { border-color: rgba(240, 199, 94, .6); background: linear-gradient(180deg, rgba(240, 199, 94, .12), rgba(0, 0, 0, .3) 60%); }
.a-head { display: flex; align-items: center; gap: 6px; font-size: .740rem; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); line-height: 1.150; }
.a-head svg { color: var(--bronze); font-size: .950rem; }
.a-head span { flex: 1; min-width: 0; }
.a-head em { font-style: normal; white-space: nowrap; color: var(--gold); border: 1px solid rgba(240, 199, 94, .4); border-radius: 999px; padding: 0 7px; letter-spacing: .02em; text-transform: none; }
.a-main { display: flex; align-items: center; gap: 10px; }
.a-faces { display: flex; flex: none; }
.a-faces .face { width: 44px; height: 44px; font-size: 1.200rem; }
.a-faces .face + .face { margin-left: -16px; }
.a-faces .more { font-size: .800rem; }
.a-who { flex: 1; min-width: 0; }
.a-name { font-size: 1.120rem; font-weight: 700; line-height: 1.150; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-team { font-size: .760rem; color: color-mix(in srgb, var(--team, var(--dim)) 70%, #fff); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.a-value { text-align: right; flex: none; line-height: 1; }
.a-value b { display: block; font-size: 2.350rem; font-weight: 700; color: var(--gold-hi); font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 #4b3611; }
.a-value span { font-size: .660rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.a-sub { font-size: .740rem; color: var(--dim); border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-sub b { color: var(--cream); font-weight: 500; }
.award.live .a-value b { color: #cfe4ff; text-shadow: 0 2px 0 #14263c; }
.award.open .a-name { color: var(--dim); font-style: italic; font-weight: 400; }
.award.open .a-value b { color: #55606e; text-shadow: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #000; flex: none; align-self: center; }
.state { font-size: .620rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 0 5px; border-radius: 3px; }
.state.live { background: rgba(92, 152, 212, .25); color: #bfdcff; }
.state.banked { background: rgba(240, 199, 94, .22); color: var(--gold-hi); }

/* ------------------------------------------------------------ ledger + chronicle */
.lower { display: grid; grid-template-columns: minmax(0, 1.350fr) minmax(0, 1fr); gap: 16px; }
.ledger-scroll { overflow-x: auto; }
table.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { padding: 4px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.ledger th:first-child, .ledger td:first-child { text-align: left; color: var(--dim); }
.ledger thead th { font-size: 1rem; }
.ledger tr.round td { color: var(--gold); font-weight: 700; padding-top: 9px; border-bottom-color: rgba(240, 199, 94, .25); }
.ledger tr.round td small { color: var(--dim); font-weight: 400; }
.ledger td.neg { color: #ffb5ab; }
.ledger td.pos { color: #c5f0bf; }
.ledger td small { color: var(--dim); margin-right: 6px; }
.ledger tr.grand td { font-size: 1.250rem; font-weight: 700; color: var(--gold-hi); border-top: 2px solid var(--bronze); border-bottom: 0; }
/* The chronicle fills whatever height the ledger beside it gives the row, and scrolls inside that. */
.lower > .slab { display: flex; flex-direction: column; min-height: 0; }
.chronicle { list-style: none; margin: 0; padding: 0; flex: 1 1 0; min-height: 260px; overflow-y: auto; }
.chronicle li { display: grid; grid-template-columns: max-content 20px 1fr; gap: 4px; padding: 4px 2px; border-bottom: 1px dashed rgba(240, 199, 94, .14); font-size: .920rem; }
.chronicle time { color: var(--dim); font-size: .760rem; padding-top: 2px; white-space: nowrap; min-width: 40px; }
.chronicle svg { margin-top: 3px; }
.chronicle .elite svg { color: #ff9478; } .chronicle .boss svg, .chronicle .victory svg { color: var(--gold); }
.chronicle .death svg, .chronicle .defeat svg, .chronicle .abandoned svg { color: var(--bad); }
.chronicle .embark svg, .chronicle .act svg { color: #a9d3ff; } .chronicle .judge svg, .chronicle .round svg { color: var(--warn); }
.chronicle .empty { display: block; color: var(--dim); font-style: italic; }

/* ------------------------------------------------------------ herald (big announcements) */
.herald {
  position: fixed; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; z-index: 20;
  padding: 26px 20px; opacity: 0; transform: scale(.94); transition: opacity .3s, transform .3s;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .86) 25%, rgba(0, 0, 0, .86) 75%, transparent);
  border-block: 2px solid transparent; border-image: linear-gradient(90deg, transparent, var(--gold), transparent) 1;
}
.herald.show { opacity: 1; transform: none; }
.herald b { display: block; font-size: clamp(2rem, 5.500vw, 4.200rem); letter-spacing: .1em; color: var(--gold-hi); text-shadow: 0 4px 0 #3d0a06; }
.herald.grim b { color: #ffb0a6; }
.herald span { font-size: 1.300rem; }

@media (max-width: 1180px) {
  .arena { grid-template-columns: 1fr 1fr; }
  .maps { grid-column: 1 / -1; order: 3; }
  .awards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}
@media (max-width: 760px) {
  .arena, .lower { grid-template-columns: 1fr; }
  .ribbon { padding-inline: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .pin .ring { animation: none; opacity: .5; }
  .herald, .hp i { transition: none; }
}

.chronicle .restart svg { color: var(--bad); }
