@import url('/fonts.css');

:root {
  color-scheme: dark;
  --ground: #10100f;
  --panel: #191815;
  --raised: #201d19;
  --field: #131110;
  --highlight: #33271c;
  --line: #40372c;
  --line-active: #806749;
  --gold: #e2bc7c;
  --accent: var(--gold);
  --accent-strong: #f1d1a1;
  --ink: #f3eadc;
  --muted: #b9ad9b;
  --quiet: #aa9e8d;
  --cta: #6a2925;
  --cta-hover: #843832;
  --cta-line: #a16b50;
  --on-cta: #fff0d9;
  --scrim: #090807bf;
  --panel-gradient:
    linear-gradient(90deg, #af855e60, transparent 61%) top / 100% 1px no-repeat,
    linear-gradient(155deg, #251f18, var(--panel) 64%);
  --card-gradient: linear-gradient(145deg, #292219, var(--raised) 69%);
  --panel-shadow: 0 8px 22px #08060450;
  --heading: 'Cinzel', Georgia, serif;
  --body: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 400 14px/1.6 var(--body);
  background:
    radial-gradient(ellipse 76% 32rem at 97% 22rem, #573b235e, transparent 72%),
    radial-gradient(ellipse 80% 38rem at 0% 56rem, #412b204c, transparent 70%),
    repeating-linear-gradient(142deg, #dfaf7409 0 1px, transparent 1px 44px),
    linear-gradient(152deg, #151310, var(--ground) 58%, #15120f);
  background-attachment: fixed;
}
@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  body { zoom: 0.8; }
}
button, input, select { font: inherit; }
button, select, input[type=checkbox] { cursor: pointer; }
a { color: var(--accent); }
button { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); line-height: 1.12; }
.frame { width: min(1264px, calc(100% - 80px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 10; inset: 12px auto auto 12px; padding: 10px 16px; background: var(--panel); }

.quiet, .text-link { border: 0; background: transparent; padding: 5px 0; color: var(--accent); text-underline-offset: 4px; }
.quiet:hover, .text-link:hover, .unit-link:hover { text-decoration: underline; }
.pagination button { border: 1px solid var(--line-active); background: var(--raised); border-radius: 3px; padding: 8px 14px; font-weight: 600; }
#language { min-width: 0; padding: 6px 5px; border: 1px solid var(--line-active); border-radius: 3px; color: var(--accent); background: var(--field); }
.pagination button:not(:disabled):hover { background: var(--highlight); }

.hero { position: relative; isolation: isolate; min-height: clamp(390px, 24vw, 560px); display: grid; align-items: center; overflow: hidden; background: #231a16; border-bottom: 1px solid #6c4c36; }
.hero-art, .hero::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-art { z-index: -2; inset-inline-start: auto; width: var(--hero-art-width, 76%); object-fit: cover; object-position: center 48%; }
.hero::after {
  z-index: -1;
  content: '';
  background: linear-gradient(90deg, #110e0cf0, #110e0c96 36%, transparent 69%),
    linear-gradient(0deg, #110e0c69, transparent 37%);
}
.hero-inner { padding-block: 40px 46px; }
.eyebrow { font: 600 15px/1.3 'Barlow Condensed', var(--body); letter-spacing: .19em; text-transform: uppercase; color: var(--gold); margin-bottom: 13px; }
.hero h1 { font-size: clamp(50px, 6vw, 86px); font-weight: 800; letter-spacing: -.045em; line-height: .99; text-shadow: 0 3px 16px #0c0908a0; }
.hero p:not(.eyebrow) { max-width: 440px; margin-top: 20px; font-size: 15px; color: #e6d9c6; }
.primary { display: inline-flex; align-items: center; gap: 14px; border: 1px solid var(--cta-line); background: var(--cta); color: var(--on-cta); border-radius: 4px; text-decoration: none; padding: 10px 17px; font-weight: 700; }
.hero .primary { margin-top: 22px; }
.primary:not(:disabled):hover { background: var(--cta-hover); }
.primary:disabled { opacity: .55; cursor: default; }
.fan-notice { padding-block: 12px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.fan-notice p { font-size: 14px; }

.ranking { padding-top: 35px; padding-bottom: 38px; scroll-margin-top: 16px; }
.section-head, .result-line, .filter-foot, .footer { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; }
.section-head { align-items: end; margin-bottom: 18px; }
.section-head h2 { font-size: 35px; }
.section-head p { color: var(--muted); margin-top: 5px; }
.section-head button { flex-shrink: 0; }
.filters { display: grid; grid-template-columns: minmax(205px, 1.6fr) minmax(135px, 1fr) minmax(110px, .65fr) minmax(146px, 1fr) minmax(150px, 1fr); gap: 13px 16px; padding: 16px 18px; }
.filters label:not(.check), .target-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.filters input[type=search], .filters select, .target-fields select { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line-active); border-radius: 3px; background: var(--field); color: var(--ink); font-size: 13px; font-weight: 400; }
.filters input::placeholder { color: var(--quiet); }
.filter-foot { grid-column: 1/-1; border-top: 1px solid var(--line); padding-top: 9px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.weight-panel { margin-top: 10px; padding: 12px 18px 14px; }
.filters, .weight-panel, .lab-panel { border: 1px solid var(--line); border-radius: 5px; background: var(--panel-gradient); box-shadow: var(--panel-shadow); }
.weight-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.weight-heading h3 { font-size: 16px; }
.weight-heading button, #weightHint { font-size: 12px; }
#weightHint { color: var(--muted); }
.weight-sliders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; margin-top: 10px; }
.weight-sliders > div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; }
.weight-sliders label { font-size: 13px; font-weight: 600; }
.weight-sliders output { color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; }
.weight-sliders input { grid-column: 1 / -1; width: 100%; min-width: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
.target-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 24px; margin-top: 10px; }
.target-status { margin-top: 8px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.result-line { padding: 13px 0 10px; color: var(--muted); font-size: 12px; }
.result-line a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.table-shell { border: 1px solid var(--line); border-radius: 5px; box-shadow: var(--panel-shadow); overflow: hidden; }
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table thead { background: linear-gradient(105deg, #30251a, #272019 60%); color: #dcc3a0; }
th { text-align: left; }
.rank-table th { font-size: 11px; letter-spacing: .075em; text-transform: uppercase; }
.rank-table th, .rank-table td { padding: 11px 15px; }
.rank-table td { border-top: 1px solid var(--line); vertical-align: middle; }
.rank-table tbody tr { background: #171512; }
.rank-table tbody tr:nth-child(even) { background: #1b1815; }
.rank-table tbody tr:hover { background: #2a2119; }
.rank { width: 67px; color: #bd9d72; font-variant-numeric: tabular-nums; }
.unit { width: 24%; }
.unit-link { padding: 0; text-align: left; border: none; background: transparent; color: var(--ink); font-weight: 700; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.unit > span { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.weapon-cell { color: #d2c5b4; font-size: 12px; }
.weapon-cell span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.points { width: 90px; }
.stat-heading small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: normal; text-transform: none; }
.stat-value { font-weight: 600; }
.metric-note { margin-top: 8px; }
.score { width: 120px; color: var(--gold); font-size: 17px; font-weight: 700; }
.score small { color: var(--muted); font-size: 11px; font-weight: 500; }
.mobile-label { display: none; }
.empty { padding: 22px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; color: var(--muted); }
.pagination button:disabled { opacity: .45; cursor: default; }
.footer { border-top: 1px solid var(--line); padding-block: 18px 26px; color: var(--muted); font-size: 12px; }
.footer p { max-width: 80ch; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; flex-shrink: 0; }
.footer-links a { text-underline-offset: 4px; }
.ranking-builder-mode :is(.fan-notice, [data-site-footer]) { display: none; }

.privacy-main { padding-block: clamp(28px, 6vw, 60px); }
.privacy-main article { max-width: 76ch; }
.privacy-main h1 { font-family: var(--body); font-size: clamp(25px, 5vw, 52px); overflow-wrap: anywhere; }
.privacy-main h2 { margin-block: 24px 7px; font-size: 21px; }
.privacy-main p { margin-block: 8px; }
.privacy-main .privacy-draft { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-inline-start: 3px solid var(--gold); background: var(--panel); }

dialog { --dialog-padding: 26px; width: min(680px, calc(100% - 28px)); max-height: min(88dvh, 960px); padding: 0; border: 1px solid var(--line-active); border-radius: 5px; color: var(--ink); background: var(--panel); box-shadow: 0 16px 56px #090704c4; }
dialog::backdrop { background: var(--scrim); }
dialog.wide { width: min(1060px, calc(100% - 28px)); }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: var(--dialog-padding) var(--dialog-padding) 14px; background: var(--panel); }
.dialog-header h2 { min-width: 0; font-size: clamp(24px, 5vw, 33px); overflow-wrap: anywhere; }
.dialog-frame { padding: 0 var(--dialog-padding) var(--dialog-padding); }
.dialog-frame h3 { font-size: 17px; margin-top: 22px; margin-bottom: 8px; }
.dialog-frame p + p { margin-top: 10px; }
.dialog-frame ul { margin-block: 8px 14px; padding-left: 20px; }
.close { flex: 0 0 34px; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 2px; background: var(--raised); color: var(--gold); font-size: 24px; line-height: 1; }
.subtitle, .fine, .references span, .detail-summary small, .score-parts small { color: var(--muted); }
.fine, .references span { font-size: 12px; }
.detail-summary, .score-parts { display: grid; gap: 8px; }
.detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.detail-summary > div, .score-parts > div { background: var(--raised); border: 1px solid var(--line); padding: 10px 12px; }
.spotlight { margin-top: 14px; padding: clamp(10px, 2vw, 20px); border: 1px solid var(--line); background: var(--field); }
.spotlight-header, .spotlight-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.spotlight-header { justify-content: space-between; margin-bottom: 8px; }
.spotlight-header h3 { margin: 0; }
.spotlight-controls label { font-size: 12px; color: var(--muted); }
.spotlight-controls select { margin-left: 4px; min-height: 30px; }
#spotlightChart { margin-block: 10px; }
#spotlightChart svg { display: block; width: 100%; height: auto; overflow: visible; }
#spotlightChart text { fill: var(--muted); font: 11px var(--body); }
.chart-grid { stroke: var(--line); fill: none; }
.chart-cursor { stroke: var(--muted); stroke-dasharray: 3 4; opacity: .65; }
.chart-series { fill: none; stroke-width: 1.75; opacity: .78; }
.chart-series.is-focused, .chart-series:hover { stroke-width: 3; opacity: 1; }
.dialog-frame .spotlight-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr)); gap: 5px; padding: 4px; list-style: none; max-height: 260px; overflow: auto; }
.spotlight-legend button { width: 100%; height: 100%; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 9px; text-align: left; font-size: 12px; background: var(--raised); border: 1px solid var(--line); }
.spotlight-legend button[aria-pressed="true"] { border-color: var(--gold); }
.spotlight-legend strong, .spotlight-legend small { display: block; overflow-wrap: anywhere; }
.spotlight-legend small { color: var(--muted); }
.chart-swatch { height: 3px; background: var(--series-color); }
.chart-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-summary strong { display: block; color: var(--gold); font: 700 34px/1.05 'Barlow Condensed', var(--body); }
.detail-summary span, .detail-summary small { display: block; }
.score-parts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 8px; }
.score-parts dd { color: var(--gold); margin: 4px 0 0; font-weight: 700; }
.dialog-frame .equipment, .dialog-frame .references { list-style: none; padding: 0; }
.equipment li, .references li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.equipment li { display: flex; gap: 9px; }
.equipment li span { color: var(--gold); flex: 0 0 30px; }
.references li span:not([aria-hidden]) { display: block; }
.notice, details { border: 1px solid var(--line); background: var(--raised); padding: 11px 13px; margin-top: 13px; }
details summary { cursor: pointer; color: var(--gold); }
details[open] summary { margin-bottom: 8px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 16px; }
.compare-scroll { overflow-x: auto; margin-top: 12px; }
.target-table th, .target-table td { border: 1px solid var(--line); vertical-align: top; }
.target-table th { background: var(--raised); }
.target-table { font-size: 13px; font-variant-numeric: tabular-nums; }
.target-table th, .target-table td { padding: 7px 8px; }
.target-table td { text-align: center; }
#targetMix .compare-scroll { margin-bottom: 12px; }

@media (max-width: 900px) {
  .frame { width: calc(100% - 48px); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .target-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-table th, .rank-table td { padding-inline: 10px; }
}
@media (max-width: 1040px) {
  .hero { min-height: 0; background: var(--ground); }
  .hero-inner { grid-area: 1 / 1; padding-block: 28px 4px; }
  .hero-art {
    position: relative;
    inset: auto;
    z-index: 0;
    grid-area: 2 / 1;
    width: 100%;
    height: auto;
    max-height: 320px;
    aspect-ratio: 2.2;
    object-position: right center;
    mask-image: linear-gradient(transparent, #000 23px);
  }
  .hero::after { content: none; }
}
@media (max-width: 600px) {
  .frame { width: calc(100% - 30px); }
  .hero h1 { font-size: clamp(41px, 11.7vw, 66px); }
  .hero p:not(.eyebrow) { max-width: 305px; font-size: 13px; }
  .ranking { padding-top: 25px; }
  .section-head { align-items: start; flex-direction: column; gap: 3px; }
  .section-head h2 { font-size: 28px; }
  .section-head p { font-size: 13px; }
  .filters { gap: 10px; padding: 12px; }
  .filters .search, .filters label:has(#sort) { grid-column: 1/-1; }
  .filter-foot { align-items: start; flex-direction: column; gap: 5px; }
  .weight-panel { padding: 12px; }
  .weight-sliders, .target-fields { grid-template-columns: 1fr; gap: 10px; }
  .footer { align-items: start; flex-direction: column; gap: 3px; }
  dialog { --dialog-padding: 18px; }
  .score-parts { grid-template-columns: 1fr; }
  .score-parts > div { display: flex; justify-content: space-between; }
  .score-parts dd { margin: 0; }
}

.custom-units { padding: 12px 0; }
.custom-units > p { margin: 5px 0; }
.custom-units ul { list-style: none; padding: 0; }
.custom-units li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.custom-units li small { display: block; color: var(--muted); }
.custom-units li button, .custom-row-actions button { margin: 3px; padding: 4px 8px; font-size: .85rem; }
.custom-row-actions { display: flex !important; align-items: center; flex-wrap: wrap; gap: 4px; }
.custom-row-actions small { color: var(--muted); }
.custom-unit-status:empty { display: none; }
/* Cancel the outer page's compact scale at the iframe boundary. The editor
   applies its own compact scale; nested zoom breaks Chromium pointer mapping. */
.custom-build-dialog { width: min(1100px, calc(100vw - 24px)); height: min(920px, calc(100dvh - 24px)); padding: 0; overflow: hidden; }
@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  .custom-build-dialog { zoom: 1.25; }
}
.custom-build-dialog[open] { display: flex; flex-direction: column; }
.custom-build-dialog > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.custom-build-dialog h2 { margin: 0; font-size: 1.2rem; }
.custom-build-dialog > iframe { display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: var(--field); }
.custom-build-dialog > iframe[inert] { pointer-events: none; }
.custom-builder-status { margin: 0; padding: 0 16px; }
.custom-builder-status:empty { display: none; }
@media (max-width: 820px) {
  .table-shell { border: none; box-shadow: none; }
  .rank-table { display: block; }
  .rank-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .rank-table tbody { display: grid; gap: 8px; }
  .rank-table tbody tr { display: grid; grid-template-columns: 26px repeat(6, minmax(0, 1fr)); gap: 4px 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; }
  .rank-table td { padding: 0; border: none; width: auto; }
  .rank-table .rank { grid-column: 1; grid-row: 1; }
  .rank-table .unit { grid-column: 2/-1; grid-row: 1; }
  .rank-table .weapon-cell { grid-column: 2/-1; grid-row: 2; }
  .rank-table .points { grid-column: 2/5; grid-row: 3; }
  .rank-table .score { grid-column: 5/-1; grid-row: 3; text-align: right; }
  .rank-table .points { text-align: left; }
  .rank-table .stat { grid-row: 4; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); text-align: center; white-space: normal; }
  .stat-shooting { grid-column: 1/4; }
  .stat-melee { grid-column: 4/6; }
  .stat-durability { grid-column: 6/-1; }
  .mobile-label { display: inline; margin-right: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
  .stat .mobile-label { display: block; margin: 0; }
}
