:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #10131a;
  --panel-2: #151922;
  --panel-3: #1b202b;
  --border: #292f3b;
  --border-strong: #3a4352;
  --text: #f4f6f8;
  --muted: #939cab;
  --faint: #626b79;
  --gold: #f5c451;
  --gold-soft: rgba(245, 196, 81, .12);
  --teal: #6fd5c5;
  --red: #ff7c83;
  --blue: #82aaff;
  --physical: #ff727b;
  --energy: #66d98b;
  --mystical: #75a7ff;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-resolved-theme="light"] {
  --bg: #d7dbe2;
  --panel: #e5e8ed;
  --panel-2: #dce0e7;
  --panel-3: #cbd1db;
  --border: #b5bdc9;
  --border-strong: #98a3b2;
  --text: #1d2430;
  --muted: #626d7d;
  --faint: #8691a1;
  --gold: #9a6810;
  --gold-soft: rgba(184, 126, 18, .12);
  --teal: #167f70;
  --red: #c8424b;
  --blue: #426fc2;
  --physical: #c94049;
  --energy: #27824a;
  --mystical: #376fcb;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% -20%, rgba(75, 95, 135, .18), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  min-height: 82px;
  padding: 16px clamp(18px, 3vw, 44px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(9, 11, 16, .88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand h1 { margin: 0; font-size: 1.18rem; letter-spacing: .01em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.brand-mark { width: 38px; height: 38px; padding: 7px; border: 1px solid #4a4028; border-radius: 10px; background: var(--gold-soft); display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; fill: none; stroke: var(--gold); stroke-width: 2.6; stroke-linejoin: round; }
.dataset-meta { margin-left: auto; color: var(--muted); font-size: .82rem; text-align: right; }
.site-nav { padding: 4px; display: flex; gap: 3px; border: 1px solid var(--border); border-radius: 10px; background: #0d1016; }
.site-nav a { padding: 8px 15px; border-radius: 7px; color: var(--muted); font-size: .84rem; font-weight: 650; text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-nav a.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.28); }
.theme-switch { padding: 3px; display: flex; gap: 2px; border: 1px solid var(--border); border-radius: 9px; background: #0d1016; }
.theme-switch button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.24); }
.theme-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.workspace {
  max-width: 1560px;
  margin: 0 auto;
  padding: 26px clamp(18px, 3vw, 44px) 56px;
  display: grid;
  grid-template-columns: minmax(275px, 330px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.effects-panel {
  position: sticky;
  top: 108px;
  max-height: calc(100vh - 134px);
  display: flex;
  flex-direction: column;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(16, 19, 26, .92);
}

.panel-heading { padding: 19px 18px 14px; display: flex; align-items: center; justify-content: space-between; }
.panel-actions { display: flex; align-items: center; gap: 6px; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: .71rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
h2 { margin: 0; font-size: 1.28rem; }
.text-button { border: 0; background: none; color: var(--teal); cursor: pointer; padding: 6px; font-size: .85rem; }
.text-button:disabled { color: var(--faint); cursor: default; }
.pin-toggle { min-width: 68px; height: 31px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid rgba(245,196,81,.3); border-radius: 7px; background: var(--gold-soft); color: #ffe19a; cursor: pointer; font-size: .72rem; white-space: nowrap; }
.pin-toggle[aria-pressed="false"] { border-color: var(--border); background: transparent; color: var(--faint); }
.pin-icon { width: 12px; height: 12px; fill: currentColor; }
.pin-settings-button { width: 29px; height: 29px; padding: 0; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.pin-settings-button:hover { border-color: var(--border-strong); background: var(--panel-3); color: var(--text); }
.pin-settings-button svg { width: 13px; height: 13px; fill: currentColor; }

.search-box { margin: 0 16px 13px; height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: #0d1016; }
.search-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search-box svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .9rem; }
.search-box kbd { min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--border); border-bottom-color: var(--border-strong); border-radius: 5px; display: grid; place-items: center; color: var(--faint); font-size: .72rem; line-height: 1; text-align: center; }

.type-tabs { padding: 0 16px 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.type-tab { border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 7px 5px; font-size: .75rem; cursor: pointer; }
.type-tab:hover { color: var(--text); background: var(--panel-3); }
.type-tab.active { color: var(--text); background: var(--panel-3); box-shadow: inset 0 0 0 1px var(--border); }

.effect-list { overflow: auto; padding: 0 8px 10px; border-top: 1px solid var(--border); scrollbar-color: var(--border-strong) transparent; }
.effect-item { width: 100%; min-height: 52px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid rgba(41, 47, 59, .65); background: transparent; text-align: left; cursor: pointer; }
.effect-item:hover { background: var(--panel-2); }
.effect-item.selected { background: var(--gold-soft); box-shadow: inset 3px 0 var(--gold); }
.effect-main { min-width: 0; display: flex; align-items: center; gap: 9px; }
.effect-copy { display: grid; gap: 4px; min-width: 0; }
.effect-title { min-width: 0; display: flex; align-items: center; gap: 5px; }
.effect-copy strong { min-width: 0; font-size: .87rem; font-weight: 610; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-marker { display: none; width: 12px; height: 12px; flex: 0 0 auto; color: var(--faint); opacity: .8; }
.pin-marker svg { width: 100%; height: 100%; fill: currentColor; }
.effect-item.pinned .pin-marker { display: inline-flex; }
.effect-copy small { color: var(--faint); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.effect-count { flex: 0 0 auto; min-width: 29px; height: 24px; padding: 0 6px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); font-size: .7rem; }
.effect-item.selected .effect-count { border-color: rgba(245, 196, 81, .38); color: var(--gold); }

.results-panel { min-width: 0; }
.lookup-surface {
  margin-bottom: 12px;
  padding: 17px 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 19, 26, .82);
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(280px, 1.3fr);
  align-items: center;
  gap: 22px;
}
.lookup-copy h2 { font-size: 1.05rem; }
.character-lookup { position: relative; }
.lookup-input { height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: #0d1016; }
.lookup-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.lookup-input svg { width: 18px; flex: 0 0 auto; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.lookup-input input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .9rem; }
.lookup-results { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 7px); max-height: 330px; overflow: auto; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: #11151d; box-shadow: 0 20px 44px rgba(0,0,0,.5); }
.lookup-result { width: 100%; padding: 10px 11px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; }
.lookup-result:hover, .lookup-result:focus-visible { background: var(--panel-3); outline: 0; }
.lookup-result strong { display: block; font-size: .87rem; line-height: 1.35; }
.lookup-result small { flex: 0 0 auto; color: var(--muted); font-size: .72rem; }
.lookup-identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.query-surface { padding: 21px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(135deg, rgba(21, 25, 34, .98), rgba(16, 19, 26, .94)); box-shadow: 0 22px 50px rgba(0,0,0,.18); }
.query-topline { display: flex; justify-content: space-between; align-items: start; gap: 24px; }
.selected-effects { min-height: 34px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.empty-selection { color: var(--muted); font-size: .96rem; line-height: 34px; }
.selected-chip { height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 9px 0 11px; border: 1px solid rgba(245,196,81,.32); border-radius: 8px; background: var(--gold-soft); color: #ffe19a; font-size: .82rem; }
.selected-chip button { width: 20px; height: 20px; border: 0; border-radius: 5px; background: rgba(255,255,255,.06); color: inherit; cursor: pointer; line-height: 1; }

.match-switch { flex: 0 0 auto; padding: 3px; display: flex; border: 1px solid var(--border); border-radius: 9px; background: #0d1016; }
.match-switch button { padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .78rem; white-space: nowrap; cursor: pointer; }
.match-switch button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.28); }

.character-filters { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 18px; }
.character-filter { min-width: 0; display: grid; gap: 6px; }
.gear-mobile-filter { display: none; }
.gear-set-desktop-filter { grid-column: 1 / -1; }
.gear-set-desktop-filter .filter-switch { width: max-content; flex-wrap: wrap; overflow-x: visible; }
.character-filter > span { color: var(--muted); font-size: .73rem; font-weight: 650; letter-spacing: .04em; }
.filter-switch { width: max-content; max-width: 100%; padding: 3px; display: flex; border: 1px solid var(--border); border-radius: 9px; background: #0d1016; overflow-x: auto; }
.filter-switch button { min-height: 31px; padding: 6px 10px; border: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: transparent; color: var(--muted); font-size: .78rem; white-space: nowrap; cursor: pointer; }
.filter-switch button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.28); }
.filter-switch button:disabled { opacity: .32; cursor: not-allowed; }
.gender-icon, .filter-icon { width: 14px; height: 14px; flex: 0 0 auto; }
.gender-icon, .filter-icon.line-icon, .crown-icon.outline { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.affinity-filter-icon, .crown-icon.filled { fill: currentColor; stroke: none; }
.affinity-filter-icon.physical { color: #ff5f68; }
.affinity-filter-icon.energy { color: #6cdb45; }
.affinity-filter-icon.mystical { color: #65b5ff; }
.filter-switch button:not(.active) .filter-icon:not(.affinity-filter-icon),
.filter-switch button:not(.active) .gender-icon { color: #7d8796; }

.filters { margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 170px 185px minmax(190px, 1fr); gap: 12px; }
.filters label { display: grid; gap: 6px; }
.filters label > span { color: var(--muted); font-size: .73rem; font-weight: 650; letter-spacing: .04em; }
.filters select, .filters input { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; outline: 0; padding: 0 11px; background: #0d1016; color: var(--text); font-size: .85rem; }
.filters select:focus, .filters input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

.results-heading { margin: 27px 2px 15px; display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.results-heading h2 { font-size: 1.45rem; }
.results-heading-actions { display: flex; align-items: end; justify-content: end; gap: 15px; }
.result-hint { margin: 0; color: var(--muted); font-size: .8rem; text-align: right; }
.sort-control { display: grid; gap: 4px; }
.sort-control > span { color: var(--faint); font-size: .67rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sort-control select { height: 34px; min-width: 112px; padding: 0 28px 0 9px; border: 1px solid var(--border); border-radius: 8px; outline: 0; background: #0d1016; color: var(--text); font-size: .76rem; }
.sort-control select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

.toon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 11px; }
.toon-card { width: 100%; min-height: 104px; padding: 15px; border: 1px solid var(--border); border-radius: 11px; background: rgba(16, 19, 26, .86); color: inherit; text-align: left; cursor: pointer; transition: border-color .16s ease, transform .16s ease, background .16s ease; }
.toon-card:hover { border-color: var(--border-strong); transform: translateY(-1px); background: var(--panel-2); }
.toon-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.toon-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toon-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.toon-copy { min-width: 0; display: grid; gap: 3px; }
.toon-card h3 { margin: 0; font-size: .95rem; line-height: 1.35; letter-spacing: .01em; }
.toon-stats { overflow: hidden; color: var(--muted); font-size: .67rem; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.affinity-physical { color: var(--physical) !important; }
.affinity-energy { color: var(--energy) !important; }
.affinity-mystical { color: var(--mystical) !important; }
.effect-total { color: var(--faint); font-size: .72rem; }
.matched-effects { margin-top: 12px; display: grid; gap: 8px; }
.match-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; }
.match-name { min-width: 0; color: #d8dde5; font-size: .78rem; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.match-name > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.match-instances { display: flex; flex-wrap: wrap; justify-content: end; gap: 4px; }
.instance-badge { min-height: 22px; padding: 3px 6px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: .65rem; white-space: nowrap; }
.instance-badge.legendary { border-color: rgba(245,196,81,.35); color: var(--gold); }
.instance-badge .target, .effect-target { color: var(--teal); }
.instance-badge .target.enemy, .effect-target.enemy { color: #ff9da3; }

.empty-state { margin-top: 70px; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 12px 0 6px; color: var(--text); }
.empty-state p { margin: 0; }
.empty-icon { margin: auto; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--faint); font-size: 1.3rem; }

.character-dialog { width: min(900px, calc(100vw - 28px)); max-height: min(860px, calc(100vh - 28px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 16px; background: #10131a; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.68); }
.character-dialog::backdrop { background: rgba(3, 5, 8, .78); backdrop-filter: blur(5px); }
.pin-dialog { width: min(620px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 16px; background: #10131a; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.68); }
.pin-dialog::backdrop { background: rgba(3, 5, 8, .78); backdrop-filter: blur(5px); }
.pin-dialog-shell { display: flex; flex-direction: column; max-height: min(760px, calc(100vh - 28px)); }
.pin-dialog-header { padding: 20px 22px 17px; display: flex; align-items: start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.pin-dialog-header h2 { font-size: 1.24rem; }
.pin-dialog-header p:last-child { margin: 6px 0 0; color: var(--muted); font-size: .8rem; }
.pin-dialog-body { min-height: 0; padding: 16px 18px; display: flex; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
.pin-search { flex: 0 0 auto; margin: 0 0 12px; }
.pin-editor-list { min-height: 220px; max-height: 440px; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; scrollbar-color: var(--border-strong) transparent; }
.pin-editor-option { min-width: 0; min-height: 48px; padding: 7px 9px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 8px; background: #0d1016; cursor: pointer; }
.pin-editor-option:hover { border-color: var(--border-strong); background: var(--panel-2); }
.pin-editor-option.checked { border-color: rgba(245,196,81,.34); background: var(--gold-soft); }
.pin-editor-option input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--gold); }
.pin-editor-copy { min-width: 0; display: grid; gap: 3px; }
.pin-editor-copy strong { overflow: hidden; font-size: .79rem; font-weight: 620; white-space: nowrap; text-overflow: ellipsis; }
.pin-editor-copy small { color: var(--faint); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.pin-dialog-footer { padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); background: #0d1016; }
.pin-dialog-footer > span { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.pin-dialog-footer > div { display: flex; align-items: center; justify-content: end; gap: 7px; }
.pin-dialog-footer button { min-height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-3); color: var(--muted); cursor: pointer; font-size: .76rem; }
.pin-dialog-footer button:hover { border-color: var(--border-strong); color: var(--text); }
.pin-dialog-footer .pin-default-button { margin-right: 5px; border-color: transparent; background: transparent; color: var(--teal); }
.pin-dialog-footer .pin-save-button { border-color: rgba(245,196,81,.42); background: var(--gold-soft); color: #ffe19a; }
.dialog-shell { min-height: 200px; }
.dialog-header { position: sticky; top: 0; z-index: 2; padding: 20px 22px 17px; display: flex; align-items: start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); background: rgba(16,19,26,.96); backdrop-filter: blur(16px); }
.dialog-header h2 { max-width: 720px; font-size: 1.32rem; line-height: 1.3; }
.dialog-character { min-width: 0; display: flex; align-items: center; gap: 14px; }
.dialog-close { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-3); color: var(--muted); font-size: 1.35rem; cursor: pointer; }
.dialog-close:hover { color: var(--text); border-color: var(--border-strong); }
.ability-list { padding: 18px 22px 24px; display: grid; gap: 13px; }
.ability-card { padding: 16px; border: 1px solid var(--border); border-radius: 11px; background: #151922; }
.ability-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.ability-identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.ability-number { min-width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(245,196,81,.36); border-radius: 7px; background: var(--gold-soft); color: var(--gold); font-size: .75rem; font-weight: 750; }
.ability-card h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.ability-tags { display: flex; flex-wrap: wrap; justify-content: end; gap: 5px; }
.ability-tag { padding: 4px 7px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: .67rem; }
.ability-description { margin: 11px 0 0; color: #c9cfd8; font-size: .86rem; line-height: 1.58; white-space: pre-line; }
.legendary-block { margin-top: 13px; padding: 11px 12px; border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; background: var(--gold-soft); }
.legendary-block strong { color: #ffe19a; font-size: .8rem; }
.legendary-block p { margin: 5px 0 0; color: #d8d0b8; font-size: .82rem; line-height: 1.5; white-space: pre-line; }
.ability-effects { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; }
.effect-pill { padding: 5px 7px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 7px; color: #cbd1da; font-size: .7rem; }
.effect-pill.buff { border-color: rgba(111,213,197,.28); color: var(--teal); }
.effect-pill.debuff { border-color: rgba(255,124,131,.28); color: var(--red); }
.effect-pill.legendary::before { content: "L"; color: var(--gold); font-weight: 800; }
.no-effects { color: var(--faint); font-size: .75rem; }

.media-frame { flex: 0 0 auto; display: inline-grid; place-items: center; overflow: hidden; border: 1px solid var(--border); background: #0d1016; }
.media-frame img { width: 100%; height: 100%; display: block; object-fit: contain; }
.media-placeholder::after { content: ""; width: 30%; height: 30%; border: 1px solid var(--faint); border-radius: 50%; opacity: .55; }
.toon-portrait { width: 50px; height: 50px; border-radius: 10px; }
.lookup-portrait { width: 38px; height: 38px; border-radius: 8px; }
.dialog-portrait { width: 58px; height: 58px; border-radius: 11px; }
.ability-icon { width: 44px; height: 44px; border-radius: 9px; }
.effect-icon { width: 34px; height: 34px; border-radius: 7px; }
.selected-effect-icon { width: 20px; height: 20px; border-radius: 5px; border-color: rgba(245,196,81,.25); }
.match-effect-icon { width: 22px; height: 22px; border-radius: 5px; }
.pill-effect-icon { width: 20px; height: 20px; border-radius: 5px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .effects-panel { position: static; max-height: none; min-height: 0; }
  .effect-list { max-height: 320px; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; margin-left: 0; }
  .site-nav a { flex: 1; text-align: center; }
  .theme-switch { margin-left: auto; }
  .dataset-meta { display: none; }
  .workspace { padding-top: 18px; gap: 18px; }
  .lookup-surface { grid-template-columns: 1fr; gap: 13px; }
  .query-topline { flex-direction: column; gap: 14px; }
  .character-filters { grid-template-columns: 1fr; }
  .gear-mobile-filter { display: grid; }
  .gear-set-desktop-filter { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .toon-search { grid-column: 1 / -1; }
  .results-heading { align-items: start; }
  .results-heading-actions { max-width: 62%; align-items: end; flex-direction: column; gap: 8px; }
  .result-hint { max-width: 150px; }
  .toon-grid { grid-template-columns: 1fr; }
  .dialog-header, .ability-list { padding-left: 15px; padding-right: 15px; }
  .ability-head { flex-direction: column; gap: 10px; }
  .ability-tags { justify-content: start; }
  .pin-editor-list { grid-template-columns: 1fr; }
  .pin-dialog-footer { align-items: stretch; flex-direction: column; }
  .pin-dialog-footer > div { justify-content: stretch; }
  .pin-dialog-footer button { flex: 1; }
  .pin-dialog-footer .pin-default-button { margin-right: 0; }
  .panel-heading { align-items: end; }
  .pin-toggle { min-width: 0; height: 29px; white-space: normal; }
  .search-box { height: 42px; }
}

:root[data-resolved-theme="light"] body {
  background: radial-gradient(circle at 75% -20%, rgba(73, 102, 158, .12), transparent 34rem), var(--bg);
}
:root[data-resolved-theme="light"] .topbar { background: rgba(215, 219, 226, .92); }
:root[data-resolved-theme="light"] .site-nav,
:root[data-resolved-theme="light"] .theme-switch,
:root[data-resolved-theme="light"] .search-box,
:root[data-resolved-theme="light"] .lookup-input,
:root[data-resolved-theme="light"] .match-switch,
:root[data-resolved-theme="light"] .filter-switch,
:root[data-resolved-theme="light"] .filters select,
:root[data-resolved-theme="light"] .filters input,
:root[data-resolved-theme="light"] .sort-control select,
:root[data-resolved-theme="light"] .pin-editor-option,
:root[data-resolved-theme="light"] .media-frame { background: #d9dde4; }
:root[data-resolved-theme="light"] .effects-panel,
:root[data-resolved-theme="light"] .lookup-surface,
:root[data-resolved-theme="light"] .toon-card { background: rgba(229, 232, 237, .96); }
:root[data-resolved-theme="light"] .query-surface { background: linear-gradient(135deg, #e7e9ed, #d9dde4); box-shadow: 0 16px 36px rgba(58, 70, 92, .11); }
:root[data-resolved-theme="light"] .lookup-results { background: #e7e9ed; box-shadow: 0 18px 40px rgba(58, 70, 92, .18); }
:root[data-resolved-theme="light"] .character-dialog,
:root[data-resolved-theme="light"] .pin-dialog { background: #e7e9ed; box-shadow: 0 28px 80px rgba(45, 54, 70, .3); }
:root[data-resolved-theme="light"] .dialog-header { background: rgba(231,233,237,.97); }
:root[data-resolved-theme="light"] .ability-card { background: #dce0e7; }
:root[data-resolved-theme="light"] .ability-description,
:root[data-resolved-theme="light"] .match-name { color: #3e4857; }
:root[data-resolved-theme="light"] .legendary-block strong,
:root[data-resolved-theme="light"] .pin-toggle,
:root[data-resolved-theme="light"] .selected-chip { color: #875b0e; }
:root[data-resolved-theme="light"] .legendary-block p { color: #675d47; }
:root[data-resolved-theme="light"] .effect-pill { color: #4e5867; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
