/* Mushoku — a personal game journal kept by Roxy, Sylphiette and Eris. */
@font-face { font-family: "Cinzel"; src: url("./fonts/cinzel.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("./fonts/eb-garamond.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("./fonts/eb-garamond-italic.woff2") format("woff2"); font-weight: 400 800; font-style: italic; font-display: swap; }

:root {
  --night-0: #0a1129;
  --night-1: #0f1836;
  --night-2: #18244b;
  --night-3: #27356b;
  --ivory: #fbf5e6;
  --gold: #c3a058;
  --gold-soft: #e8d6a8;
  --gold-deep: #8c6a2b;
  --page: #f6efe1;
  --card: #fffbf2;
  --card-2: #faf3e3;
  --ink: #2a2118;
  --ink-2: #5a4936;
  --ink-3: #8a755c;
  --line: rgba(90, 73, 54, .16);
  --line-strong: rgba(90, 73, 54, .3);
  --roxy: #3a5bbf;
  --roxy-ink: #26408c;
  --roxy-soft: #e4eaf8;
  --sylph: #4d7b39;
  --sylph-ink: #36592a;
  --sylph-soft: #e6efd9;
  --eris: #b23a2e;
  --eris-ink: #8c2a21;
  --eris-soft: #f7e2dd;
  --accent: var(--gold-deep);
  --accent-ink: var(--ink);
  --accent-soft: var(--card-2);
  --shadow-sm: 0 1px 2px rgba(42, 33, 24, .06), 0 10px 24px -18px rgba(42, 33, 24, .45);
  --shadow-lg: 0 2px 4px rgba(42, 33, 24, .06), 0 26px 46px -28px rgba(42, 33, 24, .6);
  --display: "Cinzel", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --body: "EB Garamond", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --gutter: clamp(18px, 4vw, 56px);
  --strip: 58px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); font: 18px/1.55 var(--body); font-variant-numeric: lining-nums; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 40; padding: 10px 16px; border-radius: 6px; background: var(--card); color: var(--ink); text-decoration: none; }
.skip-link:focus { top: 12px; }
.kicker { margin: 0 0 8px; color: var(--accent); font: 600 11.5px/1.3 var(--display); letter-spacing: .22em; text-transform: uppercase; }

/* ================= hero: the party rising out of the evening clouds ================= */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-bottom: var(--strip); color: var(--ivory); background: linear-gradient(180deg, var(--night-0) 0%, var(--night-1) 30%, #1d2a5a 58%, #3b4583 80%, #6d68a2 100%); }
.hero :focus-visible { outline-color: var(--gold-soft); }
.sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.stars, .dawn { position: absolute; inset: 0; }
.stars {
  -webkit-mask-image: linear-gradient(#000 30%, transparent 78%); mask-image: linear-gradient(#000 30%, transparent 78%);
  background-image:
    radial-gradient(1.3px 1.3px at 22px 38px, #fff 50%, transparent 52%), radial-gradient(1px 1px at 141px 92px, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 260px 24px, var(--gold-soft) 50%, transparent 52%), radial-gradient(1px 1px at 310px 160px, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 88px 210px, #fff 50%, transparent 52%), radial-gradient(1px 1px at 200px 250px, #dfe6ff 50%, transparent 52%);
  background-size: 340px 280px;
}
.stars.far { opacity: .55; background-size: 230px 190px; background-position: 117px 61px; }
.dawn { background: radial-gradient(70% 55% at 64% 100%, rgba(243, 196, 196, .42), rgba(170, 146, 200, .22) 45%, transparent 75%); }

.topbar {
  position: relative; z-index: 8; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  max-width: 1320px; margin: 0 auto; padding: 22px var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 12px; justify-self: start; color: var(--ivory); font: 600 13px/1 var(--display); letter-spacing: .22em; text-transform: uppercase; text-decoration: none; }
.crest { width: 30px; height: 30px; flex: none; color: var(--gold-soft); }
.chapter-links { display: flex; gap: 6px 30px; font: 500 12px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; }
.chapter-links a { padding: 8px 0; color: rgba(251, 245, 230, .8); text-decoration: none; background: linear-gradient(var(--gold-soft), var(--gold-soft)) 50% 100% / 0 1px no-repeat; transition: color .2s ease, background-size .25s ease; }
.chapter-links a:hover { color: var(--ivory); background-size: 100% 1px; }
.chapter-links i { margin-right: 8px; color: var(--gold); font-size: 10px; font-style: normal; letter-spacing: .08em; }
.topbar-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
a.back { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid rgba(232, 214, 168, .32); border-radius: 999px; color: rgba(251, 245, 230, .86); font: 500 11.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; transition: border-color .2s ease, color .2s ease; }
a.back:hover { border-color: var(--gold-soft); color: var(--ivory); }

/* Theme picker, dressed for the night sky. */
.theme-picker {
  --tp-font: var(--body);
  --tp-fg: var(--ink);
  --tp-muted: var(--ink-3);
  --tp-bg: var(--card);
  --tp-line: var(--line-strong);
  --tp-hover: var(--card-2);
  --tp-accent: var(--gold-deep);
  --tp-menu-radius: 10px;
  --tp-toggle-bg: rgba(255, 255, 255, .05);
  --tp-toggle-fg: rgba(251, 245, 230, .9);
  --tp-toggle-line: rgba(232, 214, 168, .32);
  --tp-toggle-ring: var(--night-1);
  --tp-shadow: 0 2px 6px rgba(10, 17, 41, .2), 0 30px 60px -24px rgba(10, 17, 41, .7);
}
.theme-toggle { font: 500 11.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.theme-toggle:hover, .theme-picker.is-open > .theme-toggle { border-color: var(--gold-soft); }
.theme-picker-fallback { font: 500 11.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.theme-menu-title { color: var(--gold-deep); font-family: var(--display); font-weight: 600; letter-spacing: .2em; }
.theme-option-text b { font: 600 16px/1.2 var(--display); letter-spacing: .02em; }
.theme-option-text small { font-size: 14px; font-style: italic; }
.theme-gallery { font-size: 15px; font-style: italic; }

.hero-inner {
  position: relative; display: grid; grid-template-columns: minmax(0, 470px) minmax(0, 1fr); grid-template-rows: 1fr auto;
  max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter);
}
.hero-copy { position: relative; z-index: 6; grid-column: 1; grid-row: 1; align-self: end; padding-top: 36px; }
.hero-copy .kicker { color: var(--gold-soft); }
.hero h1 { margin: 0; color: var(--ivory); font: 700 clamp(46px, 5.4vw, 80px)/.98 var(--display); letter-spacing: .01em; text-wrap: balance; text-shadow: 0 2px 40px rgba(195, 160, 88, .28); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 { background: linear-gradient(180deg, #fffaf0 35%, #e9d39f 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
}
.hero h1::after { content: ""; display: block; width: 168px; height: 12px; margin-top: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 168 12' fill='none' stroke='%23c3a058'%3E%3Cpath d='M0 6h68M100 6h68' stroke-width='1'/%3E%3Cpath d='m84 1 5 5-5 5-5-5z' fill='%23c3a058'/%3E%3Ccircle cx='73' cy='6' r='1.6' fill='%23c3a058' stroke='none'/%3E%3Ccircle cx='95' cy='6' r='1.6' fill='%23c3a058' stroke='none'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
.lede { max-width: 30ch; margin: 16px 0 0; color: rgba(251, 245, 230, .86); font-size: clamp(20px, 1.7vw, 23px); font-style: italic; line-height: 1.4; }

/* The bottom padding keeps the sync line above both cloud banks (the back bank's base is 9.4vw tall; only its faint mist crowns rise behind the line). */
.hero-ledger { position: relative; z-index: 6; grid-column: 1; grid-row: 2; padding: 26px 0 max(120px, calc(9.4vw + 16px)); }
.ledger {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 470px; margin: 0; padding: 6px;
  border: 1px solid rgba(232, 214, 168, .26); border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 36, 75, .74), rgba(13, 21, 49, .84));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 24px 40px -28px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ledger div { min-width: 0; padding: 14px 10px 12px; text-align: center; }
.ledger div + div { border-left: 1px solid rgba(232, 214, 168, .14); }
.ledger dt { color: rgba(232, 214, 168, .74); font: 600 9.5px/1.3 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.ledger dd { margin: 8px 0 0; color: var(--ivory); font: 600 clamp(24px, 2.3vw, 30px)/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.sync { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 14px 0 0; padding: 6px 14px 6px 12px; border: 1px solid rgba(232, 214, 168, .16); border-radius: 999px; background: rgba(10, 17, 41, .74); color: rgba(251, 245, 230, .88); font-size: 15.5px; font-style: italic; line-height: 1.3; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #9fd28a; box-shadow: 0 0 0 3px rgba(159, 210, 138, .18); }
.sync a { color: var(--gold-soft); font-style: normal; text-underline-offset: 3px; }

/* The stage keeps the source art's proportions: Eris, Roxy and Sylphiette left to right, matching chapters I–III; Roxy at full scale in front, the others at 0.84 behind her. */
.stage { position: relative; grid-column: 2; grid-row: 1 / span 2; align-self: end; width: calc(100% + var(--gutter) + 40px); margin-left: -40px; aspect-ratio: 1670 / 1160; }
.stage-sky { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.halo { position: absolute; left: 52%; top: 40%; width: 74%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 241, 214, .26), rgba(164, 178, 255, .1) 42%, transparent 68%); }
.sigil { position: absolute; left: 52%; top: 40%; width: 62%; height: auto; transform: translate(-50%, -50%); color: var(--gold-soft); opacity: .34; overflow: visible; }
.sigil-outer, .sigil-inner { transform-origin: 300px 300px; }
.sigil-outer { animation: turn 240s linear infinite; }
.sigil-inner { animation: turn 160s linear infinite reverse; }
@keyframes turn { to { transform: rotate(360deg); } }
.light { position: absolute; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; }
.light.roxy { left: 52%; top: 50%; background: radial-gradient(circle, rgba(96, 138, 255, .5), rgba(96, 138, 255, .12) 45%, transparent 68%); }
.light.sylphiette { left: 85%; top: 46%; width: 38%; background: radial-gradient(circle, rgba(132, 200, 120, .4), transparent 66%); }
.light.eris { left: 18%; top: 44%; width: 38%; background: radial-gradient(circle, rgba(240, 104, 88, .4), transparent 66%); }
.sparkles i { position: absolute; width: 12px; height: 12px; background: #fff3d2; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: twinkle 5s ease-in-out infinite; }
.sparkles i:nth-child(1) { left: 6%; top: 10%; animation-delay: -1s; }
.sparkles i:nth-child(2) { left: 37%; top: 3%; width: 9px; height: 9px; animation-delay: -3.2s; }
.sparkles i:nth-child(3) { left: 47%; top: 26%; width: 8px; height: 8px; animation-delay: -2s; }
.sparkles i:nth-child(4) { left: 72%; top: 4%; animation-delay: -4.1s; }
.sparkles i:nth-child(5) { left: 95%; top: 22%; width: 9px; height: 9px; animation-delay: -.6s; }
.sparkles i:nth-child(6) { left: 31%; top: 62%; width: 8px; height: 8px; animation-delay: -2.7s; }
.sparkles i:nth-child(7) { left: 66%; top: 66%; width: 10px; height: 10px; animation-delay: -1.7s; }
.sparkles i:nth-child(8) { left: 99%; top: 58%; width: 8px; height: 8px; animation-delay: -3.6s; }
.sparkles i:nth-child(9) { left: 10%; top: 76%; width: 9px; height: 9px; animation-delay: -4.6s; }
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1); } }

.heroine { position: absolute; z-index: 3; height: auto; max-width: none; animation: drift 9s ease-in-out infinite; }
.heroine.sylphiette { left: 69.04%; top: 14.66%; width: 30.96%; filter: drop-shadow(0 0 18px rgba(150, 214, 128, .3)) drop-shadow(0 18px 22px rgba(6, 12, 34, .4)); animation-delay: -3s; }
.heroine.roxy { left: 29.9%; top: 5.95%; width: 44.85%; z-index: 4; filter: drop-shadow(0 0 22px rgba(118, 156, 255, .38)) drop-shadow(0 22px 26px rgba(6, 12, 34, .45)); animation-duration: 8s; }
.heroine.eris { left: 0; top: 10.34%; width: 37%; filter: drop-shadow(0 0 18px rgba(255, 120, 100, .3)) drop-shadow(0 18px 22px rgba(6, 12, 34, .4)); animation-delay: -5.5s; animation-duration: 10s; }
@keyframes drift { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -1.3%, 0); } }

/* Two cloud banks: the lilac one drifts behind the party, the paper one in front becomes the first page of the journal. */
.clouds { position: absolute; left: 0; right: 0; bottom: calc(var(--strip) - 1px); width: 100%; height: max(72px, 7.5vw); pointer-events: none; }
/* The mist's lobes crest up to y = -27.1, so its viewBox starts at -36 and the box is 156/120 = 1.3× its 120-unit base: same scale, full crowns, flush bottom. */
.clouds.back { z-index: 2; height: calc(max(92px, 9.4vw) * 1.3); fill: url(#mist); }
.clouds.back .mid { fill: rgba(240, 230, 238, .5); }
.clouds.front { z-index: 5; fill: var(--page); }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; height: var(--strip); background: var(--page); }

.name-tags { position: absolute; top: 100%; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: 34% 36% 30%; align-items: center; height: var(--strip); padding-bottom: 4px; }
.name-tag { justify-self: center; display: grid; justify-items: center; gap: 5px; min-width: 0; color: var(--ink); text-align: center; text-decoration: none; white-space: nowrap; }
.name-tag b { display: inline-flex; align-items: center; gap: 9px; font: 600 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; }
.name-tag b::before { content: ""; width: 6px; height: 6px; flex: none; transform: rotate(45deg); background: var(--tag); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag) 18%, transparent); }
.name-tag > span { color: var(--ink-3); font-size: 15px; font-style: italic; line-height: 1; }
.name-tag:hover b { color: var(--tag); }
.name-tag.roxy { --tag: var(--roxy); }
.name-tag.sylphiette { --tag: var(--sylph); }
.name-tag.eris { --tag: var(--eris); }
.hero .name-tag:focus-visible { outline-color: var(--gold-deep); }

/* ================= main: the journal pages ================= */
main {
  position: relative; padding: 0 var(--gutter) 56px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .17 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(90% 50% at 50% 0, #fbf6ea, transparent 70%),
    var(--page);
}
main > * { position: relative; max-width: 1240px; margin-left: auto; margin-right: auto; }
.roxy { --accent: var(--roxy); --accent-ink: var(--roxy-ink); --accent-soft: var(--roxy-soft); }
.sylphiette { --accent: var(--sylph); --accent-ink: var(--sylph-ink); --accent-soft: var(--sylph-soft); }
.eris { --accent: var(--eris); --accent-ink: var(--eris-ink); --accent-soft: var(--eris-soft); }

/* ---------- the party ---------- */
.party { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding-top: 18px; }
.member {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px;
  padding: 18px 20px 18px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm);
  transition: box-shadow .25s ease, transform .25s ease;
}
.member::before { content: ""; position: absolute; left: 20px; right: 20px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .8; }
.member:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.portrait { position: relative; display: block; width: 78px; height: 96px; flex: none; overflow: hidden; border-radius: 39px 39px 10px 10px; background: radial-gradient(circle at 50% 30%, #fff, var(--accent-soft) 70%); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 0 4px var(--card), 0 0 0 5px rgba(195, 160, 88, .55); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.1); transform-origin: 50% 30%; transition: transform .4s ease; }
.member:hover .portrait img { transform: scale(1.16); }
.role { margin: 0; color: var(--accent); font: 600 10.5px/1.3 var(--display); letter-spacing: .16em; text-transform: uppercase; }
.member h3 { margin: 5px 0 6px; font: 600 19px/1.15 var(--display); letter-spacing: .02em; }
.member-stat { margin: 0; color: var(--ink-2); font-size: 16.5px; line-height: 1.4; }
.member-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--accent-ink); font: 600 11px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }
.member-link::after { content: "→"; font-family: var(--body); font-size: 15px; letter-spacing: 0; transition: transform .2s ease; }
.member-link:hover::after { transform: translateX(4px); }

/* ---------- chapters ---------- */
.chapter { padding-top: 104px; scroll-margin-top: 8px; }
.chapter-head { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 22px; padding-bottom: 22px; margin-bottom: 28px; }
.chapter-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--accent) 0, color-mix(in srgb, var(--accent) 40%, transparent) 90px, var(--line-strong) 160px, var(--line) 70%, transparent); }
.chapter-head::before { content: ""; position: absolute; left: 86px; bottom: -4px; width: 8px; height: 8px; transform: rotate(45deg); background: var(--page); box-shadow: inset 0 0 0 1.5px var(--accent); }
.numeral { min-width: 64px; color: var(--gold); font: 500 76px/.8 var(--display); text-align: center; }
@supports (-webkit-text-stroke: 1px black) { .numeral { color: transparent; -webkit-text-stroke: 1.2px var(--gold); } }
.chapter-title { min-width: 0; }
.chapter-head h2 { margin: 0; font: 600 clamp(32px, 3.8vw, 48px)/1.04 var(--display); letter-spacing: .01em; }
.chapter-line { margin: 8px 0 0; color: var(--ink-2); font-size: 19px; font-style: italic; }
.chapter-face { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); box-shadow: 0 0 0 3px var(--page), 0 0 0 4px color-mix(in srgb, var(--accent) 60%, transparent); }

/* ---------- records ---------- */
.records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.record-board { padding: 24px 26px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm); }
.record-board h3 { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 0 16px; }
.record-board h3 span { color: var(--accent-ink); font: 600 13px/1.2 var(--display); letter-spacing: .18em; text-transform: uppercase; }
.record-board h3 small { color: var(--ink-3); font-size: 15px; font-style: italic; font-weight: 400; }
.record-board { display: flex; flex-direction: column; min-width: 0; }
/* Collapsed boards: a fixed preview of the top five. They never scroll, so the wheel always moves the page. */
.record-board .ranked { flex: 1; overflow: visible; }
.board-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 6px; padding: 14px 0 6px; border-top: 1px solid var(--line); }
.board-count { color: var(--ink-3); font-size: 15.5px; font-style: italic; }
.expand { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 18px; border: 1px solid color-mix(in srgb, var(--gold-deep) 55%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--gold-soft) 32%, var(--card)); color: var(--night-1); font: 600 11.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.expand::after { content: ""; width: 10px; height: 10px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg) scale(.8); }
.expand:hover { border-color: var(--gold-deep); background: var(--gold-soft); }
.expand:focus-visible { outline: 2px solid var(--night-2); outline-offset: 3px; }

.ranked { margin: 0; padding: 0; list-style: none; }
.ranked li { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.ranked .rank { color: var(--gold-deep); font: 600 14px/1 var(--display); letter-spacing: .02em; text-align: center; white-space: nowrap; font-variant-numeric: lining-nums; }
.ranked li.featured { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 18px; padding: 0 0 18px; border-top: 0; }
.ranked li.featured + li { border-top: 0; }
.ranked li.ranked-empty { display: block; padding: 18px 0; border: 0; color: var(--ink-3); font-style: italic; }
.record-cover { aspect-ratio: 460 / 215; border-radius: 8px; box-shadow: 0 12px 24px -16px rgba(42, 33, 24, .8); }
.record-cover::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); pointer-events: none; }
.rank-badge { position: absolute; left: 10px; top: 10px; z-index: 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(15, 24, 54, .85); color: var(--gold-soft); font: 600 13px/1 var(--display); box-shadow: 0 0 0 1px rgba(232, 214, 168, .5); }
.featured-text { display: grid; align-content: center; gap: 4px; min-width: 0; }
.featured-text .ranked-title { font-size: 22px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.featured-value { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.featured-value strong { color: var(--accent-ink); font: 600 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.featured-value strong small { margin-left: 4px; color: var(--ink-3); font: italic 400 16px/1 var(--body); }
.ranked-text { display: grid; min-width: 0; }
.ranked-title { overflow: hidden; font-size: 19px; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
a.ranked-title:hover { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ranked-meta { color: var(--ink-3); font-size: 15px; }
.ranked-value { font: 600 16px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ranked-value small { color: var(--ink-3); font: italic 400 15px/1 var(--body); }
.blade { grid-column: 2 / -1; height: 3px; margin-top: 9px; border-radius: 2px; background: linear-gradient(90deg, var(--eris), #d9735f) 0 0 / var(--value) 100% no-repeat, color-mix(in srgb, var(--eris) 10%, transparent); }

/* Wax seal for Metacritic scores, coloured by the usual green / amber / red tiers. */
.seal { --seal: var(--ink-3); position: relative; display: grid; place-content: center; justify-items: center; width: 47px; height: 47px; flex: none; border-radius: 50%; background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .32), transparent 46%), var(--seal); color: #fff8ea; text-decoration: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--seal) 72%, #000), 0 6px 14px -5px rgba(0, 0, 0, .5); transition: transform .2s ease, filter .2s ease; }
.seal::before { content: ""; position: absolute; inset: 3.5px; border: 1px dashed rgba(255, 248, 234, .42); border-radius: 50%; }
.seal b { font: 700 16.5px/1 var(--display); }
.seal small { margin-top: 2px; font: 600 6.2px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.seal.s-high { --seal: #4f7d3c; }
.seal.s-mid { --seal: #b48a2c; }
.seal.s-low { --seal: #a8382d; }
a.seal:hover { transform: rotate(-8deg) scale(1.05); filter: brightness(1.08); }
.seal.large { width: 56px; height: 56px; }
.seal.large b { font-size: 20px; }
.seal.large small { font-size: 6.6px; }

/* ---------- archive ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  margin: 0 -10px 14px; padding: 10px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(251, 246, 234, .9); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2); box-shadow: 0 14px 30px -26px rgba(42, 33, 24, .9);
}
.tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: 10px; background: rgba(90, 73, 54, .06); }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: 600 11.5px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; transition: background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.tab small { color: var(--ink-3); font: 500 14px/1 var(--body); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.tab:hover { background: rgba(255, 255, 255, .7); color: var(--roxy-ink); }
.tab[aria-pressed="true"] { background: var(--card); color: var(--roxy-ink); box-shadow: 0 1px 3px rgba(42, 33, 24, .14), inset 0 -2px 0 var(--roxy); }
.tab[aria-pressed="true"] small { color: var(--roxy); }
.search-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.search input { width: min(300px, 70vw); height: 40px; padding: 0 14px 0 38px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a755c' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") 13px 50% no-repeat; font-size: 17px; transition: border-color .2s ease, box-shadow .2s ease; }
.search input::placeholder { color: var(--ink-3); font-style: italic; }
.search input:focus { outline: none; border-color: var(--roxy); box-shadow: 0 0 0 3px rgba(58, 91, 191, .16); }
.sort { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font: 600 10.5px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; }
.sort select { height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%235a4936' stroke-width='1.5'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E") right 12px center no-repeat; color: var(--ink); font: 500 16px/1.2 var(--body); letter-spacing: 0; text-transform: none; appearance: none; cursor: pointer; }
.sort select:focus-visible { outline: none; border-color: var(--roxy); box-shadow: 0 0 0 3px rgba(58, 91, 191, .16); }
.result-count { margin: 0 0 18px; color: var(--ink-3); font-size: 16px; font-style: italic; text-align: right; }
.result-count:empty { display: none; }

.state { padding: 36px 20px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--ink-2); font-style: italic; text-align: center; }
.state .button { margin-left: 12px; }
.state.small { padding: 10px 0 0; border: 0; text-align: left; font-size: 16px; }
.state.small:empty { display: none; }

.tomes { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 24px; }
.tome { position: relative; display: flex; flex-direction: column; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.tome:hover { transform: translateY(-4px); border-color: rgba(195, 160, 88, .55); box-shadow: var(--shadow-lg); }
.tome > .cover { aspect-ratio: 460 / 215; border-radius: 7px; }
.tome > .cover::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), inset 0 -30px 40px -30px rgba(10, 17, 41, .5); pointer-events: none; }
.tome-body { position: relative; display: flex; flex-direction: column; flex: 1; padding: 14px 9px 8px; }
.tome-body > .seal { position: absolute; top: -28px; right: 6px; z-index: 3; }
.tome-platform { margin: 0; padding-right: 52px; color: var(--roxy); font: 600 10.5px/1.3 var(--display); letter-spacing: .16em; text-transform: uppercase; }
.tome-title { display: -webkit-box; margin: 5px 0 12px; overflow: hidden; font-size: 20px; font-weight: 600; line-height: 1.2; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tome-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: auto 0 0; padding-top: 11px; border-top: 1px solid var(--line); }
.tome-facts div + div { padding-left: 10px; border-left: 1px solid var(--line); }
.tome-facts dt { color: var(--ink-3); font: 600 9.5px/1.2 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.tome-facts dd { margin: 4px 0 0; font-size: 17px; font-weight: 600; line-height: 1.2; }
.tome-achievements { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; margin-top: 12px; color: var(--ink-2); font-size: 15px; line-height: 1.2; }
.tome-achievements b { color: var(--gold-deep); font: 600 12px/1.2 var(--display); }
.tome-achievements .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--gold-deep), var(--gold)) 0 0 / var(--value) 100% no-repeat, rgba(140, 106, 43, .12); }
.more-row { display: flex; justify-content: center; margin-top: 30px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 26px; border: 1px solid var(--night-2); border-radius: 999px; background: var(--night-1); color: var(--gold-soft); font: 600 11.5px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; cursor: pointer; box-shadow: inset 0 0 0 3px var(--night-1), inset 0 0 0 4px rgba(232, 214, 168, .38); transition: background-color .2s ease, color .2s ease; }
.button:hover { background: var(--night-2); color: var(--ivory); }

/* ---------- covers ---------- */
.cover { position: relative; display: block; overflow: hidden; background: linear-gradient(135deg, var(--night-2), var(--night-3)); isolation: isolate; }
.cover img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.cover[data-shape="square"] img { object-fit: contain; }
.cover[data-shape="square"]::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(232, 214, 168, .24), transparent 70%); }
.cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold-soft); font: 600 34px/1 var(--display); }
a.cover:hover img, .tome:hover .cover img { transform: scale(1.04); }

/* ---------- journal ---------- */
.journal-bar { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px 28px; margin-bottom: 22px; padding: 14px 22px 14px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm); }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0 0 3px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--card); color: var(--sylph-ink); font: 500 26px/1 var(--body); cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.month-nav button:hover:not(:disabled) { border-color: var(--sylph); background: var(--sylph-soft); }
.month-nav button:disabled { opacity: .32; cursor: default; }
.month-nav > span { min-width: 190px; text-align: center; font: 600 20px/1 var(--display); letter-spacing: .04em; }
.month-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.month-summary div { min-width: 0; padding: 2px 18px; border-left: 1px solid var(--line); }
.month-summary dt { color: var(--sylph); font: 600 9.5px/1.3 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.month-summary dd { margin: 4px 0 0; overflow: hidden; font-size: 20px; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

.journal { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
.calendar-page { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm); }
.weekdays, .calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--ink-3); font: 600 10px/1 var(--display); letter-spacing: .16em; text-align: center; text-transform: uppercase; }
.day { position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 6 / 5; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card-2); text-align: left; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.day:disabled { border-color: transparent; background: rgba(90, 73, 54, .035); color: rgba(138, 117, 92, .75); cursor: default; }
.day[data-heat="1"] { background: var(--sylph-soft); border-color: #d2e0bd; }
.day[data-heat="2"] { background: #c8dcaa; border-color: #b2cb8f; }
.day[data-heat="3"] { background: #8db36a; border-color: #79a057; color: #fff; }
.day[data-heat="4"] { background: var(--sylph); border-color: var(--sylph-ink); color: #fff; }
.day.historical::after { content: ""; position: absolute; inset: 3px; border: 1.5px dashed var(--gold-deep); border-radius: 6px; pointer-events: none; }
.day[data-heat="3"].historical::after, .day[data-heat="4"].historical::after { border-color: rgba(255, 248, 225, .85); }
.day.today .day-number::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; vertical-align: middle; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px rgba(195, 160, 88, .25); }
.day:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 12px -8px rgba(42, 33, 24, .6); }
.day[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.day.loading { opacity: .5; }
.day-number { font: 600 14.5px/1 var(--display); }
.day small { overflow: hidden; font-size: 13.5px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 15px; }
.legend-scale { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; }
.legend i[data-heat="1"] { background: var(--sylph-soft); box-shadow: inset 0 0 0 1px #d2e0bd; } .legend i[data-heat="2"] { background: #c8dcaa; }
.legend i[data-heat="3"] { background: #8db36a; } .legend i[data-heat="4"] { background: var(--sylph); }
.legend .legend-historical { width: 16px; height: 16px; border: 1.5px dashed var(--gold-deep); background: var(--card-2); }

.entry { position: sticky; top: 16px; padding: 24px 24px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm); }
.entry::before { content: ""; position: absolute; top: -1px; right: 24px; width: 18px; height: 46px; background: linear-gradient(90deg, var(--sylph-ink), var(--sylph) 50%, var(--sylph-ink)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.entry .kicker { color: var(--sylph); }
.entry h3 { margin: 0; padding-right: 34px; font: 600 20px/1.25 var(--display); letter-spacing: .01em; }
.entry-summary { margin: 6px 0 0; color: var(--ink-2); font-style: italic; }
.entry-list { display: grid; margin: 14px 0 0; padding: 0; list-style: none; }
.entry-game { display: grid; grid-template-columns: 54px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 14px; row-gap: 3px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.entry-cover { grid-row: span 2; width: 54px; height: 54px; border-radius: 8px; }
.entry-cover[data-shape="wide"] img { object-position: 30% 50%; }
.entry-text { display: grid; min-width: 0; }
.entry-title { overflow: hidden; font-size: 17.5px; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
a.entry-title:hover { color: var(--sylph-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.entry-text span { color: var(--ink-3); font-size: 14.5px; }
.entry-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.entry-value b { color: var(--sylph-ink); font: 600 16px/1.2 var(--body); }
.entry-game.unknown .entry-value b { color: var(--gold-deep); font-style: italic; }
.entry-value span { color: var(--ink-3); font-size: 14.5px; }

.note { margin: 18px 0 0; color: var(--ink-3); font-size: 15.5px; font-style: italic; }
.source-note { max-width: 70ch; margin: 0 auto; padding-top: 72px; color: var(--ink-3); font-size: 15.5px; font-style: italic; text-align: center; }

/* ================= footer: back under the night sky ================= */
/* Past 2400px the cloud box grows at 5vw so the width-scaled lobe tips are never sliced off, and the padding keeps clearing it. */
.footer { position: relative; overflow: hidden; padding: clamp(130px, 13vw, max(180px, 5vw + 40px)) var(--gutter) 44px; background: linear-gradient(180deg, #3b4583 0%, var(--night-2) 34%, var(--night-0) 100%); color: rgba(251, 245, 230, .72); }
.footer-clouds { position: absolute; left: 0; top: -1px; width: 100%; height: clamp(80px, 8vw, max(120px, 5vw)); transform: scaleY(-1); fill: var(--page); pointer-events: none; }
.constellation { position: absolute; left: 0; top: clamp(48px, 5vw, 70px); width: 100%; height: clamp(70px, 7vw, 100px); color: var(--gold-soft); opacity: .3; pointer-events: none; }
.footer-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px 32px; max-width: 1240px; margin: 0 auto; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand .crest { width: 38px; height: 38px; }
.footer-brand p { display: grid; gap: 4px; margin: 0; }
.footer-brand b { color: var(--ivory); font: 600 14px/1 var(--display); letter-spacing: .22em; text-transform: uppercase; }
.footer-brand span { font-size: 16px; font-style: italic; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 28px; font: 500 11.5px/1.4 var(--display); letter-spacing: .12em; }
.footer-links a { color: var(--gold-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ivory); text-decoration: underline; text-underline-offset: 4px; }
.credit { grid-column: 1 / -1; max-width: 92ch; margin: 0; padding-top: 22px; border-top: 1px solid rgba(232, 214, 168, .16); font-size: 15px; line-height: 1.55; }
.credit a { color: var(--gold-soft); text-underline-offset: 3px; }
.footer :focus-visible { outline-color: var(--gold-soft); }

/* ---------- full ranking dialog ---------- */
/* The page behind the open dialog is locked in place; the gap stands in for the hidden scrollbar. */
html.ranking-open { overflow: hidden; scroll-behavior: auto; }
html.ranking-open body { padding-right: var(--lock-gap, 0); }
.ranking-dialog {
  width: min(760px, calc(100vw - 48px)); max-width: none; height: min(860px, calc(100dvh - 64px)); max-height: none;
  margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 18px; background: transparent; color: var(--ink);
  box-shadow: 0 0 0 1px rgba(232, 214, 168, .5), 0 0 0 7px rgba(10, 17, 41, .5), 0 0 0 8px rgba(232, 214, 168, .28), 0 40px 120px rgba(0, 0, 0, .55);
  overscroll-behavior: contain;
}
.ranking-dialog::backdrop { background: radial-gradient(ellipse at 50% 40%, rgba(39, 53, 107, .7), rgba(5, 9, 24, .9) 70%); backdrop-filter: blur(3px); }
.ranking-dialog[open] { animation: rise .26s ease-out; }
.ranking-dialog[open]::backdrop { animation: fade .26s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes fade { from { opacity: 0; } }
.ranking-sheet { display: flex; flex-direction: column; height: 100%; background: linear-gradient(180deg, #fffaf0, var(--card) 140px); }
.ranking-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 26px 30px 22px; color: var(--ivory); background: radial-gradient(ellipse at 18% 0, rgba(232, 214, 168, .2), transparent 60%), linear-gradient(180deg, var(--night-0), var(--night-2)); }
.ranking-head::after { content: ""; position: absolute; left: 30px; right: 30px; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.ranking-head .kicker { color: var(--gold-soft); }
.ranking-head h2 { margin: 0; color: var(--ivory); font: 600 clamp(26px, 4vw, 34px)/1.1 var(--display); letter-spacing: .04em; }
.ranking-count { margin: 8px 0 0; color: rgba(251, 245, 230, .8); font-size: 16.5px; font-style: italic; }
.ranking-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(232, 214, 168, .5); border-radius: 50%; background: rgba(10, 17, 41, .4); color: var(--gold-soft); font: 400 28px/1 var(--body); cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.ranking-close:hover { background: var(--gold-soft); color: var(--night-1); }
.ranking-close:focus-visible, .ranking-foot .button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.ranking-body {
  flex: 1; min-height: 0; padding: 22px 30px 8px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--gold-deep) 70%, transparent) transparent;
}
.ranking-body:focus { outline: none; }
.ranking-body:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold-deep) 60%, transparent); }
.ranking-body::-webkit-scrollbar { width: 10px; }
.ranking-body::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 10px; background: color-mix(in srgb, var(--gold-deep) 65%, transparent) padding-box; }
.ranking-body .ranked li:last-child { border-bottom: 1px solid var(--line); }
.ranking-foot { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 30px 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 15.5px; font-style: italic; }
/* A soft shade above the footer shows that more ranks continue below. */
.ranking-foot::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 34px; background: linear-gradient(transparent, rgba(255, 251, 242, .95)); pointer-events: none; transition: opacity .2s ease; }
.ranking-dialog[data-end="true"] .ranking-foot::before { opacity: 0; }
.ranking-foot .button { min-height: 40px; padding: 0 22px; }

/* ================= responsive ================= */
@media (max-width: 1180px) {
  .hero-inner { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
  .chapter-links { gap: 6px 22px; }
  .tomes { grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); }
  .journal { grid-template-columns: 1fr; }
  .entry { position: static; }
}
@media (max-width: 1000px) {
  :root { --strip: 52px; }
  .topbar { grid-template-columns: 1fr auto; grid-template-areas: "brand end" "links links"; row-gap: 14px; }
  .brand { grid-area: brand; }
  .topbar-end { grid-area: end; }
  .chapter-links { grid-area: links; justify-content: flex-start; padding-top: 12px; border-top: 1px solid rgba(232, 214, 168, .14); }
  .hero-inner { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .hero-copy { grid-row: 1; padding-top: 22px; }
  .hero-ledger { grid-row: 2; padding: 26px 0 0; }
  .stage { --stage-w: min(800px, 100vw); grid-column: 1; grid-row: 3; align-self: auto; width: var(--stage-w); margin: 14px 0 0 calc((100% - var(--stage-w)) / 2); }
  .party { grid-template-columns: 1fr; max-width: 640px; gap: 14px; }
  .records { grid-template-columns: 1fr; }
  .journal-bar { grid-template-columns: 1fr; padding: 14px; }
  .month-nav { justify-content: space-between; }
  .month-summary div:first-child { border-left: 0; padding-left: 4px; }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .chapter-links { gap: 6px 18px; font-size: 11px; letter-spacing: .14em; }
  .chapter-links i { margin-right: 6px; }
  .chapter { padding-top: 72px; }
  .chapter-head { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding-bottom: 18px; margin-bottom: 22px; }
  .chapter-head::before { left: 62px; }
  .numeral { min-width: 44px; font-size: 54px; }
  .chapter-face { display: none; }
  .chapter-line { font-size: 17.5px; }
  .record-board { padding: 18px 16px 8px; }
  .ranked li { grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 10px; }
  .ranked .rank { font-size: 12.5px; letter-spacing: 0; }
  .ranked li.featured { grid-template-columns: 1fr; gap: 12px; }
  .featured-text .ranked-title { font-size: 20px; }
  .featured-value strong { font-size: 26px; }
  .ranked-title { font-size: 17.5px; }
  .seal { width: 42px; height: 42px; }
  .seal b { font-size: 14.5px; }
  .seal small { font-size: 5.8px; }
  .toolbar { position: static; margin: 0 0 12px; }
  .tabs { width: 100%; }
  .tab { flex: 1 1 auto; justify-content: center; padding: 9px 10px; font-size: 11px; }
  .search-sort, .search { width: 100%; }
  .search input { width: 100%; }
  .sort { width: 100%; }
  .sort select { flex: 1; }
  .result-count { text-align: left; }
  .tomes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tome { padding: 5px; border-radius: 10px; }
  .tome > .cover { border-radius: 6px; }
  .tome-body > .seal { top: -25px; right: 4px; }
  .tome-body { padding: 10px 5px 6px; }
  .tome-platform { padding-right: 0; font-size: 9.5px; letter-spacing: .12em; }
  .tome-title { font-size: 17px; margin-bottom: 10px; }
  .tome-facts { grid-template-columns: 1fr; gap: 6px; }
  .tome-facts div + div { padding-left: 0; border-left: 0; }
  .tome-facts dd { font-size: 15.5px; }
  .tome-achievements { font-size: 13.5px; }
  .month-nav > span { min-width: 0; font-size: 18px; }
  .month-summary { grid-template-columns: 1fr 1fr; gap: 10px 0; }
  .month-summary div:nth-child(3) { border-left: 0; padding-left: 4px; }
  .month-summary dd { font-size: 18px; }
  .calendar-page { padding: 12px; }
  .weekdays, .calendar { gap: 4px; }
  .weekdays { font-size: 9px; letter-spacing: .08em; }
  .day { aspect-ratio: 1; padding: 4px 5px; border-radius: 6px; }
  .day.historical::after { inset: 2px; border-radius: 4px; }
  .day small { display: none; }
  .day-number { font-size: 13px; }
  .day.today .day-number::after { width: 5px; height: 5px; margin-left: 3px; }
  .entry { padding: 20px 16px 12px; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  :root { --strip: 44px; }
  .topbar { padding-top: 16px; padding-bottom: 6px; }
  .brand { gap: 10px; font-size: 12px; letter-spacing: .16em; }
  .crest { width: 26px; height: 26px; }
  a.back { min-height: 34px; padding: 0 12px; font-size: 10.5px; }
  .chapter-links { justify-content: space-between; gap: 6px 10px; }
  .topbar-end { gap: 6px; }
  .theme-toggle { min-height: 34px; padding: 5px 10px 5px 8px; font-size: 10.5px; }
  .hero h1 { font-size: clamp(40px, 12vw, 50px); }
  .hero h1::after { width: 132px; height: 10px; margin-top: 14px; }
  .lede { font-size: 19px; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
  .ledger div:nth-child(3) { border-left: 0; }
  .ledger div:nth-child(n + 3) { border-top: 1px solid rgba(232, 214, 168, .14); }
  .ledger div { padding: 12px 8px 11px; }
  .ledger dd { font-size: 26px; }
  .sync { font-size: 15px; }
  .stage { --stage-w: 128vw; margin-top: 4px; }
  .name-tags { left: 11%; right: 11%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .name-tag { gap: 7px; }
  .name-tag b { font-size: 11px; letter-spacing: .12em; }
  .name-tag > span, .name-tag .surname { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .member { padding: 14px 16px 14px 14px; gap: 14px; }
  .portrait { width: 64px; height: 80px; border-radius: 32px 32px 8px 8px; }
  .member h3 { font-size: 17.5px; }
  .member-stat { font-size: 15.5px; }
}
@media (max-width: 360px) {
  .tomes { grid-template-columns: 1fr; }
  .chapter-links { font-size: 10px; letter-spacing: .1em; }
}
@media (max-width: 600px) {
  .ranking-dialog { width: calc(100vw - 20px); height: calc(100dvh - 24px); border-radius: 14px; }
  .ranking-head { padding: 20px 18px 18px; }
  .ranking-head::after { left: 18px; right: 18px; }
  .ranking-body { padding: 16px 16px 6px; }
  .ranking-foot { padding: 12px 18px 14px; }
  .board-foot { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
