/* Ad Arma: porphyry and gilt. Solid grounds only; gilt marks what matters. */
:root {
  --porphyry: #3a1424;
  --porphyry-2: #561d33;   /* raised band, hover */
  --porphyry-ink: #2a0f1a; /* text on marble, 15:1 */
  --rose: #e8d7dd;         /* secondary text on porphyry, 10:1 */
  --gilt: #d9a94a;
  --gilt-hi: #e8bf66;
  --gilt-ink: #8a6210;      /* gilt text and rims on marble, 4.9:1 */
  --marble: #f3f1ee;
  --marble-2: #e7e3de;     /* rules and quiet fills on marble */
  --muted: #6a5560;        /* secondary text on marble, 6.3:1 */
  --blue: #2b59a3;  --blue-pale: #c9d6ec;   /* on marble */
  --red: #b23b2e;   --red-pale: #efcdc8;
  --serif: "Marcellus", "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--porphyry); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; /* footer sits at the bottom on short pages */
  background: var(--marble); color: var(--porphyry-ink);
  font: 400 1.125rem/1.6 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gilt); color: var(--porphyry); }
[hidden] { display: none !important; }
main { flex: 1 0 auto; width: 100%; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gilt); outline-offset: 3px; }
main :focus-visible { outline-color: var(--porphyry-2); } /* gilt is too faint on marble */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: .01em; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.375rem); }
h3 { font-family: var(--sans); font-weight: 700; font-size: 1.125rem; }
p { margin: 0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 max(16px, 4vw); }

/* Porphyry bands */
.band { background: var(--porphyry); color: #fff; }
.band a { color: #fff; }

/* Header */
.top { display: flex; align-items: center; gap: 12px 32px; flex-wrap: wrap; padding-block: 16px; }
.brand { font-family: var(--serif); font-size: 1.5rem; letter-spacing: .14em; color: var(--gilt) !important; text-decoration: none; }
.live-strip { display: flex; align-items: center; gap: 4px 20px; flex-wrap: wrap; margin-right: auto; color: var(--rose); font-size: 1rem; }
.live-strip strong { color: #fff; font-weight: 700; }
.live-strip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rose); opacity: .5; }
.live-strip.on .dot { background: var(--gilt); opacity: 1; animation: beat 2.4s ease-out infinite; }
.live-strip.down .dot { background: #f08a7a; opacity: 1; }
@keyframes beat { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.nav { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 600; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--rose); }
.nav a[aria-current="page"] { border-bottom-color: var(--gilt); }

/* The action: gilt, everywhere */
.enlist {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gilt); color: var(--porphyry) !important; text-decoration: none;
  font: 700 1.0625rem/1 var(--sans); letter-spacing: .01em;
  padding: 14px 24px; border: 0; border-radius: 3px; cursor: pointer;
  box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 6px 16px -8px rgb(0 0 0 / .6);
  transition: background-color .15s ease-out;
}
.enlist:hover { background: var(--gilt-hi); }
.enlist:disabled { background: var(--marble-2); color: var(--muted) !important; box-shadow: none; cursor: default; }
.enlist.big { font-size: 1.25rem; padding: 18px 32px; }
.nav .enlist { padding: 10px 18px; border-bottom: 0; }

/* Hero: inscription left, gilt numerals right */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-block: clamp(48px, 9vh, 112px) clamp(56px, 10vh, 120px); }
.hero h1 { font-size: clamp(4rem, 10vw, 8.5rem); color: var(--gilt); letter-spacing: .06em; line-height: .95; }
.tagline { font-family: var(--serif); font-size: clamp(1.5rem, 2.6vw, 2.125rem); margin-top: 24px; }
.lede { color: var(--rose); max-width: 46ch; margin-top: 16px; }
.hero .enlist { margin-top: 32px; }
.numbers { list-style: none; margin: 0; padding: 0 0 0 40px; border-left: 1px solid rgb(217 169 74 / .45); display: grid; gap: 28px; }
.numbers li { display: grid; gap: 4px; }
.num { font-family: var(--sans); font-weight: 600; letter-spacing: -.02em; color: var(--gilt); font-size: clamp(3.5rem, 7vw, 6rem); line-height: .9; }
.numbers span:last-child { color: var(--rose); font-size: 1.0625rem; }
.numbers li.quiet .num { display: none; }
.numbers li.quiet span:last-child { font-family: var(--serif); font-size: clamp(1.25rem, 2vw, 1.625rem); line-height: 1.25; color: #fff; max-width: 22ch; text-wrap: balance; }

/* Marble reading sections */
.section { padding-block: 88px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--gilt); }
.section-head p { color: var(--muted); }
.more { font-weight: 700; color: var(--porphyry-2); }

/* Ledger */
.ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding-top: 16px; }
.ledger ul { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.ledger li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; }
.ledger li::before { content: ""; width: 12px; height: 12px; margin-top: .55em; border-radius: 50%; background: var(--gilt); }
.ledger .missing li { color: var(--muted); }
.ledger .missing li::before { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }

/* Seat bars: one segment per seat, players solid, AI pale */
.seats { display: grid; gap: 3px; width: max-content; justify-self: center; }
.seats .row { display: flex; gap: 3px; }
.seats i { width: 12px; height: 12px; border-radius: 2px; }
.seats .b { background: var(--blue); } .seats .ba { background: var(--blue-pale); }
.seats .r { background: var(--red); }  .seats .ra { background: var(--red-pale); }

/* Battle rows (history and live) */
.battles { list-style: none; margin: 0; padding: 0; }
.battle { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 28px; align-items: center; padding-block: 18px; border-bottom: 1px solid var(--marble-2); }
.team { display: flex; flex-wrap: wrap; gap: 2px 14px; font-weight: 700; min-width: 0; }
.team.t1 { justify-content: flex-end; text-align: right; color: var(--blue); }
.team.t2 { color: var(--red); }
.team .ai { color: var(--muted); font-weight: 400; }
.battle .meta { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 1rem; }
.battle.live .meta { color: var(--porphyry-2); font-weight: 600; }

/* Finished battles: verdict line and a strip per side, opening to both scoreboards */
.match { border-bottom: 1px solid var(--marble-2); }
.match summary { display: grid; gap: 8px; padding-block: 18px; cursor: pointer; list-style: none; }
.match summary::-webkit-details-marker { display: none; }
.match .line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.match .verdict { font-family: var(--serif); font-size: 1.375rem; font-weight: 400; }
.match.w1 .verdict { color: var(--blue); } .match.w2 .verdict { color: var(--red); }
.match .meta, .match .mvp { color: var(--muted); font-size: 1rem; }
.match .toggle { margin-left: auto; color: var(--porphyry-2); font-weight: 600; font-size: 1rem; }
.match .toggle::after { content: ""; display: inline-block; inline-size: .4em; block-size: .4em; margin: 0 .15em .2em .5em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s ease-out; }
.match[open] .toggle::after { transform: translateY(.2em) rotate(-135deg); }

.laurel { inline-size: 1.5em; block-size: 1.5em; vertical-align: -.35em; margin-left: .3em; color: var(--gilt); }
.strip { display: grid; grid-template-columns: 6rem minmax(0, 1fr) minmax(5rem, 12rem) 6.5rem; gap: 4px 16px; align-items: baseline; padding-top: 8px; border-top: 1px solid var(--marble-2); }
.strip .name { font-family: var(--serif); font-size: 1.125rem; white-space: nowrap; }
.strip.t1 .name { color: var(--blue); } .strip.t2 .name { color: var(--red); }
.strip .people { display: flex; flex-wrap: wrap; gap: 2px 18px; min-width: 0; }
.strip .person small { color: var(--muted); font-size: .9375rem; }
/* Decorations: struck gilt phalerae, sized to sit inside the name line so rows keep one height. */
.decos { display: inline-flex; flex-wrap: wrap; gap: 4px 7px; margin-left: 10px; vertical-align: -5px; }
.deco { position: relative; display: inline-grid; place-items: center; inline-size: 22px; block-size: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gilt-hi), var(--gilt) 70%); box-shadow: inset 0 0 0 1.5px var(--gilt-ink); color: var(--porphyry); }
.deco svg { inline-size: 16px; block-size: 16px; fill: currentColor; }
.deco.executed { box-shadow: inset 0 0 0 1.5px var(--gilt-ink), 0 0 0 1.5px var(--marble), 0 0 0 2.5px var(--gilt-ink); }
.deco .n { position: absolute; right: -6px; bottom: -5px; min-inline-size: 14px; block-size: 14px; padding: 0 3px; border-radius: 7px;
  background: var(--porphyry); color: var(--marble); font: 700 10px/14px var(--sans); text-align: center; }
.decos.mini { gap: 4px; margin-left: 6px; vertical-align: -2px; }
.decos.mini .deco { inline-size: 14px; block-size: 14px; }
.decos.mini .deco svg { inline-size: 10px; block-size: 10px; }
.decos.mini .deco.executed { box-shadow: inset 0 0 0 1px var(--gilt-ink), 0 0 0 1px var(--marble), 0 0 0 2px var(--gilt-ink); }
.decos.mini .n { display: none; }
.deco-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; padding-top: 14px; border-top: 1px solid var(--marble-2); color: var(--muted); font-size: .9375rem; }
.deco-legend > span { display: inline-flex; align-items: center; gap: 10px; }
.deco-legend .deco { flex: none; }
.deco-legend b { color: var(--porphyry-ink); font-weight: 600; }
.strip .cpu { color: var(--muted); }
.strip .bar { align-self: center; block-size: 4px; background: var(--marble-2); }
.strip .bar i { display: block; block-size: 100%; background: #b9aab1; }
.strip .dmg { text-align: right; color: var(--muted); font-size: 1rem; white-space: nowrap; }

.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 40px; padding-block: 8px 28px; }
.side-head { display: flex; align-items: center; block-size: 2.75rem; gap: 0 4px; margin: 0; padding-bottom: 2px; border-bottom: 1px solid var(--gilt); font-family: var(--serif); font-weight: 400; font-size: 1.375rem; }
.side.t1 .side-head { color: var(--blue); } .side.t2 .side-head { color: var(--red); }
.side-head small { margin-left: 4px; font: 600 .9375rem var(--sans); color: var(--gilt-ink); }
.board { inline-size: 100%; border-collapse: collapse; font-size: 1rem; }
.board th { text-align: left; color: var(--muted); font-size: .875rem; font-weight: 600; padding: 8px 6px 4px 0; }
.board td { padding: 8px 6px 8px 0; border-top: 1px solid var(--marble-2); vertical-align: top; }
.board .stat { text-align: right; white-space: nowrap; padding-right: 0; padding-left: 12px; }
.board .who b { margin-right: 8px; }
.board .who small { color: var(--muted); font-size: .9375rem; }
.board .units { display: block; margin-top: 2px; color: var(--muted); font-size: .9375rem; cursor: help; }
.board .rank { color: var(--gilt-ink); font-family: var(--serif); letter-spacing: .04em; line-height: 1; }
.board .cpu b, .board tr.cpu td:only-child { color: var(--muted); font-weight: 400; }
.board tfoot th, .board tfoot td { border-top: 2px solid var(--marble-2); font-weight: 700; color: var(--porphyry-ink); font-size: 1rem; }

/* News */
.news { list-style: none; margin: 0; padding: 0; }
.post { display: grid; gap: 8px; padding-block: 24px; border-bottom: 1px solid var(--marble-2); max-width: 70ch; }
.post h3 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; }
.post-meta { color: var(--muted); font-size: 1rem; font-weight: 600; }

/* Ladder */
.ladder { list-style: none; margin: 0; padding: 0; }
.ladder li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto auto; gap: 4px 24px; align-items: baseline; padding-block: 12px; border-bottom: 1px solid var(--marble-2); }
.ladder .rank { font-family: var(--serif); font-size: 1.5rem; color: var(--muted); }
.ladder li.top .rank { color: var(--porphyry-2); }
.ladder li.top:first-child .rank { color: var(--gilt-ink); }
.ladder .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ladder .score { font-weight: 700; }
.ladder .record { color: var(--muted); }

.empty { color: var(--muted); padding-block: 20px; }
.status-line { color: var(--muted); min-height: 1.6em; }
.status-line.error { color: var(--red); font-weight: 600; }
.retry { font: 700 1rem var(--sans); color: var(--porphyry-2); background: none; border: 0; padding: 4px 0; text-decoration: underline; text-underline-offset: .22em; cursor: pointer; }

/* Closing band and footer */
.close { margin-top: 112px; }
.close .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 56px; }
footer { border-top: 1px solid rgb(217 169 74 / .35); color: var(--rose); font-size: 1rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 28px 36px; }

/* Sub-page title */
.page-title { padding-block: 56px 48px; }
.page-title h1 { font-size: clamp(2.75rem, 6vw, 4.5rem); color: var(--gilt); letter-spacing: .04em; }
.page-title p { color: var(--rose); max-width: 60ch; margin-top: 16px; }
.page-body { padding-block: 32px 0; }

/* Enlist steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step { padding: 28px 28px 32px; background: #fff; border-top: 4px solid var(--marble-2); display: grid; gap: 14px; align-content: start; }
.step .n { font-family: var(--serif); font-size: 2.5rem; line-height: 1; color: var(--muted); }
.step h2 { font-size: 1.625rem; }
.step.current { border-top-color: var(--gilt); box-shadow: 0 12px 32px -20px rgb(58 20 36 / .45); }
.step.current .n, .step.done .n { color: var(--porphyry-2); }
.step.done { border-top-color: var(--porphyry-2); }
.step[aria-disabled="true"] { color: var(--muted); }
.field { display: grid; gap: 8px; }
.field label { font-weight: 700; }
.field input {
  font: 600 1.125rem var(--sans); padding: 12px 14px; width: 100%; max-width: 22rem;
  background: var(--marble); color: var(--porphyry-ink); border: 1px solid #b9aab1; border-radius: 3px; caret-color: var(--porphyry-2);
}
.field input:focus-visible { outline: 3px solid var(--gilt); outline-offset: 1px; border-color: var(--porphyry-2); }
.field input:disabled { opacity: .6; }
.field small { color: var(--muted); font-size: 1rem; }
.sworn-number { font-family: var(--sans); font-weight: 600; font-size: 4.5rem; line-height: 1; color: var(--porphyry-2); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; }
  .numbers { padding: 24px 0 0; border-left: 0; border-top: 1px solid rgb(217 169 74 / .45); grid-template-columns: repeat(3, auto); justify-content: start; gap: 24px; }
  .num { font-size: clamp(2.5rem, 12vw, 3.5rem); }
  .numbers span:last-child { font-size: .9375rem; }
  .ledger, .steps { grid-template-columns: 1fr; }
  .battle { grid-template-columns: 1fr; }
  .team.t1 { justify-content: flex-start; text-align: left; }
  .battle .seats { order: -1; justify-self: start; }
  .battle .meta { text-align: left; }
  .boards { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 5.5rem minmax(0, 1fr) auto; }
  .strip .bar { grid-column: 2; }
  .strip .dmg { grid-column: 3; }
  .match .toggle { margin-left: 0; }
  .ladder li { grid-template-columns: 3.5rem minmax(0, 1fr) auto; }
  .ladder .record { grid-column: 2 / -1; grid-row: 2; }
  .section { padding-top: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
