:root {
  color-scheme: dark;
  --text: #f0f0f0;
  --muted: #b8b8b8;
  --line: #474747;
  --accent: #ffb019;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, rgba(14, 13, 12, .3), rgba(14, 13, 12, .83) 720px), url("assets/ror.jpg") center / cover fixed no-repeat, #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
.app-shell { width: min(1440px, 100%); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0; }
h1 { font-size: clamp(22px, 2.5vw, 30px); line-height: 1.25; margin: 0 0 6px; }
h1 a { color: var(--accent); text-decoration: none; }
h1 span { color: #dedede; font-weight: 500; }
.subtitle { margin: 0; color: #ddd; }
a { color: #ffcd6b; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, select, input { border: 1px solid #666; border-radius: 5px; background: #1c1c1c; color: var(--text); min-height: 38px; padding: 7px 10px; }
button { cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled), button[aria-pressed="true"] { border-color: var(--accent); color: #ffcf70; background: #3c321f; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: #d4921d; color: #141414; border-color: #e6a62f; font-weight: 650; }
button.primary:hover:not(:disabled) { color: #000; background: #ffbd43; }
:focus-visible { outline: 2px solid #ffd383; outline-offset: 3px; }
.panel { background: linear-gradient(135deg, rgba(44, 40, 34, .97), rgba(31, 30, 28, .97)); border: 1px solid #5a4d37; border-radius: 8px; padding: 18px; margin-bottom: 14px; box-shadow: inset 0 1px rgba(255, 227, 172, .07), 0 6px 18px #0003; }
.filters { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(175px, 1fr)); gap: 13px 16px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
label input, label select { width: 100%; font-size: 14px; font-weight: 400; }
.presets, .status-line, .results-bar, .export-controls, .pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.presets { margin-top: 15px; }
.presets > span { color: var(--muted); font-size: 12px; margin-right: 3px; }
.presets button { min-height: 32px; padding: 4px 11px; }
.text-button { background: transparent; border-color: transparent; }
.status-line { justify-content: space-between; margin-top: 16px; font-size: 12px; color: var(--muted); }
.status-line button { min-height: 30px; padding: 4px 10px; }
.help { margin-top: 12px; font-size: 12px; color: var(--muted); }
summary { cursor: pointer; color: #ddd; }
.help p { max-width: 1000px; }
.export-controls { align-items: flex-end; }
.export-controls label { min-width: 145px; }
#exportStatus { color: #ddd; padding-bottom: 8px; font-size: 12px; }
textarea { width: 100%; height: 210px; resize: vertical; margin-top: 14px; border: 1px solid #555; background: #161616; color: #ddd; border-radius: 5px; padding: 12px; font: 12px/1.55 ui-monospace, monospace; }
.results-bar { justify-content: space-between; padding: 4px 0 10px; }
.results-bar > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.results-bar button { font-size: 12px; min-height: 30px; }
#selectionCount { color: #ccc; font-size: 12px; }
.result { background: rgba(33, 33, 33, .98); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.result:hover { border-color: #716043; }
.result:has(.row-select:checked) { border-color: #b99247; background: rgba(46, 40, 29, .98); }
.result-main { display: grid; grid-template-columns: 24px minmax(220px, 1fr) minmax(300px, 2fr) 150px; gap: 14px; align-items: start; padding: 14px; }
.row-select { width: 17px; min-height: 17px; margin: 4px 0; accent-color: var(--accent); }
.ability-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.result-source { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.source-text { min-width: 0; }
.ability-portrait { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid #9b7c41; padding: 2px; background: #16130e; box-shadow: 0 2px 7px #0008, inset 0 0 0 1px #302919; border-radius: 3px; }
.ability-icon { display: block; width: 38px; height: 38px; object-fit: contain; }
.ability-tooltip { position: fixed; z-index: 1000; width: min(370px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain; padding: 17px; color: #e7dfcd; background: linear-gradient(145deg, #29251efc, #12120ffd); border: 1px solid #ad8848; border-radius: 6px; box-shadow: 0 12px 36px #000b, inset 0 0 0 2px #15130e, inset 0 0 22px #ad88480a; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.tooltip-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #685432; }
.tooltip-name { display: block; color: #ffcf78; font-size: 18px; font-weight: 650; line-height: 1.25; }
.tooltip-description { margin: 13px 0; white-space: pre-line; }
.tooltip-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 18px; margin: 12px 0; font-size: 12px; }
.tooltip-facts dt { color: #b6ac99; }
.tooltip-facts dd { color: #eed6a1; margin: 0; text-align: right; }
.details .tooltip-facts { max-width: 430px; }
.tooltip-value { color: #f7d48d; font-weight: 600; }
.tooltip-unknown { color: #bdad94; }
.tooltip-section { color: #d0b77e; text-transform: uppercase; font-size: 10px; letter-spacing: .09em; margin: 14px 0 5px; }
.tooltip-effect { padding-left: 10px; border-left: 2px solid #6c794d; margin: 7px 0; color: #c5daa9; }
.tooltip-note { color: #b6ac99; font-size: 11px; margin: 11px 0 0; }
.tooltip-footer { color: #a29781; font-size: 10px; border-top: 1px solid #4c412c; padding-top: 9px; margin-top: 13px; }
.career-icon { width: 19px; height: 19px; object-fit: contain; vertical-align: middle; margin-right: 5px; }
.realm-icons { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.realm-icons img { width: 30px; height: 30px; object-fit: contain; }
.realm-icons button { display: flex; align-items: center; gap: 6px; }
.career-picker { margin-top: 14px; font-size: 12px; }
.career-shortcuts { display: flex; flex-wrap: wrap; gap: 14px 28px; margin-top: 12px; }
.career-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.career-group > span { min-width: 68px; }
.career-group button { padding: 4px; min-height: 34px; }
.career-group .career-icon { width: 25px; height: 25px; margin: 0; }
.sort-field { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.sort-field select { width: auto; min-height: 30px; font-size: 12px; padding: 4px 8px; }
.compare-panel { padding-block: 13px; }
.compare-panel > details > summary { color: #e7d0a3; font-weight: 600; }
.comparison-intro, #configStatus { color: #ccc; font-size: 12px; }
.comparison-note { color: var(--muted); font-size: 12px; max-width: 1050px; }
.compare-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.compare-controls label { flex: 1; min-width: 155px; }
.compare-controls input { width: 100%; min-width: 0; font-size: 12px; }
.coverage { display: block; font-size: 11px; margin-top: 9px; color: #d4bd93; }
.coverage-listed { color: #9ece9c; }
.coverage-conditional { color: #a8c7e5; }
.coverage-reason { color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; margin: 6px 0 0; }
#enemyReferenceControls { margin-top: 12px; }
.coverage-ignored, .coverage-disabled { color: #e3a09b; }
.coverage-missing { color: #e3bd77; }
.source-meta, .source-id { color: var(--muted); font-size: 12px; margin-top: 5px; }
.realm-order { color: #8bc6ff; }
.realm-destruction { color: #ff9999; }
.effect-lines { margin: 0; padding-left: 16px; font-size: 13px; }
.effect-lines li + li { margin-top: 4px; }
.id-label { color: var(--muted); font-size: 11px; display: block; margin-bottom: 5px; }
.id-list { display: flex; flex-wrap: wrap; gap: 5px; }
.id-list a { font-family: ui-monospace, monospace; font-size: 12px; padding: 2px 5px; border: 1px solid #51472e; border-radius: 3px; text-decoration: none; }
.badge { display: inline-block; font-size: 11px; color: #ecd5a5; border: 1px solid #605338; border-radius: 3px; padding: 0 5px; margin: 0 0 4px; }
.details { border-top: 1px solid #3a3a3a; padding: 8px 14px; font-size: 12px; }
.details > summary { color: #bcbcbc; }
.description { color: #ccc; max-width: 1000px; }
.evidence { padding: 9px 0; border-top: 1px solid #3b3b3b; }
.evidence p { margin: 3px 0; overflow-wrap: anywhere; }
.evidence-meta { color: var(--muted); }
.message { border: 1px solid #555; border-radius: 6px; padding: 26px; background: #282828; }
.error { color: #ffb0a8; border-color: #904d47; margin-bottom: 12px; }
.pagination { justify-content: center; margin: 16px 0 28px; }
.pagination span { color: #ccc; min-width: 110px; text-align: center; }
@media (max-width: 950px) {
  .result-main { grid-template-columns: 22px minmax(160px, 1fr) minmax(240px, 1.6fr); }
  .result-ids { grid-column: 2 / -1; }
  .result-ids .id-label { display: inline; margin-right: 8px; }
  .result-ids .id-list { display: inline-flex; }
}
@media (max-width: 650px) {
  body { padding: 12px; }
  .topbar { align-items: flex-start; }
  .realm-icons { flex-wrap: wrap; justify-content: flex-end; max-width: 140px; gap: 4px; }
  .realm-icons button { font-size: 11px; padding: 4px 7px; min-height: 30px; }
  .realm-icons img { width: 20px; height: 20px; }
  .topbar > button { font-size: 12px; padding: 6px; }
  h1 span { display: block; margin-top: 4px; }
  .panel { padding: 13px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 11px; }
  .search-field { grid-column: 1 / -1; }
  .export-controls label { flex: 1; min-width: 125px; }
  .result-main { grid-template-columns: 20px minmax(0, 1fr); gap: 9px; padding: 12px; }
  .result-effects, .result-ids { grid-column: 2; }
  .ability-name { font-size: 15px; }
  .effect-lines { padding-left: 14px; }
}
