/* ============================================================================
   Terraria Lore Website — cinematic fantasy theme
   ========================================================================== */
:root {
  --bg:        #0c0a12;
  --bg-2:      #120e1c;
  --panel:     #1a1526;
  --panel-2:   #221b32;
  --surface:   #2b2240;
  --line:      #382c52;
  --ink:       #efeaf8;
  --muted:     #a89fc2;
  --muted-2:   #7c7398;
  --prose:     #e4ddf2;
  --header-bg: linear-gradient(180deg, rgba(12,10,18,.92), rgba(12,10,18,.72));

  --gold:      #f4c95d;
  --gold-deep: #c79330;
  --green:     #74d36e;
  --purple:    #b673e6;
  --crimson:   #e85a72;
  --cyan:      #5fcdf0;
  --orange:    #f0934e;

  --accent:    var(--gold);      /* overridden per-category */
  --accent-rgb: 244, 201, 93;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 18px 50px -18px rgba(0,0,0,.75);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.85);
  --maxw:      1180px;

  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --display: "Cinzel", "Spectral", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ----- Light theme (warm parchment) -------------------------------------- */
[data-theme="light"] {
  --bg:        #f3efe6;
  --bg-2:      #e9e3d6;
  --panel:     #ffffff;
  --panel-2:   #f7f3ea;
  --surface:   #ece5d7;
  --line:      #ddd4c2;
  --ink:       #221c2e;
  --muted:     #645c70;
  --muted-2:   #978da0;
  --prose:     #322b3c;
  --header-bg: linear-gradient(180deg, rgba(247,243,234,.95), rgba(247,243,234,.78));
  /* darker accents so accent-as-text stays legible on light */
  --gold:      #b07d12;
  --gold-deep: #8a610b;
  --green:     #3f9a39;
  --purple:    #8a40c4;
  --crimson:   #d23b56;
  --cyan:      #1f86ac;
  --orange:    #d4732e;
  --accent:    var(--gold);
  --shadow:    0 14px 40px -18px rgba(70,55,40,.22);
  --shadow-lg: 0 26px 64px -20px rgba(70,55,40,.3);
}
/* in light mode the parchment dot-grid should be dark, not white */
[data-theme="light"] body::after { background-image: radial-gradient(rgba(80,60,40,.5) 1px, transparent 1px); opacity: .04; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* layered cavern-strata backdrop */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(var(--accent-rgb), .12), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 45%, var(--bg) 100%);
  transition: background .6s ease;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; opacity: .035; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.8) 1px, transparent 1px);
  background-size: 42px 42px;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ----- Header / nav ------------------------------------------------------- */
header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  height: 64px; max-width: var(--maxw); margin: 0 auto; padding: 0 22px;
}
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--display);
  font-weight: 800; font-size: 1.18rem; letter-spacing: .5px; cursor: pointer; white-space: nowrap; }
.brand .gem { width: 26px; height: 26px; filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),.7)); }
.brand b { color: var(--gold); }
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  padding: 8px 13px; border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; transition: all .15s;
}
.nav-links a:hover { color: var(--ink); background: var(--panel); }
.nav-links a.active { color: var(--bg); background: var(--accent); }
.nav-search { position: relative; }
.nav-search input {
  width: 200px; padding: 9px 14px 9px 36px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  font-size: .9rem; transition: all .2s; font-family: var(--sans);
}
.nav-search input:focus { outline: none; width: 250px; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18); }
.nav-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-2); }
.theme-toggle { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); font-size: 1.05rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: border-color .15s, transform .15s; }
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-15deg); }

/* ----- Hero --------------------------------------------------------------- */
.hero { position: relative; min-height: 78vh; display: flex; align-items: flex-end;
  padding-bottom: 64px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.hero-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,10,18,.25) 0%, rgba(12,10,18,.55) 55%, var(--bg) 100%); }
.hero-inner { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto;
  padding: 0 22px; width: 100%; }
/* hero text always sits over a dark image overlay -> keep it light in both themes */
.hero h1 { font-family: var(--display); font-size: clamp(2.6rem, 7vw, 5.4rem); font-weight: 900;
  line-height: 1.02; letter-spacing: 1px; text-shadow: 0 4px 30px rgba(0,0,0,.85); max-width: 14ch;
  color: #f6f1ff; }
.hero h1 .sub { display: block; color: #f4c95d; }
.hero p.tag { font-family: var(--serif); font-size: clamp(1.05rem, 2.2vw, 1.4rem); color: #d9d1ec;
  margin-top: 18px; max-width: 56ch; text-shadow: 0 2px 14px rgba(0,0,0,.9); }
.hero .eyebrow { color: #f4c95d; text-shadow: 0 1px 10px rgba(0,0,0,.7); }
.hero .big-search { margin-top: 30px; position: relative; max-width: 520px; }
.hero .big-search input { width: 100%; padding: 17px 20px 17px 52px; font-size: 1.05rem;
  border-radius: 14px; background: rgba(26,21,38,.85); border: 1px solid var(--line); color: var(--ink);
  backdrop-filter: blur(8px); font-family: var(--sans); }
.hero .big-search input:focus { outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(244,201,93,.2); }
.hero .big-search svg { position: absolute; left: 19px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--muted); }

/* ----- Section heading ---------------------------------------------------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--display); font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800; letter-spacing: .5px; }
.section-head h2 .accent { color: var(--accent); }
.section-head p { color: var(--muted); max-width: 60ch; margin-top: 6px; font-size: .98rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 3px; font-size: .74rem; font-weight: 700;
  color: var(--accent); margin-bottom: 8px; }

/* ----- Category cards (home) --------------------------------------------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.cat-card { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 230px;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 22px;
  border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
.cat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.cat-card .cc-bg { position: absolute; inset: 0; z-index: 0; }
.cat-card .cc-bg img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.cat-card:hover .cc-bg img { transform: scale(1.07); }
.cat-card .cc-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,10,18,.15), rgba(12,10,18,.55) 50%, rgba(12,10,18,.95)); }
.cat-card .cc-body { position: relative; z-index: 1; }
.cat-card h3 { font-family: var(--display); font-size: 1.5rem; font-weight: 800; }
.cat-card .pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--bg); background: var(--accent); padding: 3px 10px;
  border-radius: 999px; margin-bottom: 10px; }
.cat-card p { color: #cfc6e4; font-size: .9rem; margin-top: 4px; }

/* ----- Entity grid -------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s, border-color .22s;
  display: flex; flex-direction: column; }
.card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.card .thumb { aspect-ratio: 16/10; overflow: hidden; position: relative; background: var(--panel-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .thumb img { transform: scale(1.08); }
.card .thumb::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(26,21,38,.9)); }
.card .meta { padding: 14px 16px 16px; }
.card .meta h4 { font-family: var(--display); font-size: 1.12rem; font-weight: 700; line-height: 1.2; }
.card .meta .tg { color: var(--muted); font-size: .85rem; margin-top: 5px; font-family: var(--serif);
  font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }
.card .corner { position: absolute; top: 10px; left: 10px; z-index: 2; font-size: .68rem;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--bg);
  background: var(--accent); padding: 3px 9px; border-radius: 999px; opacity: .95; }

/* letter placeholder behind every thumb — shows when the image is missing/loading */
.thumb[data-letter]::before {
  content: attr(data-letter); position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 2.8rem; font-weight: 800; color: var(--muted-2);
  background: radial-gradient(circle at 50% 38%, var(--surface), var(--panel-2));
}
.card .thumb img { position: relative; z-index: 1; }

/* ----- Detail page -------------------------------------------------------- */
.detail-hero { position: relative; min-height: 56vh; display: flex; align-items: flex-end;
  overflow: hidden; }
.detail-hero .dh-bg { position: absolute; inset: 0; z-index: 0; }
.detail-hero .dh-bg img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero .dh-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,10,18,.2) 0%, rgba(12,10,18,.6) 50%, var(--bg) 100%),
              linear-gradient(90deg, rgba(12,10,18,.6), transparent 60%); }
.detail-hero .dh-inner { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto;
  width: 100%; padding: 0 22px 40px; }
.detail-hero .crumbs { font-size: .85rem; color: rgba(245,240,255,.78); margin-bottom: 14px;
  text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.detail-hero .crumbs a:hover { color: #f4c95d; }
.detail-hero h1 { font-family: var(--display); font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 900;
  line-height: 1.05; text-shadow: 0 4px 24px rgba(0,0,0,.85); color: #f6f1ff; }
.detail-hero .tag { font-family: var(--serif); font-style: italic; font-size: 1.25rem;
  color: #f4c95d; margin-top: 10px; text-shadow: 0 2px 12px rgba(0,0,0,.9); }

.detail-body { display: grid; grid-template-columns: 1fr 320px; gap: 40px; padding: 44px 0 80px; }
@media (max-width: 880px) { .detail-body { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
  overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 11px 18px; font-weight: 700; font-size: .95rem; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: all .15s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.prose { font-family: var(--serif); font-size: 1.12rem; line-height: 1.8; color: var(--prose); }
.prose p { margin-bottom: 1.1em; }
.prose .dropcap::first-letter { font-family: var(--display); font-size: 3.4em; float: left;
  line-height: .8; padding: 4px 12px 0 0; color: var(--accent); }
.story { font-family: var(--serif); font-size: 1.14rem; line-height: 1.85; color: var(--prose);
  border-left: 3px solid var(--accent); padding: 6px 0 6px 26px; font-style: italic; }
.guide { font-family: var(--sans); font-size: 1.02rem; line-height: 1.75; color: var(--prose); }
.guide p { margin-bottom: .9em; }

/* sidebar panels */
.panel { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel h3 { font-family: var(--display); font-size: 1.05rem; margin-bottom: 14px; color: var(--accent);
  letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.stat-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
  border-bottom: 1px dashed var(--line); font-size: .92rem; }
.stat-row:last-child { border-bottom: 0; }
.stat-row .k { color: var(--muted); font-weight: 600; }
.stat-row .v { color: var(--ink); text-align: right; font-weight: 600; }
.drops-list, .dyk-list { list-style: none; }
.drops-list li, .dyk-list li { padding: 7px 0 7px 20px; position: relative; font-size: .9rem;
  color: var(--prose); border-bottom: 1px dashed var(--line); }
.drops-list li:last-child, .dyk-list li:last-child { border-bottom: 0; }
.drops-list li::before { content: "◆"; position: absolute; left: 0; color: var(--accent); font-size: .7rem; top: 9px; }
.dyk-list li::before { content: "✦"; position: absolute; left: 0; color: var(--gold); top: 8px; }
.wiki-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 10px;
  background: var(--accent); color: var(--bg); font-weight: 700; font-size: .92rem; width: 100%;
  justify-content: center; transition: transform .15s, filter .15s; }
.wiki-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }

/* video heroes */
.hero-bg video, .dh-bg video { width: 100%; height: 100%; object-fit: cover; }

/* prev / next nav */
.pn-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; margin-top: 8px; }
.pn-btn { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-weight: 600;
  font-size: .92rem; transition: all .18s; min-width: 0; }
.pn-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.pn-next { justify-content: flex-end; text-align: right; }
.pn-up { background: transparent; color: var(--muted); white-space: nowrap; }
@media (max-width: 620px) { .pn-nav { grid-template-columns: 1fr 1fr; } .pn-up { display: none; } }

/* nav special links (Timeline / Item DB) */
.nav-links a.nav-special { color: var(--gold); }
.nav-links a.nav-special:hover { background: rgba(244,201,93,.12); }
.nav-links a.nav-special.active { color: var(--bg); background: var(--gold); }

/* home feature cards (Timeline + Item DB) */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.feature-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 900px) { .feature-grid, .feature-grid-3 { grid-template-columns: 1fr; } }

/* lore cross-links */
.lore-link { color: var(--accent); text-decoration: none; border-bottom: 1px dotted rgba(var(--accent-rgb), .5);
  transition: border-color .15s, background .15s; padding: 0 1px; border-radius: 2px; }
.lore-link:hover { border-bottom-style: solid; background: rgba(var(--accent-rgb), .12); }

/* ----- Progression Roadmap ------------------------------------------------ */
.rm-legend { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: .86rem;
  margin-bottom: 30px; }
.rm-legend i.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px;
  vertical-align: middle; }
.lg.gate { background: var(--gold); } .lg.opt { background: var(--muted-2); } .lg.final { background: var(--crimson); }
.roadmap { max-width: 920px; margin: 0 auto; }
.rm-stage { margin-bottom: 10px; }
.rm-stage-head { border-left: 4px solid var(--accent); padding: 4px 0 4px 16px; margin-bottom: 18px; }
.rm-stage-head.t-pre { --accent: var(--green); } .rm-stage-head.t-hm { --accent: var(--purple); }
.rm-stage-head.t-end { --accent: var(--crimson); }
.rm-tier { text-transform: uppercase; letter-spacing: 2px; font-size: .72rem; font-weight: 700; color: var(--accent); }
.rm-stage-head h3 { font-family: var(--display); font-size: 1.5rem; margin: 2px 0; }
.rm-stage-head p { color: var(--muted); font-size: .92rem; }
.rm-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rm-node { display: flex; gap: 12px; align-items: center; background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; transition: transform .15s, border-color .15s; }
.rm-node:hover { transform: translateY(-3px); border-color: var(--accent); }
.rm-node.is-final { border-color: var(--crimson); box-shadow: 0 0 22px -6px rgba(232,90,114,.5); }
.rm-node.is-gate { border-color: rgba(244,201,93,.5); }
.rm-thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; flex-shrink: 0; position: relative; background: var(--panel-2); }
.rm-thumb img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.rm-thumb[data-letter]::before { content: attr(data-letter); position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-family: var(--display); color: var(--muted-2); font-size: 1.5rem;
  background: radial-gradient(circle, var(--surface), var(--panel-2)); }
.rm-info { min-width: 0; }
.rm-name { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.rm-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.rm-badge { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 7px; border-radius: 999px; }
.rm-badge.gate { background: var(--gold); color: var(--bg); }
.rm-badge.final { background: var(--crimson); color: #fff; }
.rm-badge.opt { background: var(--surface); color: var(--muted); }
.rm-badge.evil { background: rgba(182,115,230,.2); color: var(--purple); border: 1px solid rgba(182,115,230,.4); }
.rm-note { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.rm-arrow { text-align: center; color: var(--accent); font-size: 1.4rem; margin: 14px 0 18px; opacity: .5; }
.feature-card { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 180px;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 24px;
  border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .25s, box-shadow .25s; }
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.feature-card .cc-bg { position: absolute; inset: 0; z-index: 0; }
.feature-card .cc-bg img { width: 100%; height: 100%; object-fit: cover; }
.feature-card .cc-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, rgba(12,10,18,.95) 30%, rgba(12,10,18,.5)); }
.feature-card .cc-body { position: relative; z-index: 1; }
.feature-card h3 { font-family: var(--display); font-size: 1.5rem; }
.feature-card p { color: #cfc6e4; font-size: .92rem; margin-top: 4px; max-width: 44ch; }
.feature-card .pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--bg); background: var(--accent); padding: 3px 10px;
  border-radius: 999px; margin-bottom: 10px; }

/* ----- Timeline ----------------------------------------------------------- */
.timeline { position: relative; padding-left: 8px; }
.timeline::before { content: ""; position: absolute; left: 14px; top: 10px; bottom: 10px; width: 2px;
  background: linear-gradient(180deg, var(--gold), var(--purple), var(--crimson)); opacity: .5; }
.tl-era { font-family: var(--display); font-size: 1.3rem; color: var(--gold); font-weight: 800;
  margin: 34px 0 18px 38px; letter-spacing: 1px; }
.tl-era:first-child { margin-top: 0; }
.tl-item { position: relative; padding-left: 44px; margin-bottom: 26px; }
.tl-dot { position: absolute; left: 7px; top: 26px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold); border: 3px solid var(--bg); box-shadow: 0 0 0 3px rgba(244,201,93,.3); }
.tl-card { display: flex; gap: 0; background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tl-art { width: 200px; flex-shrink: 0; position: relative; background: var(--panel-2); }
.tl-art img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.tl-art[data-letter]::before { content: attr(data-letter); position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-family: var(--display); font-size: 3rem;
  color: var(--muted-2); background: radial-gradient(circle, var(--surface), var(--panel-2)); }
.tl-body { padding: 20px 24px; }
.tl-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.tl-ver { font-family: var(--sans); font-weight: 800; font-size: .8rem; color: var(--bg);
  background: var(--gold); padding: 2px 10px; border-radius: 999px; }
.tl-date { color: var(--muted); font-size: .85rem; }
.tl-body h3 { font-family: var(--display); font-size: 1.5rem; margin-bottom: 8px; }
.tl-body p { font-family: var(--serif); font-size: 1.04rem; line-height: 1.7; color: var(--prose); }
.tl-feats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.tl-feats li { font-size: .82rem; color: var(--gold); background: rgba(244,201,93,.1);
  border: 1px solid rgba(244,201,93,.25); padding: 4px 11px; border-radius: 999px; }
.tl-link { font-size: .88rem; color: var(--muted); font-weight: 600; }
.tl-link:hover { color: var(--gold); }
@media (max-width: 720px) { .tl-card { flex-direction: column; } .tl-art { width: 100%; height: 160px; } }

/* ----- Item Database ------------------------------------------------------ */
.db-controls { margin-bottom: 22px; }
.db-search { position: relative; max-width: 460px; margin-bottom: 16px; }
.db-search input { width: 100%; padding: 13px 16px 13px 44px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--line); color: var(--ink); font-size: 1rem; font-family: var(--sans); }
.db-search input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(182,115,230,.2); }
.db-search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted-2); }
.db-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.db-chip { font-family: var(--sans); font-size: .84rem; font-weight: 600; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); padding: 6px 13px; border-radius: 999px;
  cursor: pointer; transition: all .15s; }
.db-chip span { opacity: .6; font-size: .76rem; }
.db-chip:hover { color: var(--ink); border-color: var(--purple); }
.db-chip.active { color: var(--bg); background: var(--purple); border-color: var(--purple); }
.db-pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0;
  color: var(--muted); font-size: .9rem; }
.db-pg { font-family: var(--sans); font-weight: 700; font-size: .88rem; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); padding: 8px 16px; border-radius: 10px; cursor: pointer; }
.db-pg:hover:not([disabled]) { border-color: var(--purple); color: var(--purple); }
.db-pg[disabled] { opacity: .4; cursor: default; }
.db-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.db-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 10px 12px;
  text-align: center; transition: transform .15s, border-color .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.db-item:hover { transform: translateY(-3px); border-color: var(--purple); }
.db-sprite { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.25); border-radius: 8px; }
.db-sprite img { max-width: 48px; max-height: 48px; image-rendering: pixelated; }
.db-sprite.noimg::after { content: "?"; font-family: var(--display); color: var(--muted-2); font-size: 1.4rem; }
.db-name { font-size: .82rem; font-weight: 600; line-height: 1.25; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.db-type { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--purple); font-weight: 700; }

/* ----- Search results ----------------------------------------------------- */
.search-info { color: var(--muted); margin-bottom: 22px; font-size: .95rem; }

/* ----- Footer ------------------------------------------------------------- */
footer { border-top: 1px solid var(--line); padding: 40px 0; margin-top: 40px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.3)); }
footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  color: var(--muted); font-size: .88rem; align-items: center; }
footer .brand { font-size: 1rem; }

/* ----- Misc --------------------------------------------------------------- */
.back-top { color: var(--muted); font-size: .9rem; display: inline-flex; align-items: center;
  gap: 6px; margin-bottom: 20px; cursor: pointer; }
.back-top:hover { color: var(--accent); }
.loading { text-align: center; padding: 100px 20px; color: var(--muted); font-family: var(--display);
  font-size: 1.3rem; letter-spacing: 1px; }
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--accent); color: var(--bg);
  font-size: 1.4rem; font-weight: 700; cursor: pointer; opacity: 0; transform: translateY(16px);
  transition: opacity .25s, transform .25s, filter .15s; pointer-events: none; box-shadow: var(--shadow); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { filter: brightness(1.1); }
.fade-in { animation: fade .5s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.count-badge { font-family: var(--sans); font-size: .82rem; font-weight: 700; color: var(--accent);
  background: rgba(var(--accent-rgb), .12); border: 1px solid rgba(var(--accent-rgb),.3);
  padding: 3px 10px; border-radius: 999px; }

@media (max-width: 620px) {
  .nav-search input { width: 130px; } .nav-search input:focus { width: 160px; }
  .detail-body { gap: 26px; }
}
