/* Sectaria website — jade, gold and cream (matches the game HUD). */
:root {
  --jade-950: #0b2621;
  --jade-900: #123f35;
  --jade-800: #185244;
  --jade-700: #1f6553;
  --jade-500: #2f8a72;
  --jade-200: #cfe5d9;
  --gold-600: #a8822e;
  --gold-500: #c9a24a;
  --gold-300: #e7cf8a;
  --cream-50: #fffaf0;
  --cream-100: #f7efdc;
  --cream-200: #eee1c2;
  --ink: #2a2418;
  --ink-soft: #6a5d45;
  --line: #dccba3;
  --red: #a63a2c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.08), 0 4px 14px rgba(40, 30, 10, 0.06);
  --font: 'Sarabun', 'Noto Sans Thai', 'Leelawadee UI', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--ink); background: var(--cream-100) url('/assets/ui/site/paper.webp') repeat; background-size: 256px; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: var(--jade-700); }
a:hover { color: var(--jade-500); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; color: var(--jade-900); }
h2 { font-size: 1.2rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 0.4rem 0; }

/* language: show only the active one */
html[data-lang='th'] .l-en, html[data-lang='en'] .l-th { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; background: var(--gold-300); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 40px; min-height: 60vh; }

/* header */
.top { background: var(--jade-900) linear-gradient(180deg, var(--jade-800), var(--jade-950)); border-bottom: 2px solid var(--gold-500); position: sticky; top: 0; z-index: 5; }
.bar { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--gold-300); flex: none; }
.brand-logo { height: 44px; width: auto; display: block; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--cream-100); text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; font-size: 0.95rem; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav a.on { background: rgba(201, 162, 74, 0.2); color: var(--gold-300); box-shadow: inset 0 -2px 0 var(--gold-500); }
.bar-end { display: flex; align-items: center; gap: 10px; flex: none; }
.lang { display: flex; border: 1px solid rgba(231, 207, 138, 0.5); border-radius: 6px; overflow: hidden; }
.lang button { background: transparent; color: var(--cream-100); border: 0; padding: 4px 9px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.lang button[aria-pressed='true'] { background: var(--gold-500); color: var(--jade-950); font-weight: 700; }
.play, .btn.gold { background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); color: var(--jade-950); border: 1px solid var(--gold-600); }
.play { text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.play:hover { filter: brightness(1.05); color: var(--jade-950); }

/* footer */
.foot { background: var(--jade-950); color: var(--jade-200); padding: 24px 0; font-size: 0.9rem; border-top: 2px solid var(--gold-600); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.foot a { color: var(--gold-300); }

/* building blocks */
.page-title { font-size: 1.7rem; margin: 0.2rem 0 0.4rem; }
.lead { color: var(--ink-soft); font-size: 1.05rem; margin: 0 0 1rem; max-width: 70ch; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.panel { background: var(--cream-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.note { background: #f4ead0; border-left: 3px solid var(--gold-500); padding: 8px 12px; border-radius: 6px; }
.draft { background: #f8e1da; border: 1px solid var(--red); color: #6d2017; padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--jade-700); background: var(--jade-800); color: var(--cream-50); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn.big { padding: 12px 22px; font-size: 1.05rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.tag { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: var(--jade-200); color: var(--jade-900); font-weight: 700; vertical-align: middle; }
.tag.gold { background: var(--gold-300); color: #5a4210; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0 0 16px; }
.card { display: block; background: var(--cream-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
a.card:hover { border-color: var(--gold-500); transform: translateY(-1px); color: var(--ink); }
.card-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card.cls { display: flex; gap: 12px; align-items: center; }
.count-card { text-align: center; }
.count-card .big, .stat-card .big { display: block; font-size: 1.6rem; font-weight: 800; color: var(--jade-800); }
.stat-card { display: flex; align-items: center; gap: 12px; }
.stat-ico { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--jade-900); color: var(--gold-300); font-size: 1.2rem; border: 2px solid var(--gold-500); }
.stats-cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

dl.mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 8px 0; }
dl.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; margin: 0; }
.kv { display: flex; flex-direction: column; }
.kv dt { font-size: 0.75rem; color: var(--ink-soft); text-transform: none; }
.kv dd { margin: 0; font-weight: 700; }
.mini .kv dd { font-size: 0.85rem; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.93rem; background: var(--cream-50); }
.tbl caption { text-align: left; font-weight: 700; padding: 4px 0; color: var(--jade-800); }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--cream-200); vertical-align: top; }
.tbl thead th { background: var(--jade-900); color: var(--gold-300); font-weight: 600; text-align: left; }
.tbl thead th.r { text-align: right; }
.tbl tbody tr:hover { background: #fbf3df; }
.tbl.rank td.rk { font-weight: 800; color: var(--gold-600); width: 3em; }
.scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); margin: 0 0 12px; }
.scroll .tbl { min-width: 520px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.el { font-size: 0.78rem; padding: 0 6px; border-radius: 4px; background: var(--cream-200); white-space: nowrap; }
.el-fire { background: #f6d3c3; color: #8a2b12; } .el-water { background: #cfe2f3; color: #1d4c78; } .el-wood { background: #d8ecc9; color: #2e5b17; }
.el-metal { background: #e2e2e2; color: #444; } .el-earth { background: #ecdcc0; color: #6b4a1b; } .el-wind { background: #d7f0ea; color: #1d6555; }
.el-poison { background: #e6d4ef; color: #5b2a77; } .el-shadow { background: #d6d0e3; color: #2e2547; } .el-light { background: #fbf0c4; color: #7a5d06; }

/* wiki layout */
.with-side { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; background: var(--jade-950); border-radius: var(--radius); padding: 10px; border: 1px solid var(--gold-600); }
.side-nav a { display: flex; gap: 8px; align-items: center; color: var(--cream-100); text-decoration: none; padding: 6px 8px; border-radius: 6px; font-size: 0.93rem; }
.side-nav a:hover { background: rgba(255, 255, 255, 0.07); color: var(--gold-300); }
.side-h { color: var(--gold-500); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; margin: 10px 8px 4px; }
.ico { width: 1.2em; text-align: center; color: var(--gold-300); }
.crumbs { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 4px; }
.crumbs .sep { margin: 0 6px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.search, .sort, .search-bar input { font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0; }
.search { flex: 1 1 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip { font: inherit; font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--cream-50); color: var(--ink); cursor: pointer; }
.chip.on { background: var(--jade-800); color: var(--gold-300); border-color: var(--jade-800); }
.count { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 8px; }
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--cream-50); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.row:hover { border-color: var(--gold-500); color: var(--ink); }
.row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.row-side { color: var(--jade-700); text-align: right; max-width: 45%; }
.icon { width: 32px; height: 32px; image-rendering: pixelated; flex: none; background: var(--cream-200); border-radius: 6px; }
.icon.missing { visibility: hidden; }
.entity-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.entity-head .icon { width: 56px; height: 56px; }
.portrait { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; background: var(--cream-200); border-radius: 12px; }
.portrait.sm { width: 56px; height: 56px; }
.hero-banner { position: relative; display: flex; align-items: center; min-height: 300px; aspect-ratio: 3 / 1; max-height: 420px; width: 100%;
  background: var(--jade-900) url('/assets/ui/site/hero.webp') center / cover no-repeat; image-rendering: pixelated;
  border-radius: 14px; border: 2px solid var(--gold-600); margin-bottom: 18px; overflow: hidden; box-shadow: var(--shadow); }
.hero-banner.short { min-height: 170px; aspect-ratio: auto; max-height: none; }
.hero-banner::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255, 250, 236, 0.82) 0, rgba(255, 250, 236, 0.55) 38%, rgba(255, 250, 236, 0) 62%); }
.hero-copy { position: relative; max-width: 46%; padding: 24px 28px; }
.hero-copy .page-title { color: var(--jade-950); font-size: 2rem; margin-top: 0; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }
.hero-copy .lead { color: #3c3324; font-weight: 600; margin-bottom: 14px; }
.hero-banner.short .page-title { font-size: 1.6rem; }
.page-title.with-ico { display: flex; align-items: center; gap: 10px; }
.title-ico { width: 48px; height: 48px; flex: none; }
.cat-ico { width: 48px; height: 48px; display: block; margin: 0 auto 4px; }
.side-nav .px { width: 24px; height: 24px; flex: none; }
.medal { width: 28px; height: 28px; vertical-align: middle; }
.badge { width: 40px; height: 40px; vertical-align: middle; margin-right: 6px; }
.tab .badge-sm { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
.medal-cell { display: inline-flex; align-items: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.badge-xs { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.title-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-weight: 700; color: var(--jade-900); }
.prose { max-width: 75ch; }
.prose ul, .prose ol { padding-left: 1.3em; }
.chart th, .chart td.c { text-align: center; }
.chart .m1_5 { background: #d9efcf; font-weight: 700; } .chart .m0_75 { background: #f6dfd6; } .chart .m0_5 { background: #efd0c6; font-weight: 700; }
.links { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.links a { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--cream-50); text-decoration: none; }

.worldmap { overflow: auto; background: var(--jade-950); border-radius: var(--radius); border: 1px solid var(--gold-600); padding: 8px; }
.worldmap svg { display: block; }
.worldmap .links line { stroke: var(--gold-500); stroke-width: 2; opacity: 0.6; }
.worldmap .node rect { fill: var(--jade-800); stroke: var(--gold-500); }
.worldmap .node.town rect { fill: var(--gold-600); }
.worldmap .node text { fill: var(--cream-100); font-size: 13px; text-anchor: middle; font-family: var(--font); }
.worldmap .node text.sub { fill: var(--gold-300); font-size: 11px; }
.worldmap a:hover rect { stroke-width: 3; }

/* explorer */
.search-bar { display: flex; gap: 8px; margin: 0 0 16px; }
.search-bar input { flex: 1; font-size: 1.05rem; }
.tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; border-bottom: 2px solid var(--line); margin: 8px 0 12px; }
.tab { font: inherit; padding: 8px 14px; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-weight: 600; }
.tab.on { color: var(--jade-900); border-bottom-color: var(--gold-500); }
.tab-panel .tabs { border-bottom: 0; }
.tab-panel .tabs .tab { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; margin: 0; font-size: 0.9rem; }
.tab-panel .tabs .tab.on { background: var(--jade-800); color: var(--gold-300); border-color: var(--jade-800); }
.item-cell { display: inline-flex; align-items: center; gap: 6px; }
.item-cell img { image-rendering: pixelated; }
.empty { padding: 20px; text-align: center; }
.chart-svg { width: 100%; height: auto; }
.chart-svg .line { fill: none; stroke: var(--jade-500); stroke-width: 2.5; }
.chart-svg circle { fill: var(--gold-500); }
.chart-svg text { font-size: 11px; fill: var(--ink-soft); }
.char-head { margin: 10px 0; }

/* download / changelog / faq / legal */
.platforms { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.platform.mine { border-color: var(--gold-500); box-shadow: 0 0 0 2px var(--gold-300); }
.steps { padding-left: 1.3em; margin: 0; }
.timeline { list-style: none; padding: 0; }
.timeline time { font-weight: 800; color: var(--gold-600); }
.faq details summary { cursor: pointer; font-weight: 700; color: var(--jade-900); }
.toc { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }

@media (max-width: 860px) {
  .with-side { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; padding: 6px; }
  .side-nav { display: flex; flex-wrap: nowrap; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
  .side-nav a { white-space: nowrap; flex: none; }
  .side-h { display: none; }
  .cols2 { grid-template-columns: 1fr; }
  .hero-banner { background-position: 70% center; aspect-ratio: auto; min-height: 240px; }
  .hero-banner::before { background: linear-gradient(180deg, rgba(255, 250, 236, 0.85) 0, rgba(255, 250, 236, 0.6) 55%, rgba(255, 250, 236, 0.1) 100%); }
  .hero-copy { max-width: 100%; padding: 18px; }
  .hero-copy .page-title { font-size: 1.5rem; }
}
@media (max-width: 560px) {
  .bar { flex-wrap: wrap; gap: 8px; }
  .brand-logo { height: 36px; }
  .nav { order: 3; flex-basis: 100%; }
  .bar-end { margin-left: auto; }
  .page-title { font-size: 1.35rem; }
  dl.mini { grid-template-columns: repeat(2, 1fr); }
  .row-side { display: none; }
}
.content { min-width: 0; }
