/* Royal Tournament Wiki */
:root {
  --bg: #f4f5f7;
  --paper: #ffffff;
  --ink: #1d2024;
  --ink-2: #4b525c;
  --ink-3: #6f7782;
  --line: #d9dde3;
  --line-2: #eceef1;
  --link: #2f5fb3;
  --link-visited: #5a4aa8;
  --gold: #a8812f;
  --gold-soft: #f6efdc;
  --head-bg: #1f2226;
  --head-ink: #eef1f5;
  --open-bg: #fff6e0;
  --open-line: #e2b443;
  --chip-bg: #f1f3f6;
  --buff: #2f8656;
  --debuff: #a83a3a;
  --lane-a: #2f6db3;
  --lane-b: #b0761f;
  --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 4px 16px rgba(20, 24, 30, .05);
  --serif: "Linux Libertine", "Georgia", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Menlo", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101214;
  --paper: #17191c;
  --ink: #e4e7eb;
  --ink-2: #b3b9c2;
  --ink-3: #8a929c;
  --line: #2e3238;
  --line-2: #23262a;
  --link: #86b0ee;
  --link-visited: #b3a5ee;
  --gold: #d6b25f;
  --gold-soft: #2a2518;
  --head-bg: #0b0c0e;
  --open-bg: #2a2416;
  --open-line: #9c7a2a;
  --chip-bg: #22252a;
  --buff: #4fb57c;
  --debuff: #e06a6a;
  --lane-a: #6aa0e6;
  --lane-b: #e0a24a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101214; --paper: #17191c; --ink: #e4e7eb; --ink-2: #b3b9c2; --ink-3: #8a929c;
    --line: #2e3238; --line-2: #23262a; --link: #86b0ee; --link-visited: #b3a5ee; --gold: #d6b25f;
    --gold-soft: #2a2518; --head-bg: #0b0c0e; --open-bg: #2a2416; --open-line: #9c7a2a; --chip-bg: #22252a;
    --buff: #4fb57c; --debuff: #e06a6a; --lane-a: #6aa0e6; --lane-b: #e0a24a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: .88em var(--mono); background: var(--chip-bg); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--chip-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
pre code { background: none; padding: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* header */
.top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--head-bg); color: var(--head-ink); border-bottom: 2px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--head-ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 600 18px/1.1 var(--serif); letter-spacing: .02em; }
.brand-sub { font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: #c9a24a; }
.logo { display: block; }
.search { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.search input { width: 100%; padding: 9px 14px; border-radius: 8px; border: 1px solid #3a3f46; background: #2a2e34; color: #eef1f5; font: inherit; font-size: 15px; }
.search input::placeholder { color: #9aa2ad; }
.search input:focus { outline: 2px solid #c9a24a; outline-offset: 1px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; padding: 6px; }
.search-results a, .sr-item { display: block; padding: 8px 10px; border-radius: 7px; color: var(--ink); }
.search-results a:hover, .search-results a.sel { background: var(--chip-bg); text-decoration: none; }
.sr-t { font-weight: 600; }
.sr-k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-left: 6px; }
.sr-s { display: block; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-empty { padding: 10px; color: var(--ink-3); font-size: 14px; }
.sr-all { border-top: 1px solid var(--line-2); margin-top: 4px; font-size: 14px; }
.theme-btn, .menu-btn { background: none; border: 1px solid #3a3f46; color: var(--head-ink); border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; flex: none; }
.theme-btn:hover, .menu-btn:hover { border-color: #c9a24a; }
.menu-btn { display: none; }

/* layout */
.wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; max-width: 1320px; margin: 0 auto; padding: 24px 20px 40px; }
.sidebar { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 14px; padding-right: 6px; }
.nav-group { margin-bottom: 18px; }
.nav-h { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; padding: 0 8px; }
.nav-h a { color: var(--ink-3); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 3px 8px; border-radius: 6px; color: var(--ink-2); }
.sidebar li a:hover { background: var(--paper); color: var(--link); text-decoration: none; }
.sidebar li.cur a { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }

/* article */
.article { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 28px 36px 24px; box-shadow: var(--shadow); }
.title { font: 400 2.1rem/1.2 var(--serif); margin: 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.article.class .title { border-bottom: 3px solid var(--cc); }
.tagline { font-size: 13px; color: var(--ink-3); margin: 6px 0 18px; }
.body { overflow-wrap: break-word; }
.body::after { content: ""; display: block; clear: both; }
.body h2 { font: 400 1.55rem/1.3 var(--serif); margin: 1.6em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.body h3 { font-size: 1.12rem; margin: 1.4em 0 .4em; }
.class .body h3 { font: 400 1.25rem var(--serif); color: var(--ink-2); margin-top: 1.8em; }
.body h4 { font-size: 1.05rem; margin: 1.1em 0 .3em; }
.body p, .body ul, .body ol { margin: .5em 0 .9em; }
.body li { margin: .2em 0; }
.body h2 + p, .body h3 + p { margin-top: .3em; }

.table-wrap { overflow-x: auto; margin: .6em 0 1.1em; max-width: 100%; }
.body table { border-collapse: collapse; font-size: 14.5px; min-width: 50%; }
.body th, .body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.body thead th { background: var(--chip-bg); font-weight: 600; }
table.sortable thead th { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable thead th::after { content: " ⇅"; color: var(--ink-3); font-size: 11px; }
table.sortable thead th.asc::after { content: " ▲"; color: var(--gold); }
table.sortable thead th.desc::after { content: " ▼"; color: var(--gold); }

/* toc */
.toc { display: inline-block; min-width: 240px; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px 10px 14px; margin: 6px 0 10px; font-size: 14.5px; }
.toc-title { font-weight: 700; margin-bottom: 4px; text-align: center; }
.toc ol { margin: 0; padding-left: 1.3em; counter-reset: none; }
.toc ol ol { padding-left: 1.2em; }
.toc li { margin: 1px 0; }

/* infobox */
.infobox { float: right; clear: right; width: 290px; margin: 0 0 16px 22px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); font-size: 14px; }
.ib-title { background: var(--head-bg); color: var(--head-ink); text-align: center; font: 600 1.05rem var(--serif); padding: 9px 10px; border-bottom: 3px solid var(--cc, var(--gold)); }
.infobox table { width: 100%; border-collapse: collapse; min-width: 0; }
.infobox th, .infobox td { border: 0; border-top: 1px solid var(--line-2); padding: 6px 10px; vertical-align: top; }
.infobox th { width: 42%; text-align: left; color: var(--ink-2); font-weight: 600; }
.infobox tr:first-child th, .infobox tr:first-child td { border-top: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid rgba(0,0,0,.25); }

/* callouts */
.admonition { border-left: 4px solid var(--line); background: var(--bg); border-radius: 8px; padding: 10px 14px; margin: 1.2em 0; font-size: 15px; }
.admonition p { margin: .2em 0; }
.admonition-title { font-weight: 700; }
.admonition.open { border-left-color: var(--open-line); background: var(--open-bg); }
.admonition.open .admonition-title::before { content: "◔ "; color: var(--open-line); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 0 7px 0 2px; border-radius: 6px; background: var(--chip-bg); border: 1px solid var(--line);
  font-weight: 600; font-size: .92em; line-height: 1.55; white-space: nowrap; color: var(--ink); position: relative; vertical-align: baseline; }
a.chip:hover { text-decoration: none; border-color: var(--cc, var(--gold)); }
.chip-icon { display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 4px; font-size: .68em; letter-spacing: -.02em;
  color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--cc) 85%, white), color-mix(in srgb, var(--cc) 70%, black)); margin: 1px 0; }
.chip-aura { padding: 0 7px 0 7px; }
.chip-aura::before { content: ""; width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.chip-buff::before { background: var(--buff); }
.chip-debuff::before { background: var(--debuff); }
.chip[data-tip]:hover::after, .chip[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 20;
  width: max-content; max-width: 280px; white-space: normal; background: var(--head-bg); color: var(--head-ink); font-weight: 400; font-size: 13px; line-height: 1.4;
  padding: 7px 10px; border-radius: 7px; box-shadow: var(--shadow); pointer-events: none; }
.gcd { display: inline-block; font: 700 12px/1.6 var(--mono); padding: 0 6px; border-radius: 5px; color: #fff; }
.gcd-a { background: var(--lane-a); }
.gcd-b { background: var(--lane-b); }
.gcd-off { background: var(--ink-3); }
.gcd-tbd { background: transparent; color: var(--ink-3); border: 1px dashed var(--ink-3); }

/* ability cards */
.ability-card { border: 1px solid var(--line); border-left: 4px solid var(--cc); border-radius: 10px; padding: 14px 16px 10px; margin: .4em 0 1.4em; background: var(--bg); }
.ab-head { display: flex; gap: 14px; align-items: center; }
.ab-icon { flex: none; width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; font: 700 18px var(--sans); color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--cc) 80%, white), color-mix(in srgb, var(--cc) 65%, black));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 0 0 1px rgba(0,0,0,.35); }
.ab-name { font-weight: 700; font-size: 1.1rem; }
.ab-tip { color: var(--ink-2); font-style: italic; font-size: 15px; line-height: 1.45; }
.ab-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin: 12px 0 8px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 8px; font-size: 14px; }
.stat .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.stat .v { font-weight: 600; }
.ab-details { margin: .4em 0 .6em; padding-left: 1.2em; }
.ab-counter { font-size: 14.5px; padding: 8px 12px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line-2); margin: 6px 0; }
.ab-open { font-size: 14px; padding: 8px 12px; border-radius: 8px; background: var(--open-bg); border-left: 3px solid var(--open-line); margin: 6px 0; }
.ab-open ul { margin: .2em 0 0; padding-left: 1.2em; }
.ab-id { font-size: 12px; color: var(--ink-3); text-align: right; margin-top: 6px; }
.ab-id code { font-size: 12px; }
.body h4 + .ability-card { margin-top: .2em; }

/* filter */
.filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.filter button { font: inherit; font-size: 14px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.filter button.on { background: var(--cc, var(--gold)); border-color: var(--cc, var(--gold)); color: #fff; }

/* class cards */
.class-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: .6em 0 1em; }
.class-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 10px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-top: 4px solid var(--cc); transition: transform .12s, box-shadow .12s; }
.class-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.cc-name { font: 600 1.25rem var(--serif); color: var(--cc); filter: brightness(1.1); }
.cc-role { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.cc-sum { font-size: 14px; color: var(--ink-2); line-height: 1.45; }

/* categories */
.catlinks { margin-top: 26px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.catlinks span { font-weight: 600; }
.catlist li { margin: .35em 0; }
.catlist .sum { color: var(--ink-2); }

/* search page */
.search-big { display: flex; gap: 8px; margin: 4px 0 18px; }
.search-big input { flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.search-big button { padding: 10px 18px; border-radius: 8px; border: 0; background: var(--head-bg); color: var(--head-ink); font: inherit; font-weight: 600; cursor: pointer; }
.sp-item { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.sp-item a { font-weight: 600; font-size: 1.05rem; }
.sp-item p { margin: 2px 0 0; color: var(--ink-2); font-size: 14.5px; }
mark { background: var(--gold-soft); color: inherit; padding: 0 1px; border-radius: 2px; }

/* home */
.home .welcome { background: var(--head-bg); color: var(--head-ink); border-radius: 14px; padding: 30px 34px; margin-bottom: 22px; position: relative; overflow: hidden;
  border: 1px solid #2e3238; box-shadow: var(--shadow); }
.home .welcome::after { content: ""; position: absolute; inset: auto -60px -80px auto; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,74,.22), transparent 65%); }
.home .welcome h1 { font: 400 2.2rem/1.2 var(--serif); margin: 0 0 8px; }
.home .welcome h1 span { color: #d6b25f; }
.home .welcome p { margin: 4px 0; color: #c4cad2; max-width: 760px; position: relative; z-index: 1; }
.home .welcome a { color: #e6c674; }
.home .counts { margin-top: 12px !important; font-size: 14px; }
.home .counts b { color: #fff; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.home-col { display: flex; flex-direction: column; gap: 22px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; box-shadow: var(--shadow); }
.box h2 { font: 400 1.35rem var(--serif); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--gold); }
.box h3 { margin: 0 0 6px; font-size: 1.15rem; }
.box p { margin: .4em 0; }
.box .more { font-size: 14px; margin-top: 10px; }
.facts, .dyk, .status { padding-left: 1.2em; margin: .4em 0; }
.status { list-style: none; padding-left: 0; }
.facts li, .dyk li, .status li { margin: .35em 0; }
.topics-box { margin-top: 22px; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.topic { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.topic:hover { text-decoration: none; border-color: var(--gold); }
.t-name { font-weight: 600; }
.t-count { font-size: 13px; color: var(--ink-3); }

/* footer */
.foot { max-width: 1320px; margin: 0 auto; padding: 18px 20px 40px; font-size: 13px; color: var(--ink-3); text-align: center; }
.foot p { margin: 3px 0; }

/* responsive */
@media (max-width: 960px) {
  .wrap { grid-template-columns: 1fr; padding: 14px 12px 30px; }
  .menu-btn { display: block; }
  .sidebar { position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; max-height: none; background: var(--bg); z-index: 40; padding: 16px 12px;
    border-right: 1px solid var(--line); transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .top { gap: 10px; padding: 10px 12px; }
  .brand-text { display: none; }
  .article { padding: 20px 16px; border-radius: 10px; }
  .title { font-size: 1.7rem; }
  .infobox { float: none; width: 100%; margin: 0 0 16px; }
  .home .welcome { padding: 22px 20px; }
  .home .welcome h1 { font-size: 1.7rem; }
  .toc { display: block; }
}
@media print {
  .top, .sidebar, .foot, .toc { display: none; }
  .wrap { display: block; }
  .article { border: 0; box-shadow: none; }
}
@media (max-width: 680px) { .body td { min-width: 6.5em; } }
