:root {
  color-scheme: dark;
  --bg: #0b0e16;
  --panel: #121724;
  --panel-soft: #171d2c;
  --line: #273044;
  --muted: #9aa5bb;
  --text: #eef2fb;
  --gold: #e8b86a;
  --blue: #79b8ff;
  --green: #67d5a0;
  --red: #ff8c98;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at 18% 0%, #1a2134 0, transparent 32rem), var(--bg);
  color: var(--text);
}
a { color: inherit; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 56px; }
.eyebrow { color: var(--gold); font-size: .76rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.hero h1 { margin: 7px 0 8px; font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.045em; }
.hero p { max-width: 660px; margin: 0; color: var(--muted); line-height: 1.55; }
.hero-meta { color: var(--muted); font-size: .82rem; text-align: right; white-space: nowrap; }
.hero-meta a { color: var(--blue); text-decoration: none; }
.tabs-shell { position: sticky; top: 12px; z-index: 5; margin: 0 0 26px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: rgba(12,16,27,.9); box-shadow: 0 12px 30px rgba(0,0,0,.2); backdrop-filter: blur(14px); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.tab { flex: 1 0 auto; min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: .86rem; font-weight: 750; white-space: nowrap; }
.tab:hover { color: var(--text); background: rgba(255,255,255,.045); }
.tab[aria-selected="true"] { border-color: rgba(121,184,255,.32); background: rgba(121,184,255,.12); color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tab-panel { min-width: 0; }
.overview-note { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.overview-note strong { font-size: .95rem; }
.overview-note span { color: var(--muted); font-size: .82rem; line-height: 1.5; text-align: right; }
.profile-detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr); gap: 14px; }
.character-context { min-width: 0; }
.character-context h3 { margin: 0; font-size: 1rem; }
.character-context p { margin: 12px 0 20px; color: #d7deed; font-size: .84rem; line-height: 1.55; }
.context-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.context-list div { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.035); }
.context-list strong, .context-list span { display: block; }
.context-list strong { font-size: 1rem; }
.context-list span { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.grid { display: grid; gap: 14px; }
.overview-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 28px; }
.stat-card, .panel, .profile-card, .run-card, .loading-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(25,32,49,.96), rgba(15,20,32,.96)); border-radius: 16px; box-shadow: 0 16px 44px rgba(0,0,0,.16); }
.stat-card { padding: 17px; }
.stat-card strong { display: block; font-size: 1.65rem; letter-spacing: -.035em; }
.stat-card span { display: block; margin-top: 5px; color: var(--muted); font-size: .8rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 0 13px; }
.section-heading h2 { margin: 0; font-size: 1.2rem; }
.section-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.profiles-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-card { padding: 20px; min-width: 0; }
.profile-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.profile-head h3 { margin: 0; font-size: 1.35rem; }
.profile-head p { margin: 5px 0 0; color: var(--muted); font-size: .83rem; }
.role-badge { border: 1px solid rgba(232,184,106,.32); border-radius: 999px; color: var(--gold); padding: 5px 9px; font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 22px 0 15px; }
.metric { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.035); }
.metric strong { display: block; font-size: 1.02rem; }
.metric span { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.percentiles { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.pill { border-radius: 999px; background: rgba(121,184,255,.1); color: var(--blue); padding: 5px 9px; font-size: .74rem; }
.pill.gold { background: rgba(232,184,106,.1); color: var(--gold); }
.sparkline { width: 100%; height: 58px; display: block; margin: 4px 0 12px; }
.chart-label { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; }
.insight { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: #d7deed; font-size: .82rem; line-height: 1.5; }
.panel { padding: 20px; }
.runs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.run-card { padding: 18px; }
.run-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.run-head h3 { margin: 0; font-size: 1rem; }
.run-head p { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.run-result { color: var(--green); font-weight: 800; font-size: .8rem; white-space: nowrap; }
.run-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 17px 0; }
.run-stats div { padding: 9px; background: rgba(255,255,255,.035); border-radius: 9px; }
.run-stats strong { display: block; font-size: .95rem; }
.run-stats span { display: block; margin-top: 3px; color: var(--muted); font-size: .68rem; }
.run-members { display: flex; flex-wrap: wrap; gap: 7px; }
.member { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: #cbd4e5; font-size: .75rem; }
.member em { color: var(--muted); font-style: normal; }
.run-link { display: inline-block; margin-top: 16px; color: var(--blue); font-size: .78rem; text-decoration: none; }
.run-link:hover { text-decoration: underline; }
.methodology { margin-top: 14px; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.methodology summary { cursor: pointer; color: #d8e0ef; }
.methodology ul { margin-bottom: 0; padding-left: 20px; }
.empty { color: var(--muted); padding: 24px 0; }
.loading-card { padding: 32px; color: var(--muted); }
.error { border-color: rgba(255,140,152,.4); color: var(--red); }
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profiles-grid, .runs-grid { grid-template-columns: 1fr; }
  .profile-detail-grid { grid-template-columns: 1fr; }
  .hero { align-items: start; flex-direction: column; }
  .hero-meta { text-align: left; }
}
@media (max-width: 560px) {
  .page-shell { width: min(100% - 22px, 1180px); padding-top: 24px; }
  .tabs-shell { top: 6px; margin-bottom: 20px; }
  .tab { min-height: 40px; padding-inline: 13px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid .stat-card:last-child { grid-column: span 2; }
  .run-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-note { align-items: start; flex-direction: column; gap: 8px; }
  .overview-note span { text-align: left; }
  .context-list { grid-template-columns: 1fr; }
}
