/* SILAMANI Wiki (docs/36): the game's dark violet and gold, Mali for Thai, pixel art kept crisp. */
@font-face { font-family: Mali; font-weight: 400; font-display: swap; src: url(/fonts/mali-400-thai.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Mali; font-weight: 400; font-display: swap; src: url(/fonts/mali-400-latin.woff2) format('woff2'); }
@font-face { font-family: Mali; font-weight: 600; font-display: swap; src: url(/fonts/mali-600-thai.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Mali; font-weight: 600; font-display: swap; src: url(/fonts/mali-600-latin.woff2) format('woff2'); }
@font-face { font-family: Mali; font-weight: 700; font-display: swap; src: url(/fonts/mali-700-thai.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Mali; font-weight: 700; font-display: swap; src: url(/fonts/mali-700-latin.woff2) format('woff2'); }
@font-face { font-family: Pixelify; font-weight: 700; font-display: swap; src: url(/fonts/pixelify-sans-700-latin.woff2) format('woff2'); }

:root {
  --bg: #120b1c; --bg2: #0d0815; --panel: #1b1228; --panel2: #231833; --line: #34264a; --line2: #2a1f3b;
  --ink: #f2e9d6; --ink2: #d6cbe4; --dim: #a597ba; --faint: #76678c; --link: #f5c55a; --link2: #ffdd8a;
  --gold: #f2c14e; --teal: #6fd6d0; --red: #ff7a6a; --green: #7fd88a; --violet: #b48cff; --blue: #7aa8ff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r-common: #cfc8dc; --r-uncommon: #8fe39a; --r-rare: #79bdff; --r-epic: #cf9bff; --r-legendary: #ffbf55;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf6ee; --bg2: #f1ebe0; --panel: #ffffff; --panel2: #fbf7f0; --line: #e2d8c6; --line2: #ece4d6;
    --ink: #241a33; --ink2: #3a2e4c; --dim: #6c5f80; --faint: #9a8fae; --link: #9a5b00; --link2: #b86e00;
    --gold: #b07a10; --teal: #138a82; --red: #c0392b; --green: #2e8b46; --violet: #7a4fd0; --blue: #2f6bd8;
    --shadow: 0 8px 24px rgba(60, 40, 20, .12);
    --r-common: #6d6380; --r-uncommon: #2e8b46; --r-rare: #2f6bd8; --r-epic: #7a4fd0; --r-legendary: #b86e00;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #faf6ee; --bg2: #f1ebe0; --panel: #ffffff; --panel2: #fbf7f0; --line: #e2d8c6; --line2: #ece4d6;
  --ink: #241a33; --ink2: #3a2e4c; --dim: #6c5f80; --faint: #9a8fae; --link: #9a5b00; --link2: #b86e00;
  --gold: #b07a10; --teal: #138a82; --red: #c0392b; --green: #2e8b46; --violet: #7a4fd0; --blue: #2f6bd8;
  --shadow: 0 8px 24px rgba(60, 40, 20, .12);
  --r-common: #6d6380; --r-uncommon: #2e8b46; --r-rare: #2f6bd8; --r-epic: #7a4fd0; --r-legendary: #b86e00;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.65 Mali, system-ui, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link2); text-decoration: underline; }
img.px, .px img { image-rendering: pixelated; image-rendering: crisp-edges; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; }
h2 { font-size: 21px; margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 10px; }
h2 small { font-size: 13px; color: var(--dim); font-weight: 400; }
h3 { font-size: 17px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
code { font-size: .9em; background: var(--bg2); padding: 1px 6px; border-radius: 6px; }

/* the top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--gold); font: 700 20px/1 Pixelify, Mali, sans-serif; letter-spacing: .06em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--gold); }
.brand img { image-rendering: pixelated; border-radius: 6px; }
.brand small { font: 600 13px Mali, sans-serif; letter-spacing: 0; color: var(--dim); margin-left: 6px; }
.search { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.search input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 14px; font: inherit; font-size: 15px; outline: none; }
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
.results { position: absolute; left: 0; right: 0; top: 46px; max-height: min(70vh, 520px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.results a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--ink); }
.results a:hover, .results a.on { background: var(--panel2); text-decoration: none; }
.results a img, .results a .sp { width: 28px; height: 28px; image-rendering: pixelated; flex: none; object-fit: contain; }
.results a span { flex: 1; min-width: 0; }
.results a small { color: var(--dim); font-size: 12px; white-space: nowrap; }
.results .none { padding: 10px; color: var(--dim); }
.top button { flex: none; height: 40px; min-width: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 18px; cursor: pointer; }
.top .menu { display: none; }
.play { flex: none; height: 40px; line-height: 40px; padding: 0 16px; border-radius: 12px; background: var(--gold); color: #1a1020 !important; font-weight: 700; white-space: nowrap; }
.play:hover { text-decoration: none; filter: brightness(1.08); }

/* the frame */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); max-width: 1380px; margin: 0 auto; }
.side { position: sticky; top: 61px; align-self: start; height: calc(100vh - 61px); overflow-y: auto; padding: 16px 10px 40px 16px; border-right: 1px solid var(--line2); }
.side .ng { margin-bottom: 14px; }
.side h4 { font-size: 12px; color: var(--faint); letter-spacing: .04em; margin: 0 0 4px 8px; font-weight: 600; }
.side a { display: block; padding: 4px 10px; border-radius: 8px; color: var(--ink2); font-size: 15px; }
.side a:hover { background: var(--panel); text-decoration: none; }
.side a.on { background: var(--panel2); color: var(--gold); font-weight: 600; }
.main { min-width: 0; padding: 18px 28px 40px; }
.crumbs { font-size: 13px; color: var(--dim); margin-bottom: 10px; }
.crumbs span { margin: 0 4px; color: var(--faint); }
.head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.head .hicon { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); padding: 4px; flex: none; }
.head h1 { font-size: clamp(24px, 3.4vw, 34px); }
.lead { color: var(--dim); margin: 4px 0 0; font-size: 15px; }
.page.has-box { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; align-items: start; }
.page.has-box .infobox { grid-column: 2; grid-row: 1; position: sticky; top: 76px; }
.page.has-box .content { grid-column: 1; grid-row: 1; min-width: 0; }
.content > section:first-child h2, .content > h2:first-child { margin-top: 0; }

/* the info box */
.infobox { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.bx-title { padding: 10px 14px; font-weight: 700; background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 22%, var(--panel2)), var(--panel2)); border-bottom: 1px solid var(--line); }
.bx-pic { display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 70%); border-bottom: 1px solid var(--line2); }
.bx-pic img { image-rendering: pixelated; max-width: 100%; }
.infobox dl { margin: 0; padding: 6px 14px 12px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.infobox dt { color: var(--dim); }
.infobox dd { margin: 0; overflow-wrap: anywhere; }

/* pieces */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 14px; line-height: 1.6; vertical-align: middle; max-width: 100%; }
.chip img { width: 24px; height: 24px; object-fit: contain; flex: none; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--dim); font-size: 12px; white-space: nowrap; }
a.chip:hover { border-color: var(--gold); text-decoration: none; color: var(--ink); }
.rar { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; line-height: 1.7; }
.r-common { color: var(--r-common); } .r-uncommon { color: var(--r-uncommon); } .r-rare { color: var(--r-rare); } .r-epic { color: var(--r-epic); } .r-legendary { color: var(--r-legendary); }
.tag { display: inline-block; font-size: 12px; padding: 0 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--dim); white-space: nowrap; line-height: 1.7; margin-right: 4px; }
.tag.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.tag.red { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, var(--line)); }
.tag.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 50%, var(--line)); }
.note { font-size: 13px; color: var(--dim); }
.callout { padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--gold) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); margin: 0 0 16px; }
.callout b { color: var(--gold); }
.spoiler { border: 1px dashed var(--line); border-radius: 12px; padding: 8px 14px; margin: 8px 0; background: var(--panel); }
.spoiler summary { cursor: pointer; font-weight: 600; }
.spoiler summary small { color: var(--dim); font-weight: 400; }
.spoiler[open] summary { margin-bottom: 8px; }
.quote { border-left: 3px solid var(--gold); padding: 4px 0 4px 14px; margin: 6px 0; color: var(--ink2); font-style: italic; }

/* tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); margin: 0 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 8px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line2); }
th { position: sticky; top: 0; background: var(--panel2); color: var(--dim); font-size: 13px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--gold) 5%, transparent); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th::after { content: ' ↕'; color: var(--faint); font-size: 11px; }
table.sortable th.asc::after { content: ' ↑'; color: var(--gold); }
table.sortable th.desc::after { content: ' ↓'; color: var(--gold); }
td .chip { margin: 1px 4px 1px 0; }
.ing { display: flex; flex-wrap: wrap; gap: 2px 0; }

/* cards (home, lists) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 0 0 18px; }
.card { display: block; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--gold); text-decoration: none; color: var(--ink); }
.card .ct { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.card .ct img { width: 34px; height: 34px; image-rendering: pixelated; object-fit: contain; }
.card p { margin: 6px 0 0; font-size: 13.5px; color: var(--dim); }
.card .num { color: var(--gold); font-weight: 700; }
.grid-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 18px; }
.gi { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 14px; min-width: 0; }
.gi:hover { border-color: var(--gold); text-decoration: none; color: var(--ink); }
.gi img { width: 36px; height: 36px; object-fit: contain; flex: none; image-rendering: pixelated; }
.gi span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero { position: relative; border-radius: 20px; overflow: hidden; margin: 0 0 22px; border: 1px solid var(--line); background: #0b0712; min-height: 220px; display: flex; align-items: flex-end; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.hero .hx { position: relative; padding: 22px 24px; background: linear-gradient(180deg, transparent, rgba(8, 4, 14, .92)); width: 100%; color: #f6ecd8; }
.hero h2 { border: 0; margin: 0 0 6px; font-size: clamp(22px, 3vw, 30px); color: #ffd780; }
.hero p { margin: 0; color: #e2d6ee; }
.scene { width: 100%; border-radius: 16px; border: 1px solid var(--line); margin: 0 0 16px; display: block; }
.mon { image-rendering: pixelated; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 0 0 16px; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.stats b { display: block; font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--dim); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.toc a { font-size: 13px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink2); }
.toc a:hover { border-color: var(--gold); text-decoration: none; }
.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line2); font-size: 13px; color: var(--dim); }
.foot p { margin: 0 0 4px; }
.guide p, .guide li { font-size: 16px; }
.guide ul, .guide ol { padding-left: 22px; margin: 0 0 12px; }
.guide li { margin: 0 0 4px; }

/* phones and narrow screens */
@media (max-width: 1100px) {
  .page.has-box { grid-template-columns: minmax(0, 1fr); }
  .page.has-box .infobox { grid-column: 1; grid-row: 1; position: static; }
  .page.has-box .content { grid-column: 1; grid-row: 2; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 61px; bottom: 0; height: auto; width: min(300px, 86vw); z-index: 30; background: var(--bg); border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; }
  .top .menu { display: block; }
  .main { padding: 14px 16px 30px; }
  .brand small { display: none; }
  .play { padding: 0 12px; }
}
@media (max-width: 560px) {
  .top { gap: 8px; padding: 8px 10px; }
  .brand span { display: none; }
  .theme { display: none; }
  .head .hicon { width: 52px; height: 52px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  th, td { padding: 7px 9px; }
}
