:root {
  --bg: #eef3f5;
  --panel: #ffffff;
  --text: #16232a;
  --muted: #66747c;
  --line: #dbe3e7;
  --teal: #147c7d;
  --teal-soft: #e2f3f1;
  --amber: #a8670d;
  --amber-soft: #fff0d6;
  --blue: #2b5f93;
  --shadow: 0 16px 36px rgba(25, 42, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.app-shell.monster-focus {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.monster-focus .sidebar {
  display: none;
}

.app-shell.monster-focus .workspace {
  padding-left: 16px;
  padding-right: 16px;
}

.hidden {
  display: none !important;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfc;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 800;
  font-size: 14px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p,
.topbar p,
.panel-header p,
.sample-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.field.compact {
  margin-bottom: 0;
}

.field span,
.filter-title,
.section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

input[type="search"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
  outline: none;
}

input[type="number"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--text);
  outline: none;
}

input[type="number"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

input[type="search"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.filter-block {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.nav-row,
.featured-row {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.nav-row {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
}

.nav-row span {
  font-size: 13px;
  font-weight: 800;
}

.nav-row b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav-row:hover,
.nav-row.active {
  border-color: var(--line);
  background: white;
  box-shadow: 0 8px 18px rgba(25, 42, 54, 0.05);
}

.featured-list {
  display: grid;
  gap: 8px;
}

.featured-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px;
}

.featured-row:hover {
  background: white;
  border-color: var(--line);
}

.featured-row img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.featured-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.featured-row b,
.featured-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-row b {
  font-size: 12px;
}

.featured-row small {
  color: var(--muted);
  font-size: 10px;
}

.formulas-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.xp-widget {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.xp-widget-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.xp-widget-head strong {
  font-size: 14px;
}

.xp-widget-summary {
  color: var(--muted);
  font-size: 12px;
}

.xp-widget-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.xp-widget-grid .field {
  margin: 0;
}

.xp-heirloom-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 10px;
}

.xp-vip-list {
  display: grid;
  gap: 6px;
}

.xp-heirloom-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.xp-vip-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.xp-calibration-inline {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(120px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
}

.xp-calibration-inline label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.xp-calibration-inline input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: white;
}

.xp-calibration-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1200px) {
  .xp-widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xp-heirloom-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xp-calibration-inline {
    grid-template-columns: 1fr 1fr;
  }
}

.formula-card {
  display: grid;
  gap: 12px;
}

.formula-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.formula-status.known {
  background: #e7f6f1;
  color: #12604b;
}

.formula-status.inferred {
  background: #e8f0fb;
  color: #1b4d8b;
}

.formula-status.unknown {
  background: #fbeede;
  color: #8a4f11;
}

.formula-code {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafcfd;
  color: #22333a;
  font-size: 12px;
}

.formula-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip,
.segment,
.ghost-button,
.primary-button,
.icon-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.filter-chip {
  font-size: 12px;
}

.filter-chip.active,
.segment.active,
.ghost-button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #075a5b;
}

select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--text);
}

.character-block {
  scroll-margin-top: 20px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.character-summary {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 12px;
}

.summary-line {
  display: grid;
  gap: 2px;
}

.summary-line strong {
  font-size: 13px;
}

.summary-line span,
.summary-tags span {
  color: var(--muted);
  font-size: 11px;
}

.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.summary-tags span {
  border-radius: 999px;
  background: #eef2f4;
  padding: 4px 7px;
  font-weight: 800;
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 20px 24px 24px;
}

.app-shell.xp-mode {
  display: block;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(226, 243, 241, 0.76), rgba(238, 243, 245, 0) 360px),
    var(--bg);
}

.app-shell.xp-mode .sidebar {
  display: none;
}

.app-shell.xp-mode .workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.app-shell.xp-mode .topbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  padding: 8px;
}

.app-shell.xp-mode .topbar-actions {
  display: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  margin-bottom: 16px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-tab {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.nav-tab:hover,
.nav-tab.active {
  border-color: var(--line);
  background: white;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.database-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fafb 100%);
  box-shadow: var(--shadow);
  padding: 20px;
}

.database-hero h2 {
  font-size: 28px;
  line-height: 1.1;
}

.database-hero p {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.hero-search {
  display: grid;
  gap: 8px;
}

.hero-search span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-search input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: var(--text);
  outline: none;
}

.hero-search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 12px;
  margin-bottom: 16px;
}

.feature-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
}

.feature-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.feature-heading h3 {
  font-size: 15px;
}

.feature-heading p {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
}

.builder-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-meter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.source-meter span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--muted);
  font-size: 11px;
  background: #fbfcfc;
}

.source-meter b {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.xp-calculator {
  margin-bottom: 16px;
  scroll-margin-top: 20px;
}

.tool-page {
  display: grid;
  gap: 16px;
}

.tool-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f5fbfa 100%);
  box-shadow: var(--shadow);
  padding: 22px;
}

.tool-hero h2 {
  font-size: 30px;
  line-height: 1.08;
}

.tool-hero p {
  max-width: 640px;
  color: var(--muted);
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.5;
}

.xp-tool .xp-calculator {
  margin-bottom: 0;
}

.xp-source {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfc;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
}

.xp-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.xp-calibration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.xp-result {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.xp-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.xp-kpis span {
  display: grid;
  gap: 4px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--muted);
  padding: 11px;
  font-size: 11px;
}

.xp-kpis b {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.xp-note {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--teal-soft);
  padding: 10px 12px;
}

.xp-note strong {
  color: #075a5b;
  font-size: 12px;
}

.xp-note span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.xp-note .rate-warning {
  color: #9b4a13;
  font-weight: 800;
}

.xp-calibration-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.xp-calibration-results span {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(7, 90, 91, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 8px;
}

.xp-calibration-results b {
  color: #075a5b;
  font-size: 11px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 78px;
  padding: 14px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 24px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.catalog-layout {
  grid-template-columns: minmax(0, 1fr) 410px;
}

.panel-header {
  min-height: 64px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  font-size: 15px;
}

.result-tools {
  display: flex;
  gap: 8px;
}

.category-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 14px 0;
  max-width: 100%;
}

.category-card {
  flex: 0 0 150px;
  min-height: 92px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 7px 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  text-align: left;
}

.category-card:hover,
.category-card.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.category-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  grid-row: span 2;
  border-radius: 8px;
  background: white;
  color: var(--teal);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 900;
}

.category-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.category-card small {
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  max-height: none;
  overflow: visible;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-height: none;
  overflow: visible;
  padding: 14px;
}

.monster-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 0 14px 10px;
}

.monster-field {
  margin: 0;
}

.damage-sim-controls .monster-field:nth-child(9) {
  grid-column: span 2;
}

.damage-sim-controls .monster-field:nth-child(10) {
  grid-column: span 2;
}

@media (max-width: 1200px) {
  .damage-sim-controls .monster-field:nth-child(9),
  .damage-sim-controls .monster-field:nth-child(10) {
    grid-column: span 1;
  }
}

#monsterSearchInput {
  min-width: 220px;
}

@media (min-width: 1200px) {
  .monster-controls .monster-field:first-child {
    grid-column: span 2;
  }
}

.monster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.monster-table th,
.monster-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.monster-table th:nth-child(1),
.monster-table td:nth-child(1) {
  width: 64px;
  text-align: center;
}

.monster-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafb;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.monster-table tbody tr {
  cursor: pointer;
}

.monster-table tbody tr:hover,
.monster-table tbody tr.selected {
  background: var(--teal-soft);
}

.rune-row td {
  vertical-align: middle;
}

.rune-row td:first-child {
  min-width: 220px;
}

.rune-name-cell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.rune-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 8px;
}

.rune-name-meta {
  display: grid;
  min-width: 0;
}

.rune-name-meta strong {
  font-size: 14px;
  line-height: 1.2;
}

.rune-name-meta span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rune-affix-cell {
  max-width: 480px;
  color: #34444d;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  background: #f7fafb;
  color: var(--muted);
}

.quality-badge.q1 {
  border-color: #2eef15;
  color: #1c8f0e;
  background: #eefde9;
}

.quality-badge.q2 {
  border-color: #47a4ff;
  color: #1d69b0;
  background: #eaf4ff;
}

.quality-badge.q3 {
  border-color: #b062d3;
  color: #7c3f99;
  background: #f5ebfb;
}

.quality-badge.q4 {
  border-color: #f79722;
  color: #a55f06;
  background: #fff3e4;
}

.quality-badge.q5 {
  border-color: #ff5a75;
  color: #b12f4d;
  background: #ffeaf0;
}

.rune-row.q1 {
  border-left: 3px solid #2eef15;
}

.rune-row.q2 {
  border-left: 3px solid #47a4ff;
}

.rune-row.q3 {
  border-left: 3px solid #b062d3;
}

.rune-row.q4 {
  border-left: 3px solid #f79722;
}

.rune-row.q5 {
  border-left: 3px solid #ff5a75;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

#runesView .monster-table th:nth-child(2),
#runesView .monster-table td:nth-child(2),
#runesView .monster-table th:nth-child(3),
#runesView .monster-table td:nth-child(3),
#runesView .monster-table th:nth-child(4),
#runesView .monster-table td:nth-child(4),
#runesView .monster-table th:nth-child(5),
#runesView .monster-table td:nth-child(5),
#runesView .monster-table th:nth-child(6),
#runesView .monster-table td:nth-child(6) {
  white-space: nowrap;
}

.pack-toggle {
  min-height: 26px;
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.pack-toggle.active {
  border-color: #d4aa00;
  background: #fff8d6;
  color: #e0b400;
}

.actual-xpm-input {
  width: 100%;
  min-width: 96px;
  max-width: 160px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
}

.catalog-grid.list-mode {
  grid-template-columns: 1fr;
}

.app-shell.monster-mode .catalog-grid {
  display: block;
  padding: 14px;
}

.app-shell.monster-focus .catalog-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.app-shell.monster-focus .catalog-panel {
  border: 0;
  box-shadow: none;
  background: transparent;
}

.app-shell.monster-focus .catalog-panel .panel-header {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(25, 42, 54, 0.05);
  margin-bottom: 10px;
  padding: 16px 18px;
}

.app-shell.monster-focus #catalogSectionTitle {
  font-size: 30px;
  line-height: 1.08;
}

.app-shell.monster-focus #catalogCount {
  margin-top: 4px;
  font-size: 13px;
}

.app-shell.monster-focus .monster-controls {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(25, 42, 54, 0.04);
  margin-bottom: 12px;
  padding: 12px;
}

.app-shell.monster-focus .catalog-grid {
  padding: 0;
}

.app-shell.monster-mode .sidebar .filter-block:nth-of-type(2),
.app-shell.monster-mode .sidebar .filter-block:nth-of-type(3) {
  display: none;
}

.item-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
  cursor: pointer;
}

.item-card:hover,
.item-card.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.item-card.limited {
  opacity: 0.68;
}

.load-more-card {
  min-height: 72px;
  border: 1px dashed var(--teal);
  border-radius: 8px;
  background: var(--teal-soft);
  color: #075a5b;
  font-weight: 800;
  cursor: pointer;
}

.empty-state {
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 15px;
}

.empty-state span {
  max-width: 520px;
  font-size: 12px;
  line-height: 1.5;
}

.empty-state.error {
  border-color: #e4b7a4;
  background: #fff7f3;
}

.item-card.q2 {
  border-left: 4px solid #47a4ff;
}

.item-card.q3 {
  border-left: 4px solid #b062d3;
}

.item-card.q4 {
  border-left: 4px solid #f79722;
}

.item-card.q5 {
  border-left: 4px solid #ff5a75;
}

.item-icon-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.item-icon-wrap.large {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
}

.item-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.item-icon-wrap span {
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.item-icon-wrap.missing-icon span {
  display: block;
}

.item-card-body {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.item-card h4 {
  overflow: visible;
  margin: 0;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.item-card p {
  color: var(--muted);
  font-size: 11px;
}

.item-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.item-card-stats span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 6px 7px;
  font-size: 11px;
  font-weight: 800;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.item-card-stats b {
  color: var(--muted);
  display: block;
  font-size: 9px;
  line-height: 1.1;
  text-transform: uppercase;
}

.item-drop-line {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  border-radius: 8px;
  background: #f3f7f7;
  color: var(--muted);
  padding: 6px 7px;
  font-size: 11px;
  line-height: 1.25;
}

.item-drop-line b {
  color: #075a5b;
  font-size: 10px;
  text-transform: uppercase;
}

.item-drop-line span {
  min-width: 0;
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-meta span {
  border-radius: 999px;
  background: #eef2f4;
  color: var(--muted);
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: var(--teal-soft);
}

td strong {
  display: block;
  font-size: 13px;
}

td span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.confidence {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  background: #eef2f4;
  font-size: 11px;
  font-weight: 800;
}

.confidence.high {
  color: #075a5b;
  background: var(--teal-soft);
}

.confidence.medium {
  color: var(--amber);
  background: var(--amber-soft);
}

.inspector {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.detail-content {
  padding: 12px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.item-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.item-hero.compact {
  gap: 10px;
  margin-bottom: 12px;
}

.item-hero.compact h4 {
  margin-bottom: 2px;
  font-size: 20px;
}

.item-hero.compact p {
  font-size: 12px;
}

.monster-detail {
  display: grid;
  gap: 10px;
}

.monster-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-chip {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: #fbfcfc;
}

.metric-chip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-chip b {
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.item-hero h4 {
  margin-bottom: 4px;
  font-size: 18px;
}

.item-hero p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-metrics {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.detail-metrics span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.detail-metrics b {
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.summary-strip span {
  display: grid;
  gap: 2px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 11px;
  background: #fbfcfc;
}

.summary-strip b {
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.character-context-note {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  background: #fbfcfc;
}

.character-context-note b {
  font-size: 13px;
}

.character-context-note span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.field-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.field-pill {
  display: inline-grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 11px;
  background: #fbfcfc;
}

.field-pill b {
  color: var(--text);
}

.sample-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.mini-table {
  width: 100%;
  margin: 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}

.mini-table th,
.mini-table td {
  padding: 9px 10px;
}

.stat-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin: 10px 0 18px;
}

.stat-chip {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.stat-chip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-chip strong {
  color: var(--teal);
  font-size: 18px;
  line-height: 1;
}

.stat-chip b {
  font-size: 12px;
}

.stat-chip small {
  color: var(--muted);
  font-size: 10px;
}

.option-stack {
  display: grid;
  gap: 10px;
  margin: 10px 0 18px;
}

.passive-grid {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
}

.passive-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.passive-card.race {
  border-left: 4px solid var(--teal);
}

.passive-card.class {
  border-left: 4px solid var(--amber);
}

.passive-card strong {
  display: block;
  font-size: 13px;
}

.passive-card small,
.passive-card p,
.passive-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.passive-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.passive-effect {
  border-radius: 999px;
  background: var(--teal-soft);
  color: #075a5b;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
}

.passive-effect b {
  margin-right: 4px;
}

.data-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  margin: 10px 0 18px;
  overflow: hidden;
}

.data-section.compact {
  margin: 0;
}

.data-section summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.data-section summary::-webkit-details-marker {
  display: none;
}

.data-section summary span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.data-section summary b {
  border-radius: 999px;
  background: #eef2f4;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
}

.data-section[open] summary {
  border-bottom: 1px solid var(--line);
}

.option-card-grid,
.refine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
  padding: 10px;
}

.option-card,
.refine-card {
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  min-width: 0;
}

.option-card strong,
.refine-card strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
}

.option-card small,
.refine-card small,
.empty-note,
.source-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.option-card p,
.refine-card p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.weight-badge {
  width: fit-content;
  border-radius: 999px;
  background: var(--teal-soft);
  color: #075a5b;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.refine-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.refine-card dl div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.refine-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.refine-card dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-note {
  margin: 10px 12px;
}

.raw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 18px;
}

.raw-grid.compact {
  margin: 0;
  padding: 10px;
}

.raw-grid span {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.raw-grid b {
  color: var(--text);
}

.q1.active,
.q1.item-icon-wrap {
  border-color: #2eef15;
}

.q2.active,
.q2.item-icon-wrap {
  border-color: #47a4ff;
}

.q3.active,
.q3.item-icon-wrap {
  border-color: #b062d3;
}

.q4.active,
.q4.item-icon-wrap {
  border-color: #f79722;
}

.q5.active,
.q5.item-icon-wrap {
  border-color: #ff5a75;
}

.sample-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.sample-row h4 {
  font-size: 13px;
  margin-bottom: 2px;
}

.sample-row div {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.sample-row b {
  color: var(--text);
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(12, 22, 27, 0.36);
  padding: 24px;
}

.drawer.open {
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: min(720px, 100%);
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.drawer-header {
  min-height: 72px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.api-list {
  max-height: calc(100vh - 145px);
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.api-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

code {
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 12px;
}

.api-card span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: static;
    height: auto;
  }

  .content-grid,
  .stats-grid,
  .database-hero,
  .feature-grid,
  .builder-controls,
  .xp-grid,
  .xp-calibration-grid,
  .xp-kpis,
  .xp-calibration-results {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .inspector {
    position: static;
    max-height: none;
    grid-template-rows: auto;
  }

  .table-wrap,
  .catalog-grid,
  .detail-content {
    max-height: none;
  }

  .detail-content {
    overflow: visible;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .category-rail {
    max-width: calc(100vw - 48px);
  }

  .category-card {
    flex-basis: min(150px, 58vw);
  }

  .raw-grid {
    grid-template-columns: 1fr;
  }
}
