/* 深邃幻想 Depth Fantasia — public site styles (WEB2).
   Design tokens first: the SPA's Mantine theme reads the same values
   (PLAN §4.1, docs/DECISIONS.md W2-3). Palette: a pure white page with
   neutral greys (no ivory or beige) and neutral dark grey text; gold and
   wine red from the title screen's logo are small accents only (buttons,
   heading rules, icons). Only the home hero keeps the coloured twilight
   art. Text
   colours keep WCAG AA contrast on --color-bg and --color-surface. */
:root {
  --color-bg: #ffffff;
  --color-bg-2: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-2: #f8f9fb;
  --color-surface-3: #eef0f3;
  --color-border: #e3e6ea;
  --color-border-strong: #c9ced6;
  --color-text: #1f2328;
  --color-muted: #4f5661;
  --color-subtle: #656c77;
  --color-primary: #b8873a; /* the same gold and wine red as the member centre's theme (app/src/theme/tokens.ts) */
  --color-primary-2: #8a5f17;
  --color-primary-3: #ddb872;
  --color-primary-text: #2b1d05;
  --color-accent: #6d4fc4;
  --color-crimson: #8c1c33;
  --color-ok: #2e9d5f;
  --color-warn: #c98a12;
  --color-danger: #c23a4c;
  --color-link: #8c1c33;
  --color-footer: #f5f6f8;
  --twilight: linear-gradient(180deg, #0d0b16 0%, #1d1538 38%, #3d2352 64%, #7a3a4e 84%, #c0703f 100%);
  --parchment: linear-gradient(180deg, #ffffff 0%, #f5f6f8 100%);
  --gold-line: linear-gradient(90deg, transparent, #ddb872 15%, #c9973f 50%, #ddb872 85%, transparent);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(31, 35, 40, .12);
  --shadow-gold: 0 0 0 1px rgba(201, 151, 63, .5), 0 10px 26px rgba(31, 35, 40, .12);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --font-display: "Noto Serif TC", "Songti TC", "PMingLiU", "Noto Sans TC", serif;
  --container: 1200px;
  --header-h: 64px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--color-bg) radial-gradient(1200px 600px at 50% -200px, rgba(139, 108, 240, .14), transparent 70%) no-repeat;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.35; margin: 0 0 var(--space-3); letter-spacing: .02em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-link); text-underline-offset: 3px; }
a:hover { color: var(--color-primary-2); }
img { max-width: 100%; height: auto; }
img.pixel, .pixel img { image-rendering: pixelated; image-rendering: crisp-edges; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--color-surface-2); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
hr { border: 0; height: 1px; background: var(--gold-line); margin: var(--space-5) 0; }
:focus-visible { outline: 3px solid var(--color-primary-2); outline-offset: 2px; border-radius: 4px; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--space-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; }
.skip-link:focus { left: var(--space-3); top: var(--space-3); background: var(--color-primary); color: var(--color-primary-text); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.site-main { flex: 1; padding: var(--space-5) 0 var(--space-6); outline: none; }
.page-home .site-main { padding-top: 0; }
.muted { color: var(--color-muted); }
.small { font-size: .875rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 9px 18px; min-height: 42px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  color: var(--color-text); background: rgba(255, 255, 255, .03);
  font: inherit; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { border-color: var(--color-primary); color: var(--color-primary-2); }
.btn-primary {
  background: linear-gradient(180deg, #f6d78f 0%, #e8b65a 45%, #c48f3a 100%);
  border-color: #f6d78f; color: var(--color-primary-text); font-weight: 700;
  box-shadow: 0 2px 0 #7a5420, 0 6px 18px rgba(232, 182, 90, .25);
}
.btn-primary:hover { color: var(--color-primary-text); filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 30px; min-height: 54px; font-size: 1.125rem; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 11, 22, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--gold-line); opacity: .6; z-index: -1; pointer-events: none; } /* below the open menus (it was drawn across them) */
.header-inner { display: flex; align-items: center; gap: var(--space-3); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text); text-decoration: none; flex-shrink: 0; }
.brand:hover { color: var(--color-text); }
.brand-mark { width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-zh { font-family: var(--font-display); font-weight: 900; font-size: 1.2rem; letter-spacing: .12em; color: var(--color-primary-2); }
.brand-en { font-family: var(--font-display); font-size: .72rem; letter-spacing: .28em; color: var(--color-muted); text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: var(--space-3); flex: 1; justify-content: flex-end; }
.nav-list { list-style: none; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; }
.nav-list a, .sub-toggle { display: block; padding: 8px 11px; color: var(--color-text); text-decoration: none; border-radius: var(--radius-sm); font-size: .95rem; white-space: nowrap; }
.sub-toggle { border: 0; background: transparent; font-family: inherit; line-height: inherit; cursor: pointer; }
.nav-list a:hover, .sub-toggle:hover { color: var(--color-primary-2); background: rgba(232, 182, 90, .08); }
.nav-list a[aria-current="page"], .sub-toggle.is-current { color: var(--color-primary-2); box-shadow: inset 0 -2px 0 var(--color-primary); border-radius: 0; }
.has-sub { position: relative; }
.sub-nav {
  list-style: none; margin: 0; padding: var(--space-2); position: absolute; top: 100%; left: 0; min-width: 180px;
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s;
}
.has-sub:hover > .sub-nav, .has-sub:focus-within > .sub-nav, .has-sub.open > .sub-nav { opacity: 1; visibility: visible; transform: none; }
.sub-nav a { padding: 8px 12px; }
.sub-nav a[aria-current="page"] { box-shadow: none; font-weight: 700; }
/* an open section shows its menu, not the "current section" underline as well (it read as a stray line over the menu) */
.has-sub:hover > .sub-toggle, .has-sub:focus-within > .sub-toggle, .has-sub.open > .sub-toggle { box-shadow: none; border-radius: var(--radius-sm); }
.sub-toggle { display: inline-flex; align-items: center; gap: 6px; }
.sub-toggle::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .55; transition: transform .15s; }
.has-sub:hover > .sub-toggle::after, .has-sub:focus-within > .sub-toggle::after, .has-sub.open > .sub-toggle::after { transform: translateY(1px) rotate(-135deg); }
.nav-list { gap: 6px; }
.nav-actions { display: flex; gap: var(--space-2); }
.header-status { display: none; }
.nav-toggle {
  display: none; margin-left: auto; align-items: center; gap: 8px; min-height: 42px; padding: 6px 12px;
  background: transparent; color: var(--color-text); border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); font: inherit; cursor: pointer;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; content: ""; }
.nav-toggle-bar::before { position: absolute; top: -6px; }
.nav-toggle-bar::after { position: absolute; top: 6px; }

/* ---------- status & banners ---------- */
.maintenance-banner { background: linear-gradient(90deg, #6d1e2e, #a5323f, #6d1e2e); color: #fff; padding: var(--space-2) 0; text-align: center; font-weight: 500; }
.server-status { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--color-muted); }
.server-status strong { color: var(--color-text); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-subtle); flex-shrink: 0; }
.status-up .status-dot { background: var(--color-ok); box-shadow: 0 0 0 4px rgba(87, 199, 133, .18); }
.status-maintenance .status-dot { background: var(--color-warn); box-shadow: 0 0 0 4px rgba(240, 181, 69, .18); }
.status-down .status-dot { background: var(--color-danger); }

/* ---------- page heading ---------- */
.page-head { position: relative; padding: var(--space-5) 0 var(--space-4); margin-bottom: var(--space-4); }
.page-head::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: 0; height: 1px; background: var(--gold-line); }
.page-head h1 { margin-bottom: var(--space-2); }
.page-head .lead { color: var(--color-muted); font-size: 1.075rem; max-width: 70ch; margin: 0; }
.eyebrow { display: inline-block; font-family: var(--font-display); color: var(--color-primary); letter-spacing: .3em; font-size: .78rem; text-transform: uppercase; margin-bottom: var(--space-2); }
.crumbs { font-size: .875rem; color: var(--color-subtle); margin-bottom: var(--space-3); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--color-subtle); }
.crumbs a { color: var(--color-muted); text-decoration: none; }
.crumbs a:hover { color: var(--color-primary-2); }
.crumbs [aria-current] { color: var(--color-text); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.section-title h2 { margin: 0; position: relative; padding-left: 18px; }
.section-title h2::before { content: ""; position: absolute; left: 0; top: .3em; width: 8px; height: .9em; background: var(--color-primary); transform: skewX(-12deg); border-radius: 2px; }
.section-title a { font-size: .95rem; white-space: nowrap; }

/* ---------- hero (home) ---------- */
.hero { position: relative; overflow: hidden; background: var(--twilight); min-height: min(86vh, 760px); display: flex; align-items: center; isolation: isolate; }
.hero-sky { position: absolute; inset: 0; z-index: -4; }
.hero-art { position: absolute; inset: 0; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.hero-sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(900px 420px at 50% 100%, rgba(240, 150, 80, .4), transparent 70%); }
.stars { position: absolute; inset: 0 0 35% 0; background-repeat: repeat; }
.stars.s1 { background-image: radial-gradient(1.6px 1.6px at 20px 30px, #fff, transparent), radial-gradient(1.2px 1.2px at 140px 80px, #fffc, transparent), radial-gradient(1.4px 1.4px at 260px 20px, #fffd, transparent), radial-gradient(1px 1px at 330px 140px, #fff9, transparent); background-size: 360px 180px; animation: twinkle 5s ease-in-out infinite alternate; }
.stars.s2 { background-image: radial-gradient(1.2px 1.2px at 70px 110px, #f6d78f, transparent), radial-gradient(1.6px 1.6px at 210px 50px, #fff, transparent), radial-gradient(1px 1px at 300px 160px, #ffe, transparent); background-size: 420px 220px; animation: twinkle 7s ease-in-out 1.5s infinite alternate-reverse; }
.moon { position: absolute; top: 12%; right: 14%; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff8e0, #f6d78f 55%, #c48f3a); box-shadow: 0 0 60px 20px rgba(246, 215, 143, .25); animation: float 9s ease-in-out infinite; }
.hero-layer { position: absolute; left: -5%; width: 110%; bottom: 0; pointer-events: none; will-change: transform; }
.layer-far { z-index: -3; height: 55%; opacity: .9; }
.layer-mid { z-index: -2; height: 48%; }
.layer-near { z-index: -1; height: 30%; }
.hero-particles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero-inner { position: relative; z-index: 1; padding: var(--space-6) var(--space-3) calc(var(--space-6) + 40px); text-align: center; width: 100%; }
.hero-emblem { display: block; width: 88px; height: 88px; margin: 0 auto var(--space-3); filter: drop-shadow(0 6px 18px rgba(232, 182, 90, .45)); animation: float 6s ease-in-out infinite; }
.scroll-hint { position: absolute; left: 50%; bottom: 64px; width: 26px; height: 42px; margin-left: -13px; color: var(--color-primary-2); z-index: 2; opacity: .85; }
.scroll-hint svg { width: 100%; height: 100%; animation: bob 1.8s ease-in-out infinite; }
.hero-kicker { font-family: var(--font-display); color: var(--color-primary-2); letter-spacing: .5em; font-size: .9rem; margin-bottom: var(--space-3); }
.hero-title { margin: 0 0 var(--space-3); font-weight: 900; line-height: 1.15; }
.hero-title .zh { display: block; font-size: clamp(2.6rem, 1.4rem + 6vw, 5.2rem); letter-spacing: .18em; background: linear-gradient(180deg, #fff6dc 10%, #f6d78f 45%, #c48f3a 90%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .6)); }
.hero-title .en { display: block; font-size: clamp(1rem, .8rem + 1.2vw, 1.6rem); letter-spacing: .5em; color: #f3d6e0; margin-top: var(--space-2); text-shadow: 0 2px 10px rgba(208, 80, 109, .6); }
.hero-tagline { font-size: clamp(1.05rem, .95rem + .5vw, 1.3rem); color: #efe5f6; max-width: 40em; margin: 0 auto var(--space-4); text-shadow: 0 2px 8px rgba(0, 0, 0, .7); }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-bottom: var(--space-4); }
.hero-meta { display: inline-flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; align-items: center; padding: 8px 18px; border-radius: 999px; background: rgba(13, 11, 22, .6); border: 1px solid var(--color-border-strong); }
.hero-meta .server-status { color: var(--color-text); }

/* carousel (event banners) */
.banner-strip { margin-top: calc(-1 * var(--space-5)); position: relative; z-index: 2; }
.carousel { position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--color-border-strong); background: var(--color-surface); aspect-ratio: 3 / 1; }
.carousel-track { display: flex; height: 100%; transition: transform .5s ease; }
.carousel-item { flex: 0 0 100%; height: 100%; position: relative; display: block; color: var(--color-text); text-decoration: none; }
.carousel-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--space-4) var(--space-4) var(--space-3); background: linear-gradient(0deg, rgba(13, 11, 22, .9), transparent); font-family: var(--font-display); font-size: 1.25rem; }
.carousel-dots { position: absolute; right: var(--space-3); bottom: var(--space-3); display: flex; gap: 8px; }
.carousel-dots button { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--color-primary-2); background: transparent; padding: 0; cursor: pointer; }
.carousel-dots button[aria-current="true"] { background: var(--color-primary); }
.carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--color-border-strong); background: rgba(13, 11, 22, .7); color: var(--color-text); cursor: pointer; font-size: 1.2rem; }
.carousel-prev { left: var(--space-3); }
.carousel-next { right: var(--space-3); }

/* ---------- home blocks ---------- */
.home-section { padding-top: var(--space-6); } /* only the top: the .container keeps its side gutter (REVB) */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-4); }
.panel { background: var(--gold-line) top 0 left 20px / calc(100% - 40px) 1px no-repeat, linear-gradient(180deg, var(--color-surface-2), var(--color-surface)); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); position: relative; }
.panel h2 { font-size: 1.3rem; }
.status-panel .status-big { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.status-panel .online { font-family: var(--font-display); font-size: 2.6rem; color: var(--color-primary-2); line-height: 1; }
.status-panel .online-label { color: var(--color-muted); font-size: .9rem; }
.rank-mini { list-style: none; margin: 0 0 var(--space-3); padding: 0; counter-reset: r; }
.rank-mini li { counter-increment: r; display: flex; align-items: center; gap: var(--space-2); padding: 8px 0; border-bottom: 1px dashed var(--color-border); }
.rank-mini li::before { content: counter(r); width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .85rem; background: var(--color-surface-3); color: var(--color-muted); flex-shrink: 0; }
.rank-mini li:nth-child(1)::before { background: linear-gradient(180deg, #f6d78f, #c48f3a); color: var(--color-primary-text); }
.rank-mini li:nth-child(2)::before { background: #c9c6d6; color: #222; }
.rank-mini li:nth-child(3)::before { background: #c9875a; color: #221; }
.rank-mini .pt { margin-left: auto; color: var(--color-primary-2); font-variant-numeric: tabular-nums; }
.cta-band { margin-top: var(--space-6); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-4); text-align: center; background: var(--twilight); border: 1px solid var(--color-border-strong); position: relative; overflow: hidden; }
.cta-band h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem); }
.cta-band p { color: #efe5f6; }

/* news */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { border-bottom: 1px solid var(--color-border); }
.news-list a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: 12px 4px; color: var(--color-text); text-decoration: none; }
.news-list a:hover .news-title { color: var(--color-primary-2); }
.news-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-list time, .news-card time, .article-meta time { color: var(--color-subtle); font-size: .875rem; font-variant-numeric: tabular-nums; }
.news-cat { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; letter-spacing: .05em; background: var(--color-surface-3); color: var(--color-text); white-space: nowrap; }
.cat-notice { background: #3b4f8c; }
.cat-update { background: #2f6d5a; }
.cat-event { background: #8a3b5c; }
.cat-maintenance { background: #7a5a22; }
.pinned { font-size: .78rem; color: var(--color-primary); border: 1px solid var(--color-primary-3); border-radius: 999px; padding: 1px 8px; }
.news-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.news-card { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-4); padding: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); transition: border-color .15s, transform .15s; }
.news-card:hover { border-color: var(--color-primary-3); }
.news-card .thumb { border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1200 / 630; background: var(--color-surface-2); }
.news-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card h2 { font-size: 1.2rem; margin: 8px 0 4px; }
.news-card h2 a { color: var(--color-text); text-decoration: none; }
.news-card h2 a:hover { color: var(--color-primary-2); }
.news-card p { color: var(--color-muted); margin: 6px 0 0; }

/* tabs & pager */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.tabs a { display: inline-block; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--color-border-strong); color: var(--color-muted); text-decoration: none; font-size: .95rem; }
.tabs a:hover { color: var(--color-primary-2); border-color: var(--color-primary-3); }
.tabs a[aria-current="page"] { background: var(--color-primary); color: var(--color-primary-text); border-color: var(--color-primary); font-weight: 700; }
.pager { display: flex; gap: var(--space-3); justify-content: center; align-items: center; margin: var(--space-5) 0 0; }
.pager a { padding: 6px 14px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); text-decoration: none; }

/* ---------- cards ---------- */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { position: relative; background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface)); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { border-color: var(--color-primary-3); transform: translateY(-2px); box-shadow: var(--shadow-gold); }
.card-media { aspect-ratio: 16 / 9; background: var(--color-bg-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: var(--space-3) var(--space-3) var(--space-4); flex: 1; }
.card-body h2, .card-body h3 { font-size: 1.15rem; margin: 0 0 var(--space-2); }
.card-body p { color: var(--color-muted); margin: 0; font-size: .95rem; }
.card a.stretched { color: var(--color-text); text-decoration: none; }
.card a.stretched::after { content: ""; position: absolute; inset: 0; }
.card a.stretched:hover { color: var(--color-primary-2); }
.card-tag { position: absolute; top: 10px; left: 10px; z-index: 1; font-size: .75rem; font-weight: 700; background: rgba(13, 11, 22, .8); color: var(--color-primary-2); border: 1px solid var(--color-primary-3); border-radius: 999px; padding: 1px 10px; }
.features { display: grid; gap: var(--space-4); grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; }
.feature { position: relative; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.feature .card-media { aspect-ratio: 4 / 3; }
.feature h3 { font-size: 1.2rem; margin-bottom: 6px; }

/* ---------- placeholders (WEBA fills the images; content/data/images.yaml) ---------- */
.ph {
  position: relative; display: grid; place-items: center; text-align: center; width: 100%; height: 100%; min-height: 120px;
  color: var(--color-muted); font-size: .85rem; padding: var(--space-3);
  background:
    linear-gradient(135deg, rgba(139, 108, 240, .16), rgba(208, 80, 109, .12) 55%, rgba(232, 182, 90, .14)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 12px, transparent 12px 24px), var(--color-bg-2);
}
.ph::before { content: ""; position: absolute; inset: 10px; border: 1px dashed rgba(232, 182, 90, .35); border-radius: var(--radius-sm); pointer-events: none; }
.ph-label { display: block; font-family: var(--font-display); color: var(--color-text); font-size: 1rem; }
.ph-file { display: block; font-family: ui-monospace, Consolas, monospace; font-size: .75rem; color: var(--color-subtle); margin-top: 4px; word-break: break-all; }
figure.ph-figure { margin: 0; }

/* ---------- article / doc ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-5); align-items: start; }
.doc-layout.no-nav { grid-template-columns: minmax(0, 1fr); }
.side-nav { position: sticky; top: calc(var(--header-h) + 16px); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-3); max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; }
.side-nav h2 { font-size: 1rem; color: var(--color-primary); margin-bottom: var(--space-2); }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav a { display: block; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--color-muted); text-decoration: none; font-size: .93rem; }
.side-nav a:hover { color: var(--color-text); background: var(--color-surface-2); }
.side-nav a[aria-current="page"] { color: var(--color-primary-2); background: var(--color-surface-3); font-weight: 500; }
.side-nav .group-label { font-size: .75rem; letter-spacing: .15em; color: var(--color-subtle); padding: 10px 10px 4px; }
.article { max-width: 860px; }
.doc-layout .article { max-width: none; }
.article-head h1 { margin-bottom: var(--space-2); }
.article-head .lead { color: var(--color-muted); font-size: 1.1rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-3); }
.draft-note { display: flex; gap: var(--space-2); padding: 12px 16px; border-radius: var(--radius); background: rgba(240, 181, 69, .1); border: 1px solid rgba(240, 181, 69, .45); color: #f8dfa8; margin-bottom: var(--space-4); font-size: .95rem; }
.article-cover { border-radius: var(--radius-lg); overflow: hidden; margin: 0 0 var(--space-4); border: 1px solid var(--color-border); aspect-ratio: 16 / 9; background: var(--color-bg-2); }
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-cover.news { aspect-ratio: 1200 / 630; }
.gallery { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: var(--space-4) 0; }
.gallery figure { margin: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.gallery .shot { aspect-ratio: 4 / 3; overflow: hidden; background: var(--color-bg-2); }
.gallery .shot img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; }
.gallery figcaption { padding: 10px 12px; font-size: .9rem; color: var(--color-muted); }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-5); }
.prev-next a { display: block; padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius); text-decoration: none; color: var(--color-text); background: var(--color-surface); }
.prev-next a:hover { border-color: var(--color-primary-3); }
.prev-next .dir { display: block; font-size: .8rem; color: var(--color-subtle); }
.prev-next .next { text-align: right; grid-column: 2; }

.prose { max-width: 75ch; }
.doc-layout .prose { max-width: 78ch; }
.prose h2 { margin-top: var(--space-5); padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.prose h3 { margin-top: var(--space-4); color: var(--color-primary-2); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 var(--space-3); }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--color-primary); }
.prose strong { color: #fff; }
.prose blockquote { margin: var(--space-4) 0; padding: var(--space-3) var(--space-4); border-left: 4px solid var(--color-primary); background: var(--color-surface); border-radius: 0 var(--radius) var(--radius) 0; color: var(--color-muted); }
.prose blockquote p:last-child { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--space-3) 0 var(--space-4); font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--color-border); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--color-surface-2); color: var(--color-primary-2); font-weight: 700; white-space: nowrap; }
.prose tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }
.prose img { border-radius: var(--radius); }

/* gameplay index */
.group-block { margin-bottom: var(--space-6); }
.group-block > h2 { display: flex; align-items: center; gap: var(--space-3); }
.group-block > h2::after { content: ""; flex: 1; height: 1px; background: var(--gold-line); }
.toc-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0 0 var(--space-5); }
.toc-chips a { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-muted); text-decoration: none; font-size: .9rem; }
.toc-chips a:hover { color: var(--color-primary-2); border-color: var(--color-primary-3); }

/* ---------- codex ---------- */
.codex-hub { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); list-style: none; padding: 0; margin: 0; }
.codex-hub .card-body { text-align: center; padding: var(--space-4) var(--space-3); }
.codex-hub .count { font-family: var(--font-display); font-size: 2rem; color: var(--color-primary-2); line-height: 1.2; display: block; }
.codex-hub .hub-icon { width: 64px; height: 64px; margin: 0 auto var(--space-2); display: grid; place-items: center; border-radius: 50%; background: var(--color-surface-3); border: 1px solid var(--color-border-strong); }
.codex-hub .hub-icon img { max-width: 48px; max-height: 48px; }
.codex-search { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.codex-search input, .codex-search select, .faq-search {
  flex: 1; min-width: 200px; min-height: 44px; padding: 8px 14px; font: inherit; color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
}
.codex-search select { flex: 0 1 200px; }
.codex-search input:focus, .faq-search:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px rgba(232, 182, 90, .25); }
.result-count { color: var(--color-muted); font-size: .9rem; margin-bottom: var(--space-3); }
.codex-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.codex-grid a, .codex-grid .tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--space-3) var(--space-2); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; text-align: center; font-size: .88rem; height: 100%; }
.codex-grid a:hover { border-color: var(--color-primary-3); color: var(--color-primary-2); }
.codex-grid .icon { width: 64px; height: 64px; display: grid; place-items: center; }
.codex-grid .icon img { max-width: 64px; max-height: 64px; image-rendering: pixelated; }
.codex-grid .id { color: var(--color-subtle); font-size: .75rem; font-variant-numeric: tabular-nums; }
.codex-detail-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.item-icon-big { background: var(--color-surface-2); border: 1px solid var(--color-border-strong); border-radius: var(--radius); padding: var(--space-4); display: grid; place-items: center; min-height: 200px; }
.item-icon-big img { width: 128px; image-rendering: pixelated; }
.spec { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0 0 var(--space-4); }
.spec dt { color: var(--color-subtle); }
.spec dd { margin: 0; }
.skill-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.skill-list li { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px 16px; }
.skill-list h2 { font-size: 1.05rem; margin: 0 0 4px; font-family: var(--font-body); font-weight: 700; color: var(--color-primary-2); }
.skill-list p { margin: 0; color: var(--color-muted); font-size: .92rem; }
.skill-list .id { float: right; color: var(--color-subtle); font-size: .75rem; }
.job-groups { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.job-group { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-4); }
.job-group h2 { font-size: 1.15rem; color: var(--color-primary-2); }
.job-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.job-group li { padding: 3px 12px; border-radius: 999px; background: var(--color-surface-3); font-size: .9rem; }
.map-groups section { margin-bottom: var(--space-5); }
.map-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.map-list a { display: flex; justify-content: space-between; gap: var(--space-2); padding: 10px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; }
.map-list a:hover { border-color: var(--color-primary-3); color: var(--color-primary-2); }
.map-list .code { color: var(--color-subtle); font-size: .8rem; font-family: ui-monospace, Consolas, monospace; }
.map-figure { margin: 0 0 var(--space-4); background: var(--color-bg-2); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-2); overflow: auto; }
.map-figure img { display: block; margin: 0 auto; }
.map-figure figcaption { color: var(--color-muted); font-size: .85rem; padding: 6px; }
.pet-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pet-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-3); }
.pet-card h2 { font-size: 1.15rem; margin-bottom: var(--space-2); }
.pet-main { display: grid; place-items: center; min-height: 120px; background: radial-gradient(circle at 50% 70%, var(--color-surface-3), transparent 70%); border-radius: var(--radius-sm); margin-bottom: var(--space-2); }
.pet-main img { image-rendering: pixelated; }
.pet-colors { display: flex; flex-wrap: wrap; gap: 4px; }
.pet-colors img { width: 36px; height: auto; image-rendering: pixelated; background: var(--color-bg-2); border-radius: 4px; }

/* ranking */
.rank-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.rank-table th, .rank-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--color-border); }
.rank-table th { background: var(--color-surface-2); color: var(--color-primary-2); font-weight: 700; font-size: .9rem; }
.rank-table td.num, .rank-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank-table tbody tr:hover { background: var(--color-surface-2); }
.rank-pos { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--color-surface-3); font-weight: 700; font-size: .9rem; }
.rank-1 .rank-pos { background: linear-gradient(180deg, #f6d78f, #c48f3a); color: var(--color-primary-text); }
.rank-2 .rank-pos { background: #c9c6d6; color: #222; }
.rank-3 .rank-pos { background: #c9875a; color: #221; }

/* download */
.download-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-5); align-items: center; padding: var(--space-5); border-radius: var(--radius-lg); background: var(--twilight); border: 1px solid var(--color-border-strong); margin-bottom: var(--space-5); }
.download-hero h2 { font-size: 1.6rem; }
.download-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-3) 0; }
.download-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: .92rem; background: rgba(13, 11, 22, .55); border: 1px solid var(--color-border-strong); border-radius: var(--radius); padding: var(--space-3); }
.download-meta dt { color: var(--color-muted); }
.download-meta dd { margin: 0; }
.os-note { padding: 12px 16px; background: rgba(139, 108, 240, .14); border: 1px solid rgba(139, 108, 240, .45); border-radius: var(--radius); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 var(--space-4); display: grid; gap: var(--space-3); }
.steps li { counter-increment: s; position: relative; padding: var(--space-3) var(--space-3) var(--space-3) 64px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary); color: var(--color-primary-text); font-weight: 700; }

/* faq */
.faq-category { margin-bottom: var(--space-5); }
.faq-category h2 { color: var(--color-primary-2); }
.faq-list details { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin-bottom: var(--space-2); }
.faq-list summary { cursor: pointer; padding: 14px 18px; font-weight: 500; list-style: none; position: relative; padding-right: 44px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--color-primary); font-size: 1.3rem; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details[open] summary { border-bottom: 1px solid var(--color-border); color: var(--color-primary-2); }
.faq-answer { padding: 14px 18px; color: var(--color-muted); }
.faq-answer p:last-child { margin: 0; }
.faq-empty { display: none; }

/* shop */
.product .price { font-family: var(--font-display); font-size: 1.4rem; color: var(--color-primary-2); margin: var(--space-2) 0; }
.product .card-media { aspect-ratio: 1; }
.product .desc { white-space: pre-line; } /* the description's line breaks (bullet lists) show (CRB-13) */

/* error & maintenance */
.error-page { text-align: center; padding: var(--space-5) 0; max-width: 680px; }
.error-art { width: min(100%, 520px); margin: 0 auto var(--space-4); aspect-ratio: 3 / 2; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); }
.error-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.error-code { font-family: var(--font-display); font-size: clamp(4rem, 3rem + 5vw, 7rem); margin: 0; line-height: 1; background: linear-gradient(180deg, #f6d78f, #c48f3a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }

/* ---------- footer ---------- */
.site-footer { margin-top: auto; background: linear-gradient(180deg, var(--color-bg), #07060c); border-top: 1px solid var(--color-border); position: relative; color: var(--color-muted); font-size: .92rem; }
.site-footer::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px; background: var(--gold-line); }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: var(--space-4); padding-top: var(--space-5); padding-bottom: var(--space-4); }
.footer-tagline { margin: var(--space-2) 0 var(--space-3); }
.footer-title { font-family: var(--font-body); font-size: .95rem; color: var(--color-primary-2); margin-bottom: var(--space-2); letter-spacing: .1em; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { color: var(--color-muted); text-decoration: none; }
.footer-col a:hover { color: var(--color-primary-2); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--color-border); padding-top: var(--space-3); padding-bottom: var(--space-4); font-size: .85rem; }
.footer-bottom p { margin: 0 0 6px; }
.footer-rating { display: flex; align-items: center; gap: 10px; }
.footer-copy { color: var(--color-text); }
.social-links { list-style: none; padding: 0; margin: 0 0 var(--space-2); display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---------- ornaments (SVG sprite: static/img/sprite.svg) ---------- */
.ico { width: 1.6em; height: 1.6em; fill: none; color: currentColor; vertical-align: middle; }
.hub-icon .ico { width: 40px; height: 40px; color: var(--color-primary-2); transition: transform .3s; }
.card:hover .hub-icon .ico { transform: rotate(-8deg) scale(1.1); }
.feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -42px 0 8px; position: relative; border-radius: 50%; background: var(--color-surface-3); border: 1px solid var(--color-primary-3); color: var(--color-primary-2); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.feature-icon .ico { width: 26px; height: 26px; }
.divider { display: block; width: min(480px, 90%); height: 24px; margin: calc(-1 * var(--space-2)) auto var(--space-4); color: var(--color-primary); }
.divider .draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .divider .draw { stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s ease; }
.js .divider.is-visible .draw { stroke-dashoffset: 0; }
.divider .pop { transform-origin: 240px 12px; }
.js .divider .pop { transform: scale(0); transition: transform .5s .9s cubic-bezier(.3, 1.6, .5, 1); }
.js .divider.is-visible .pop { transform: scale(1); }
.framed { position: relative; }
.framed::before { content: ""; position: absolute; inset: 6px; pointer-events: none; border-radius: inherit;
  background:
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) top left / 18px 1px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) top left / 1px 18px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) top right / 18px 1px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) top right / 1px 18px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) bottom left / 18px 1px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) bottom left / 1px 18px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) bottom right / 18px 1px,
    linear-gradient(var(--color-primary-3), var(--color-primary-3)) bottom right / 1px 18px;
  background-repeat: no-repeat; opacity: .8; }
.cta-band .corner { position: absolute; width: 64px; height: 64px; color: var(--color-primary); opacity: .8; }
.cta-band .corner.tl { top: 10px; left: 10px; }
.cta-band .corner.br { bottom: 10px; right: 10px; transform: rotate(180deg); }
.btn-frame { border-color: var(--color-primary-3); background: rgba(13, 11, 22, .45); position: relative; }
.btn-frame::before, .btn-frame::after { content: ""; position: absolute; width: 8px; height: 8px; border: 1px solid var(--color-primary-2); transform: rotate(45deg); top: 50%; margin-top: -4px; background: var(--color-bg); }
.btn-frame::before { left: -5px; }
.btn-frame::after { right: -5px; }
.btn-shine { position: relative; overflow: hidden; }
.btn-shine::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-20deg); animation: shine 4.5s ease-in-out infinite; }
.card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(246, 215, 143, .14) 45%, transparent 60%); transform: translateX(-120%); transition: transform .7s ease; }
.card:hover::after { transform: translateX(120%); }
.news-carousel { aspect-ratio: 1200 / 500; margin-bottom: var(--space-3); }
.news-carousel .carousel-caption { font-size: 1.05rem; }
.anim-figure img { image-rendering: pixelated; }
.pet-main img { animation: bob 2.4s ease-in-out infinite; }
.pet-card:nth-child(3n+2) .pet-main img { animation-delay: -.8s; }
.pet-card:nth-child(3n) .pet-main img { animation-delay: -1.6s; }
.doc-anim { float: right; width: 160px; margin: 0 0 var(--space-3) var(--space-4); aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); background: radial-gradient(circle at 50% 70%, var(--color-surface-3), var(--color-bg-2)); }
.doc-anim .ph { min-height: 0; font-size: .75rem; }
.doc-anim img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.page-head .head-icon { color: var(--color-primary-2); margin-right: 6px; }

/* ---------- motion ---------- */
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 130%; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeUp .9s cubic-bezier(.2, .7, .2, 1) both; }
.fade-in.d1 { animation-delay: .1s; }
.fade-in.d2 { animation-delay: .3s; }
.fade-in.d3 { animation-delay: .55s; }
.fade-in.d4 { animation-delay: .75s; }
.fade-in.d5 { animation-delay: .95s; }
.js .reveal-init { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 80ms); }
.js .reveal-init.is-visible { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
.brand-en { display: none; }
@media (min-width: 1400px) { .brand-en { display: block; } }
/* 1024–1199px: tighter menu and buttons instead of hiding the member centre (REVB) */
@media (max-width: 1199px) {
  .header-inner { gap: var(--space-2); }
  .site-nav { gap: var(--space-2); }
  .nav-list { gap: 0; }
  .nav-list a, .sub-toggle { padding: 8px 7px; font-size: .88rem; }
  .sub-toggle { gap: 4px; }
  .nav-actions { gap: 6px; }
}
@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }
  .header-status { display: none; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: var(--space-3);
    background: var(--color-bg-2); border-bottom: 1px solid var(--color-border-strong); padding: var(--space-3); max-height: calc(100vh - var(--header-h)); max-height: calc(100dvh - var(--header-h)); overflow: auto; overscroll-behavior: contain;
  }
  .site-nav.open { display: flex; }
  .nav-list { flex-direction: column; align-items: stretch; }
  .nav-list a, .sub-toggle { padding: 12px; font-size: 1rem; }
  .sub-toggle { width: 100%; justify-content: space-between; text-align: left; }
  .nav-list a[aria-current="page"], .sub-toggle.is-current { box-shadow: inset 3px 0 0 var(--color-primary); }
  .sub-nav { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; background: transparent; padding: 0 0 0 var(--space-3); }
  .js .sub-nav { display: none; }
  .js .has-sub.open > .sub-nav { display: block; }
  .nav-actions { flex-direction: column; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; max-height: none; order: 2; }
  .download-hero { grid-template-columns: 1fr; padding: var(--space-4); }
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  body { font-size: 15.5px; }
  .site-main { padding-top: var(--space-4); }
  .hero { min-height: 560px; }
  .hero-title .zh { letter-spacing: .08em; }
  .hero-title .en { letter-spacing: .25em; }
  .features { grid-template-columns: 1fr; }
  .carousel { aspect-ratio: 16 / 9; }
  .carousel-nav { display: none; }
  .news-card { grid-template-columns: 1fr; gap: var(--space-2); }
  .news-list a { grid-template-columns: auto minmax(0, 1fr); }
  .news-list time { grid-column: 2; }
  .news-title { white-space: normal; }
  .codex-detail-grid { grid-template-columns: 1fr; }
  .skill-list { grid-template-columns: 1fr; }
  .rank-table th, .rank-table td { padding: 10px 8px; }
  .prev-next { grid-template-columns: 1fr; }
  .prev-next .next { grid-column: auto; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .site-header .brand-text { display: none; }
  .hero-kicker { letter-spacing: .22em; font-size: .75rem; }
  .scroll-hint { display: none; }
  .moon { width: 56px; height: 56px; top: 8%; right: 8%; }
  .doc-anim { float: none; margin: 0 auto var(--space-3); }
}
@media (max-width: 380px) {
  .footer-inner { grid-template-columns: 1fr; }
  .hero-cta .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .side-nav, .maintenance-banner { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- hero art layers (WEBA C01, parallax) ---------- */
.hero-layers { position: absolute; inset: 0; z-index: -3; overflow: hidden; }
.art-layer { position: absolute; left: -3%; top: -3%; width: 106%; height: 106%; max-width: none; object-fit: cover; will-change: transform; } /* max-width: none — img's 100% cap left a stripe on the right (REVB) */
.hero:has(.hero-layers) .moon, .hero:has(.hero-layers) .stars, .hero:has(.hero-layers) .hero-art { display: none; }
.hero-veil { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 46%, rgba(18, 14, 36, .58), rgba(18, 14, 36, .2) 70%, transparent 100%),
    linear-gradient(180deg, rgba(18, 14, 36, .3) 0%, transparent 30%, transparent 72%, rgba(255, 255, 255, .55) 90%, #ffffff 100%); }
.hero-tagline, .hero-kicker { text-shadow: 0 2px 12px rgba(10, 8, 24, .65); }
@media (max-width: 767px) {
  .hero-layers { display: none; }
  .hero:has(.hero-layers) .hero-art { display: block; }
}
.gallery .shot img { object-fit: contain; background: var(--color-surface-3); }
.card-media, .article-cover, .gallery .shot, .carousel-item, .doc-anim, .error-art { position: relative; }
.credit { position: absolute; left: 6px; bottom: 4px; z-index: 1; font-size: .68rem; line-height: 1.4; padding: 0 6px; border-radius: 3px; background: rgba(20, 22, 28, .55); color: #fff; letter-spacing: .03em; pointer-events: none; }
.codex-credit, .art-credit { font-size: .8rem; color: var(--color-subtle); }
.card-media > img.card-anim { position: absolute; right: 8px; bottom: 6px; width: auto; height: auto; max-height: 62%; max-width: 45%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); transition: transform .3s; }
.card:hover .card-anim { transform: translateY(-4px) scale(1.06); }

/* ---------- language switcher (W2-18) ---------- */
.lang-switch { position: relative; }
.lang-switch summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 6px 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: .9rem; color: var(--color-text); }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary .ico { width: 18px; height: 18px; color: var(--color-primary-2); }
.lang-switch ul { list-style: none; margin: 0; padding: 6px; position: absolute; right: 0; top: calc(100% + 4px); min-width: 140px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 60; }
.lang-switch a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; }
.lang-switch a:hover { background: var(--color-surface-3); }
.lang-switch a[aria-current="true"] { color: var(--color-crimson); font-weight: 700; }
.fallback-note { font-size: .9rem; }
.lang-ko { --font-body: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans TC", system-ui, sans-serif; --font-display: "Noto Serif KR", "Noto Sans KR", "Malgun Gothic", serif; word-break: keep-all; }
/* Japanese (J-1): Noto Sans JP / Noto Serif JP, then the systems' Japanese fonts */
.lang-ja { --font-body: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans TC", system-ui, sans-serif; --font-display: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "Noto Sans JP", serif; line-break: strict; }
/* the Japanese header labels are wider (katakana): a tighter brand and menu keep the header on one line from 1024px up */
.lang-ja .brand-zh { letter-spacing: .02em; font-size: 1.08rem; }
@media (min-width: 1024px) and (max-width: 1439px) {
  .lang-ja .nav-list a, .lang-ja .sub-toggle { padding: 8px 7px; font-size: .88rem; }
  .lang-ja .nav-actions .btn, .lang-ja .nav-actions .lang-switch summary { padding: 0 10px; font-size: .85rem; }
}
.lang-en { --font-display: "Noto Serif TC", Georgia, serif; }
.lang-en .hero-title .zh, .lang-ko .hero-title .zh, .lang-ja .hero-title .zh { letter-spacing: .04em; font-size: clamp(2.2rem, 1.2rem + 5vw, 4.6rem); }
.lang-en .hero-title .en, .lang-ko .hero-title .en, .lang-ja .hero-title .en { letter-spacing: .2em; }
@media (max-width: 1023px) { .lang-switch ul { position: static; box-shadow: none; } }

/* ---------- white theme (W2-3): the page, cards, header and footer are
   light; the home hero keeps its coloured twilight art, so the text over
   it stays light. ---------- */
body { background: var(--color-bg); }
::selection { background: #dfe3ea; color: var(--color-text); }
.site-header { background: rgba(255, 255, 255, .94); box-shadow: 0 2px 12px rgba(31, 35, 40, .06); }
.brand-zh { color: var(--color-crimson); }
.brand-en { color: var(--color-primary-2); }
.nav-list a:hover { background: rgba(201, 151, 63, .1); }
.news-cat { color: #fff; }
.cat-notice { background: #3c5a9a; }
.cat-update { background: #2f7a62; }
.cat-event { background: var(--color-crimson); }
.cat-maintenance { background: #946a17; }
.card-tag { background: rgba(255, 255, 255, .92); color: var(--color-primary-2); }
.draft-note { background: var(--color-surface-2); border-color: var(--color-border); border-left: 4px solid var(--color-primary); color: var(--color-text); }
.prose strong { color: var(--color-text); }
.prose blockquote { background: var(--color-surface-3); }
.panel, .card, .news-card, .side-nav, .job-group, .pet-card, .skill-list li, .faq-list details, .map-list a, .codex-grid a, .codex-grid .tile, .rank-table, .steps li, .prev-next a { box-shadow: 0 1px 3px rgba(31, 35, 40, .06); }
.feature-icon { background: var(--color-surface); box-shadow: 0 2px 8px rgba(31, 35, 40, .10); margin: 4px 0 10px; }
/* header actions: one height, one font size, no wrapping (English "My Account" wrapped to two lines) */
.nav-actions { align-items: center; }
.nav-actions .btn, .nav-actions .lang-switch summary { min-height: 40px; height: 40px; padding: 0 16px; font-size: .9rem; white-space: nowrap; }
.nav-actions .lang-switch summary { padding: 0 12px; }
.nav-actions .btn-primary { box-shadow: 0 1px 0 #a87a2e, 0 3px 10px rgba(232, 182, 90, .22); }
.ph { color: var(--color-muted);
  background: repeating-linear-gradient(45deg, rgba(31, 35, 40, .03) 0 12px, transparent 12px 24px), var(--color-surface-3); }
.ph::before { border-color: var(--color-border-strong); }
.carousel { background: var(--color-surface-3); }
.carousel-caption { color: #fff; background: linear-gradient(0deg, rgba(20, 14, 30, .82), transparent); }
.carousel-nav { color: #fff; background: rgba(20, 14, 30, .55); border-color: rgba(255, 255, 255, .4); }
.carousel-dots button { border-color: #fff; }
.cta-band { background: var(--parchment); border-color: var(--color-primary-3); color: var(--color-text); }
.cta-band h2 { color: var(--color-crimson); }
.cta-band p { color: var(--color-muted); }
.download-hero { background: var(--parchment); border-color: var(--color-primary-3); }
.download-meta { background: var(--color-surface); border-color: var(--color-border); }
.os-note { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-text); }
.cta-band, .download-hero { border-color: var(--color-border); }
.panel { background: var(--gold-line) top 0 left 20px / calc(100% - 40px) 1px no-repeat, var(--color-surface); }
.card { background: var(--color-surface); }
.prose blockquote { background: var(--color-surface-2); }
.prose th { background: var(--color-surface-3); }
.btn-frame { background: rgba(255, 255, 255, .7); color: var(--color-text); }
.btn-frame::before, .btn-frame::after { border-color: var(--color-primary); background: var(--color-bg); }
.site-footer { background: var(--color-footer); color: var(--color-muted); }
.footer-bottom { border-top-color: var(--color-border-strong); }
.rank-mini li::before { color: var(--color-text); }
.rank-pos { background: var(--color-surface-3); }
.status-up .status-dot { box-shadow: 0 0 0 4px rgba(46, 157, 95, .18); }
.maintenance-banner a { color: #fff; }
/* the hero stays dark: light text and translucent dark chips over the art */
.hero { color: #fff; }
.hero-kicker, .scroll-hint { color: #f6d78f; }
.hero-meta { background: rgba(13, 11, 22, .6); border-color: rgba(246, 215, 143, .45); }
.hero-meta .server-status, .hero-meta .server-status strong { color: #fff; }
.hero .btn-frame { background: rgba(13, 11, 22, .45); color: #fff; }
.hero .btn-frame::before, .hero .btn-frame::after { background: #1d1538; border-color: #f6d78f; }

/* ---------- REVB fixes (after the white-theme block, which sets the header button sizes) ---------- */
/* 1024–1199px: the member centre stays; smaller buttons and a globe-only language switch make room */
@media (min-width: 1024px) and (max-width: 1199px) {
  .nav-actions .btn, .nav-actions .lang-switch summary, .lang-ja .nav-actions .btn, .lang-ja .nav-actions .lang-switch summary { padding: 0 10px; font-size: .85rem; }
  .lang-switch summary > span { display: none; } /* the summary keeps its aria-label */
}
/* carousel dots on a small pill; on phones they sit at the top so a two-line caption never runs under them */
.carousel-dots { padding: 5px 8px; border-radius: 999px; background: rgba(20, 14, 30, .45); line-height: 0; }
@media (max-width: 767px) {
  .carousel-dots { top: var(--space-2); right: var(--space-2); bottom: auto; }
  .carousel-caption { padding: var(--space-4) var(--space-3) var(--space-3); font-size: 1rem; }
}
/* the member centre (SPA) uses this header too: icon buttons with a count, and the account menu */
.btn-icon { position: relative; width: 40px; padding: 0 !important; }
.count-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--color-crimson); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.account-menu > .sub-nav { left: auto; right: 0; min-width: 210px; }
.account-toggle { gap: 6px; }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.sub-nav a, .sub-nav-button { display: flex; align-items: center; gap: 8px; }
.account-menu .sub-nav a { padding: 8px 12px; color: var(--color-text); text-decoration: none; border-radius: var(--radius-sm); font-size: .95rem; white-space: nowrap; }
.account-menu .sub-nav a:hover { color: var(--color-primary-2); background: rgba(201, 151, 63, .1); }
.sub-nav-button { width: 100%; padding: 8px 12px; border: 0; background: transparent; font: inherit; font-size: .95rem; color: var(--color-text); border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.sub-nav-button:hover { color: var(--color-primary-2); background: rgba(201, 151, 63, .1); }
/* 1024–1279px with the member's two extra icons: the mark without the name, the account icon without the name */
@media (min-width: 1024px) and (max-width: 1279px) {
  .site-header:has(.account-menu) .brand-text { display: none; }
}
@media (min-width: 1024px) and (max-width: 1439px) {
  .account-name { display: none; }
  .site-header:has(.account-menu) .nav-list a, .site-header:has(.account-menu) .sub-toggle { padding: 8px 7px; font-size: .88rem; }
  .site-header:has(.account-menu) .nav-actions { gap: 6px; }
  .site-header:has(.account-menu) .lang-switch summary > span { display: none; }
}
/* CRB-1: the header stays inside the page's container at every desktop
   width (from 1440 px it ran past it: Japanese and English names are
   longer, a member has two more icons). The tighter menu and buttons of
   1024–1439 px hold from 1024 px up for Japanese, English and a member;
   the member's language switch is the globe alone, and in Japanese and
   Korean the account button is the icon alone (its name is in the menu's
   aria-label). The SPA marks the body lang-xx like the public pages. */
@media (min-width: 1024px) {
  .lang-ja .nav-list a, .lang-ja .sub-toggle, .lang-en .nav-list a, .lang-en .sub-toggle,
  .site-header:has(.account-menu) .nav-list a, .site-header:has(.account-menu) .sub-toggle { padding: 8px 7px; font-size: .88rem; }
  .lang-ja .nav-actions .btn, .lang-ja .nav-actions .lang-switch summary,
  .lang-en .nav-actions .btn, .lang-en .nav-actions .lang-switch summary { padding: 0 10px; font-size: .85rem; }
  .site-header:has(.account-menu) .nav-actions { gap: 6px; }
  .site-header:has(.account-menu) .lang-switch summary > span { display: none; }
  .lang-ja .account-name, .lang-ko .account-name { display: none; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  .lang-ja .nav-list a, .lang-ja .sub-toggle { padding: 8px 5px; }
}
/* the bell and the cart: side by side, in the phone menu too (CRB-10) */
.nav-icons { display: flex; align-items: center; gap: var(--space-2); }
@media (max-width: 1199px) { .nav-icons { gap: 6px; } }
@media (max-width: 1023px) {
  .nav-icons { justify-content: center; gap: var(--space-3); }
  .account-menu { display: flex; flex-direction: column; align-items: center; }
  .account-menu > .sub-nav { position: static; padding: var(--space-2) 0 0; min-width: 0; }
}
/* "not yet translated": database text shown in Traditional Chinese on another locale's page */
.untranslated { display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1.5; padding: 0 8px; border-radius: 999px; border: 1px solid var(--color-border-strong); background: var(--color-surface-2); color: var(--color-muted); vertical-align: middle; white-space: nowrap; font-family: var(--font-body); letter-spacing: 0; }
.carousel-caption .untranslated { background: rgba(255, 255, 255, .9); color: var(--color-text); border-color: transparent; }
.codex-lang-note .untranslated { margin-right: 6px; }
/* balanced lines: no one-character last line under the hero title and tagline */
.hero-title .en, .hero-tagline, .page-head .lead { text-wrap: balance; }
/* Japanese hero title (ディプスファンタジア, ten wide kana): one line on phones */
@media (max-width: 480px) {
  .lang-ja .hero-title .zh { font-size: clamp(1.6rem, 8.6vw, 2.4rem); letter-spacing: 0; }
}
