.cache-status {
  position: fixed;
  top: 120px;
  right: 20px;
  font-size: 0.75rem;
  color: #6c757d;
  background: rgba(248, 249, 250, 0.95);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 100;
  max-width: 250px;
}

.cache-status button {
  margin-left: 0.5rem;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
}

body.dark-mode .cache-status {
  background: rgba(45, 55, 72, 0.95);
  color: #a0aec0;
}

/* Sticky Quick Navigation */
.quick-nav {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  z-index: 50;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* Add space after quick nav */
.quick-nav + h1,
.quick-nav + h2 {
  margin-top: 4.5rem;
}

/* Add scroll offset for anchor links */
html {
  scroll-padding-top: 120px;
}

.quick-nav a {
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s;
}

.quick-nav a:hover {
  color: #5a67d8;
  text-decoration: underline;
}

body.dark-mode .quick-nav {
  background: rgba(26, 32, 44, 0.98);
  border-bottom-color: #4a5568;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  color: #e2e8f0;
}

body.dark-mode .quick-nav strong {
  color: #e2e8f0;
}

body.dark-mode .quick-nav a,
.dark-mode .quick-nav a {
  color: #8b9dff;
}

body.dark-mode .quick-nav a:hover,
.dark-mode .quick-nav a:hover {
  color: #a5b4fc;
}

/* Campaign insights as flowing text */
.campaign-insights-text {
  font-size: 1rem;
  line-height: 1.6;
  margin: 1rem 0 2rem 0;
  max-width: 800px;
}

.campaign-insights-text::first-letter {
  font-size: inherit !important;
  float: none !important;
  line-height: inherit !important;
  font-family: inherit !important;
  color: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
}

.insight-highlight {
  font-weight: 600;
  color: #667eea;
}

body.dark-mode .insight-highlight {
  color: #8b9dff;
}

.chart-container {
  position: relative;
  height: 440px;
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h5 {
  margin-bottom: 0.5rem;
  color: #6c757d;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #0066cc;
}

/* Dark mode support */
body.dark-mode .stat-card {
  background: #2d3748;
}

body.dark-mode .stat-card h5 {
  color: #a0aec0;
}

body.dark-mode .stat-value {
  color: #63b3ed;
}

/* Two-column chart layout */
.chart-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-column {
  flex: 1;
  min-width: 0; /* Prevents flex item from overflowing */
}

.chart-column .chart-container {
  height: 350px;
}

.chart-subtitle {
  font-size: 0.875rem;
  color: #718096;
  margin: -0.5rem 0 1rem 0;
  font-style: italic;
}

body.dark-mode .chart-subtitle {
  color: #a0aec0;
}

@media (max-width: 768px) {
  .chart-row {
    flex-direction: column;
  }

  .chart-column .chart-container {
    height: 400px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* Level Duration Heatmap */
.level-duration-container {
  margin: 2rem 0;
}

.level-duration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.level-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  transition: transform 0.2s;
}

.level-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.level-number {
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.level-days {
  font-size: 0.75rem;
  opacity: 0.8;
}

body.dark-mode .level-cell {
  border-color: #4a5568;
}

@media (max-width: 768px) {
  .level-duration-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.4rem;
  }

  .level-number {
    font-size: 0.8rem;
  }

  .level-days {
    font-size: 0.7rem;
  }
}

/* Level Duration Matrix Table */
.level-duration-matrix-container {
  margin: 2rem 0;
  overflow-x: auto;
}

.level-duration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.level-duration-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.level-duration-table th {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.level-duration-table th:first-child {
  text-align: left;
  padding-left: 1rem;
  min-width: 150px;
  position: sticky;
  left: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 11;
}

.level-duration-table td {
  padding: 0.5rem;
  text-align: center;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
  font-weight: 500;
}

.level-duration-table td.campaign-name {
  text-align: left;
  padding-left: 1rem;
  font-weight: 600;
  background: #f8f9fa;
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 2px solid #cbd5e0;
}

.level-duration-table tbody tr:hover td {
  background-color: rgba(102, 126, 234, 0.1);
}

.level-duration-table tbody tr:hover td.campaign-name {
  background-color: rgba(102, 126, 234, 0.15);
}

body.dark-mode .level-duration-table,
.dark-mode .level-duration-table {
  background: #1e293b;
}

body.dark-mode .level-duration-table td,
.dark-mode .level-duration-table td {
  border-color: #4a5568;
}

body.dark-mode .level-duration-table td.campaign-name,
.dark-mode .level-duration-table td.campaign-name {
  background: #334155;
  border-right-color: #64748b;
}

body.dark-mode .level-duration-table tbody tr:hover td,
.dark-mode .level-duration-table tbody tr:hover td {
  background-color: rgba(102, 126, 234, 0.2);
}

body.dark-mode .level-duration-table tbody tr:hover td.campaign-name,
.dark-mode .level-duration-table tbody tr:hover td.campaign-name {
  background-color: rgba(102, 126, 234, 0.25);
}

@media (max-width: 768px) {
  .level-duration-table {
    font-size: 0.7rem;
  }

  .level-duration-table th,
  .level-duration-table td {
    padding: 0.4rem 0.3rem;
  }

  .level-duration-table th:first-child,
  .level-duration-table td.campaign-name {
    min-width: 100px;
    padding-left: 0.5rem;
  }
}

/* Deadliest Threats Compact Display */
.deadliest-threats-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.threat-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
  transition: all 0.2s;
}

.threat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
}

.threat-rank {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.threat-details {
  flex: 1;
  min-width: 0;
}

.threat-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threat-count {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 500;
  margin-top: 0.15rem;
}

body.dark-mode .threat-card,
.dark-mode .threat-card {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
  border-color: rgba(220, 38, 38, 0.4);
}

body.dark-mode .threat-card:hover,
.dark-mode .threat-card:hover {
  border-color: rgba(220, 38, 38, 0.6);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

body.dark-mode .threat-name,
.dark-mode .threat-name {
  color: #f1f5f9;
}

body.dark-mode .threat-count,
.dark-mode .threat-count {
  color: #fca5a5;
}

@media (max-width: 768px) {
  .deadliest-threats-compact {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .threat-card {
    padding: 0.6rem;
  }
}

/* Player Class Heatmap */
.heatmap-container {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.player-class-heatmap-table {
  border-collapse: collapse;
  font-size: 0.8rem;
  width: 100%;
  background: #ffffff;
}

.player-class-heatmap-table th,
.player-class-heatmap-table td {
  padding: 0.4rem 0.5rem;
  text-align: center;
  border: 1px solid #e2e8f0;
}

body.dark-mode .player-class-heatmap-table,
.dark-mode .player-class-heatmap-table {
  background: #1e293b;
}

body.dark-mode .player-class-heatmap-table th,
body.dark-mode .player-class-heatmap-table td,
.dark-mode .player-class-heatmap-table th,
.dark-mode .player-class-heatmap-table td {
  border-color: #4a5568;
}

.player-class-heatmap-table thead th {
  background-color: #f7fafc;
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
  height: 120px;
  vertical-align: bottom;
  padding: 0;
  position: relative;
}

.player-class-heatmap-table thead th:first-child {
  height: auto;
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}

.player-class-heatmap-table thead th > span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: inline-block;
  padding: 8px 0;
}

body.dark-mode .player-class-heatmap-table thead th,
.dark-mode .player-class-heatmap-table thead th {
  background-color: #2d3748;
  color: #e2e8f0;
}

.player-class-heatmap-table .player-name {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  background-color: #f8f9fa;
  border-right: 2px solid #cbd5e0;
}

.player-class-heatmap-table tbody tr:hover td {
  background-color: rgba(102, 126, 234, 0.1);
}

.player-class-heatmap-table tbody tr:hover td.player-name {
  background-color: rgba(102, 126, 234, 0.15);
}

body.dark-mode .player-class-heatmap-table .player-name,
.dark-mode .player-class-heatmap-table .player-name {
  background-color: #334155;
  color: #e2e8f0;
  border-right-color: #64748b;
}

body.dark-mode .player-class-heatmap-table tbody tr:hover td,
.dark-mode .player-class-heatmap-table tbody tr:hover td {
  background-color: rgba(102, 126, 234, 0.2);
}

body.dark-mode .player-class-heatmap-table tbody tr:hover td.player-name,
.dark-mode .player-class-heatmap-table tbody tr:hover td.player-name {
  background-color: rgba(102, 126, 234, 0.25);
}

/* Obsolete classes (no longer available in archetypes.yml) */
.player-class-heatmap-table thead th.obsolete-class {
  opacity: 0.5;
  font-style: italic;
}

.player-class-heatmap-table thead th.obsolete-class > span {
  color: #ef4444;
}

body.dark-mode .player-class-heatmap-table thead th.obsolete-class > span,
.dark-mode .player-class-heatmap-table thead th.obsolete-class > span {
  color: #f87171;
}

.player-class-heatmap-table tbody td {
  font-weight: 500;
  transition: all 0.15s;
}

/* Player Folk Heatmap (Player's Folk Repertoire) */
.player-folk-heatmap-table {
  border-collapse: collapse;
  font-size: 0.8rem;
  width: 100%;
  background: #ffffff;
}

.player-folk-heatmap-table th,
.player-folk-heatmap-table td {
  padding: 0.4rem 0.5rem;
  text-align: center;
  border: 1px solid #e2e8f0;
}

body.dark-mode .player-folk-heatmap-table,
.dark-mode .player-folk-heatmap-table {
  background: #1e293b;
}

body.dark-mode .player-folk-heatmap-table th,
body.dark-mode .player-folk-heatmap-table td,
.dark-mode .player-folk-heatmap-table th,
.dark-mode .player-folk-heatmap-table td {
  border-color: #4a5568;
}

.player-folk-heatmap-table thead th {
  background-color: #f7fafc;
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
  height: 120px;
  vertical-align: bottom;
  padding: 0;
  position: relative;
}

.player-folk-heatmap-table thead th:first-child {
  height: auto;
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}

.player-folk-heatmap-table thead th > span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: inline-block;
  padding: 8px 0;
}

body.dark-mode .player-folk-heatmap-table thead th,
.dark-mode .player-folk-heatmap-table thead th {
  background-color: #2d3748;
  color: #e2e8f0;
}

.player-folk-heatmap-table .player-name {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  background-color: #f8f9fa;
  border-right: 2px solid #cbd5e0;
}

.player-folk-heatmap-table tbody tr:hover td {
  background-color: rgba(102, 126, 234, 0.1);
}

.player-folk-heatmap-table tbody tr:hover td.player-name {
  background-color: rgba(102, 126, 234, 0.15);
}

body.dark-mode .player-folk-heatmap-table .player-name,
.dark-mode .player-folk-heatmap-table .player-name {
  background-color: #334155;
  color: #e2e8f0;
  border-right-color: #64748b;
}

body.dark-mode .player-folk-heatmap-table tbody tr:hover td,
.dark-mode .player-folk-heatmap-table tbody tr:hover td {
  background-color: rgba(102, 126, 234, 0.2);
}

body.dark-mode .player-folk-heatmap-table tbody tr:hover td.player-name,
.dark-mode .player-folk-heatmap-table tbody tr:hover td.player-name {
  background-color: rgba(102, 126, 234, 0.25);
}

.player-folk-heatmap-table tbody td {
  font-weight: 500;
  transition: all 0.15s;
}

.player-class-heatmap-table tbody td:hover {
  transform: scale(1.05);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
  position: relative;
}

body.dark-mode .player-class-heatmap-table tbody td:hover,
.dark-mode .player-class-heatmap-table tbody td:hover {
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  .player-class-heatmap-table {
    font-size: 0.7rem;
  }

  .player-class-heatmap-table th,
  .player-class-heatmap-table td {
    padding: 0.3rem 0.4rem;
  }
}

/* Player Signature Profile */
.dimension-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 2rem 0;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-radius: 8px;
  border: 1px solid rgba(102, 126, 234, 0.15);
}

.dimension-legend > div {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #374151;
}

.dimension-legend strong {
  color: #667eea;
}

body.dark-mode .dimension-legend {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-color: rgba(102, 126, 234, 0.25);
}

body.dark-mode .dimension-legend > div {
  color: #e2e8f0;
}

body.dark-mode .dimension-legend strong {
  color: #8b9dff;
}

.signature-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.signature-profile-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
  transition: all 0.3s;
}

.signature-profile-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.signature-profile-card h5 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.signature-profile-canvas {
  position: relative;
  height: 280px;
}

body.dark-mode .signature-profile-card {
  background: #2d3748;
  border-color: #4a5568;
}

body.dark-mode .signature-profile-card h5 {
  color: #e2e8f0;
  border-bottom-color: #4a5568;
}

@media (max-width: 768px) {
  .dimension-legend {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1rem;
  }

  .signature-profiles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .signature-profile-card {
    padding: 1rem;
  }

  .signature-profile-canvas {
    height: 240px;
  }
}
