@font-face { font-family: 'Thmanyah Sans'; src: url('/assets/fonts/thmanyahsans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url('/assets/fonts/thmanyahsans-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Thmanyah Serif Display'; src: url('/assets/fonts/thmanyahserifdisplay-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Thmanyah Serif Display'; src: url('/assets/fonts/thmanyahserifdisplay-Black.woff2') format('woff2'); font-weight: 900; font-display: swap; }

/*
  The wiki is the army's ledger: a reference to be scanned, sorted and compared.
  Surfaces stay in the game's HUD brown, type in limestone. Gold is the only accent and
  always means "selected" or "act". Green marks the Arab side, red the Frankish side.
  Ratings are short walls of ten stone blocks; numbers are always shown beside them.
*/
:root {
  --page: #14100c;
  --surface: #1b1611;
  --raised: #231c15;
  --sunken: #100c09;
  --text: #ece2cc;
  --text-2: #b3a184;
  --text-3: #9c8d74;
  --gold: #d9a441;
  --gold-hi: #f0cf85;
  --gold-wash: rgba(217, 164, 65, .09);
  --ink: #22160c;
  --stone: #d9c7a1;
  --line: rgba(230, 216, 189, .1);
  --line-2: rgba(230, 216, 189, .2);
  --green: #3e7a4b;
  --green-text: #a6d09a;
  --red: #a4302b;
  --red-text: #eca290;

  --font-display: 'Thmanyah Serif Display', 'Times New Roman', serif;
  --font-text: 'Thmanyah Sans', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --max: 1240px;
  --gutter: clamp(16px, 3.5vw, 40px);
  --top-h: 60px;
  --tabs-h: 48px;
  --head-h: calc(var(--top-h) + var(--tabs-h));
  --r: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; background: var(--page); color: var(--text); font: 400 1rem/1.65 var(--font-text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.2; font-weight: 700; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
::selection { background: var(--gold); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; inset-inline-start: 12px; top: -64px; z-index: 60; background: var(--gold); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 10px; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------------------------------------------------------------- Header */
.top { position: sticky; top: 0; z-index: 40; background: rgba(20, 16, 12, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { height: var(--top-h); max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); display: flex; align-items: center; gap: clamp(12px, 2.4vw, 32px); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; text-decoration: none; }
.brand img { border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--font-display); font-weight: 900; font-size: 1.08rem; }
.brand-text small { color: var(--gold); font-size: .78rem; font-weight: 700; }
.top .search { flex: 1; max-width: 460px; margin-inline-start: auto; }
body[data-page="home"] .top .search { visibility: hidden; }
.top-end { display: flex; align-items: center; gap: 12px; flex: none; }
.to-site { color: var(--text-2); text-decoration: none; font-size: .92rem; white-space: nowrap; }
.to-site:hover { color: var(--gold-hi); }
.lang { min-width: 42px; height: 36px; padding: 0 12px; font-weight: 700; font-size: .88rem; background: transparent; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; }
.lang:hover { border-color: var(--gold); color: var(--gold-hi); }
.tabs { height: var(--tabs-h); max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); display: flex; align-items: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 12px; flex: none; color: var(--text-2); font-weight: 700; font-size: .95rem; text-decoration: none; transition: color .2s; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::after { content: ''; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; background: var(--gold); border-radius: 2px; }
.tabs .n { color: var(--text-3); font-weight: 400; font-size: .82rem; }
.tabs .gap { flex: 1; min-width: 16px; }

/* ---------------------------------------------------------------- Search */
.search { position: relative; }
.search input { width: 100%; height: 40px; padding-inline: 40px 44px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); transition: border-color .2s, background-color .2s; }
.search input::placeholder { color: var(--text-3); }
.search input:focus { outline: none; border-color: var(--gold); background: var(--raised); }
.search input::-webkit-search-cancel-button { display: none; }
.search .glass { position: absolute; inset-inline-start: 13px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search kbd { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); min-width: 24px; text-align: center; font: 700 .78rem/1.6 var(--font-text); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; pointer-events: none; }
.search input:focus ~ kbd { display: none; }
.results { position: absolute; z-index: 50; inset-inline: 0; top: calc(100% + 6px); max-height: min(70vh, 520px); overflow: auto; background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); padding: 6px; }
.results .grp { padding: 8px 10px 4px; color: var(--text-3); font-size: .78rem; font-weight: 700; }
.results a { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 8px; text-decoration: none; }
.results a[aria-selected="true"], .results a:hover { background: var(--gold-wash); }
.results a[aria-selected="true"] .r-name { color: var(--gold-hi); }
.results .thumb { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: #3a3a3a; flex: none; }
.results .thumb.ic { object-fit: contain; background: none; }
.results .r-name { flex: 1; min-width: 0; font-weight: 700; }
.results .r-sub { color: var(--text-3); font-size: .84rem; white-space: nowrap; }
.results .empty { padding: 14px 12px; color: var(--text-2); }
.search.big input { height: 56px; border-radius: 14px; font-size: 1.1rem; padding-inline: 50px 52px; background: rgba(20, 16, 12, .82); }
.search.big .glass { inset-inline-start: 18px; width: 20px; height: 20px; }
.search.big kbd { inset-inline-end: 16px; }

/* ---------------------------------------------------------------- Page frame */
main { flex: 1; width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding: clamp(20px, 3vw, 36px) var(--gutter) clamp(56px, 8vw, 96px); outline: none; }
.foot { border-top: 1px solid var(--line); color: var(--text-2); font-size: .9rem; }
.foot-in { max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--gold-hi); }
.loading { padding: 80px 0; text-align: center; color: var(--text-2); }

.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 14px; color: var(--text-3); font-size: .9rem; }
.crumbs a { text-decoration: none; color: var(--text-2); }
.crumbs a:hover { color: var(--gold-hi); }
.crumbs li + li::before { content: '/'; margin-inline-end: 8px; opacity: .5; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.7rem); font-weight: 900; }
.page-head p { margin-top: 6px; color: var(--text-2); font-size: 1.05rem; max-width: 60ch; }
.h2 { font-size: 1.35rem; font-weight: 900; margin-bottom: 14px; }
.section { margin-top: clamp(32px, 4vw, 48px); }
.muted { color: var(--text-2); }
.note { color: var(--text-3); font-size: .88rem; }
.note a { color: var(--text-2); }
.note a:hover { color: var(--gold-hi); }

/* Tags and small marks */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: .8rem; font-weight: 700; background: rgba(230, 216, 189, .08); color: var(--text-2); white-space: nowrap; }
.tag.franks, .tag.arabs { padding-inline-start: 7px; }
.tag.franks::before, .tag.arabs::before { content: ''; width: 7px; height: 11px; background: currentColor; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }
.tag.franks { color: var(--red-text); background: rgba(164, 48, 43, .18); }
.tag.arabs { color: var(--green-text); background: rgba(62, 122, 75, .22); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pips { display: inline-flex; gap: 2px; vertical-align: -1px; }
.pips i { width: 8px; height: 12px; background: rgba(230, 216, 189, .18); }
.pips i.on { background: var(--gold); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, #888); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); flex: none; }
.coin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: inset 0 0 0 2px #a97c26; flex: none; }
.cost { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.costs { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; }
.dash { color: var(--text-3); }

/* Segmented filter */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 7px; color: var(--text-2); font-weight: 700; font-size: .9rem; text-decoration: none; transition: background-color .2s, color .2s; }
.seg a:hover { color: var(--text); }
.seg a[aria-current="true"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg .n { color: var(--text-3); font-weight: 400; font-size: .8rem; }

/* The signature: ten stone blocks that fill. One tone; gold when it is the highlighted rating. */
.meter { --v: 0; --col: var(--stone); --dir: to right; display: block; height: 10px; min-width: 80px;
  background: linear-gradient(var(--dir), var(--col) calc(var(--v) * 1%), rgba(230, 216, 189, .12) 0);
  -webkit-mask: repeating-linear-gradient(var(--dir), #000 0 calc(10% - 2px), transparent 0 10%);
          mask: repeating-linear-gradient(var(--dir), #000 0 calc(10% - 2px), transparent 0 10%); }
html[dir="rtl"] .meter { --dir: to left; }
.meter.gold { --col: var(--gold); }
.meter.thin { height: 6px; min-width: 56px; }

/* ---------------------------------------------------------------- Data tables */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.dt th, .dt td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt thead th { position: sticky; top: 0; z-index: 2; background: var(--raised); color: var(--text-2); font-size: .8rem; font-weight: 700; border-bottom-color: var(--line-2); }
.dt th.n, .dt td.n { text-align: end; }
.dt .sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: none; }
.dt .sort::after { content: ''; width: 0; height: 0; border-inline: 4px solid transparent; border-top: 5px solid currentColor; opacity: .3; }
.dt th[aria-sort] .sort { color: var(--gold-hi); }
.dt th[aria-sort] .sort::after { opacity: 1; }
.dt th[aria-sort="ascending"] .sort::after { border-top: 0; border-bottom: 5px solid currentColor; }
.dt td.on { background: var(--gold-wash); }
.dt tbody tr { transition: background-color .15s; }
.dt tbody tr.link { cursor: pointer; }
.dt tbody tr.link:hover { background: rgba(230, 216, 189, .04); }
.dt tbody tr.link:hover .who b { color: var(--gold-hi); }
.dt .first { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); }
.dt thead .first { z-index: 3; background: var(--raised); }
.dt tbody tr.link:hover .first { background: #201a14; }
.who { display: flex; align-items: center; gap: 12px; min-width: 200px; text-decoration: none; }
.who img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #3a3a3a; flex: none; }
.who img.ic { object-fit: contain; background: none; }
.who b { display: block; font-weight: 700; transition: color .15s; }
.who small { display: block; color: var(--text-3); font-size: .8rem; line-height: 1.3; }
.who .side-mark { width: 3px; align-self: stretch; border-radius: 2px; background: transparent; flex: none; }
.who .side-mark.franks { background: var(--red); }
.who .side-mark.arabs { background: var(--green); }
.cell-meter { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.cell-meter .meter { width: 64px; min-width: 64px; }
.dt .group th { position: static; background: var(--sunken); color: var(--text); font-family: var(--font-display); font-size: 1rem; padding-block: 12px; }
.dt .group th small { font-family: var(--font-text); color: var(--text-3); font-weight: 400; margin-inline-start: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.toolbar .hint { color: var(--text-3); font-size: .86rem; }

/* ---------------------------------------------------------------- Home */
.hero { position: relative; isolation: isolate; overflow: hidden; border-radius: 18px; padding: clamp(28px, 5vw, 56px); min-height: clamp(300px, 34vw, 400px); display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; background: #2a2118; }
.hero > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(20, 16, 12, .97) 0%, rgba(20, 16, 12, .8) 42%, rgba(20, 16, 12, .25) 100%); }
.hero h1 { font-size: clamp(2.2rem, 1.3rem + 3.6vw, 3.8rem); font-weight: 900; line-height: 1.12; max-width: 18ch; text-wrap: balance; }
.hero p { color: #e8dcc2; font-size: 1.1rem; max-width: 52ch; margin-top: -6px; }
.hero .search { max-width: 640px; }
.hero .quick { display: flex; flex-wrap: wrap; gap: 8px; color: var(--text-2); font-size: .9rem; align-items: center; }
.hero .quick a { color: var(--text); text-decoration: none; padding: 3px 10px; border-radius: 999px; background: rgba(230, 216, 189, .1); transition: background-color .2s; }
.hero .quick a:hover { background: rgba(217, 164, 65, .25); }
.index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.index a { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 2px 14px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: border-color .2s, background-color .2s; }
.index a:hover { border-color: var(--line-2); background: var(--raised); }
.index a:hover h3 { color: var(--gold-hi); }
.index img { grid-row: span 2; width: 52px; height: 52px; object-fit: contain; }
.index h3 { font-size: 1.15rem; font-weight: 900; transition: color .2s; }
.index span { grid-column: 2; color: var(--text-2); font-size: .9rem; line-height: 1.4; }
.index .n { grid-column: 3; grid-row: 1 / span 2; color: var(--text-3); font-size: 1.4rem; font-family: var(--font-display); }
.ranks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rank { border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.rank h3 { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 10px; font-size: 1.05rem; font-weight: 900; }
.rank h3 small { font-family: var(--font-text); font-weight: 400; color: var(--text-3); font-size: .8rem; }
.rank li a { display: grid; grid-template-columns: 18px 32px 1fr auto; align-items: center; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--line); text-decoration: none; transition: background-color .15s; }
.rank li a:hover { background: rgba(230, 216, 189, .04); }
.rank li a:hover .nm { color: var(--gold-hi); }
.rank .i { color: var(--text-3); font-weight: 700; font-size: .85rem; text-align: center; }
.rank img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: #3a3a3a; }
.rank .nm { font-weight: 700; transition: color .15s; }
.rank .v { font-weight: 700; }

/* ---------------------------------------------------------------- Detail pages */
.d-head { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 24px; align-items: start; }
.d-pic { width: 168px; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #3a3a3a; box-shadow: 0 0 0 1px var(--line-2); }
.d-pic img { width: 100%; height: 100%; object-fit: cover; }
.d-pic.franks { box-shadow: 0 0 0 2px var(--red); }
.d-pic.arabs { box-shadow: 0 0 0 2px var(--green); }
.d-pic.icon { background: radial-gradient(circle at 50% 42%, #3a2f22, #1e1812); }
.d-pic.icon img { object-fit: contain; padding: 14%; }
.d-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.d-title h1 { font-size: clamp(2rem, 1.5rem + 1.8vw, 2.8rem); font-weight: 900; }
.d-title .alt { color: var(--text-3); font-size: 1.05rem; }
.d-head .tags { margin-top: 10px; }
.d-head .lead { margin-top: 12px; font-size: 1.1rem; max-width: 62ch; }
.d-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px; background: var(--gold); color: var(--ink); font-weight: 700; font-size: .95rem; text-decoration: none; border: 0; cursor: pointer; transition: background-color .2s; }
.btn:hover { background: var(--gold-hi); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-hi); }
.btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* Key numbers */
.keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 26px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.keys > div { padding: 14px 18px; border-inline-start: 1px solid var(--line); min-width: 0; }
.keys > div:first-child { border-inline-start: 0; }
.keys dt { color: var(--text-2); font-size: .82rem; font-weight: 700; }
.keys dd { margin-top: 2px; font-size: 1.6rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keys dd small { font-size: .85rem; color: var(--text-3); font-weight: 400; margin-inline-start: 4px; }
.keys dd.word { font-family: var(--font-display); font-size: 1.25rem; padding-top: 4px; }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 18px 20px; min-width: 0; }
.panel > h2 { font-size: 1.1rem; font-weight: 900; margin-bottom: 10px; }
.panel > h2 small { font-family: var(--font-text); font-weight: 400; color: var(--text-3); font-size: .82rem; margin-inline-start: 8px; }
.panel.span { grid-column: 1 / -1; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.ratings { display: grid; gap: 10px; }
.ratings .r { display: grid; grid-template-columns: 76px minmax(0, 1fr) 64px; align-items: center; gap: 14px; }
.ratings .k { color: var(--text-2); font-weight: 700; font-size: .92rem; }
.ratings .v { text-align: end; font-weight: 700; }
.ratings .meter { height: 12px; }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--text-2); }
.facts dd { font-weight: 700; text-align: end; }
.facts dd small { display: block; color: var(--text-3); font-size: .8rem; font-weight: 400; }
.facts .sub-h { padding: 12px 0 4px; border-top: 0; color: var(--text); font-weight: 700; font-family: var(--font-display); }
.empty-note { color: var(--text-2); }
.abilities { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.ability { padding: 12px 14px; border-radius: 10px; background: var(--raised); }
.ability b { font-family: var(--font-display); font-size: 1.02rem; }
.ability p { margin-top: 2px; color: var(--text-2); font-size: .94rem; }

/* Matchups */
.matchups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mlist li a { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; }
.mlist li:first-child a { border-top: 0; }
.mlist img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: #3a3a3a; }
.mlist b { font-weight: 700; transition: color .15s; }
.mlist small { display: block; color: var(--text-3); font-size: .8rem; }
.mlist li a:hover b { color: var(--gold-hi); }
.mlist .t { text-align: end; font-size: .85rem; color: var(--text-2); }
.mlist .t b { display: block; color: var(--text); }
.win-h { color: var(--green-text); }
.lose-h { color: var(--red-text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; padding-inline: 6px 12px; border-radius: 10px; background: var(--raised); text-decoration: none; font-weight: 700; font-size: .92rem; transition: box-shadow .2s; }
.chip:hover { box-shadow: inset 0 0 0 1px var(--gold); }
.chip img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background: #3a3a3a; }
.chip img.ic { object-fit: contain; background: none; }
.chip small { color: var(--text-3); font-weight: 400; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--line); text-decoration: none; min-width: 0; flex: 1; max-width: 50%; transition: border-color .2s; }
.pager a:hover { border-color: var(--gold); }
.pager a small { color: var(--text-3); font-size: .82rem; }
.pager a b { font-weight: 700; }
.pager a.next { text-align: end; margin-inline-start: auto; }

/* ---------------------------------------------------------------- Lords */
.lord { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; padding: 20px; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); scroll-margin-top: calc(var(--head-h) + 16px); }
.lord > img { width: 112px; height: 112px; border-radius: 12px; object-fit: cover; background: #3a3a3a; }
.lord.franks > img { box-shadow: 0 0 0 2px var(--red); }
.lord.arabs > img { box-shadow: 0 0 0 2px var(--green); }
.lord h2 { font-size: 1.6rem; font-weight: 900; }
.lord .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; color: var(--text-2); font-size: .92rem; }
.lord .lead { margin-top: 8px; }
.lord .grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lord .grid > div { padding: 10px 14px; border-inline-start: 1px solid var(--line); }
.lord .grid > div:first-child { border-inline-start: 0; }
.lord .grid dt { color: var(--text-3); font-size: .8rem; font-weight: 700; }
.lord .grid dd { font-weight: 700; margin-top: 2px; }
.lord .grid dd small { display: block; color: var(--text-3); font-weight: 400; font-size: .8rem; }
.lord .army { margin-top: 14px; display: grid; gap: 10px; }
.lord .army > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; }
.lord .army dt { color: var(--text-2); font-size: .9rem; padding-top: 6px; }

/* ---------------------------------------------------------------- Resources */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.res { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); scroll-margin-top: calc(var(--head-h) + 16px); }
.res:target { border-color: var(--gold); }
.res h3 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 900; }
.res h3 .swatch { width: 14px; height: 14px; }
.res dl { margin-top: 10px; display: grid; gap: 8px; }
.res dt { color: var(--text-3); font-size: .82rem; font-weight: 700; }
.res dd { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.res dd a { text-decoration: none; border-bottom: 1px solid var(--line-2); }
.res dd a:hover { color: var(--gold-hi); border-color: var(--gold-hi); }

/* ---------------------------------------------------------------- Compare */
.pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; margin-bottom: 18px; }
.pick label { display: grid; gap: 6px; color: var(--text-2); font-weight: 700; font-size: .88rem; }
.pick select { height: 46px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); }
.pick select:focus { outline: none; border-color: var(--gold); }
.swap { height: 46px; width: 46px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); cursor: pointer; color: var(--text-2); }
.swap:hover { border-color: var(--gold); color: var(--gold-hi); }
.swap svg { width: 18px; height: 18px; }
.cmp th, .cmp td { white-space: normal; }
.cmp thead th { font-size: .95rem; color: var(--text); }
.cmp thead th .who { min-width: 0; }
.cmp td.better { color: var(--gold-hi); }
.cmp td.better::before { content: '▲ '; font-size: .7em; vertical-align: 1px; }
.cmp th[scope="row"] { color: var(--text-2); font-weight: 700; width: 30%; }
.verdict { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.verdict .box { padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.verdict .box b { display: block; font-family: var(--font-display); font-size: 1.4rem; }
.verdict .box span { color: var(--text-2); font-size: .92rem; }
.verdict .box.win { border-color: var(--gold); grid-column: 1 / -1; background: linear-gradient(90deg, var(--gold-wash), transparent); }

/* ---------------------------------------------------------------- Rules / prose */
.prose { max-width: 66ch; }
.prose p + p { margin-top: 10px; }
.notfound { padding: 56px 0; text-align: center; }
.notfound h1 { font-size: 2.2rem; font-weight: 900; }
.notfound p { margin-top: 8px; color: var(--text-2); }
.notfound .btn { margin-top: 18px; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1000px) {
  .index, .ranks { grid-template-columns: 1fr 1fr; }
  .keys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .keys > div:nth-child(4) { border-inline-start: 0; }
  .keys > div:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .cols, .matchups { grid-template-columns: 1fr; }
  .lord .grid { grid-template-columns: 1fr 1fr; }
  .lord .grid > div:nth-child(3) { border-inline-start: 0; }
  .lord .grid > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .to-site { display: none; }
}
@media (max-width: 680px) {
  :root { --top-h: 56px; --tabs-h: 44px; }
  .brand-text { display: none; }
  .top .search kbd, .search.big kbd { display: none; }
  .index, .ranks { grid-template-columns: 1fr; }
  .index a { grid-template-columns: 44px 1fr auto; padding: 14px; }
  .index img { width: 44px; height: 44px; }
  .d-head { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; }
  .d-pic { width: 96px; border-radius: 12px; }
  .d-head .lead, .d-acts { grid-column: 1 / -1; }
  .d-head .lead { margin-top: 4px; }
  .keys { grid-template-columns: 1fr 1fr; }
  .keys > div:nth-child(n) { border-inline-start: 0; border-top: 1px solid var(--line); }
  .keys > div:nth-child(2n) { border-inline-start: 1px solid var(--line); }
  .keys > div:nth-child(-n + 2) { border-top: 0; }
  .keys > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .keys dd { font-size: 1.35rem; }
  .panel { padding: 16px; }
  .lord { grid-template-columns: 1fr; }
  .lord > img { width: 72px; height: 72px; }
  .lord .army > div { grid-template-columns: 1fr; gap: 4px; }
  .pick { grid-template-columns: 1fr auto; }
  .pick label:last-of-type { grid-column: 1; }
  .swap { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
  .verdict { grid-template-columns: 1fr; }
  .dt th, .dt td { padding: 9px 10px; }
  .who { min-width: 150px; gap: 10px; }
  .who img { width: 34px; height: 34px; }
  .cell-meter .meter { display: none; }
  .pager a { max-width: none; }
  .hero { border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
