/* PROJECT: R.E.D — Player Wiki · design tokens */
:root {
  --bg: #09090d;
  --bg-2: #0e0e14;
  --surface: #14141c;
  --surface-2: #1b1b26;
  --surface-3: #232331;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --text: #f3f1ee;
  --muted: #aaa6b3;
  --faint: #7a7684;
  --red: #ff3b47;
  --red-2: #ff6b73;
  --red-deep: #8f0f18;
  --cyan: #3fe0e8;
  --gold: #ffd34d;

  /* ความหายาก — ค่าเดียวกับเกม (src/ui/RarityStyle.js) */
  --r-common: #c8d0dc;
  --r-uncommon: #7fd47f;
  --r-rare: #1a8cff;
  --r-epic: #a86bff;
  --r-legendary: #ffd34d;
  --r-dragon: #ff3d7f;
  --r-octagram: #b26bff;

  --font-head: "Chakra Petch", "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 220ms;
  --wrap: 1200px;
  --head-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--head-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
body::after { content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0.05; background: url("img/art/texture/noise.png"); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.25; letter-spacing: 0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }

.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--red); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); text-decoration: none; }
.skip:focus { top: 12px; }

/* ── header ─────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 50; height: var(--head-h);
  background: rgba(9, 9, 13, 0.78); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.top__in { height: 100%; display: flex; align-items: center; gap: var(--s4); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; min-width: 0; }
.brand__logo { width: auto; height: 46px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(255, 59, 71, 0.4)); }
.foot__logo { width: 160px; height: auto; margin-bottom: 6px; }
.brand__name { font: 700 18px/1 var(--font-head); letter-spacing: 0.06em; white-space: nowrap; }
.brand__name b { color: var(--red); }
.brand__tag { font: 600 11px/1 var(--font-head); letter-spacing: 0.18em; color: var(--muted); border: 1px solid var(--line-2); padding: 4px 7px; border-radius: 4px; }
.nav { display: flex; gap: var(--s1); }
.nav a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px;
  text-decoration: none; color: var(--muted); font-weight: 500; border-radius: var(--r-sm);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="true"] .ic { color: var(--red); }
.navbtn { display: none; }

/* ── buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: var(--r-sm); border: 1px solid transparent; text-decoration: none; cursor: pointer;
  font: 600 15px/1 var(--font-head); letter-spacing: 0.04em; touch-action: manipulation;
  transition: transform 160ms var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 10px 30px -10px rgba(255, 59, 71, 0.7); }
.btn--primary:hover { background: var(--red-2); }
.btn--ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--line-2); color: var(--text); }
.btn--ghost:hover { border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); }

/* ── hero ───────────────────────────────────────────── */
.hero { position: relative; min-height: min(92dvh, 860px); display: flex; align-items: center; overflow: hidden; isolation: isolate; }
.hero__art { position: absolute; inset: 0; z-index: -2; }
.hero__art picture, .hero__art img { width: 100%; height: 100%; }
.hero__art img { object-fit: cover; object-position: 78% 40%; filter: saturate(1.05) brightness(0.95); }
.hero__grid { position: absolute; inset: 0; z-index: -1; opacity: 0.35; background: url("img/art/texture/grid-hud.png"); -webkit-mask-image: linear-gradient(90deg, #000 0%, transparent 55%); mask-image: linear-gradient(90deg, #000 0%, transparent 55%); }
.hero__logo { width: min(560px, 86%); height: auto; margin-bottom: var(--s5); filter: drop-shadow(0 8px 24px rgba(255, 59, 71, 0.35)); animation: rise 600ms var(--ease) both; }
.hero__fx {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(9, 9, 13, 0.92) 30%, rgba(9, 9, 13, 0.45) 62%, rgba(9, 9, 13, 0.15) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 35%),
    radial-gradient(60% 50% at 0% 100%, rgba(255, 59, 71, 0.28), transparent 70%);
}
.hero__fx::after {
  content: ""; position: absolute; inset: 0; opacity: 0.18;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}
.hero__in { padding-block: var(--s8); max-width: var(--wrap); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 600 12px/1 var(--font-head); letter-spacing: 0.24em; color: var(--muted); margin-bottom: var(--s5); }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(255, 59, 71, 0.2); animation: pulse 2.4s var(--ease) infinite; }
.ver { color: var(--red-2); letter-spacing: 0.08em; }
.hero__title { font-size: clamp(42px, 7vw, 88px); font-weight: 700; line-height: 1.12; max-width: 12ch; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5); }
.hero__title .hl { color: var(--red); background: linear-gradient(90deg, var(--red), #ff8a5c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero__lead { margin-top: var(--s5); max-width: 54ch; color: #d6d2db; font-size: 17px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: var(--s7) 0 0; max-width: 560px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; backdrop-filter: blur(8px); }
.kpis > div { background: rgba(14, 14, 20, 0.72); padding: 14px 16px; }
.kpis dt { font-size: 13px; color: var(--muted); }
.kpis dd { margin: 2px 0 0; font: 700 28px/1.1 var(--font-head); font-variant-numeric: tabular-nums; }

/* ── ticker ─────────────────────────────────────────── */
.ticker { border-block: 1px solid var(--line); background: var(--bg-2); overflow: hidden; }
.ticker__track { display: flex; align-items: center; gap: 28px; width: max-content; padding: 14px 0; animation: marquee 38s linear infinite; }
.ticker span { font: 600 13px/1 var(--font-head); letter-spacing: 0.28em; color: var(--faint); white-space: nowrap; }
.ticker i { width: 7px; height: 7px; background: var(--red); transform: rotate(45deg); opacity: 0.8; }

/* ── sections ───────────────────────────────────────── */
.sec { --sec-bg: var(--bg); position: relative; isolation: isolate; padding-block: var(--s9); }
.banner { position: absolute; inset: 0 0 auto; height: clamp(300px, 34vw, 520px); z-index: -1; overflow: hidden; }
.banner img { width: 100%; height: 100%; object-fit: cover; object-position: right center; opacity: 0.9; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--sec-bg) 0%, color-mix(in srgb, var(--sec-bg) 78%, transparent) 38%, transparent 78%), linear-gradient(0deg, var(--sec-bg) 2%, transparent 62%); }
.sec--alt { --sec-bg: var(--bg-2); background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-block: 1px solid var(--line); }
.sec__head { margin-bottom: var(--s6); max-width: 720px; min-height: clamp(120px, 16vw, 260px); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6); }
.kicker { font: 600 12px/1 var(--font-head); letter-spacing: 0.24em; color: var(--red); margin-bottom: var(--s3); }
.kicker--cyan { color: var(--cyan); }
.sec h2 { font-size: clamp(32px, 4.4vw, 52px); font-weight: 700; }
.sec__lead { margin-top: var(--s3); color: var(--muted); max-width: 62ch; }

/* ── classes ────────────────────────────────────────── */
.classes { display: grid; gap: var(--s5); }
.classes__tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); }
.ctab {
  position: relative; display: grid; grid-template-rows: 116px auto; align-items: end; gap: 6px; padding: 10px 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; text-align: left; overflow: hidden;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ctab::before { content: ""; position: absolute; inset: auto 0 0 0; height: 60%; background: radial-gradient(70% 70% at 50% 100%, rgba(255, 59, 71, 0.18), transparent 70%); opacity: 0; transition: opacity var(--dur) var(--ease); }
.ctab img { justify-self: center; height: 116px; width: 100%; object-fit: cover; object-position: 50% 8%; border-radius: 6px; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.6)); transition: transform var(--dur) var(--ease); position: relative; }
.ctab__name { font: 600 15px/1.2 var(--font-head); position: relative; }
.ctab__role { font-size: 12px; color: var(--faint); position: relative; }
.ctab:hover { border-color: var(--line-2); transform: translateY(-2px); }
.ctab:hover img { transform: translateY(-3px) scale(1.03); }
.ctab[aria-selected="true"] { border-color: var(--red); background: var(--surface-2); }
.ctab[aria-selected="true"]::before { opacity: 1; }

.classes__panel {
  display: grid; grid-template-columns: minmax(240px, 0.85fr) 1.6fr; gap: var(--s6); padding: var(--s6);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); position: relative; overflow: hidden;
}
.classes__panel::before { content: ""; position: absolute; inset: 0; background: radial-gradient(50% 60% at 15% 70%, rgba(255, 59, 71, 0.14), transparent 70%); pointer-events: none; }
.cart { position: sticky; top: calc(var(--head-h) + 24px); align-self: start; display: grid; place-items: end center; min-height: 420px; }
.cart::after { content: ""; position: absolute; bottom: 6px; width: 70%; height: 22px; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.7), transparent); }
.cart img { position: relative; z-index: 1; max-height: 520px; width: 100%; object-fit: contain; animation: rise 520ms var(--ease) both; }
.cinfo { position: relative; display: grid; gap: var(--s5); align-content: start; }
.cinfo h3 { font-size: 34px; }
.cinfo .tag { display: inline-flex; gap: 8px; align-items: center; font: 600 12px/1 var(--font-head); letter-spacing: 0.14em; color: var(--red-2); text-transform: uppercase; }
.cinfo__blurb { color: #d3cfd8; max-width: 60ch; }
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 20px; }
.bar { display: grid; grid-template-columns: 40px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.bar b { font: 600 12px/1 var(--font-head); color: var(--muted); letter-spacing: 0.08em; }
.bar span { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar span i { display: block; height: 100%; background: linear-gradient(90deg, var(--red-deep), var(--red)); border-radius: inherit; transform-origin: left; animation: grow 600ms var(--ease) both; }
.bar em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--s3); }
.skill { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.skill__ic { width: 48px; height: 48px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-2); object-fit: cover; }
.skill__ic--none { display: grid; place-items: center; color: var(--faint); }
.skill h4 { margin: 0; font: 600 14px/1.3 var(--font-head); }
.skill__meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.pill { font: 600 11px/1 var(--font-head); letter-spacing: 0.06em; padding: 4px 7px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.pill--ult { background: rgba(255, 59, 71, 0.16); color: var(--red-2); }
.pill--passive { background: rgba(63, 224, 232, 0.12); color: var(--cyan); }
.skill p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── toolbar / chips ────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s4); }
.search { flex: 1 1 280px; position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; min-height: 48px; padding: 0 16px 0 42px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-2); outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 59, 71, 0.18); }
.select select {
  min-height: 48px; padding: 0 40px 0 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-2);
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.chip, .seg button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 500; font-size: 14px; touch-action: manipulation;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.chip small { font-variant-numeric: tabular-nums; color: var(--faint); font-size: 12px; }
.chip:hover, .seg button:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"], .seg button[aria-pressed="true"] { color: #fff; background: var(--surface-3); border-color: var(--red); }
.chip[aria-pressed="true"] small { color: var(--red-2); }
.chip .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.seg button { border-color: transparent; background: transparent; min-height: 38px; }
.note { display: flex; gap: 10px; align-items: flex-start; margin: var(--s4) 0 var(--s2); padding: 12px 14px; font-size: 14px; color: #e4cfa1; background: rgba(255, 211, 77, 0.06); border: 1px solid rgba(255, 211, 77, 0.18); border-radius: var(--r-sm); }
.note .ic { color: var(--gold); margin-top: 3px; }
.count { margin: var(--s4) 0 var(--s3); font-size: 14px; color: var(--faint); font-variant-numeric: tabular-nums; }
.more { display: flex; justify-content: center; margin-top: var(--s6); }
.more[hidden] { display: none; }

/* ── grids / cards ──────────────────────────────────── */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.grid--items { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.grid--mons { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.card {
  --c: var(--r-common);
  position: relative; width: 100%; height: 100%; display: grid; text-align: left; cursor: pointer; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  animation: fadeUp 380ms var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms);
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 16px 34px -18px color-mix(in srgb, var(--c) 70%, transparent); }
.card--item { grid-template-columns: 72px 1fr; gap: 14px; align-items: center; padding: 12px; }
.card--item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); box-shadow: 0 0 12px var(--c); }
.slot {
  position: relative; width: 72px; height: 72px; border-radius: 10px; display: grid; place-items: center;
  background: var(--frame, none) center / cover no-repeat, var(--surface-3);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent), 0 0 18px -6px var(--c);
}
.slot img { width: 58px; height: 58px; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); }
.card__body { min-width: 0; display: grid; gap: 3px; }
.card__name { font: 600 15px/1.35 var(--font-head); overflow-wrap: anywhere; }
.card__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--faint); }
.rar { font: 600 12px/1 var(--font-head); color: var(--c); letter-spacing: 0.04em; }
.badge { font: 600 10px/1 var(--font-head); letter-spacing: 0.08em; padding: 3px 6px; border-radius: 4px; background: rgba(255, 211, 77, 0.12); color: var(--gold); }

.card--mon { grid-template-rows: 190px auto; }
.card--mon .card__art { position: relative; display: grid; place-items: end center; padding-top: 14px; background: radial-gradient(70% 80% at 50% 100%, rgba(255, 59, 71, 0.16), transparent 70%), var(--bg-2); border-bottom: 1px solid var(--line); }
.card--mon.is-spirit .card__art { background: radial-gradient(70% 80% at 50% 100%, rgba(63, 224, 232, 0.18), transparent 70%), var(--bg-2); }
.card--mon img { max-height: 170px; max-width: 90%; object-fit: contain; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.6)); transition: transform var(--dur) var(--ease); }
.card--mon:hover img { transform: translateY(-4px) scale(1.04); }
.card--mon .card__body { padding: 12px 14px 14px; }
.lv { position: absolute; top: 10px; left: 10px; font: 700 12px/1 var(--font-head); padding: 5px 8px; border-radius: 4px; background: rgba(9, 9, 13, 0.8); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.boss { position: absolute; top: 10px; right: 10px; display: inline-flex; gap: 5px; align-items: center; font: 700 11px/1 var(--font-head); letter-spacing: 0.08em; padding: 5px 8px; border-radius: 4px; background: rgba(255, 59, 71, 0.9); color: #fff; }
.boss .ic { width: 13px; height: 13px; }
.empty img { width: min(260px, 70%); height: auto; margin: 0 auto var(--s3); }
.empty { grid-column: 1 / -1; padding: var(--s7) var(--s4); text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-md); }

/* ── guides ─────────────────────────────────────────── */
.guides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: var(--s4); }
.guide { position: relative; padding: var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.guide::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; background: radial-gradient(closest-side, rgba(255, 59, 71, 0.16), transparent); }
.guide:hover { border-color: var(--line-2); transform: translateY(-3px); }
.guide__ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: rgba(255, 59, 71, 0.12); color: var(--red-2); margin-bottom: var(--s4); }
.guide__ic .ic { width: 24px; height: 24px; }
.guide h3 { font-size: 20px; margin-bottom: var(--s2); }
.guide p { color: var(--muted); font-size: 15px; }

/* ── story ──────────────────────────────────────────── */
.story { position: relative; padding-block: var(--s9); overflow: hidden; isolation: isolate; border-top: 1px solid var(--line); }
.story__fx { position: absolute; inset: 0; z-index: -1; background:
  radial-gradient(40% 60% at 85% 30%, rgba(63, 224, 232, 0.16), transparent 70%),
  radial-gradient(40% 60% at 10% 90%, rgba(255, 59, 71, 0.16), transparent 70%), var(--bg); }
.story__fx::before { content: ""; position: absolute; right: -8%; top: 30%; width: min(70vw, 900px); aspect-ratio: 1;
  background: url("img/art/texture/rift-glow.webp") center / contain no-repeat; opacity: 0.55; animation: spin 90s linear infinite; }
.story { --sec-bg: var(--bg); }
.story .banner { z-index: 0; }
.story__in { position: relative; z-index: 1; }
.story h2 { font-size: clamp(36px, 5.5vw, 64px); max-width: 14ch; }
.timeline { list-style: none; margin: var(--s7) 0 0; padding: 0; display: grid; gap: var(--s4); max-width: 760px; counter-reset: t; }
.timeline { max-width: 980px; }
.timeline li { position: relative; display: grid; grid-template-columns: minmax(180px, 300px) 1fr; grid-template-rows: auto 1fr; column-gap: var(--s5); align-content: center; padding: var(--s3); background: rgba(20, 20, 28, 0.72); border: 1px solid var(--line); border-radius: var(--r-lg); backdrop-filter: blur(6px); counter-increment: t; }
.timeline li::before { content: "0" counter(t); position: absolute; left: 22px; top: 20px; z-index: 1; font: 700 22px/1 var(--font-head); color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); }
.timeline__img { grid-row: 1 / span 2; width: 100%; height: 100%; min-height: 170px; object-fit: cover; border-radius: var(--r-md); }
.timeline__tag { align-self: end; margin-top: var(--s3); }
.timeline li p { align-self: start; padding-bottom: var(--s3); }
.timeline__tag { display: inline-block; font: 600 12px/1 var(--font-head); letter-spacing: 0.14em; color: var(--red-2); margin-bottom: 8px; }
.timeline__tag--cyan { color: var(--cyan); }
.timeline p { color: #d3cfd8; }
.timeline strong { color: var(--text); }
.story__note { margin-top: var(--s5); font-size: 13px; color: var(--faint); }

/* ── footer ─────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); padding-block: var(--s6); background: var(--bg-2); }
.foot__in { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.foot__fine { color: var(--faint); font-size: 13px; }

/* ── detail sheet (dialog) ──────────────────────────── */
.sheet { padding: 0; border: 0; background: transparent; color: var(--text); max-width: min(100vw - 24px, 760px); width: 100%; max-height: min(100dvh - 24px, 860px); }
.sheet::backdrop { background: rgba(4, 4, 8, 0.72); backdrop-filter: blur(4px); }
.sheet[open] { animation: pop 240ms var(--ease) both; }
.sheet__in { --c: var(--r-common); position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: auto; max-height: inherit; box-shadow: var(--shadow); }
.sheet__close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(9, 9, 13, 0.8); cursor: pointer; }
.sheet__close:hover { border-color: var(--red); }
.dhead { display: grid; grid-template-columns: auto 1fr; gap: var(--s5); align-items: center; padding: var(--s6) var(--s6) var(--s5); background: radial-gradient(60% 120% at 0% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%); border-bottom: 1px solid var(--line); }
.dhead .slot { width: 112px; height: 112px; border-radius: 16px; }
.dhead .slot img { width: 92px; height: 92px; }
.dhead--mon { grid-template-columns: 200px 1fr; }
.dhead--mon .dart { display: grid; place-items: end center; height: 200px; background: radial-gradient(70% 70% at 50% 100%, rgba(255, 59, 71, 0.2), transparent 70%); border-radius: var(--r-md); }
.dhead--mon img { max-height: 190px; max-width: 100%; object-fit: contain; }
.dhead h3 { font-size: 26px; padding-right: 40px; overflow-wrap: anywhere; }
.dhead .rar { font-size: 14px; }
.dsub { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.dsub code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.dbody { padding: var(--s5) var(--s6) var(--s6); display: grid; gap: var(--s5); }
.dbody h4 { margin: 0 0 var(--s2); font: 600 13px/1 var(--font-head); letter-spacing: 0.18em; color: var(--faint); text-transform: uppercase; }
.dbody .desc { color: #d6d2db; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 8px; margin: 0; }
.stats div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.stats dt { color: var(--muted); font-size: 14px; }
.stats dd { margin: 0; font: 600 15px/1.4 var(--font-head); font-variant-numeric: tabular-nums; color: var(--text); }
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.links button { --c: var(--r-common); width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; text-align: left; cursor: pointer; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); transition: border-color var(--dur) var(--ease); }
.links button:hover { border-color: var(--line-2); }
.links img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.links span { min-width: 0; display: grid; font-size: 14px; line-height: 1.35; }
.links small { color: var(--faint); font-variant-numeric: tabular-nums; }
.maptags { display: flex; flex-wrap: wrap; gap: 8px; }
.maptag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 13px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.maptag.is-spirit { border-color: rgba(63, 224, 232, 0.4); color: var(--cyan); }
.muted { color: var(--faint); font-size: 14px; }

/* rarity tokens per element (--c) */
[data-r="common"] { --c: var(--r-common); }
[data-r="uncommon"] { --c: var(--r-uncommon); }
[data-r="rare"] { --c: var(--r-rare); }
[data-r="epic"] { --c: var(--r-epic); }
[data-r="legendary"] { --c: var(--r-legendary); }
[data-r="dragon"] { --c: var(--r-dragon); }
[data-r="octagram"] { --c: var(--r-octagram); }
[data-r="octagram"] .slot { box-shadow: inset 0 0 0 2px transparent, 0 0 18px -4px #b26bff; background: linear-gradient(var(--surface-3), var(--surface-3)) padding-box, conic-gradient(#ff3d7f, #ffd34d, #7fd47f, #3fe0e8, #a86bff, #ff3d7f) border-box; border: 2px solid transparent; }

/* ── motion ─────────────────────────────────────────── */
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 59, 71, 0); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ── responsive ─────────────────────────────────────── */
@media (max-width: 1023px) {
  .navbtn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
  .nav { position: absolute; top: var(--head-h); left: 0; right: 0; flex-direction: column; padding: var(--s3) 16px var(--s4); background: rgba(9, 9, 13, 0.97); border-bottom: 1px solid var(--line); display: none; }
  .nav.is-open { display: flex; }
  .nav a { min-height: 48px; font-size: 16px; }
  .classes__panel { grid-template-columns: 1fr; padding: var(--s5); }
  .cart { position: relative; top: auto; min-height: 260px; }
  .cart img { max-height: 280px; }
}
@media (max-width: 767px) {
  .brand__tag { display: none; }
  .hero { min-height: auto; }
  .hero__in { padding-block: var(--s7) var(--s6); }
  .hero__fx { background: linear-gradient(0deg, var(--bg) 4%, rgba(9, 9, 13, 0.55) 30%, rgba(9, 9, 13, 0.62) 62%, rgba(9, 9, 13, 0.3) 100%); }
  .hero__lead, .eyebrow { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 14px rgba(0, 0, 0, 0.8); }
  .hero__art img { object-position: 50% 100%; }
  .hero__lead { font-size: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec { padding-block: var(--s8); }
  .classes__tabs { grid-template-columns: repeat(5, 120px); overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .ctab { scroll-snap-align: start; }
  .seg { width: 100%; }
  .seg button { flex: 1; justify-content: center; padding: 0 8px; }
  .dhead, .dhead--mon { grid-template-columns: 1fr; padding: var(--s5); }
  .dhead--mon .dart { height: 180px; }
  .dbody { padding: var(--s4) var(--s5) var(--s5); }
  .timeline li { grid-template-columns: 1fr; grid-template-rows: auto; }
  .timeline__img { grid-row: auto; min-height: 0; aspect-ratio: 3 / 2; }
  .timeline li p { padding: 0 var(--s2) var(--s2); }
  .timeline__tag { margin-left: var(--s2); }
  .banner { height: 240px; }
  .sec__head { min-height: 0; }
  .hero__logo { width: min(340px, 88%); }
  .brand__logo { height: 38px; }
}
