/* ── Unit Card Container ─────────────────────────────────────────────────── */
.unit-card {
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
  overflow: hidden !important;
  padding: 0 !important;
  cursor: pointer !important;
  border-radius: 12px !important;
  background: linear-gradient(160deg, rgba(18, 18, 26, 0.95) 0%, rgba(8, 8, 12, 0.98) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  position: relative !important;
  transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease) !important;
}

.unit-card:hover {
  transform: translateY(-4px) !important;
  border-color: rgba(99, 102, 241, 0.45) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

/* ── Portrait Media Area ───────────────────────────────────────────────────── */
.unit-card-media {
  height: 200px !important;
  background: radial-gradient(120% 80% at 50% 0%, #1a1a24 0%, #0c0c12 70%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  position: relative !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.unit-card-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center 20% !important;
  transition: transform var(--t-med) var(--ease) !important;
}

.unit-card:hover .unit-card-media img {
  transform: scale(1.05) !important;
}

.unit-card-media::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none !important;
  background: linear-gradient(to top, rgba(8, 8, 11, 0.98) 0%, rgba(8, 8, 11, 0.4) 40%, rgba(8, 8, 11, 0) 65%) !important;
  z-index: 1 !important;
}

/* Top Left Ascension Chip */
.unit-card-top-left {
  position: absolute !important;
  top: 8px !important;
  left: 8px !important;
  z-index: 2 !important;
}

.unit-card-ascend-chip {
  display: inline-flex !important;
  align-items: center !important;
  font-size: 8px !important;
  font-weight: 800 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  background: rgba(16, 185, 129, 0.18) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
  backdrop-filter: blur(6px) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}

.unit-card-ascend-chip[hidden] {
  display: none !important;
}

/* Top Right Portrait Meta & Badges */
.unit-card-portrait-meta {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  z-index: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: 4px !important;
}

.unit-card-element,
.unit-card-archetype {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 2px 7px !important;
  border-radius: 5px !important;
  background: rgba(10, 10, 14, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  line-height: 1 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
}

.unit-card-element img,
.unit-card-archetype img {
  width: 12px !important;
  height: 12px !important;
  object-fit: contain !important;
}

.unit-card-badge-text {
  font-size: 8.5px !important;
  font-weight: 750 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}

/* ── Elemental & Archetype Theme Color Styles ── */
.element-dark,
.element-shadow,
.element-curse {
  background: rgba(59, 13, 94, 0.85) !important;
  border-color: rgba(168, 85, 247, 0.6) !important;
  color: #ffffff !important;
}

.element-light,
.element-holy,
.element-divine {
  background: rgba(113, 63, 18, 0.85) !important;
  border-color: rgba(234, 179, 8, 0.6) !important;
  color: #ffffff !important;
}

.element-fire,
.element-flame,
.element-pyro,
.element-ignite {
  background: rgba(127, 29, 29, 0.85) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #ffffff !important;
}

.element-water,
.element-hydro,
.element-aqua {
  background: rgba(10, 37, 64, 0.92) !important;
  border-color: rgba(30, 110, 180, 0.7) !important;
  color: #ffffff !important;
}

.element-storm {
  background: rgba(15, 76, 73, 0.90) !important;
  border-color: rgba(45, 212, 191, 0.75) !important;
  color: #ffffff !important;
}

.element-lightning,
.element-electric,
.element-thunder {
  background: rgba(113, 63, 18, 0.85) !important;
  border-color: rgba(234, 179, 8, 0.6) !important;
  color: #ffffff !important;
}

.element-wind,
.element-gale,
.element-air {
  background: rgba(6, 78, 59, 0.85) !important;
  border-color: rgba(16, 185, 129, 0.6) !important;
  color: #ffffff !important;
}

.element-earth,
.element-terra {
  background: rgba(120, 53, 15, 0.85) !important;
  border-color: rgba(217, 119, 6, 0.6) !important;
  color: #ffffff !important;
}

.element-psychic,
.element-mind,
.element-telekinetic {
  background: rgba(112, 26, 117, 0.85) !important;
  border-color: rgba(217, 70, 239, 0.6) !important;
  color: #ffffff !important;
}

.element-ice,
.element-frost,
.element-cryo,
.element-freeze {
  background: rgba(12, 74, 110, 0.85) !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
  color: #ffffff !important;
}

.element-neutral,
.element-none {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(100, 116, 139, 0.6) !important;
  color: #ffffff !important;
}

.archetype-physical {
  background: rgba(127, 29, 29, 0.85) !important;
  border-color: rgba(220, 38, 38, 0.6) !important;
  color: #ffffff !important;
}

.archetype-magic,
.archetype-magical {
  background: rgba(12, 74, 110, 0.85) !important;
  border-color: rgba(14, 165, 233, 0.6) !important;
  color: #ffffff !important;
}

/* ── Bottom Nameplate Overlay ─────────────────────────────────────────────── */
.unit-card-nameplate {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 2 !important;
  padding: 8px 10px 6px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1px !important;
}

.unit-card-name {
  font-family: var(--font-display, inherit) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  letter-spacing: -0.01em !important;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    0px 2px 4px rgba(0, 0, 0, 0.95) !important;
}

.unit-card-sub {
  font-size: 9.5px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.75) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ── Stat Section Bar ─────────────────────────────────────────────────────── */
.unit-card-body {
  padding: 8px 10px !important;
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 5px !important;
  background: linear-gradient(180deg, #0b0b10 0%, #060608 100%) !important;
}

.unit-card-stat {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  padding: 5px 2px !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.unit-card-stat-label {
  font-size: 8px !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

.unit-card-stat-label.stat-dmg {
  color: #f87171 !important;
}

.unit-card-stat-label.stat-spa {
  color: #38bdf8 !important;
}

.unit-card-stat-label.stat-rng {
  color: #fbbf24 !important;
}

.unit-card-stat-value {
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  white-space: nowrap !important;
}

/* ── Integrated Footer Action Button ──────────────────────────────────────── */
.unit-card-footer {
  padding: 0 8px 8px !important;
  background: #060608 !important;
}

.unit-card-dps-btn {
  width: 100% !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  background: rgba(99, 102, 241, 0.1) !important;
  border: 1px solid rgba(99, 102, 241, 0.28) !important;
  color: #a5b4fc !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 120ms ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

.unit-card-dps-btn:hover {
  background: rgba(99, 102, 241, 0.22) !important;
  border-color: rgba(99, 102, 241, 0.5) !important;
  color: #ffffff !important;
}

.unit-card-btn-arrow {
  margin-left: auto !important;
  opacity: 0.6 !important;
  transition: transform 120ms ease, opacity 120ms ease !important;
}

.unit-card-dps-btn:hover .unit-card-btn-arrow {
  transform: translateX(2px) !important;
  opacity: 1 !important;
}

/* ── Modal Backdrop and standard typography layout ───────── */
.dps-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.dps-modal-backdrop,
.dps-modal-backdrop * {
  font-family: var(--font-body, "Montserrat", sans-serif) !important;
}

.dps-modal-backdrop h1,
.dps-modal-backdrop h2,
.dps-modal-backdrop h3,
.dps-modal-backdrop .dps-panel-title,
.dps-modal-backdrop .dps-summary-name {
  font-family: var(--font-display, "Montserrat", sans-serif) !important;
}

.dps-modal-backdrop .dps-r-val,
.dps-modal-backdrop .dps-summary-val,
.dps-modal-backdrop .dps-relic-detail-stats span {
  font-family: var(--font-mono, "JetBrains Mono", monospace) !important;
}

/* Side-by-side flex container */
.dps-modal-container {
  display: flex;
  gap: 12px;
  align-items: stretch;
  max-width: min(1040px, 95vw);
  height: 85vh;
  max-height: 720px;
  width: max-content;
  min-height: 0;
  overflow: hidden !important;
  justify-content: center;
}

.dps-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  background: var(--card, #131316);
  border: 1px solid var(--border-strong, #2c2c32);
  border-radius: 10px;
  overflow: hidden;
  animation: panel-in 0.18s ease-out;
}

.dps-panel.summons-panel {
  width: min(92vw, 280px);
  flex-shrink: 0;
  border-color: rgba(45, 212, 191, 0.25);
  background: #09090b;
}

.dps-panel.main-panel {
  width: min(92vw, 460px);
  flex-shrink: 0;
  min-width: 0;
}

.dps-panel.relics-panel {
  width: min(92vw, 195px);
  flex-shrink: 0;
  border-color: rgba(99, 102, 241, 0.22);
  background: #07070b;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dps-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border, #1e1e22);
  background: var(--background-elevated, #0e0e11);
}

.dps-panel-header-text {
  flex: 1;
  min-width: 0;
}

.dps-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #fafafa);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dps-panel-sub {
  font-size: 10.5px;
  color: var(--muted, #71717a);
  margin-top: 1px;
}

.dps-panel-close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border, #1e1e22);
  background: transparent;
  color: var(--muted, #71717a);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 100ms ease;
}

.dps-panel-close:hover {
  background: var(--background-elevated, #0e0e11);
  border-color: var(--border-strong, #2c2c32);
  color: var(--text, #fafafa);
}

.dps-panel-body {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.dps-panel-footer {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  background: #08080d;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── Hero summary layout block ───────────────────────────── */
.dps-summary-block {
  border-radius: 8px;
  border: 1px solid var(--border, #141418);
  background: linear-gradient(135deg, #09090d 0%, #040406 100%);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: none !important;
}

.dps-summary-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dps-summary-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--border, #141418);
  overflow: hidden;
  background: var(--background-elevated, #07070a);
}

.dps-summary-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dps-summary-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text, #fafafa);
  line-height: 1.2;
}

.dps-summary-sub {
  font-size: 10px;
  color: var(--muted, #71717a);
}

/* Horizontal metrics grid of boxes */
.dps-metric-grid {
  display: flex;
  flex-wrap: nowrap;
  background: var(--background-elevated, #07070a);
  border: 1px solid var(--border, #141418);
  border-radius: var(--radius-md, 6px);
  overflow: hidden;
  box-shadow: none !important;
}

.dps-metric-card {
  flex: 1;
  min-width: 0;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none !important;
}

.dps-metric-card:last-child {
  border-right: none;
}

.dps-metric-card.combined-card {
  border-color: rgba(99, 102, 241, 0.15);
  background: var(--background-elevated, #07070a);
  box-shadow: none !important;
}

.dps-metric-card:nth-last-child(2),
.dps-metric-card.combined-card {
  flex: 1.6;
  min-width: 72px;
}

.dps-metric-val {
  font-family: var(--font-mono, monospace) !important;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.dps-metric-lbl {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted, #71717a);
  text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

/* ── Math Sections & Layouts ────────────────── */
.dps-section {
  background: var(--background-elevated, #07070a);
  border: 1px solid var(--border, #141418);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: none !important;
}

.dps-section-hd {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary, #a1a1aa);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.dps-section-hd::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple-strong, #818cf8);
}

.section-damage .dps-section-hd::before {
  background: #b80000;
}

.section-crit .dps-section-hd::before {
  background: #ad2eff;
}

.section-spa .dps-section-hd::before {
  background: #00f0ff;
}

.section-range .dps-section-hd::before {
  background: #facc15;
}

.section-dot .dps-section-hd::before {
  background: #10b981;
}

.section-summons .dps-section-hd::before {
  background: #2dd4bf;
}

/* Header titles */
.color-damage {
  color: #b80000;
}

.color-crit {
  color: #ad2eff;
}

.color-spa {
  color: #00f0ff;
}

.color-range {
  color: #facc15;
}

.color-dot {
  color: #10b981;
}

.color-summons {
  color: #2dd4bf;
}

.damage-highlight {
  color: #b80000 !important;
}

.crit-highlight {
  color: #ad2eff !important;
}

.spa-highlight {
  color: #00f0ff !important;
}

.range-highlight {
  color: #facc15 !important;
}

.dot-highlight {
  color: #10b981 !important;
}

.summons-highlight {
  color: #2dd4bf !important;
}

.combined-highlight {
  color: #ad2eff !important;
}

.highlight-large {
  font-size: 13px;
  font-weight: 700;
}

/* Bespoke Table Layout structure */
.dps-table {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.dps-table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  padding: 1px 0;
  gap: 8px;
}

.dps-table-row.indented {
  padding-left: 14px;
  font-size: 11px;
}

.dps-table-lbl {
  color: var(--text-secondary, #a1a1aa);
  min-width: 0;
}

.dps-table-row.indented .dps-table-lbl {
  color: var(--muted, #71717a);
}

.dps-table-val {
  font-weight: 600;
  color: #fafafa !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.dps-table-row.indented .dps-table-val {
  color: #cbd5e1 !important;
}

.dps-table-row.divider {
  margin-top: 3px;
  padding: 0;
  height: 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.dps-table-row.primary {
  padding-top: 5px;
}

.dps-summary-val {
  font-family: var(--font-mono, monospace) !important;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  text-shadow: none !important;
}

@media (max-width: 900px) {
  .dps-modal-container {
    flex-direction: column;
    height: 90vh;
    max-height: 90vh;
    overflow-y: auto !important;
  }

  .dps-panel {
    width: 100% !important;
    max-height: none !important;
  }
}