/* Intentionally aligned with ror_scenarios_styles.css so the archive page reads as part of the same dashboard family. */

:root {
  color-scheme: dark;
  --bg: #1a1a1a;
  --panel: rgba(43, 43, 43, 0.92);
  --panel-border: rgba(68, 68, 68, 0.8);
  --text: #f0f0f0;
  --muted: #888888;
  --accent: #ffb019;
  --accent-strong: #ffcf70;
  --order: #6bb2ff;
  --destro: #ff6b6b;
  --order-bg: rgba(107, 178, 255, 0.2);
  --destro-bg: rgba(255, 107, 107, 0.2);
  --order-border: rgba(107, 178, 255, 0.55);
  --destro-border: rgba(255, 107, 107, 0.55);
  --neutral: #ffcf70;
  --card-shadow: 0 18px 30px rgba(0, 0, 0, 0.55);
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 16px 20px 20px;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image: url("assets/ror.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

button,
input,
select {
  font: inherit;
}

header {
  position: relative;
  padding: 4px 24px 6px;
  text-align: center;
}

header h1 {
  margin: 0;
  text-align: center;
  color: var(--accent);
}

header h1 .muted {
  color: var(--muted);
  font-size: inherit;
}

header h1 .muted a {
  color: var(--muted) !important;
  text-decoration: none;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  text-decoration: none;
  color: var(--accent-strong);
}

header p {
  margin: 10px auto 0;
  max-width: 860px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.top-nav {
  position: absolute;
  top: 8px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.top-nav a {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1;
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0.8;
}

.top-nav a + a::before {
  content: "·";
  color: rgba(255, 191, 73, 0.35);
  margin-right: 8px;
}

.top-nav a:hover {
  color: var(--accent-strong);
  opacity: 1;
}

.control-bar {
  margin: 0;
}

#controlBar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 0;
  margin-bottom: 6px;
}

.control-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 191, 73, 0.3);
  background: rgba(40, 30, 12, 0.55);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .filter-toggle:hover {
    color: var(--accent-strong);
    border-color: var(--accent);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  }
}

.filter-toggle.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 176, 25, 0.7), rgba(60, 38, 10, 0.9));
  color: var(--text);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.4);
}

.control-pill {
  min-height: 44px;
  padding: 5px 12px 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 191, 73, 0.16);
  background: rgba(32, 28, 22, 0.82);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--card-shadow);
}

.control-pill span {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.control-pill input,
.control-pill select {
  min-height: 30px;
  border: 1px solid rgba(255, 191, 73, 0.18);
  border-radius: 10px;
  background: rgba(18, 18, 18, 0.55);
  color: var(--text);
  padding: 0 10px;
}

#timeRange,
#lastUpdated {
  transition: opacity 0.2s ease;
}

#lastUpdated {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 10px 0 6px;
}

.error-box,
.loading-box {
  max-width: 1200px;
  margin: 8px auto 12px;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.error-box {
  border: 1px solid rgba(255, 107, 107, 0.45);
  background: rgba(56, 18, 18, 0.88);
  color: #ffd8d8;
}

.loading-box {
  border: 1px dashed rgba(255, 191, 73, 0.35);
  background: rgba(20, 20, 20, 0.85);
  color: var(--muted);
  text-align: center;
}

.realm-summary {
  max-width: 1200px;
  margin: 18px auto 12px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-value {
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.05;
}

.summary-value .faction-order,
.summary-value .faction-destro {
  font-size: 1.1rem;
}

.summary-note {
  color: var(--text);
  opacity: 0.8;
  font-size: 0.8rem;
  line-height: 1.45;
}

#content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  gap: 16px;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 2.05fr);
  gap: 16px;
}

.stats-panel {
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.panel-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
  padding-top: 0;
  line-height: 0;
}

.icon-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  opacity: 0.74;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}

.icon-filter-toggle img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.icon-filter-toggle:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.icon-filter-toggle.active {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255, 176, 25, 0.72));
  transform: none;
}

.icon-filter-toggle:focus-visible {
  outline: 2px solid rgba(255, 176, 25, 0.55);
  outline-offset: 4px;
  border-radius: 8px;
}

.panel-head h2 {
  margin: 0;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.mix-subsection {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.mix-subhead h3 {
  margin: 0;
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.mix-subhead p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mix-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.mix-row-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.mix-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mix-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 176, 25, 0.48), rgba(255, 210, 125, 0.9));
}

.pill,
.small-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 191, 73, 0.24);
  background: rgba(40, 30, 12, 0.38);
}

.pill {
  padding: 5px 10px;
  color: #fff0cd;
  font-size: 0.76rem;
  font-weight: 700;
}

.small-pill {
  padding: 3px 8px;
  color: var(--muted);
  font-size: 0.68rem;
}

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

.highlight-card {
  min-height: 172px;
  padding: 16px;
  border: 1px solid rgba(255, 191, 73, 0.16);
  border-radius: 16px;
  background: rgba(20, 20, 20, 0.24);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.highlight-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.highlight-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.highlight-subline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.highlight-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.highlight-stat {
  padding: 12px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.highlight-stat-label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.highlight-stat-value {
  margin-top: 6px;
  color: #fff4d6;
  font-size: 0.96rem;
  font-weight: 700;
}

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

.side-card {
  min-height: 210px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.side-card.order {
  border-color: var(--order-border);
  background: linear-gradient(140deg, rgba(107, 178, 255, 0.16), rgba(18, 22, 34, 0.72));
}

.side-card.destro {
  border-color: var(--destro-border);
  background: linear-gradient(140deg, rgba(255, 107, 107, 0.16), rgba(32, 18, 22, 0.72));
}

.side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.96rem;
  font-weight: 800;
}

.side-title.order {
  color: var(--order);
}

.side-title.destro {
  color: var(--destro);
}

.side-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

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

.mini-stat {
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.mini-stat-label {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-stat-value {
  margin-top: 6px;
  font-size: 0.98rem;
  font-weight: 700;
}

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

.archetype-card {
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.archetype-card h3 {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text);
}

.archetype-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rank-cell {
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.character-cell {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.character-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.character-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.character-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.character-name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.character-name {
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}

.character-sub,
.cell-note {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.metric-strong {
  color: var(--text);
  font-weight: 700;
}

.career-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.career-title {
  font-weight: 700;
  color: var(--text);
}

.faction-order {
  color: var(--order);
}

.faction-destro {
  color: var(--destro);
}

.win-split-cell {
  font-weight: 600;
}

.empty-state {
  padding: 18px 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 1220px) {
  .realm-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 900px) {
  .side-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  body {
    padding: 12px;
    background-attachment: scroll;
  }

  header {
    padding: 4px 0 6px;
    text-align: left;
  }

  header h1 {
    font-size: 1.3rem;
    line-height: 1.28;
    text-align: left;
  }

  header h1 .muted {
    display: block;
    margin-top: 4px;
    font-size: 0.9em;
  }

  header p {
    max-width: none;
  }

  .top-nav {
    position: static;
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
  }

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

  .panel-tools {
    margin-left: 0;
    padding-top: 0;
  }

  #controlBar {
    padding-left: 0;
    padding-right: 0;
  }

  .control-row {
    align-items: stretch;
  }

  .control-row-time {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .control-row-time .filter-toggle {
    width: 100%;
  }

  .control-row-time .control-pill {
    grid-column: 1 / -1;
  }

  .control-row-filters {
    flex-direction: column;
  }

  .control-pill {
    width: 100%;
    justify-content: space-between;
  }

  .control-row-filters .filter-toggle {
    width: 100%;
  }

  .control-pill input,
  .control-pill select {
    min-width: 0;
    width: 100%;
  }

  .realm-summary,
  #content {
    padding-left: 0;
    padding-right: 0;
  }

  .realm-summary {
    grid-template-columns: 1fr;
  }

  .stats-panel {
    padding: 16px;
  }

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

@media (max-width: 720px) {
  .table-wrap {
    overflow: visible;
  }

  .data-table {
    min-width: 0;
    border-collapse: separate;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tbody {
    display: grid;
    gap: 12px;
  }

  .data-table tr {
    padding: 14px;
    border: 1px solid rgba(255, 191, 73, 0.16);
    border-radius: 16px;
    background: rgba(20, 20, 20, 0.28);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  }

  .data-table td {
    margin-top: 10px;
    padding: 0;
    border: none;
    display: grid;
    grid-template-columns: minmax(84px, 108px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .data-table td:first-child {
    margin-top: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.35;
  }

  .table-empty-row {
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
  }

  .table-empty-row td {
    margin: 0;
    display: block;
  }

  .table-empty-row td::before,
  .data-table td.empty-state::before {
    content: none;
  }

  .character-cell {
    gap: 12px;
  }

  .character-icon {
    width: 36px;
    height: 36px;
  }

  .character-icon img {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 560px) {
  .mix-row {
    grid-template-columns: 1fr;
  }

  .mix-row-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .highlight-stats,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
