:root {
  --bg: #0a0810;
  --bg-2: #14101c;
  --panel: #1a1426;
  --panel-2: #221a32;
  --line: #382b50;
  --line-gold: rgba(212,166,74,0.45);
  --text: #ece6d5;
  --muted: #a094b3;
  --gold: #d4a64a;
  --gold-bright: #f5d77d;
  --gold-deep: #8a6a23;
  --crimson: #8b1f2c;
  --crimson-bright: #c83a4a;
  --ok: #5fb37a;
  --err: #c8556a;
  --ff-display: "Cinzel Decorative", "Noto Serif TC", "Microsoft JhengHei", serif;
  --ff-serif: "Noto Serif TC", "Cinzel", "Microsoft JhengHei", serif;
  --ff-body: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(212,166,74,0.12), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(200,58,74,0.16), transparent 60%),
    radial-gradient(800px 400px at 50% 110%, rgba(139,31,44,0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

main.container { flex: 1; padding-top: 28px; padding-bottom: 48px; }

/* Header */
.site-header {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.85), rgba(20,16,28,0.7));
  border-bottom: 1px solid var(--line-gold);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 22px rgba(0,0,0,0.5);
}
.site-header::after {
  content: ""; display: block; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--crimson-bright) 50%, var(--gold) 70%, transparent);
  opacity: 0.55;
}
.nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.brand-logo { filter: drop-shadow(0 0 6px rgba(212,166,74,0.45)); transition: transform .25s, filter .25s; }
.brand:hover .brand-logo { transform: rotate(-4deg) scale(1.04); filter: drop-shadow(0 0 10px rgba(245,215,125,0.7)); }
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-title {
  font-family: var(--ff-display);
  font-weight: 900; font-size: 22px; letter-spacing: 6px;
  background: linear-gradient(180deg, #f5d77d 0%, #d4a64a 60%, #8a6a23 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 18px rgba(212,166,74,0.25);
}
.brand-text small {
  display: block; font-family: var(--ff-display);
  font-size: 10px; color: var(--muted); letter-spacing: 4px; font-weight: 500;
}
nav { display: flex; gap: 4px; }
nav a {
  color: var(--text); text-decoration: none;
  font-family: var(--ff-serif);
  font-size: 15px; font-weight: 500;
  padding: 8px 16px; letter-spacing: 2px;
  position: relative;
  transition: color .2s;
}
nav a::after {
  content: ""; position: absolute; left: 50%; bottom: 2px;
  width: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: translateX(-50%);
  transition: width .25s;
}
nav a:hover { color: var(--gold-bright); }
nav a:hover::after { width: 70%; }
nav a.active { color: var(--gold-bright); }
nav a.active::after { width: 80%; }

/* Hero */
.hero {
  position: relative;
  padding: 60px 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  border: 1px solid var(--line-gold);
  border-radius: 16px;
  background:
    url('/img/hero-bg.svg') center/cover no-repeat,
    radial-gradient(700px 250px at 50% -20%, rgba(212,166,74,0.22), transparent 70%),
    linear-gradient(180deg, var(--panel), var(--bg-2));
  margin-bottom: 28px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.6), 0 6px 24px rgba(0,0,0,0.4);
}
.hero::before, .hero::after {
  content: ""; position: absolute; left: 24px; right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--crimson-bright) 50%, var(--gold) 80%, transparent);
  opacity: 0.65;
}
.hero::before { top: 18px; }
.hero::after  { bottom: 18px; }
.hero h1 {
  font-family: var(--ff-display);
  font-size: 52px; margin: 0 0 14px;
  letter-spacing: 8px; font-weight: 900;
  text-shadow: 0 0 25px rgba(0,0,0,0.6);
}
.hero h1 .accent {
  background: linear-gradient(180deg, #f5d77d 0%, #d4a64a 55%, #8a6a23 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(212,166,74,0.55));
}
.hero-sub {
  font-family: var(--ff-serif);
  color: var(--muted); margin: 0 0 28px;
  font-size: 17px; letter-spacing: 3px; font-weight: 500;
}
.hero-actions { display: flex; gap: 14px; justify-content: flex-start; flex-wrap: wrap; }
.hero-logo {
  display: block;
  width: 400px;
  height: 400px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 18px rgba(212,166,74,0.45));
}
.hero-text { text-align: left; max-width: 360px; }
.hero-text .hero-sub { margin: 0 0 28px; }
@media (max-width: 860px) {
  .hero { gap: 24px; }
  .hero-logo { width: 280px; height: 280px; }
  .hero-text { text-align: center; }
  .hero-text .hero-actions { justify-content: center; }
}

/* Card */
.card {
  background:
    linear-gradient(180deg, rgba(56,43,80,0.15), transparent 30%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 30px;
  margin-bottom: 22px;
  position: relative;
  box-shadow: 0 2px 14px rgba(0,0,0,0.35);
}
.card::before {
  content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.5;
}
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.card.center { text-align: center; }
.card h1 { margin-top: 0; font-family: var(--ff-serif); }
.card h2 { font-family: var(--ff-serif); color: var(--gold-bright); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 4px;
  text-decoration: none;
  font-family: var(--ff-serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 3px;
  border: 1px solid var(--line-gold);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: transform .1s, background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { background: linear-gradient(180deg, #2d2244, var(--panel-2)); border-color: var(--gold); box-shadow: 0 0 18px rgba(212,166,74,0.25); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  color: #1a0f02; border-color: var(--gold-deep);
  box-shadow: 0 0 14px rgba(212,166,74,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 0 22px rgba(245,215,125,0.6), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn.ghost { background: transparent; border-color: var(--line); }

/* Markdown */
.markdown h1, .markdown h2, .markdown h3 { color: var(--gold-bright); font-family: var(--ff-serif); letter-spacing: 1px; }
.markdown h1 { border-bottom: 1px solid var(--line-gold); padding-bottom: 8px; position: relative; }
.markdown h1::after { content: ""; position: absolute; bottom: -1px; left: 0; width: 60px; height: 1px; background: var(--gold-bright); }
.markdown a { color: var(--gold-bright); text-decoration: none; border-bottom: 1px dashed rgba(245,215,125,0.5); }
.markdown a:hover { color: var(--gold); border-bottom-style: solid; }
.markdown table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.markdown th { background: var(--panel-2); }
.markdown blockquote { border-left: 3px solid var(--gold); padding-left: 14px; color: var(--muted); margin: 14px 0; }
.markdown code { background: var(--bg-2); padding: 2px 6px; border-radius: 4px; }

/* Query */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 18px; flex-wrap: wrap; }
.tab {
  background: transparent; color: var(--muted);
  border: none; border-bottom: 2px solid transparent;
  padding: 10px 18px; cursor: pointer; font-size: 15px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.tab-panel.hidden { display: none; }

.query-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 18px; }
.query-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.query-form input, .query-form select {
  min-width: 180px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}
.query-form input:focus, .query-form select:focus { outline: none; border-color: var(--gold); }

.result table {
  width: 100%; border-collapse: collapse; margin-top: 12px;
  font-size: 13px;
}
.result th, .result td {
  border: 1px solid var(--line); padding: 6px 10px;
}
.result th { background: var(--panel-2); color: var(--gold-bright); text-align: left; position: sticky; top: 0; }
.result tr:hover td { background: rgba(212,166,74,0.05); }
.result .meta { color: var(--muted); margin-top: 10px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.result-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* Armor grid */
.armor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.armor-card {
  display: flex; flex-direction: column; align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 10px 10px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.armor-card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 6px 18px rgba(0,0,0,0.5); }
.armor-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.06), rgba(0,0,0,0.4));
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  image-rendering: pixelated;
}
.armor-icon img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.armor-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-all;
}
.armor-meta { font-size: 11px; color: var(--muted); }

/* Grade colors (1=一般 ~ 6=神話) */
.armor-card.grade-1 .armor-name { color: #f3f0e6; text-shadow: 0 0 6px rgba(255,255,255,0.15); }
.armor-card.grade-2 .armor-name { color: #5fdc7c; text-shadow: 0 0 8px rgba(95,220,124,0.35); }
.armor-card.grade-3 .armor-name { color: #5aa2ff; text-shadow: 0 0 8px rgba(90,162,255,0.45); }
.armor-card.grade-4 .armor-name { color: #ff5d6c; text-shadow: 0 0 8px rgba(255,93,108,0.45); }
.armor-card.grade-5 .armor-name { color: #b975ff; text-shadow: 0 0 10px rgba(185,117,255,0.55); }
.armor-card.grade-6 .armor-name { color: #ffcf3a; text-shadow: 0 0 12px rgba(255,207,58,0.75); }

.armor-card.grade-2 { border-color: rgba(95,220,124,0.35); }
.armor-card.grade-3 { border-color: rgba(90,162,255,0.45); }
.armor-card.grade-4 { border-color: rgba(255,93,108,0.50); }
.armor-card.grade-5 { border-color: rgba(185,117,255,0.55); }
.armor-card.grade-6 {
  border-color: rgba(255,207,58,0.7);
  background: linear-gradient(180deg, rgba(255,207,58,0.10), var(--panel-2));
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 360px;
  background: rgba(10,8,16,0.96);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}

/* Craft */
.craft-recipe {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-top: 14px;
}
.craft-header {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px; margin-bottom: 12px;
}
.craft-id { color: var(--muted); font-family: ui-monospace, monospace; }
.craft-note { color: var(--gold-bright); font-weight: 600; flex: 1; }
.craft-chance { color: var(--ok); font-weight: 600; }
.craft-flow { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.craft-side { flex: 1; min-width: 200px; }
.craft-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.craft-arrow { display: grid; place-items: center; color: var(--gold); font-size: 28px; }

.material-row {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.material-card {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  width: 110px;
  text-align: center;
}
.material-card.output { border-color: rgba(212,166,74,0.5); }
.material-card img {
  width: 44px; height: 44px;
  image-rendering: pixelated;
  margin-bottom: 6px;
}
.material-name { font-size: 12px; font-weight: 600; line-height: 1.3; word-break: break-all; }
.material-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Dropmap (Phase 2) */
.dropmap-search { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 22px; }
.dropmap-mode { display: flex; gap: 6px; }
.mode-btn {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: var(--ff-serif);
  font-size: 14px;
  letter-spacing: 2px;
  transition: all .2s;
}
.mode-btn:hover { color: var(--text); border-color: var(--gold-deep); }
.mode-btn.active {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #1a0f02; border-color: var(--gold-deep); font-weight: 700;
  box-shadow: 0 0 12px rgba(212,166,74,0.35);
}
.dropmap-input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--ff-body);
}
.dropmap-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 10px rgba(212,166,74,0.2); }

.dropmap-list, .dropmap-view { min-height: 200px; }
.dropmap-view.hidden, .dropmap-list.hidden { display: none; }
.dropmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.dropmap-card {
  background: linear-gradient(180deg, rgba(56,43,80,0.2), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: var(--ff-serif);
  font-size: 15px;
  position: relative;
  transition: all .15s;
}
.dropmap-card:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212,166,74,0.08), var(--panel-2));
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,166,74,0.1);
  transform: translateY(-2px);
}
.dropmap-card::before {
  content: ""; position: absolute; left: 6px; top: 6px; width: 4px; height: calc(100% - 12px);
  background: linear-gradient(180deg, var(--gold), transparent);
  opacity: 0; transition: opacity .15s;
}
.dropmap-card:hover::before { opacity: 1; }
.dm-name { display: block; padding-left: 6px; word-break: break-word; }

/* Filter bar (weapon/armor) */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 16px; align-items: center; }
.filter-bar .dropmap-input { flex: 1; min-width: 220px; }
.filter-bar select {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; font-size: 14px;
  font-family: var(--ff-body);
}
.filter-bar select:focus { outline: none; border-color: var(--gold); }

/* 遊戲式 hover tooltip（武器/防具）*/
.equip-tooltip {
  position: fixed;
  z-index: 9999;
  width: 340px;
  background: linear-gradient(180deg, #0a0610 0%, #14101e 100%);
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.85), 0 0 22px rgba(212,166,74,0.25);
  padding: 0;
  pointer-events: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  overflow: hidden;
}
.equip-tooltip.hidden { display: none; }
.tip-header {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(212,166,74,0.10), transparent);
  border-bottom: 1px solid var(--line-gold);
}
.tip-header.grade-1 { background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent); }
.tip-header.grade-2 { background: linear-gradient(180deg, rgba(95,220,124,0.12), transparent); }
.tip-header.grade-3 { background: linear-gradient(180deg, rgba(90,162,255,0.14), transparent); }
.tip-header.grade-4 { background: linear-gradient(180deg, rgba(255,93,108,0.14), transparent); }
.tip-header.grade-5 { background: linear-gradient(180deg, rgba(185,117,255,0.16), transparent); }
.tip-header.grade-6 { background: linear-gradient(180deg, rgba(255,207,58,0.18), transparent); }
.tip-icon {
  flex: 0 0 56px; width: 56px; height: 56px;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.08), rgba(0,0,0,0.5));
  border: 1px solid var(--line-gold);
  border-radius: 6px;
  display: grid; place-items: center;
  overflow: hidden;
}
.tip-icon img { max-width: 80%; max-height: 80%; image-rendering: pixelated; }
.tip-title { min-width: 0; flex: 1; }
.tip-grade { font-family: var(--ff-display); color: var(--gold-bright); letter-spacing: 3px; font-size: 11px; }
.tip-name { font-family: var(--ff-serif); font-size: 16px; font-weight: 700; color: var(--text); margin: 2px 0; word-break: break-word; }
.tip-name { font-size: 16px; }
.tip-header.grade-2 .tip-name { color: #5fdc7c; text-shadow: 0 0 6px rgba(95,220,124,0.4); }
.tip-header.grade-3 .tip-name { color: #5aa2ff; text-shadow: 0 0 6px rgba(90,162,255,0.5); }
.tip-header.grade-4 .tip-name { color: #ff5d6c; text-shadow: 0 0 6px rgba(255,93,108,0.5); }
.tip-header.grade-5 .tip-name { color: #b975ff; text-shadow: 0 0 8px rgba(185,117,255,0.6); }
.tip-header.grade-6 .tip-name { color: #ffcf3a; text-shadow: 0 0 10px rgba(255,207,58,0.7); }
.tip-type { color: var(--muted); font-size: 11px; }
.tip-meta {
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.tip-meta div { white-space: nowrap; }
.tip-classes {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
}
.tip-section { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.tip-section:last-child { border-bottom: none; }
.tip-section-title { color: var(--gold-bright); font-size: 12px; letter-spacing: 2px; margin-bottom: 6px; font-family: var(--ff-serif); }
.tip-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.tip-stat { display: flex; justify-content: space-between; font-size: 12px; }
.tip-stat span { color: var(--muted); }
.tip-stat b { color: var(--gold-bright); font-weight: 700; }
.tip-skill { color: var(--crimson-bright); font-size: 12px; padding: 2px 0; }
.tip-muted { color: var(--muted); font-size: 12px; font-style: italic; }
.tip-loading, .tip-error { padding: 14px; text-align: center; color: var(--muted); }
.tip-error { color: var(--err); }

/* Detail view (weapon/armor) — DEPRECATED Phase 4 改用 hover tooltip */
.detail-view { animation: fadeIn .2s; }
.detail-view.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.detail-header {
  display: flex; gap: 20px; align-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(212,166,74,0.06), var(--panel-2));
  border: 1px solid var(--line-gold);
  border-radius: 12px;
  margin: 14px 0 18px;
}
.detail-header.grade-1 { border-color: rgba(255,255,255,0.2); }
.detail-header.grade-2 { border-color: rgba(95,220,124,0.4); background: linear-gradient(180deg, rgba(95,220,124,0.08), var(--panel-2)); }
.detail-header.grade-3 { border-color: rgba(90,162,255,0.45); background: linear-gradient(180deg, rgba(90,162,255,0.08), var(--panel-2)); }
.detail-header.grade-4 { border-color: rgba(255,93,108,0.50); background: linear-gradient(180deg, rgba(255,93,108,0.08), var(--panel-2)); }
.detail-header.grade-5 { border-color: rgba(185,117,255,0.55); background: linear-gradient(180deg, rgba(185,117,255,0.10), var(--panel-2)); }
.detail-header.grade-6 { border-color: rgba(255,207,58,0.7); background: linear-gradient(180deg, rgba(255,207,58,0.12), var(--panel-2)); }
.detail-icon {
  flex: 0 0 96px; width: 96px; height: 96px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.08), rgba(0,0,0,0.5));
  border: 1px solid var(--line-gold);
  border-radius: 10px;
  overflow: hidden;
}
.detail-icon img { max-width: 80%; max-height: 80%; image-rendering: pixelated; }
.detail-info { flex: 1; min-width: 0; }
.detail-grade { font-family: var(--ff-display); color: var(--gold-bright); letter-spacing: 4px; font-size: 13px; margin-bottom: 4px; }
.detail-name { font-family: var(--ff-serif); margin: 0 0 8px; font-size: 26px; color: var(--text); }
.detail-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.detail-meta span { background: rgba(0,0,0,0.3); padding: 4px 10px; border-radius: 4px; }
.detail-classes { font-size: 13px; color: var(--gold); }
.detail-section { margin: 18px 0; }
.detail-section h3 { font-family: var(--ff-serif); color: var(--gold-bright); border-bottom: 1px solid var(--line-gold); padding-bottom: 6px; margin: 0 0 12px; }
.detail-section ul { margin: 0; padding-left: 22px; line-height: 1.9; }
.detail-section ul li { color: var(--text); }
.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.stat-item {
  display: flex; justify-content: space-between;
  background: var(--bg-2); padding: 8px 12px;
  border-radius: 6px; border: 1px solid var(--line);
  font-size: 13px;
}
.stat-label { color: var(--muted); }
.stat-value { color: var(--gold-bright); font-weight: 700; }

/* Items grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.item-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(180deg, rgba(56,43,80,0.18), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  transition: all .15s;
}
.item-card.clickable { cursor: pointer; }
.item-card.clickable:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212,166,74,0.08), var(--panel-2));
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  transform: translateY(-1px);
}
.item-icon {
  flex: 0 0 48px; width: 48px; height: 48px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.06), rgba(0,0,0,0.4));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.item-icon img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-family: var(--ff-serif); font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 14px; word-break: break-word; }
.item-meta { font-size: 11px; color: var(--muted); display: flex; gap: 10px; }
.item-hint { font-size: 11px; color: var(--gold); margin-top: 4px; font-style: italic; }

.dropmap-card.no-drop { opacity: 0.65; }
.dropmap-card.no-drop:hover { opacity: 1; }
.dm-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; font-style: italic; }

.back-btn {
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; margin-bottom: 10px;
  font-family: var(--ff-body);
}
.back-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.view-title {
  font-family: var(--ff-display);
  color: var(--gold-bright); font-size: 24px; margin: 8px 0 16px;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--line-gold); padding-bottom: 10px;
}
.center { text-align: center; }

/* 製作查詢 */
.craft-npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.craft-npc-grid.hidden { display: none; }
.craft-npc-card {
  display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(180deg, rgba(56,43,80,0.22), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: var(--ff-serif);
  transition: all .15s;
}
.craft-npc-card:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212,166,74,0.10), var(--panel-2));
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,166,74,0.12);
  transform: translateY(-2px);
}
.cn-name { font-weight: 700; font-size: 15px; color: var(--text); }
.cn-meta { font-size: 12px; color: var(--muted); }

/* 職業介紹（圖文左右排） */
.class-block {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 28px;
  align-items: start;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.class-block:last-child { border-bottom: none; }
.class-block .class-text > h3:first-child { margin-top: 0; }
.class-block .class-img { display: grid; place-items: center; }
.class-block .class-img img {
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line-gold);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  display: block;
}
@media (max-width: 720px) {
  .class-block { grid-template-columns: 1fr; gap: 14px; }
  .class-block .class-img { order: -1; }
  .class-block .class-img img { max-width: 320px; }
}

/* 頁面底部影片 */
.page-video {
  margin: 36px auto 24px;
  max-width: 880px;
  padding: 0 16px;
  display: flex;
  justify-content: center;
}
.page-video video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line-gold);
  box-shadow: 0 6px 28px rgba(0,0,0,0.55);
  background: #000;
}

/* 地圖介紹 */
.map-section { margin-top: 22px; }
.map-section:first-of-type { margin-top: 14px; }
.map-section-title {
  font-family: var(--ff-serif);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--gold);
  border-bottom: 1px solid var(--line-gold);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.map-section-count { font-size: 12px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.map-npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.map-npc-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  font-family: var(--ff-serif);
  transition: all .15s;
}
.map-npc-card:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212,166,74,0.10), var(--bg-2));
  color: var(--gold-bright);
}
.map-drop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.map-drop-card {
  display: flex; gap: 10px; align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}
.md-icon { width: 32px; height: 32px; display: grid; place-items: center; flex-shrink: 0; }
.md-icon img { max-width: 32px; max-height: 32px; image-rendering: pixelated; }
.md-name { font-size: 13px; color: var(--text); line-height: 1.3; }

.craft-recipes.hidden { display: none; }
.recipe-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.recipe-card {
  background: linear-gradient(180deg, rgba(56,43,80,0.18), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
}
.recipe-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px;
  gap: 12px;
}
.rc-note { font-family: var(--ff-serif); color: var(--gold-bright); font-size: 14px; }
.rc-note.muted { color: var(--muted); }
.rc-chance { font-size: 13px; color: var(--gold); white-space: nowrap; }
.rc-chance.ok { color: var(--ok); font-weight: 700; }

.recipe-flow { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.recipe-side { flex: 1; min-width: 220px; }
.recipe-label { font-size: 11px; color: var(--muted); letter-spacing: 2px; margin-bottom: 8px; font-family: var(--ff-serif); }
.recipe-arrow { display: grid; place-items: center; color: var(--gold); font-size: 22px; }

.recipe-items { display: flex; flex-direction: column; gap: 6px; }
.recipe-item {
  display: flex; gap: 10px; align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.recipe-item.output { border-color: rgba(212,166,74,0.4); background: linear-gradient(180deg, rgba(212,166,74,0.06), var(--bg-2)); }
.recipe-item.exchange {
  border-color: rgba(90,162,255,0.4);
  background: linear-gradient(180deg, rgba(90,162,255,0.06), var(--bg-2));
  border-style: dashed;
}
.ri-enchant { color: var(--gold-bright); font-weight: 700; margin-right: 4px; }

.material-with-alts {
  background: rgba(0,0,0,0.18);
  border-left: 2px solid var(--gold-deep);
  padding: 6px 8px 6px 10px;
  border-radius: 4px;
}
.material-alts { margin: 6px 0 0 14px; }
.alt-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-style: italic;
}
.alt-items { display: flex; flex-direction: column; gap: 4px; }
.alt-hint { color: var(--gold); font-size: 11px; margin-left: 6px; font-style: italic; font-weight: normal; }

.recipe-fail {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.recipe-fail .recipe-label { color: var(--err); }
.ri-icon {
  flex: 0 0 36px; width: 36px; height: 36px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.06), rgba(0,0,0,0.4));
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.ri-icon img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.ri-info { flex: 1; min-width: 0; }
.ri-name { font-size: 13px; color: var(--text); font-family: var(--ff-serif); word-break: break-word; }
.ri-count { font-size: 11px; color: var(--muted); }

@media (max-width: 720px) {
  .recipe-flow { flex-direction: column; }
  .recipe-arrow { transform: rotate(90deg); }
}

/* Pagination */
.pagination {
  display: flex; gap: 6px; flex-wrap: wrap;
  justify-content: center;
  margin-top: 18px;
}
.pg-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--ff-serif);
  cursor: pointer;
  transition: all .12s;
  min-width: 38px;
}
.pg-btn:hover:not(:disabled):not(.disabled) {
  background: linear-gradient(180deg, rgba(212,166,74,0.12), var(--panel-2));
  border-color: var(--gold);
  color: var(--gold-bright);
}
.pg-btn.active {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  color: #1a0f02;
  border-color: var(--gold-deep);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(212,166,74,0.35);
}
.pg-btn:disabled, .pg-btn.disabled { opacity: 0.35; cursor: not-allowed; }
.pg-ellipsis { color: var(--muted); padding: 6px 4px; }
.page-info {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  letter-spacing: 1px;
}
.equip-list { display: block; }
.armor-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.small { font-size: 12px; }
@media (max-width: 720px) {
  .craft-flow { flex-direction: column; }
  .craft-arrow { transform: rotate(90deg); }
}

/* Admin */
.row-between { display: flex; justify-content: space-between; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; }
.stack input, .stack textarea {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 12px; font-size: 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.stack textarea { line-height: 1.6; }
.admin-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }

/* States */
.error { color: var(--err); }
.success { color: var(--ok); }
.muted { color: var(--muted); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line-gold);
  padding: 28px 0 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: rgba(0,0,0,0.45);
  position: relative;
}
.site-footer::before {
  content: ""; position: absolute; top: -2px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--crimson-bright) 50%, var(--gold) 70%, transparent);
  opacity: 0.6;
}
.site-footer p { margin: 4px 0; }
.site-footer .brand-mini {
  font-family: var(--ff-display);
  letter-spacing: 6px; color: var(--gold);
  font-weight: 900; font-size: 16px;
}

@media (max-width: 720px) {
  .nav { flex-direction: column; gap: 10px; }
  nav a { margin: 0 10px; }
  .hero h1 { font-size: 28px; }
  .query-form input, .query-form select { min-width: 0; width: 100%; }
  .query-form label { width: 100%; }
}
