/* Unit page. The biome (html[data-biome]) sets accent, tint, sky and weather of the whole page. */

@property --accent { syntax: '<color>'; inherits: true; initial-value: #dcb64c; }
@property --tint { syntax: '<color>'; inherits: true; initial-value: #1c2016; }

:root {
  --bg: #100e0b;
  --panel: #1a1712;
  --panel-2: #231f18;
  --line: rgba(236, 228, 208, 0.11);
  --line-2: rgba(236, 228, 208, 0.24);
  --text: #ece4d0;
  --muted: #a59b84;
  --dim: #6f6757;
  --accent: #dcb64c; /* also BIOME_ACCENT in app.js */
  --accent-ink: #15120c;
  --tint: #1c2016;
  --de: #cdb98a;
  --su: #d2493a;
  --us: #8ea767;
  --neutral: #8a96a0;
  --display: "Big Shoulders", "Arial Narrow", Impact, sans-serif;
  --stencil: "Big Shoulders Stencil", "Big Shoulders", Impact, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 56px;
  --gutter: clamp(16px, 4vw, 64px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
  transition: --accent 0.9s ease, --tint 0.9s ease;
}
html[data-biome="desert"] { --accent: #f0a552; --tint: #2b1e10; }
html[data-biome="winter"] { --accent: #a8d4ea; --tint: #172028; }
[data-faction="de"] { --faction: var(--de); }
[data-faction="su"] { --faction: var(--su); }
[data-faction="us"] { --faction: var(--us); }
[data-faction="neutral"] { --faction: var(--neutral); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 8px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(110% 70% at 50% 0%, var(--tint), transparent 75%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p, dl, dd, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Film grain over everything, scroll progress at the very top. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 60;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .progress { animation: progress linear both; animation-timeline: scroll(root); }
}
@keyframes progress { to { transform: scaleX(1); } }

/* --- shared pieces ---------------------------------------------------------------- */

.mark { display: inline-block; width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.mark svg, .ico svg { display: block; width: 100%; height: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 12px 20px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(16, 14, 11, 0.4);
  font: 700 17px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.25s var(--ease);
}
.btn::after { content: "→"; transition: transform 0.25s var(--ease); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:hover::after { transform: translateX(4px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--text); border-color: var(--text); color: var(--accent-ink); }
.btn.small { padding: 9px 14px; font-size: 15px; }
.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 11.5px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 4px;
}
.link:hover { color: var(--accent); text-decoration-color: currentColor; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 2px; background: rgba(16, 14, 11, 0.55); backdrop-filter: blur(8px); }
.seg button {
  padding: 7px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 11.5px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s, background 0.3s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Picture frame of a unit: game thumbnail or model snapshot, both on transparent ground. */
.pic { display: grid; place-items: center; aspect-ratio: 3 / 2; color: var(--dim); font: 11px var(--mono); }
.pic img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.5)); animation: fade 0.5s both; }
@keyframes fade { from { opacity: 0; } }

/* The sky behind a 3D view: one layer per biome, cross-faded. */
.sky, .sky i { position: absolute; inset: 0; }
.sky i { opacity: 0; transition: opacity 1.1s ease; }
html[data-biome="forest"] .sky-forest, html[data-biome="desert"] .sky-desert, html[data-biome="winter"] .sky-winter { opacity: 1; }
.sky-forest { background: radial-gradient(58% 34% at 50% 76%, rgba(150, 160, 110, 0.38), transparent 72%), linear-gradient(#252d24 0%, #1b2018 48%, var(--bg) 100%); }
.sky-desert { background: radial-gradient(58% 34% at 50% 76%, rgba(250, 180, 100, 0.42), transparent 72%), linear-gradient(#6a4b2b 0%, #38260f 50%, var(--bg) 100%); }
.sky-winter { background: radial-gradient(58% 34% at 50% 76%, rgba(200, 225, 240, 0.36), transparent 72%), linear-gradient(#41525f 0%, #1f282f 50%, var(--bg) 100%); }

/* --- navigation ------------------------------------------------------------------- */

#nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid transparent;
  transition: background 0.4s, border-color 0.4s;
}
#nav.solid { background: rgba(16, 14, 11, 0.82); border-color: var(--line); backdrop-filter: blur(14px); }
.brand { font: 900 22px/1 var(--stencil); letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.brand i { font-style: normal; color: var(--accent); }
.links { display: flex; gap: 22px; margin-right: auto; }
.links a {
  position: relative;
  padding: 6px 0;
  color: var(--muted);
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}
.links a::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.3s var(--ease); }
.links a:hover { color: var(--text); }
.links a:hover::after { transform: scaleX(1); }

/* --- hero ------------------------------------------------------------------------- */

.hero {
  --p: 0; /* scroll progress through the hero, set by app.js */
  position: relative;
  min-height: max(100svh, 640px);
  display: grid;
  grid-template: "space space" 1fr "copy plate" auto "kpis kpis" auto / minmax(0, 1fr) auto;
  gap: 0 32px;
  padding: 0 var(--gutter);
  overflow: hidden;
  isolation: isolate;
}
.hero .sky { z-index: -3; }
.title {
  position: absolute;
  z-index: -2;
  top: calc(var(--nav-h) + 3.5vh);
  left: 50%;
  width: max-content;
  display: flex;
  gap: 0.2em;
  font: 900 16vw/0.82 var(--stencil);
  text-transform: uppercase;
  white-space: nowrap;
  translate: -50% calc(var(--p) * -90px);
  opacity: calc(1 - var(--p) * 1.4);
  user-select: none;
}
.title .word { display: inline-block; overflow: hidden; padding-top: 0.05em; }
.title .hollow { color: transparent; -webkit-text-stroke: max(1.5px, 0.012em) var(--accent); }
.title .ch { display: inline-block; animation: letter 1s var(--ease) both; animation-delay: calc(var(--n) * 60ms + 200ms); }
@keyframes letter { from { transform: translateY(105%); } }
#hero-view, #weather { position: absolute; left: 0; width: 100%; pointer-events: none; }
#hero-view { z-index: -1; top: 3%; height: 80%; opacity: calc(1 - var(--p) * 1.1); transition: opacity 0.6s ease; }
#hero-view.swap { opacity: 0; transition-duration: 0.3s; }
#weather { z-index: 0; top: 0; height: 100%; opacity: calc(1 - var(--p)); }
.hero::after {
  /* Fades the stage into the page. */
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  z-index: -1;
  background: linear-gradient(transparent, var(--bg) 92%);
  pointer-events: none;
}
.hero-copy { grid-area: copy; align-self: end; max-width: 25rem; padding-bottom: 36px; animation: rise 1s var(--ease) 0.9s both; }
.kicker { color: var(--accent); font: 500 12px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; }
.lede { margin: 14px 0 24px; font: 700 clamp(22px, 2.1vw, 31px)/1.12 var(--display); letter-spacing: 0.01em; text-wrap: balance; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }

.plate {
  --t: 0; /* progress towards the next featured unit */
  grid-area: plate;
  align-self: end;
  width: min(340px, 100%);
  margin-bottom: 36px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(16, 14, 11, 0.62);
  backdrop-filter: blur(10px);
  animation: rise 1s var(--ease) 1.1s both;
}
.plate:empty { visibility: hidden; }
.pips { display: flex; gap: 8px; margin-bottom: 14px; }
.pips button { flex: 1; display: flex; align-items: center; gap: 8px; padding: 4px 0; border: 0; background: none; opacity: 0.5; transition: opacity 0.3s; }
.pips button:hover, .pips button[aria-pressed="true"] { opacity: 1; }
.pips i { flex: 1; height: 2px; background: var(--line-2); position: relative; overflow: hidden; }
.pips [aria-pressed="true"] i::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--t)); }
.plate-kicker { color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.plate h2 { margin: 4px 0 12px; font: 900 28px/1 var(--display); text-transform: uppercase; letter-spacing: 0.01em; text-wrap: balance; }
.plate .plate-kicker, .plate h2, .plate .facts, .plate .btn { animation: rise 0.6s var(--ease) both; }
.plate h2 { animation-delay: 60ms; }
.plate .facts { animation-delay: 120ms; }
.plate .btn { animation-delay: 180ms; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.plate .facts { margin-bottom: 16px; }
.plate .facts li { color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.plate .facts b { display: block; color: var(--text); font: 500 14px var(--mono); letter-spacing: 0; text-transform: none; }

.kpis {
  grid-area: kpis;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-2);
  animation: rise 1s var(--ease) 1.3s both;
}
.kpis div { padding: 16px 0 22px 18px; border-left: 1px solid var(--line); }
.kpis div:first-child { padding-left: 0; border-left: 0; }
.kpis dd { font: 900 clamp(34px, 4vw, 58px)/1 var(--display); font-variant-numeric: tabular-nums; }
.kpis dt { margin-top: 2px; color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }

/* --- sections --------------------------------------------------------------------- */

.band { padding: clamp(72px, 11vw, 150px) var(--gutter) 0; }
.head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 24px; align-items: end; margin-bottom: clamp(28px, 4vw, 56px); }
.head .no { grid-row: span 2; align-self: start; color: transparent; font: 900 clamp(60px, 9vw, 140px)/0.8 var(--stencil); -webkit-text-stroke: 1.5px var(--accent); }
.head h2 { font: 900 clamp(44px, 7vw, 108px)/0.86 var(--display); text-transform: uppercase; letter-spacing: 0.005em; }
.head p { max-width: 56ch; color: var(--muted); font-size: 16px; text-wrap: pretty; }

[data-reveal] { opacity: 0; transform: translateY(34px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
[data-reveal].in { opacity: 1; transform: none; }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; }
.features article { position: relative; padding: 22px 0 38px; border-top: 1px solid var(--line-2); }
.features article::before { content: ""; position: absolute; inset: -1px 0 auto; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.7s var(--ease); }
.features article:hover::before { transform: scaleX(1); }
.features b { display: block; color: var(--accent); font: 900 clamp(48px, 5vw, 76px)/1 var(--stencil); letter-spacing: 0.01em; }
.features h3 { margin: 10px 0 8px; font: 700 26px/1.05 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.features p { max-width: 44ch; color: var(--muted); text-wrap: pretty; }

/* --- armies ----------------------------------------------------------------------- */

.armies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.army {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 0 20px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--faction);
  border-radius: 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--faction) 9%, var(--panel)), var(--panel));
  text-decoration: none;
  overflow: hidden;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), border-color 0.3s;
}
.army:hover { border-color: var(--faction); }
.army > :not(.marquee) { margin-inline: 22px; }
.army-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.army-head .mark { width: 30px; height: 30px; }
.army-head h3 { font: 900 clamp(30px, 3vw, 46px)/0.9 var(--display); text-transform: uppercase; }
.army-head .count { margin-left: auto; color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.army-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.army-stats b { display: block; color: var(--text); font: 900 26px/1 var(--display); letter-spacing: 0; }
.army-fact { margin-top: 16px; color: var(--muted); font-size: 13px; }
.army-fact strong { display: block; color: var(--text); font-weight: 500; }
.marquee { margin: 18px 0 16px; padding: 10px 0; border-block: 1px solid var(--line); background: rgba(0, 0, 0, 0.22); overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.track { display: flex; width: max-content; animation: marquee var(--dur, 50s) linear infinite; }
.army:hover .track { animation-play-state: paused; }
.strip { display: flex; }
.strip .pic { width: 132px; margin-right: 6px; }
@keyframes marquee { to { transform: translateX(-50%); } }
.more { color: var(--faction); font: 700 16px var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.more::after { content: " →"; display: inline-block; margin-left: 6px; transition: transform 0.25s var(--ease); }
.army:hover .more::after { transform: translateX(5px); }

/* --- duel ------------------------------------------------------------------------- */

.duel { padding: clamp(18px, 3vw, 40px); border: 1px solid var(--line); border-radius: 2px; background: var(--panel); }
.duel-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; }
.side { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 4px; min-width: 0; }
.side-b { justify-items: end; text-align: right; }
.side .pic { width: min(100%, 340px); background: radial-gradient(50% 40% at 50% 62%, color-mix(in srgb, var(--faction) 22%, transparent), transparent); }
.side-b .pic img { transform: scaleX(-1); }
.side-kicker { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.side h3 { font: 900 clamp(22px, 2.6vw, 38px)/0.95 var(--display); text-transform: uppercase; text-wrap: balance; }
.side-sub { color: var(--muted); font: 13px var(--mono); min-height: 1.5em; }
.side select { max-width: 100%; margin: 8px 0 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 2px; background: var(--bg); font-size: 13px; }
.versus { display: grid; justify-items: center; gap: 12px; }
.versus span { color: transparent; font: 900 clamp(48px, 7vw, 110px)/0.8 var(--stencil); -webkit-text-stroke: 1.5px var(--accent); }
.rows { margin-top: 26px; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.row .label { color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; text-align: center; }
.val { display: flex; align-items: center; gap: 12px; font: 500 13.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.val.a { flex-direction: row; justify-content: flex-end; }
.val.b { flex-direction: row-reverse; justify-content: flex-end; }
.val span { min-width: 78px; }
.val.a span { text-align: right; }
.val i { flex: 0 1 auto; width: var(--w); max-width: calc(100% - 90px); height: 10px; background: var(--line-2); animation: bar 1s var(--ease) both; }
.val.a i { transform-origin: 100% 50%; }
.val.b i { transform-origin: 0 50%; }
.val.win { color: var(--text); }
.val.win i { background: var(--accent); }
@keyframes bar { from { transform: scaleX(0); } }
.duel-note { margin-top: 16px; color: var(--dim); font-size: 12.5px; }

/* --- arsenal ---------------------------------------------------------------------- */

.toolbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 12px var(--gutter);
  border-block: 1px solid var(--line);
  background: rgba(16, 14, 11, 0.86);
  backdrop-filter: blur(14px);
}
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: none;
  color: var(--muted);
  font: 700 17px/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s, background 0.3s;
}
.tabs button small { font: 500 10.5px var(--mono); opacity: 0.7; }
.tabs button:hover { color: var(--text); border-color: var(--line-2); }
.tabs button[aria-pressed="true"] { color: var(--text); border-color: var(--faction); background: color-mix(in srgb, var(--faction) 16%, transparent); box-shadow: inset 0 -2px 0 var(--faction); }
#search {
  flex: 1 1 200px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--bg);
  font: 13px var(--mono);
}
#search::placeholder { color: var(--dim); }
.chips { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.chips button:hover { color: var(--text); border-color: var(--line-2); }
.chips button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.searching .tabs button, .searching .chips button { opacity: 0.45; }
#list { min-height: 60vh; padding-bottom: 40px; }
.group { display: flex; align-items: baseline; gap: 12px; margin: 38px 0 14px; font: 900 34px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.group small { color: var(--accent); font: 500 12px var(--mono); }
.group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  text-align: left;
  overflow: hidden;
  animation: card 0.6s var(--ease) both;
  animation-delay: calc(var(--i) * 26ms);
  transition: transform 0.4s var(--ease), border-color 0.25s, box-shadow 0.4s;
}
@keyframes card { from { opacity: 0; transform: translateY(18px); } }
.card::before { content: ""; position: absolute; inset: 0 auto auto 0; z-index: 1; width: 26px; height: 2px; background: var(--faction); transition: width 0.45s var(--ease); }
.card:hover, .card[aria-current="true"] { border-color: color-mix(in srgb, var(--faction) 70%, transparent); }
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -18px rgba(0, 0, 0, 0.9); }
.card:hover::before, .card[aria-current="true"]::before { width: 100%; }
.card .pic {
  width: 100%;
  margin-bottom: 10px;
  background:
    radial-gradient(56% 44% at 50% 64%, color-mix(in srgb, var(--faction) 20%, transparent), transparent 75%),
    repeating-linear-gradient(0deg, transparent 0 15px, var(--line) 15px 16px),
    repeating-linear-gradient(90deg, transparent 0 15px, var(--line) 15px 16px),
    var(--panel-2);
  background-position: center;
  overflow: hidden;
}
.card .pic img { transition: transform 0.6s var(--ease); }
.card:hover .pic img { transform: scale(1.1) translateY(-2%); }
.card > span:not(.pic) { padding: 0 12px; }
.cat { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.cat em { font-style: normal; color: var(--dim); white-space: nowrap; }
.card .name { margin: 3px 0 8px; font: 700 20px/1.05 var(--display); letter-spacing: 0.01em; overflow-wrap: anywhere; }
.card .facts { margin-top: auto; gap: 6px; }
.card .facts i { padding: 1px 7px; border: 1px solid var(--line); border-radius: 2px; font: 500 11.5px var(--mono); font-style: normal; }
.empty { padding: 60px 0; color: var(--muted); font: 700 28px var(--display); text-transform: uppercase; }

footer { display: grid; gap: 8px; padding: 70px var(--gutter) 50px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; }
footer .brand { color: var(--text); font-size: 30px; }
#status:empty { display: none; }
#status { color: var(--accent); font-family: var(--mono); }

/* --- data sheet (dialog) ---------------------------------------------------------- */

#dossier {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
#dossier[open] { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(400px, 1fr); animation: dossier 0.6s var(--ease); }
@keyframes dossier { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
.stage { position: relative; min-height: 0; overflow: hidden; isolation: isolate; }
.stage .sky { z-index: -2; }
.watermark {
  position: absolute;
  z-index: -1;
  inset: 62px 24px auto;
  color: transparent;
  font: 900 clamp(60px, 11vw, 190px)/0.82 var(--stencil);
  text-transform: uppercase;
  -webkit-text-stroke: 1.5px var(--line);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}
#view, #still, .dims { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#view { cursor: grab; touch-action: none; transition: opacity 0.35s ease; }
#view:active { cursor: grabbing; }
.stage.loading #view, .stage.loading .dims { opacity: 0; }
#still { object-fit: contain; padding: 12%; }
.dims { pointer-events: none; overflow: hidden; transition: opacity 0.35s ease; }
.dim { position: absolute; top: 0; left: 0; padding: 1px 6px; background: var(--accent); color: var(--accent-ink); font: 600 11px var(--mono); white-space: nowrap; }
#stage-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--mono); }
#stage-msg[hidden], #still[hidden], #variant[hidden], #view[hidden] { display: none; }
.stage-top { position: absolute; top: 14px; left: 20px; }
.stage-tools { position: absolute; inset: auto 20px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.stage-tools select { padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 2px; background: var(--bg); text-transform: none; letter-spacing: 0; }
.stage-tools .hint { margin-left: auto; color: var(--dim); }
.toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--text); }
.toggle input { appearance: none; width: 26px; height: 14px; margin: 0; border: 1px solid var(--line-2); border-radius: 999px; background: none; position: relative; cursor: pointer; transition: background 0.25s, border-color 0.25s; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transition: transform 0.25s var(--ease), background 0.25s; }
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::after { transform: translateX(12px); background: var(--accent-ink); }

.sheet-wrap { min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel); scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 16px 10px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px); }
#position { min-width: 64px; text-align: center; color: var(--muted); font: 500 11.5px var(--mono); font-variant-numeric: tabular-nums; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 2px; background: none; color: var(--muted); font-size: 15px; transition: color 0.2s, border-color 0.2s; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.close { margin-left: auto; }
#sheet { padding: 26px 28px 56px; }
#sheet > * { animation: rise 0.7s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 120ms); }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--faction); font: 500 11.5px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
#sheet h2 { margin-top: 8px; font: 900 clamp(34px, 3.5vw, 56px)/0.92 var(--display); text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere; }
#sheet .en { margin-top: 6px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags span { padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 2px; font: 500 11.5px var(--mono); }
.tags .id { color: var(--dim); border-color: var(--line); }

.years { position: relative; height: 40px; margin-top: 22px; border-bottom: 1px solid var(--line-2); }
.years .war, .years .span { position: absolute; bottom: 0; }
.years .war { top: 12px; background: repeating-linear-gradient(-45deg, transparent 0 4px, var(--line) 4px 5px); border-inline: 1px solid var(--line); }
.years .span { height: 6px; background: var(--faction); animation: bar 1.1s var(--ease) 0.3s both; transform-origin: 0 50%; }
.years i { position: absolute; top: 0; translate: -50% 0; color: var(--dim); font: 500 10px var(--mono); font-style: normal; }
.years i.edge { color: var(--text); }

#sheet section, .sources { margin-top: 30px; }
#sheet h3 { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--accent); font: 500 11.5px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
#sheet h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cost, .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.cost div, .tiles div { position: relative; padding: 10px 12px 11px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel-2); }
.cost b, .tiles b { display: block; font: 900 28px/1.05 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost span, .tiles span { color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.tiles small { display: block; margin-top: 2px; color: var(--dim); font: 11px var(--mono); }
.tiles .unsure { position: absolute; top: 8px; right: 10px; }
.cost .ico { display: block; width: 18px; height: 18px; margin-bottom: 8px; color: var(--accent); }
.tiles + dl { margin-top: 16px; }
#sheet dl { display: grid; grid-template-columns: max-content 1fr; gap: 0 18px; }
#sheet dt, #sheet dd { padding: 6px 0; border-bottom: 1px solid var(--line); }
#sheet dt { color: var(--muted); }
#sheet dd { font: 13.5px var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.unsure { margin-left: 6px; color: var(--accent); font: 600 12px var(--mono); cursor: help; }

.armor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.armor figure { padding: 8px 6px 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel-2); }
.armor svg { display: block; width: 100%; height: auto; overflow: visible; }
.armor svg .body { fill: rgba(236, 228, 208, 0.05); stroke: none; }
.armor svg path { fill: none; stroke: var(--muted); stroke-linecap: butt; }
.armor svg path.front { stroke: var(--accent); }
.armor svg path.barrel { stroke: var(--dim); stroke-width: 5; }
.armor svg text { fill: var(--text); font: 600 17px var(--mono); }
.armor svg text.k { fill: var(--muted); font: 500 10px var(--mono); letter-spacing: 0.12em; }
.armor figcaption { margin-top: 2px; text-align: center; color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.armor p { grid-column: 1 / -1; color: var(--dim); font-size: 12.5px; }

.weapons li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.weapons li:first-child { padding-top: 2px; }
.bore { grid-row: span 3; align-self: start; justify-self: center; width: var(--d); height: var(--d); margin-top: 3px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 2px var(--muted), 0 0 0 5px var(--panel-2); }
.w-name strong { font: 700 20px/1.1 var(--display); letter-spacing: 0.02em; }
.w-name em { margin-left: 8px; padding: 0 6px; border: 1px solid var(--accent); border-radius: 2px; color: var(--accent); font: 500 10.5px var(--mono); font-style: normal; text-transform: uppercase; vertical-align: 2px; }
.w-name small { display: block; color: var(--muted); font-size: 12.5px; }
.w-range, .w-specs { grid-column: 2; }
.w-range { display: flex; align-items: center; gap: 10px; font: 500 12.5px var(--mono); white-space: nowrap; }
.w-range i { flex: none; width: calc(var(--w) * 0.62); height: 4px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent)); transform-origin: 0 50%; animation: bar 1.1s var(--ease) 0.25s both; }
.w-range small { color: var(--muted); }
.w-specs { display: flex; flex-wrap: wrap; gap: 4px 18px; font: 13px var(--mono); }
.w-specs small { display: block; color: var(--dim); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.note { color: var(--muted); text-wrap: pretty; }
.sources summary { cursor: pointer; color: var(--accent); font: 500 11.5px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.sources ul { margin-top: 10px; padding-left: 16px; list-style: square; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.sources li { margin-bottom: 6px; }
.sources a { color: var(--text); }
#sheet > .btn { margin-top: 30px; }

/* --- small screens ---------------------------------------------------------------- */

@media (max-width: 980px) {
  .links { display: none; }
  .brand { margin-right: auto; }
  .hero { grid-template: "space" minmax(54svh, 1fr) "copy" auto "plate" auto "kpis" auto / minmax(0, 1fr); }
  .title { top: calc(var(--nav-h) + 2vh); }
  #hero-view { top: 9svh; height: 46svh; }
  .hero-copy { padding-bottom: 20px; }
  .plate { width: 100%; margin-bottom: 24px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis div:nth-child(3) { padding-left: 0; border-left: 0; }
  .kpis div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .features { grid-template-columns: minmax(0, 1fr); }
  .armies { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); }
  .val { flex-direction: column !important; align-items: stretch; gap: 3px; }
  .val.a { align-items: flex-end; }
  .val.b { align-items: flex-start; }
  .val span { min-width: 0; }
  .val i { max-width: 100%; height: 6px; }
  .duel-head { grid-template-columns: minmax(0, 1fr); }
  .versus { grid-auto-flow: column; justify-content: start; align-items: center; gap: 16px; padding: 8px 0; border-block: 1px solid var(--line); }
  .versus span { font-size: 44px; }
  .side-b { justify-items: start; text-align: left; }
  .side .pic { width: min(100%, 260px); }
  #dossier[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: 42dvh minmax(0, 1fr); }
  .sheet-wrap { border-left: 0; border-top: 1px solid var(--line); }
  .stage-tools .hint { display: none; }
  #sheet { padding: 20px 16px 48px; }
  .sheet-bar { padding-left: 16px; }
}
@media (max-width: 560px) {
  .head { grid-template-columns: minmax(0, 1fr); }
  .head .no { grid-row: auto; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card .name { font-size: 17px; }
  .tabs button { padding: 7px 10px 7px 8px; font-size: 15px; }
  .seg button { padding: 7px 8px; }
  .armor { grid-template-columns: minmax(0, 1fr); }
  .cost, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
  .track { animation: none; }
  [data-reveal] { opacity: 1; transform: none; }
}
