/* ==========================================================================
   Archival Parchment & Cartographic Ledger Theme (Inspired by Kovarel)
   ========================================================================== */

:root {
  --paper: #faf6ec;
  --paper-light: #fdfbf5;
  --paper-deep: #f2ecdd;
  --ink: #1c1915;
  --record-ink: #231f1a;
  --archive-ink: #3a352e;
  --ink-soft: #464037;
  --muted: #635b4f;
  --rule: #ddd4c2;
  --rule-row: color-mix(in srgb, #ddd4c2 74%, transparent);
  --rule-strong: #6e8795;

  --accent: #176b93;
  --accent-active: #0e5679;
  --accent-deep: #0b3b56;
  --gain: #2e642b;
  --danger: #8e2f22;
  --warn: #9a5b13;

  --icon-bg: #080c18;

  /* Paper-adapted WoW Class Colors */
  --cls-warrior: #8b6642;
  --cls-paladin: #b8477a;
  --cls-dk: #9e2538;
  --cls-rogue: #8f7508;
  --cls-druid: #c65d00;
  --cls-shaman: #0e60b8;
  --cls-mage: #1c7fa6;
  --cls-priest: #6c7680;
  --cls-warlock: #6e58a8;
  --cls-hunter: #557d24;

  /* Typography */
  --font-display: "Cormorant Garamond", "Noto Serif SC", "Source Han Serif SC", Georgia, "Songti SC", "SimSun", serif;
  --font-ui: "Roboto Condensed", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --frame-max: 1480px;
  --gutter: clamp(16px, 4.2vw, 48px);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
  color: var(--ink);
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.12s var(--ease);
}

a:hover {
  color: var(--accent-active);
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: var(--paper-deep);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--archive-ink);
}

.container {
  max-width: var(--frame-max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.num, td.num, .tabular {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Top Utility Bar (64px Kovarel Header)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  background: var(--paper-light);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  max-width: var(--frame-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-link:hover {
  color: var(--accent-deep);
}

.compass-mark {
  display: block;
  color: var(--ink);
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-slash {
  color: var(--rule);
  font-size: 22px;
  font-weight: 300;
  user-select: none;
}

/* Batch Switcher Dropdown */
.batch-dropdown {
  position: relative;
}

.batch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease);
  max-width: 260px;
}

.batch-pill:hover,
.batch-pill[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--paper-light);
}

.batch-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.batch-pill-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron-icon {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.16s var(--ease);
}

.batch-pill[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.batch-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(28, 25, 21, 0.11);
  overflow: hidden;
  z-index: 60;
}

.popover-head {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.popover-list {
  max-height: 360px;
  overflow-y: auto;
}

.popover-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-row);
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background-color 0.12s var(--ease);
}

.popover-item:last-child {
  border-bottom: none;
}

.popover-item:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.popover-item.is-selected {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.popover-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.popover-item-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Topbar Right Controls */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scope-tabs {
  display: inline-flex;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 2px;
}

.scope-tab {
  border: none;
  background: transparent;
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}

.scope-tab:hover {
  color: var(--ink);
}

.scope-tab.is-active {
  background: var(--paper-light);
  color: var(--accent-deep);
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.08);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 190px;
  height: 36px;
  padding: 0 10px 0 32px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.14s var(--ease), width 0.2s var(--ease), background-color 0.14s var(--ease);
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--paper-light);
  outline: none;
  width: 230px;
}

.rescan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--archive-ink);
  cursor: pointer;
  transition: border-color 0.14s var(--ease), color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.rescan-btn:hover {
  border-color: var(--accent);
  color: var(--accent-active);
  background: var(--paper);
}

.rescan-btn.is-spinning .rescan-icon {
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Hero Header with Ambient Cartographic Map
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule-strong);
  padding: clamp(28px, 3.6vw, 48px) 0 clamp(26px, 3.2vw, 40px);
  background: linear-gradient(180deg, var(--paper) 0%, #f6f0e3 100%);
}

.hero-map {
  position: absolute;
  inset: -12px 0 -12px 24%;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.45) 35%, rgba(0,0,0,0.95) 88%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.45) 35%, rgba(0,0,0,0.95) 88%);
  will-change: transform;
}

.hero-map svg {
  width: 100%;
  height: 100%;
  display: block;
}

@supports (animation-timeline: scroll()) {
  .hero-map {
    animation: map-drift linear both;
    animation-timeline: scroll(root);
    animation-range: 0px 260px;
  }
  @keyframes map-drift {
    from { transform: translateY(0px); }
    to { transform: translateY(10px); }
  }
}

.hero-inner {
  position: relative;
  z-index: 2;
  animation: hero-enter 0.42s var(--ease) both;
}

@keyframes hero-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.hero-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(42px, 3.8vw + 16px, 68px);
  line-height: 1.04;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.hero-lead {
  margin: 0;
  max-width: 760px;
  font-family: var(--font-display);
  font-size: clamp(16px, 1.2vw + 12px, 19px);
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ==========================================================================
   6-Column Benchmark Strip & Delta Banner
   ========================================================================== */

.workspace {
  padding-top: 0;
  padding-bottom: 64px;
}

.benchmark-strip {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--rule);
}

.bench-cell {
  padding: 16px 16px 16px 0;
  border-right: 1px solid var(--rule);
  padding-left: 16px;
}

.bench-cell:first-child {
  padding-left: 0;
}

.bench-cell:last-child {
  border-right: none;
  padding-right: 0;
}

.bench-cell dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.bench-cell dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--record-ink);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.compare-select {
  width: 100%;
  max-width: 210px;
  height: 30px;
  padding: 0 8px;
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-deep);
  cursor: pointer;
}

.compare-select:hover,
.compare-select:focus {
  border-color: var(--accent);
}

.delta-banner {
  padding: 15px 0 18px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.inline-action {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.inline-action:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Main Ranking Ledger Table
   ========================================================================== */

.ledger-section {
  padding-top: 22px;
}

.ledger-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ledger-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.ledger-sort {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.sort-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
}

.sort-chip {
  border: 1px solid var(--rule);
  background: var(--paper-light);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s var(--ease), color 0.12s var(--ease), background-color 0.12s var(--ease);
}

.sort-chip:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.sort-chip.is-active {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 8%, var(--paper-light));
}

.state-box {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 42px 24px;
  text-align: center;
  margin-top: 12px;
}

.state-box h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}

.state-box p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.ranking-table thead th {
  position: sticky;
  top: 64px;
  z-index: 10;
  background: var(--paper);
  padding: 10px 10px 10px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.ranking-table th.col-rank { width: 62px; }
.ranking-table th.col-spec { width: 22%; }
.ranking-table th.col-dps { width: 27%; }
.ranking-table th.col-delta { width: 12%; text-align: right; }
.ranking-table th.col-rel { width: 9%; text-align: right; }
.ranking-table th.col-diag { width: 19%; }
.ranking-table th.col-tools { width: 9%; text-align: right; }

.ranking-table tbody tr {
  border-bottom: 1px solid var(--rule-row);
  cursor: pointer;
  transition: background-color 0.12s var(--ease);
}

.ranking-table tbody tr:hover,
.ranking-table tbody tr:focus-within {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.ranking-table tbody tr:hover td:first-child,
.ranking-table tbody tr:focus-within td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.ranking-table td {
  padding: 13px 10px 13px 8px;
  vertical-align: middle;
  font-size: 14px;
  color: var(--record-ink);
  font-variant-numeric: tabular-nums;
}

.rank-cell {
  font-weight: 700;
  color: var(--muted);
  font-size: 14px;
}

.rank-cell.is-top3 {
  color: var(--ink);
}

.spec-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.spec-icon-frame {
  width: 26px;
  height: 26px;
  border-radius: 3px;
  background: var(--icon-bg);
  border: 1px solid rgba(28, 25, 21, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.spec-icon-frame.is-lg {
  width: 38px;
  height: 38px;
  border-radius: 5px;
}

.spec-icon-frame svg {
  width: 17px;
  height: 17px;
}

.spec-icon-frame.is-lg svg {
  width: 24px;
  height: 24px;
}

.spec-text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.spec-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}

.entity-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--paper-light);
  color: var(--muted);
  line-height: 1.35;
}

.entity-tag.is-role {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--rule));
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 7%, var(--paper-light));
}

.entity-tag.is-pet {
  border-color: color-mix(in srgb, var(--cls-druid) 35%, var(--rule));
  color: #8a4405;
  background: color-mix(in srgb, var(--cls-druid) 7%, var(--paper-light));
}

.sample-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--paper-deep);
  color: var(--archive-ink);
  font-variant-numeric: tabular-nums;
}

/* Kovarel DPS Bar + Bold Value */
.dps-cell-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.dps-bar-track {
  width: 100%;
  height: 8px;
  display: flex;
  align-items: center;
}

.dps-bar-fill {
  height: 8px;
  border-radius: 4px;
  min-width: 6px;
  transition: width 0.36s var(--ease);
}

.dps-val-wrap {
  text-align: right;
  line-height: 1.15;
}

.dps-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.dps-std {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* Delta Column */
.delta-cell {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.delta-gain { color: var(--gain); }
.delta-loss { color: var(--danger); }
.delta-muted { color: var(--muted); font-weight: 500; }
.delta-new {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.delta-sub {
  display: inline-block;
  margin-left: 5px;
  font-size: 12px;
  font-weight: 600;
}

.rel-cell {
  text-align: right;
  font-weight: 600;
  color: var(--archive-ink);
}

.diag-cell {
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diag-cell .ov-high {
  color: var(--danger);
  font-weight: 600;
}

.tools-cell {
  text-align: right;
  white-space: nowrap;
}

.row-action-btn {
  border: none;
  background: transparent;
  padding: 4px 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.12s var(--ease), background-color 0.12s var(--ease);
}

.row-action-btn:hover {
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

/* ==========================================================================
   FAQ / Methodology Section (Kovarel 2-column cards)
   ========================================================================== */

.faq-section {
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.faq-heading {
  margin: 0 0 26px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.faq-card {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 5px;
  transition: border-color 0.14s var(--ease);
}

.faq-card.is-open {
  border-color: var(--accent);
}

.faq-trigger {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 18px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.faq-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.18s var(--ease);
}

.faq-card.is-open .faq-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-body {
  padding: 0 18px 16px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.65;
  border-top: 1px solid var(--rule-row);
}

.faq-body p {
  margin: 12px 0 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-light);
  padding: 20px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==========================================================================
   Archival Detail Drawer (Slide-over Diagnostic Sheet)
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 25, 21, 0.36);
  backdrop-filter: blur(2px);
  animation: fade-in 0.18s var(--ease) both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: min(1120px, 96vw);
  background: var(--paper);
  border-left: 1px solid var(--rule-strong);
  box-shadow: -16px 0 42px rgba(28, 25, 21, 0.18);
  display: flex;
  flex-direction: column;
  animation: drawer-slide 0.24s var(--ease) both;
}

@keyframes drawer-slide {
  from { transform: translateX(36px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-header {
  padding: 18px 24px;
  background: var(--paper-light);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.drawer-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.drawer-title {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.drawer-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-compare-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.drawer-close:hover {
  border-color: var(--accent);
  color: var(--accent-active);
}

/* Multi-run Switcher Bar */
.run-switcher {
  padding: 10px 24px;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  flex-shrink: 0;
}

.run-switcher-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.run-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.run-pill {
  border: 1px solid var(--rule);
  background: var(--paper-light);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s var(--ease), background-color 0.12s var(--ease);
}

.run-pill:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.run-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fdfbf5;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* KPI Grid inside Drawer */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kpi-val {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.mini-meter {
  margin-top: 5px;
  height: 6px;
  width: 100%;
  background: var(--paper-deep);
  border-radius: 3px;
  overflow: hidden;
}

.mini-meter-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s var(--ease);
}

.kpi-tag {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}

.kpi-tag.good { background: color-mix(in srgb, var(--gain) 12%, transparent); color: var(--gain); }
.kpi-tag.mid { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.kpi-tag.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* Drawer Sections */
.drawer-section {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 18px 20px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-row);
}

.section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
}

.section-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Interactive Per-Second DPS SVG Chart */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-soft);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.legend-swatch.is-box {
  height: 10px;
  width: 12px;
  border-radius: 2px;
}

.chart-frame {
  position: relative;
  width: 100%;
  min-height: 250px;
}

.chart-frame svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  min-width: 195px;
  max-width: 260px;
  background: rgba(253, 251, 245, 0.97);
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  padding: 9px 11px;
  box-shadow: 0 8px 22px rgba(28, 25, 21, 0.14);
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tt-head {
  font-weight: 700;
  color: var(--accent-deep);
  border-bottom: 1px solid var(--rule-row);
  padding-bottom: 4px;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.5;
}

.tt-skills {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed var(--rule);
  color: var(--ink-soft);
}

/* Stacked Skill Share Strip */
.share-strip {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-deep);
  margin-bottom: 14px;
  gap: 1px;
}

.share-seg {
  height: 100%;
  transition: opacity 0.14s var(--ease);
}

.share-seg:hover {
  opacity: 0.78;
}

/* Detail Tables */
.detail-table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.detail-table th {
  text-align: left;
  padding: 8px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.detail-table th.num,
.detail-table td.num {
  text-align: right;
  white-space: nowrap;
}

.detail-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--rule-row);
  vertical-align: middle;
  color: var(--record-ink);
}

.detail-table tbody tr:last-child td {
  border-bottom: none;
}

.skill-name-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.skill-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.cell-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.share-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.share-mini-bar {
  width: 44px;
  height: 6px;
  background: var(--paper-deep);
  border-radius: 3px;
  overflow: hidden;
}

.share-mini-fill {
  height: 100%;
  border-radius: 3px;
}

.avoid-note {
  margin-top: 12px;
  padding: 9px 12px;
  background: var(--paper);
  border-left: 2px solid var(--warn);
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* Buff / Debuff Visual List */
.buff-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.buff-row {
  background: var(--paper);
  border: 1px solid var(--rule-row);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.buff-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.buff-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.buff-kind {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.buff-kind.is-buff {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent-deep);
}

.buff-kind.is-debuff {
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  color: var(--danger);
}

.buff-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buff-pct {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.buff-bar-track {
  height: 6px;
  width: 100%;
  background: var(--paper-deep);
  border-radius: 3px;
  overflow: hidden;
}

.buff-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.buff-bar-fill.is-buff { background: var(--accent); }
.buff-bar-fill.is-debuff { background: #a84824; }

.buff-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty-muted {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

/* Toast */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  background: var(--ink);
  color: var(--paper-light);
  padding: 10px 16px;
  border-radius: 5px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 26px rgba(28, 25, 21, 0.24);
}

/* ==========================================================================
   Responsive Layout
   ========================================================================== */

@media (max-width: 1120px) {
  .benchmark-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .bench-cell:nth-child(3) { border-right: none; }
  .bench-cell:nth-child(n+4) { border-top: 1px solid var(--rule-row); }
  .bench-cell:nth-child(4) { padding-left: 0; }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    height: auto;
    padding: 10px 0;
  }
  .topbar-inner {
    flex-wrap: wrap;
  }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .search-box input {
    width: 140px;
  }
  .ranking-table thead th {
    position: static;
  }
  .ranking-table th.col-diag,
  .ranking-table td.diag-cell {
    display: none;
  }
  .faq-grid,
  .buff-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .benchmark-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bench-cell {
    border-right: none !important;
    padding-left: 0 !important;
    border-top: 1px solid var(--rule-row);
  }
  .bench-cell:nth-child(-n+2) {
    border-top: none;
  }
  .ranking-table thead {
    display: none;
  }
  .ranking-table,
  .ranking-table tbody,
  .ranking-table tr,
  .ranking-table td {
    display: block;
    width: 100%;
  }
  .ranking-table tbody tr {
    padding: 12px 6px;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 6px 8px;
    align-items: center;
  }
  .ranking-table td {
    padding: 0;
    border: none;
  }
  .ranking-table td.col-dps-td {
    grid-column: 1 / -1;
  }
  .ranking-table td.rel-cell,
  .ranking-table td.tools-cell {
    display: none;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
