/* Girls Echo Wiki. Everything comes from the game UI: navy night (#0e1122), champagne gold (#d5b482), cream paper (#f6f1ec),
   the alert red (#f1244a), and the 10° slant of its rarity tags and buttons, used here for every title bar, pill and the recruit strips.
   Panels have the game's clipped corners instead of round ones.
   Light theme: cool lilac-grey page (the stage's horizon glow) around the cream paper. Dark theme: the night city around navy paper.
   The character card, home banner and table headers stay night in both: they sit on game art or act as ink bars. */
:root {
  --night: #0e1122; --night-2: #181d36; --night-line: #2c3354; --night-ink: #d8d5e3; --night-ink-2: #9a96ad;
  --gold: #d5b482; --gold-hi: #f1dfbb; --gold-deep: #a07a3e; --red: #f1244a;
  --paper: #f6f1ec; --paper-2: #ebe2d4; --cell: #fffcf8; --ink: #1f2133; --ink-2: #5d5866; --rule: #dacfbf;
  --link: #2a58a2; --mark: #a07a3e; --hl: #fbefd2;
  /* page chrome: background, header, sidebar, page titles, footer */
  --bg: #e5e5ee; --bg-art: linear-gradient(#d6d8e8, #e5e5ee 480px); --top-bg: rgba(229, 229, 238, .94);
  --c-ink: #2a2d45; --c-ink-2: #696780; --c-line: #c8c8da; --c-field: #fff; --c-gold: #8a6528; --title: #13162b; --title-glow: none;
  --logo: brightness(0) opacity(.82);  /* the white wordmark, inked for the light page */
  --theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5z'/%3E%3C/svg%3E");
  --sw: 240px; --display: "Kanit", "Source Sans 3", system-ui, sans-serif;
  --cut: 18px;  /* clipped corner size */
  --slant: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #1a1f38; --paper-2: #252b4b; --cell: #13172c; --ink: #ece6dc; --ink-2: #aeaec4; --rule: #313961;
    --link: #9dbcf5; --mark: #d5b482; --hl: #2b2e55;
    --bg: #0e1122; --bg-art: linear-gradient(rgba(14, 17, 34, .45), rgba(14, 17, 34, .94) 70%) fixed, #0e1122 url(img/site/bg.webp) center top / cover no-repeat fixed; --top-bg: rgba(14, 17, 34, .94);
    --c-ink: #d8d5e3; --c-ink-2: #9a96ad; --c-line: #2c3354; --c-field: rgba(255, 255, 255, .06); --c-gold: #d5b482; --title: #fff; --title-glow: 0 2px 20px rgba(0, 0, 0, .5);
    --logo: none; color-scheme: dark;
    --theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%23000'/%3E%3Cpath d='M12 1.5v2.5M12 20v2.5M1.5 12H4M20 12h2.5M4.6 4.6l1.8 1.8M17.6 17.6l1.8 1.8M4.6 19.4l1.8-1.8M17.6 6.4l1.8-1.8'/%3E%3C/svg%3E"); }
}
:root[data-theme="dark"] { --paper: #1a1f38; --paper-2: #252b4b; --cell: #13172c; --ink: #ece6dc; --ink-2: #aeaec4; --rule: #313961;
  --link: #9dbcf5; --mark: #d5b482; --hl: #2b2e55;
    --bg: #0e1122; --bg-art: linear-gradient(rgba(14, 17, 34, .45), rgba(14, 17, 34, .94) 70%) fixed, #0e1122 url(img/site/bg.webp) center top / cover no-repeat fixed; --top-bg: rgba(14, 17, 34, .94);
    --c-ink: #d8d5e3; --c-ink-2: #9a96ad; --c-line: #2c3354; --c-field: rgba(255, 255, 255, .06); --c-gold: #d5b482; --title: #fff; --title-glow: 0 2px 20px rgba(0, 0, 0, .5);
    --logo: none; color-scheme: dark;
    --theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%23000'/%3E%3Cpath d='M12 1.5v2.5M12 20v2.5M1.5 12H4M20 12h2.5M4.6 4.6l1.8 1.8M17.6 17.6l1.8 1.8M4.6 19.4l1.8-1.8M17.6 6.4l1.8-1.8'/%3E%3C/svg%3E"); }

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.6 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg-art); background-color: var(--bg);
  display: grid; grid-template-columns: var(--sw) minmax(0, 1fr); grid-template-rows: auto 1fr auto;
  grid-template-areas: "top top" "side main" "side foot";
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; }
h3 { font-size: 18px; margin: 20px 0 8px; }
[id] { scroll-margin-top: 16px; }
img { max-width: 100%; height: auto; }
td img, th img, .chips img { max-width: none; }  /* a % max-width zeroes the cell's min-content width, so names overflow */
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 8px 14px; background: var(--gold); color: var(--night); }
.skip:focus { top: 8px; }

/* section heading: slanted italic, a gold stroke that runs into the rule */
h2 { position: relative; margin: 40px 0 14px; padding: 0 0 8px 20px; font: italic 600 26px/1.2 var(--display);
  background: linear-gradient(90deg, var(--gold) 0 72px, var(--rule) 72px) left bottom / 100% 2px no-repeat; }
h2::before, .tab::before, .side p::before { content: ""; position: absolute; left: 0; top: .2em; width: 8px; height: .85em; background: var(--gold); clip-path: polygon(45% 0, 100% 0, 55% 100%, 0 100%); }

/* ---- header ---- */
.top { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 14px 32px 10px 0; }
.logo { flex: none; width: var(--sw); display: flex; align-items: flex-end; gap: 6px; padding-left: 22px; color: var(--c-gold); }
.logo img { height: 46px; width: auto; filter: var(--logo); }
.logo span { font: italic 600 18px/1 var(--display); padding-bottom: 6px; }
.logo:hover { text-decoration: none; }
.menu { display: none; }
.theme { flex: none; width: 40px; height: 40px; margin-left: auto; padding: 0; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-field); cursor: pointer; }
.theme::before { content: ""; display: block; width: 20px; height: 20px; margin: auto; background: var(--c-gold);  /* moon in light, sun in dark */
  -webkit-mask: var(--theme-icon) center / contain no-repeat; mask: var(--theme-icon) center / contain no-repeat; }
.theme:hover { border-color: var(--gold); }
.search { position: relative; flex: 1; max-width: 560px; }
.search input {
  width: 100%; padding: 9px 16px 9px 42px; font: inherit; color: var(--c-ink); border: 1px solid var(--c-line); border-radius: 4px;
  background: var(--c-field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d5b482' stroke-width='2.4'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E") 15px center / 18px no-repeat;
}
.search input::placeholder { color: var(--c-ink-2); }
.search input:focus { outline: none; border-color: var(--gold); }
#hits { position: absolute; z-index: 40; left: 0; right: 0; margin: 6px 0 0; padding: 4px; list-style: none; background: var(--paper); border-top: 3px solid var(--gold);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5); max-height: 70vh; overflow-y: auto; }
#hits:empty, .search:not(:focus-within) #hits { display: none; }
#hits a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: var(--ink); }
#hits a:hover, #hits a:focus { background: var(--paper-2); text-decoration: none; outline: none; box-shadow: inset 3px 0 var(--red); }
#hits small { margin-left: auto; padding-left: 8px; color: var(--ink-2); white-space: nowrap; }
#hits img { width: 32px; height: 32px; object-fit: contain; }

/* ---- sidebar ---- */
.side { grid-area: side; position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 8px 14px 110px 16px; /* +70px: until the page scrolls past the header, the sidebar's bottom sits that far below the viewport */ scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; }
.side p { display: flex; align-items: center; gap: 8px; margin: 20px 0 4px 8px; padding: 0; background: none; font: italic 500 14px/1.4 var(--display); color: var(--c-gold); }
.side p::before { position: static; flex: none; width: 6px; height: 12px; }
.side p::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--c-line), transparent); }
.side ul { margin: 0; padding: 0; list-style: none; }
.side a { display: block; padding: 4px 14px; color: var(--c-ink); font-size: 15px; }
.side a:hover { color: var(--title); text-decoration: none; box-shadow: inset 3px 0 var(--red); background: linear-gradient(90deg, rgba(241, 36, 74, .14), transparent); }
.side a[aria-current] { color: var(--c-gold); font-weight: 600; }
.side a[aria-current="page"] { color: #2b2011; font-weight: 600; background: linear-gradient(#f3dfb2, var(--gold)); box-shadow: none; clip-path: var(--slant); }

/* ---- content ---- */
main { grid-area: main; min-width: 0; max-width: 1200px; padding: 0 32px 24px 8px; }
.crumbs { margin: 0 0 4px; font-size: 14px; color: var(--c-ink-2); }
.crumbs a { color: var(--c-gold); }
footer { grid-area: foot; max-width: 1200px; padding: 8px 32px 32px 8px; color: var(--c-ink-2); font-size: 13px; }
footer p { max-width: 90ch; margin: 0 0 6px; }

/* page title: big slanted type on the night, gold and red slashes before it, the sheet below */
.tab { position: relative; margin: 0 0 16px; padding: 0 0 0 34px; background: none; font: italic 600 clamp(32px, 4.4vw, 52px)/1.05 var(--display);
  color: var(--title); letter-spacing: -.01em; text-shadow: var(--title-glow); }
.tab::before { top: .1em; width: 12px; height: .8em; }
.tab::after { content: ""; position: absolute; left: 16px; top: .1em; width: 12px; height: .8em; background: var(--red); clip-path: polygon(45% 0, 100% 0, 55% 100%, 0 100%); }
.sheet { display: flow-root; background: var(--paper); padding: 26px 32px 36px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
.sheet > :first-child, .entity > :first-child { margin-top: 0; }
.lead { color: var(--ink-2); max-width: 75ch; }

/* ---- tables: night header bar in both themes ---- */
.scroll { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--rule);
  background:  /* edge shadows show only while there is more table to scroll to */
    linear-gradient(to right, var(--cell) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--cell) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .28), transparent) left / 14px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .28), transparent) right / 14px 100% no-repeat, var(--cell); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 7px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
td + td, th + td, td + th, th + th { border-left: 1px solid var(--rule); }
tbody tr:last-child > * { border-bottom: 0; }
thead th { background: var(--night-2); color: var(--gold-hi); border-color: var(--night-line); font: 500 14px/1.3 var(--display); white-space: nowrap; }
tbody th { font-weight: 600; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--paper-2) 35%, transparent); }
tbody tr:hover { background: var(--hl); }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
th button::after { content: "↕" / ""; margin-left: 6px; opacity: .45; }
th[aria-sort="ascending"] button::after { content: "▲" / ""; opacity: 1; color: var(--gold); }
th[aria-sort="descending"] button::after { content: "▼" / ""; opacity: 1; color: var(--gold); }
.list .who { white-space: nowrap; }
.list td, .list th { vertical-align: middle; }
.list .who img, .chips img { width: 40px; height: 40px; object-fit: contain; vertical-align: middle; margin-right: 10px; }
.list .who img[style] { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 50%, #fff), var(--c) 80%); clip-path: polygon(0 0, 100% 0, 100% 75%, 75% 100%, 0 100%); }
.list tr:target { background: var(--hl); box-shadow: inset 4px 0 var(--red); }
.tier { display: inline-block; padding: 0 12px; clip-path: var(--slant); font: italic 600 13px/1.6 var(--display); color: #1d1626; background: var(--c); white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end; margin: 16px 0 12px; font-size: 14px; color: var(--ink-2); }
.filters label { display: grid; gap: 2px; max-width: 100%; min-width: 0; }
.filters input, .filters select { font: inherit; max-width: 100%; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--cell); color: var(--ink); }
.filters input { width: 260px; }
.count { margin-left: auto; font: italic 500 15px var(--display); color: var(--mark); }

/* ---- entity blocks on shared pages: infobox on the right ---- */
.entity { display: flow-root; }
.entity[id] { margin-top: 40px; padding-top: 4px; }
.entity[id] > h2 { font-size: 28px; }
.entity[id]:target > h2 { color: var(--mark); }
.infobox { float: right; clear: right; width: 300px; margin: 0 0 16px 24px; background: var(--paper-2); border: 1px solid var(--rule); }
.entity[id] .infobox { width: 260px; }
.ib-title { margin: 0; padding: 8px 12px; background: var(--night-2); color: var(--gold-hi); font: italic 600 19px/1.3 var(--display); text-align: center; }
.infobox figure { position: relative; margin: 0; background: radial-gradient(ellipse at 50% 35%, #34407a, var(--night) 75%); text-align: center; }
.infobox figure img { display: block; margin: 0 auto; max-height: 420px; width: auto; }
.infobox .sticker { position: absolute; top: 8px; right: 8px; width: 64px; height: 64px; }
.facts { display: grid; grid-template-columns: max-content 1fr; margin: 0; font-size: 15px; }
.facts > div { display: contents; }
.facts dt, .facts dd { margin: 0; padding: 5px 12px; border-top: 1px solid var(--rule); }
.facts dt { color: var(--ink-2); padding-right: 6px; }
.facts dd { overflow-wrap: anywhere; }

/* ---- own page with art: the gacha character screen. Her name huge behind her, rarity glow on the stage (hero_bg_10) ---- */
.entity > .card { position: relative; display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); margin: -26px -32px 24px; overflow: hidden; color: #ece6dc;
  background: radial-gradient(ellipse 34% 60% at 18% 70%, color-mix(in srgb, var(--c) 38%, transparent), transparent), var(--night) url(img/site/stage.webp) center bottom / cover; }
.card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--c), var(--gold) 40%, transparent); }
.ghost { position: absolute; left: 12px; top: -.08em; z-index: 0; font: italic 600 clamp(110px, 15vw, 200px)/1 var(--display); text-transform: uppercase; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1.5px color-mix(in srgb, var(--c) 55%, transparent); opacity: .7; pointer-events: none; }
.card figure { position: relative; z-index: 1; display: grid; align-items: end; justify-items: center; margin: 0; padding-top: 28px; }
.card figure img { display: block; max-height: 508px; width: auto;  /* some portraits have a boxy backdrop: fade its edges into the stage */
  -webkit-mask: radial-gradient(ellipse 62% 58% at 50% 46%, #000 62%, transparent); mask: radial-gradient(ellipse 62% 58% at 50% 46%, #000 62%, transparent); }
.card .sticker { position: absolute; top: 22px; right: 18px; width: 76px; height: 76px; }
.card-info { position: relative; z-index: 1; align-self: end; padding: 120px 32px 36px 8px; }
.card .lead { margin: 0 0 18px; color: var(--night-ink); }
.card .facts { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.card .facts > div { display: block; padding: 9px 14px; background: rgba(14, 17, 34, .74); border-left: 2px solid var(--gold); backdrop-filter: blur(4px); }
.card .facts dt, .card .facts dd { padding: 0; border: 0; }
.card .facts dt { color: var(--night-ink-2); font-size: 13px; }
.card .facts dd { font: italic 600 19px/1.3 var(--display); color: #fff; overflow-wrap: break-word; hyphens: auto; }

/* Contents: a row of slanted section links */
.toc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.toc h2 { margin: 0 8px 0 0; padding: 0 0 0 14px; background: none; font-size: 16px; color: var(--ink-2); }
.toc h2::before { width: 6px; }
.toc ol { display: contents; }
.toc li { list-style: none; }
.toc a { display: block; padding: 3px 18px; font-size: 14px; color: var(--ink); background: var(--paper-2); clip-path: var(--slant); }
.toc a:hover { background: var(--gold); color: #2b2011; text-decoration: none; }

/* skills: cards side by side, cooldowns as pills, the max-level text under the Lv. 1 text */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; gap: 16px; margin: 36px 0 0; }
.skill { padding: 18px 22px; background: var(--cell); border: 1px solid var(--rule); border-top: 3px solid var(--night-2);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%); }
.skills .skill h2 { margin: 0 0 8px; padding: 0; background: none; font-size: 21px; }
.skills .skill h2::before { display: none; }
.cd { display: flex; flex-wrap: wrap; gap: 6px; }
.cd span { padding: 1px 14px; font-size: 13px; color: var(--gold-hi); background: var(--night-2); clip-path: var(--slant); }
.entity .skill p { max-width: none; }
.entity section > p { margin: 0 0 8px; max-width: 80ch; }
.entity .max { margin-top: 12px; padding: 8px 12px; background: var(--hl); border-left: 3px solid var(--gold); }
.max b { display: inline-block; margin-right: 6px; padding: 0 10px; clip-path: var(--slant); font: italic 600 12px/1.7 var(--display); color: #2b2011; background: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.chips a { display: flex; align-items: center; padding: 3px 16px 3px 3px; background: var(--cell); border: 1px solid var(--rule); color: var(--ink); }
.chips a:hover { border-color: var(--gold); box-shadow: inset 0 -2px var(--gold); text-decoration: none; }
.chips img { width: 32px; height: 32px; margin-right: 8px; }

/* ---- navbox: siblings at the foot of a page ---- */
.navbox { clear: both; margin: 44px 0 0; background: var(--cell); border: 1px solid var(--rule); font-size: 15px; }
.navbox summary { padding: 7px 12px; background: var(--night-2); color: var(--gold-hi); font: italic 600 17px/1.4 var(--display); text-align: center; cursor: pointer; border-bottom: 2px solid var(--gold); }
.navbox div { display: grid; grid-template-columns: 7em 1fr; border-top: 1px solid var(--rule); }
.navbox div:only-of-type { grid-template-columns: 1fr; }
.navbox h3 { margin: 0; padding: 6px 12px; background: var(--paper-2); font-size: 14px; text-align: right; }
.navbox ul { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 0; padding: 6px 12px; list-style: none; }

/* ---- home ---- */
.banner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; min-height: 420px; margin: 0 0 36px;
  padding: 36px 0 0 36px; background: center 40% / cover; color: #fff; overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px)); }
.banner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(14, 17, 34, .95) 15%, rgba(14, 17, 34, .6) 55%, rgba(14, 17, 34, .35)); }
.banner > * { position: relative; }
.banner-text { padding-bottom: 40px; }
/* set in type, not the game's logo image: that is 350px ASTC art and goes soft at this size */
.banner h1 { margin: 0 0 14px; font: italic 600 clamp(48px, 7vw, 92px)/.92 var(--display); letter-spacing: -.02em; text-transform: uppercase;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .5); }
.banner h1 span { display: block; color: var(--gold); font-size: .5em; text-transform: none; letter-spacing: 0; }
.banner p { max-width: 46ch; margin: 0 0 6px; font-size: 18px; }
.banner .ver { font-size: 14px; color: var(--night-ink-2); }
/* the seven rarest Phantoms as slanted recruit strips, dealt in once on load */
.fan { display: flex; align-self: stretch; align-items: end; padding-right: 20px; }
.fan a { flex: none; width: 104px; height: 360px; margin-left: -22px; clip-path: polygon(30px 0, 100% 0, calc(100% - 30px) 100%, 0 100%);
  background: var(--night-2); transition: transform .2s; animation: deal .6s calc(var(--i) * 70ms) both cubic-bezier(.2, .8, .2, 1); }
.fan a:nth-child(odd) { height: 330px; }
.fan a:hover { transform: translateY(-10px); }
.fan img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
@keyframes deal { from { opacity: 0; transform: translateY(40px); } }

.portal-box { min-width: 0; }
.portal-box + .portal-box { margin-top: 36px; }
.portal-box .tab { font-size: clamp(26px, 3vw, 34px); }
.portal { padding-top: 8px; padding-bottom: 12px; }  /* one sheet, a row per sidebar group: label left, tiles right */
.portal section { display: grid; grid-template-columns: 150px minmax(0, 1fr); padding: 8px 0; border-top: 1px solid var(--rule); }
.portal section:first-child { border-top: 0; }
.portal h3 { margin: 22px 0 0; font: italic 600 18px/1.2 var(--display); color: var(--mark); }
.tiles, .roster { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.tiles a { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px; color: var(--ink); }
.tiles a:hover { background: var(--paper-2); box-shadow: inset 3px 0 var(--red); text-decoration: none; }
.tiles img { grid-row: span 2; width: 56px; height: 56px; object-fit: contain; }
.tiles b { font: 500 17px/1.2 var(--display); align-self: end; }
.tiles small { color: var(--ink-2); align-self: start; }
/* roster: recruit strips cut to the upper body, a rarity bar under each */
.roster { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 8px; }
.roster a { display: grid; grid-template-rows: 172px auto auto; color: var(--ink); line-height: 1.2; text-decoration: none; }
.roster img, .roster span { width: 100%; height: 172px; object-fit: cover; object-position: 50% 4%; background: var(--night-2);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%); border-bottom: 4px solid var(--c); transition: filter .15s; }
.roster span { display: grid; place-items: center; color: var(--c); font: italic 600 48px/1 var(--display); }  /* no art in the game files */
.roster b { margin-top: 6px; font: 500 15px/1.2 var(--display); }
.roster small { color: var(--ink-2); font: italic 500 12px/1.4 var(--display); }
.roster a:hover img { filter: brightness(1.12); }
.roster a:hover b { color: var(--mark); }

/* ---- tablet and phone: the sidebar becomes a drawer, header sticks ---- */
@media (max-width: 1000px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "foot"; background-attachment: scroll, scroll; }
  .top { position: sticky; top: 0; z-index: 20; gap: 10px; padding: 8px 16px; background: var(--top-bg); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--c-line); }
  .menu { display: grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0; border: 1px solid var(--c-line); border-radius: 4px;
    background: transparent; cursor: pointer; }
  .menu span, .menu span::before, .menu span::after { display: block; width: 18px; height: 2px; background: var(--c-gold); }
  .menu span { position: relative; }
  .menu span::before, .menu span::after { content: ""; position: absolute; left: 0; }
  .menu span::before { top: -6px; } .menu span::after { top: 6px; }
  .logo { width: auto; padding: 0; }
  .logo img { height: 34px; }
  .logo span { font-size: 15px; padding-bottom: 4px; }
  .side { position: fixed; z-index: 30; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); max-height: none; padding-top: 16px;
    background: var(--bg); box-shadow: 8px 0 32px rgba(0, 0, 0, .5); transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  .nav-open .side { transform: none; visibility: visible; transition: transform .2s; }
  .nav-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(6, 7, 14, .6); }
  main { padding: 14px 16px 16px; }
  footer { padding: 8px 16px 24px; }
  [id] { scroll-margin-top: 72px; }
  .fan a:nth-child(n+6) { display: none; }
}
@media (max-width: 700px) {
  :root { --cut: 12px; }
  h2 { font-size: 23px; }
  .sheet { padding: 18px 16px 24px; }
  .infobox, .entity[id] .infobox { float: none; width: auto; margin: 0 0 16px; }
  .infobox figure img { max-height: 360px; }
  .entity > .card { grid-template-columns: minmax(0, 1fr); margin: -18px -16px 20px; }
  .ghost { font-size: 96px; }
  .card figure img { max-height: 380px; }
  .card-info { padding: 4px 16px 20px; }
  .card .facts { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .skill { padding: 14px 16px; }
  .banner { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 24px 0 0 20px; }
  .banner-text { padding: 0 20px 0 0; }
  .banner p { font-size: 16px; }
  .fan { justify-content: center; padding: 0 0 0 22px; }
  .fan a { width: 84px; height: 220px; margin-left: -20px; clip-path: polygon(24px 0, 100% 0, calc(100% - 24px) 100%, 0 100%); }
  .fan a:nth-child(odd) { height: 200px; }
  .fan a:nth-child(n+5) { display: none; }
  .count { margin-left: 0; }
  .list .who { white-space: normal; min-width: 10em; }
  .filters input { width: 100%; }
  .filters label:first-child { flex: 1 1 100%; }
  .navbox div { grid-template-columns: 1fr; }
  .navbox h3 { text-align: left; }
  .portal section { grid-template-columns: minmax(0, 1fr); }
  .portal h3 { margin: 8px 0 4px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tiles a { grid-template-columns: 44px 1fr; column-gap: 10px; }
  .tiles img { width: 44px; height: 44px; }
  .roster { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .roster a { grid-template-rows: 160px auto auto; }
  .roster img, .roster span { height: 160px; }
}
@media (max-width: 700px) { .search { position: static; } #hits { left: 8px; right: 8px; top: 100%; } }  /* results span the header */
@media (max-width: 420px) {
  .top { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .menu, .theme { width: 36px; height: 36px; }
  .logo img { height: 26px; }
  .logo span { display: none; }
  .search input { padding-left: 36px; background-position: 12px center; }
}
@media (prefers-reduced-motion: reduce) { .side, .fan a, .roster img { transition: none !important; } .fan a { animation: none; } }
