/* 아르케온 홈페이지 — 레이아웃: 위 고정 막대 + 가운데 1120px 본문, 표·카드는 같은 판 위에 */
:root {
  /* 어두운 쪽이 기본 (게임 화면과 같은 쇠·잉걸불 색) */
  --bg: #171513;
  --panel: #211e1a;
  --panel2: #2a2621;
  --line: #3b352d;
  --fg: #ebe3d5;
  --muted: #a39683;
  --gold: #d6a24a;
  --gold-ink: #1b1508;
  --blood: #c0563d;
  --unique: #e0b04e;
  --legend: #e07a3f;
  --link: #e5bd6e;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --f-display: "Nanum Myeongjo", "Noto Serif KR", "Batang", serif;
  --f-body: "IBM Plex Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eceeed; --panel: #ffffff; --panel2: #f4f5f3; --line: #d5d7d2; --fg: #1d1f1e; --muted: #5f645f;
    --gold: #9a6912; --gold-ink: #ffffff; --blood: #a33d27; --unique: #9a6912; --legend: #b4511c; --link: #8a5a0a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eceeed; --panel: #ffffff; --panel2: #f4f5f3; --line: #d5d7d2; --fg: #1d1f1e; --muted: #5f645f;
  --gold: #9a6912; --gold-ink: #ffffff; --blood: #a33d27; --unique: #9a6912; --legend: #b4511c; --link: #8a5a0a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06); color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.65 var(--f-body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--panel); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(26px, 4vw, 34px); }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
code { font-family: var(--f-num); font-size: .9em; background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main.wrap { padding-block: 28px 56px; display: grid; gap: 22px; }
main.wrap > * { min-width: 0; }
.sm { color: var(--muted); font-size: 13px; }
.lead { color: var(--muted); margin: -10px 0 0; max-width: 70ch; }

/* 위 막대 */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 18px; min-height: 58px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--fg); font: 800 20px var(--f-display); letter-spacing: .02em; }
.logo img { width: 30px; height: 30px; image-rendering: auto; }
.logo:hover { text-decoration: none; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-weight: 500; }
.top nav a:hover { color: var(--fg); background: var(--panel2); text-decoration: none; }
.top nav a.on { color: var(--gold); }
.menu { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 6px; font-size: 18px; padding: 2px 10px; }
.search { position: relative; margin-left: auto; width: 230px; }
.search input { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px; }
#qr { position: absolute; top: calc(100% + 4px); right: 0; width: min(340px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; display: none; z-index: 40; }
#qr.open { display: block; }
#qr a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; color: var(--fg); }
#qr a:hover, #qr a.sel { background: var(--panel2); text-decoration: none; }
#qr img { width: 28px; height: 28px; object-fit: contain; }
#qr .k { margin-left: auto; color: var(--muted); font-size: 12px; }
@media (max-width: 860px) {
  .menu { display: block; }
  .search { order: 3; width: 100%; margin: 0 0 10px; }
  .bar { flex-wrap: wrap; gap: 10px; }
  .top nav { display: none; width: 100%; order: 4; padding-bottom: 8px; }
  body.navopen .top nav { display: flex; }
}

/* 첫 화면 */
.hero { position: relative; border-radius: 14px; overflow: hidden; padding: 44px 32px 36px; background:
  radial-gradient(120% 140% at 85% 0%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 55%),
  linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); }
.hero h1 { font-size: clamp(40px, 8vw, 72px); letter-spacing: .04em; color: var(--fg); }
.hero p { margin: 6px 0 0; max-width: 46ch; font-size: 17px; }
.hero .btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.bestiary { display: flex; gap: 0; margin-top: 18px; overflow: hidden; mask-image: linear-gradient(90deg, #000 70%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent); }
.bestiary img { width: 92px; height: 92px; object-fit: contain; margin-right: -18px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); }
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line); color: var(--fg); background: var(--panel2); font-weight: 700; }
.btn:hover { text-decoration: none; border-color: var(--gold); }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn.big { font-size: 17px; padding: 14px 24px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.stats div { padding: 14px 16px; color: var(--muted); font-size: 13px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font: 600 26px var(--f-num); color: var(--fg); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } .stats div:nth-child(3) { border-right: 0; } .stats div:nth-child(n+4) { border-top: 1px solid var(--line); } }

/* 판 */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.cols > * { min-width: 0; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.box.wide { grid-column: 1 / -1; }
.box ul, .box ol { margin: 0; padding-left: 20px; }
.note { background: color-mix(in srgb, var(--gold) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); border-radius: 10px; padding: 12px 16px; }
.tag { display: inline-block; font-size: 12px; line-height: 1.4; padding: 2px 8px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.tag.lv { font-family: var(--f-num); color: var(--fg); }
.crumb { margin: 0; color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { display: grid; gap: 6px; align-content: start; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--fg); }
.card:hover { border-color: var(--gold); text-decoration: none; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.news { list-style: none; padding: 0 !important; display: grid; gap: 2px; }
.news a { display: flex; gap: 12px; color: var(--fg); padding: 4px 0; }
.news .d { color: var(--muted); font: 13px var(--f-num); white-space: nowrap; padding-top: 2px; }
.clsrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cls { display: grid; justify-items: center; text-align: center; gap: 4px; }
.cls img { height: 120px; object-fit: contain; }
.cls p { margin: 0; color: var(--muted); font-size: 13px; }
@media (max-width: 560px) { .clsrow { grid-template-columns: 1fr; } }

/* 표 */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .04em; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel2); white-space: nowrap; }
.t td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t td:nth-child(2) { font-variant-numeric: tabular-nums; }
.t tr[hidden] { display: none; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fq { background: var(--panel); border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: 8px 12px; font: inherit; width: 220px; max-width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.chips button.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

/* 아이템·몬스터 링크 */
.it, .mon { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); vertical-align: middle; }
.it:hover, .mon:hover { color: var(--link); }
.it.gu, h1.gu { color: var(--unique); }
.it.gl, h1.gl { color: var(--legend); }
.ic { width: 24px; height: 24px; object-fit: contain; flex: none; }
.ic.ph { display: inline-block; border-radius: 4px; background: var(--panel2); }
.mi { width: 40px; height: 40px; object-fit: contain; flex: none; }
.hero-card { display: flex; gap: 18px; align-items: center; }
.hero-card .ic { width: 64px; height: 64px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.hero-card h1 { margin-bottom: 6px; }
.portrait { width: 140px; height: 140px; object-fit: contain; background: radial-gradient(circle at 50% 70%, var(--panel2), transparent 70%); border-radius: 12px; }
.drop { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.drop:first-of-type { border-top: 0; }
.dh { color: var(--muted); font-size: 13px; padding-top: 2px; }
.dl { display: flex; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
@media (max-width: 560px) { .drop { grid-template-columns: 1fr; gap: 4px; } .hero-card { align-items: flex-start; } .portrait { width: 96px; height: 96px; } }
.mat { display: inline-flex; align-items: center; margin-right: 10px; white-space: nowrap; }
.mat.base .it { color: var(--muted); }

/* 지역 */
.town { display: grid; gap: 12px; scroll-margin-top: 80px; }
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.mapc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; align-content: start; scroll-margin-top: 80px; min-width: 0; }
.mapc:target { border-color: var(--gold); }
.mh { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mh h3 { margin-right: auto; }
.ml { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ml .mi { width: 32px; height: 32px; }
.bossline { color: var(--blood); font-size: 14px; }
.bossline .mon { color: var(--blood); font-weight: 700; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details .dl { padding-top: 6px; }

/* 가이드 */
.gl { display: grid; grid-template-columns: 210px 1fr; gap: 28px; align-items: start; }
.gl > * { min-width: 0; }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); display: grid; gap: 2px; }
.side a { color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.side a.on { color: var(--gold); background: var(--panel); }
.doc { max-width: 760px; display: grid; gap: 12px; }
.doc h2 { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.doc h3 { margin-top: 6px; }
.doc p, .doc ul, .doc ol { margin: 0; }
@media (max-width: 760px) { .gl { grid-template-columns: 1fr; } .side { position: static; display: flex; flex-wrap: wrap; } }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; padding-block: 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.homecols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .homecols { grid-template-columns: 1fr; } }
.where { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.where li::before { content: "📍"; content: "· "; color: var(--muted); }
figure { margin: 4px 0; display: grid; gap: 6px; justify-items: start; }
figure img { background: radial-gradient(120% 140% at 50% 0%, #3a332b, #1d1a16); border: 1px solid var(--line); border-radius: 12px; padding: 10px; max-width: 100%; height: auto; }
figcaption { color: var(--muted); font-size: 13px; }
.must .keys td:first-child { white-space: nowrap; }
kbd { font-family: var(--f-num); font-size: 12px; padding: 2px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--panel2); color: var(--fg); white-space: nowrap; }
.must .t td:nth-child(2) { white-space: nowrap; }
.must-card { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: color-mix(in srgb, var(--gold) 8%, var(--panel)); }
.must-card h3 { color: var(--gold); }
.side a.must-link { color: var(--gold); font-weight: 700; }
