@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #121416;
  --surface: #1a1d21;
  --ink: #eceae6;
  --muted: #a3a097;
  --faint: #8d8982;
  --accent: #8fb4ff;
  --line: rgba(255, 255, 255, 0.08);
  --q-poor: #9a9a9a;
  --q-common: #eceae6;
  --q-uncommon: #9bb59a;
  --q-rare: #8e9aab;
  --q-epic: #b7a6c9;
  --q-legendary: #c4b8a4;
  --qt-poor: #b5b5b5;
  --qt-common: #eceae6;
  --qt-uncommon: #b7cbb4;
  --qt-rare: #c5d0de;
  --qt-epic: #d4c6e0;
  --qt-legendary: #ddd4c6;
  --sans: "Source Sans 3", "Segoe UI", "Helvetica Neue", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
}
button, input, select { font: inherit; color: inherit; background: transparent; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #d5e2ff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 3rem 1.5rem; color: var(--muted); font-size: 1.1rem; }

.layout { min-height: 100vh; display: flex; flex-direction: column; }
.stage { flex: 1; min-width: 0; }
.rail { display: none; }
.brand { display: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 999px;
  white-space: nowrap;
  min-height: 44px;
}
.nav a.active { color: var(--ink); background: var(--surface); }

.top { display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin: 0; }
.word, .word strong, .brand strong { color: var(--ink); text-decoration: none; }
.word small, .brand small { display: block; color: var(--muted); font-size: 0.82rem; }
.portrait { display: none; }
.lang { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.95rem; }
.page { margin: 0; padding: 4px 0 28px; }
.page > h1 { margin: 0 0 12px; font-size: 1.7rem; font-weight: 600; color: var(--ink); }

.profile {
  margin: 0 0 20px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
}
.identity { display: flex; gap: 12px; align-items: center; }
.identity strong { font-size: 1.05rem; font-weight: 600; }
.identity .sub { display: block; color: var(--muted); font-size: 0.92rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
label.field { display: grid; gap: 4px; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
select, .texty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  min-height: 44px;
}
.modes { display: flex; flex-wrap: wrap; gap: 6px; }
.modes button, .seg button, .icon-btn, .text-btn, .btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}
.modes button[aria-pressed="true"], .modes button.on, .seg button[aria-pressed="true"], .seg button.on {
  border-color: var(--accent);
  color: var(--accent);
}
.hint { margin: 8px 0 0; color: var(--muted); font-size: 0.95rem; }

.hero { padding: 8px 0; max-width: 40rem; }
.kicker {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0 0 8px;
}
h1, h2, h3 { font-family: var(--sans); font-weight: 600; letter-spacing: 0; line-height: 1.3; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 3vw, 2rem); margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.lede { font-size: 1.05rem; color: var(--muted); margin: 0 0 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.btn.primary { border-color: var(--accent); color: var(--ink); }
.fact { color: var(--ink); border-left: 2px solid var(--accent); padding-left: 12px; }

.grid-5, .grid-3, .split { display: grid; gap: 12px; }
.card, .note, .gap, .stat-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.card h3 { margin: 0 0 6px; font-size: 1rem; color: var(--ink); }
.card p, .note p { margin: 0; color: var(--muted); }
.section { margin-top: 22px; }
.feed-card, .diff { display: block; }
.node-body { min-width: 0; display: grid; gap: 6px; }
.spell { display: none; }
.q-poor { --qt: var(--qt-poor); }
.q-common { --qt: var(--qt-common); }
.q-uncommon { --qt: var(--qt-uncommon); }
.q-rare { --qt: var(--qt-rare); }
.q-epic { --qt: var(--qt-epic); }
.q-legendary { --qt: var(--qt-legendary); }
.feed-card h3, .diff h3, .node-body h3, .t-item h3 { color: var(--ink); font-size: 1rem; margin: 0; }
.meta-row, .badge-row, .vote-row, .src-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meta-row { color: var(--muted); font-size: 0.9rem; }
.summary { font-size: 1.02rem; margin: 0; color: var(--ink); }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}
.badge.official, .badge.community, .badge.datamined, .badge.x,
.badge.band-major, .badge.band-notable, .badge.band-moderate, .badge.band-low { color: var(--ink); }
.lang-note { color: var(--muted); font-size: 0.85rem; }
.vote-row button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.example { border-style: dashed; }
.timeline { display: grid; gap: 10px; margin: 8px 0 0; }
.t-item { display: block; text-decoration: none; color: inherit; padding: 4px 0; }
.you { color: var(--accent); }
.diffs { display: grid; gap: 8px; }
.diff.for-you { box-shadow: inset 2px 0 0 var(--accent); }
.meta-row .status {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.split { grid-template-columns: 1fr; }
.chart-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.chart-wrap svg { width: 100%; height: auto; min-width: 520px; }
.chart-wrap text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.axis { stroke: rgba(255, 255, 255, 0.2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stat-row, .focus-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.stat-list, .focus-list { display: grid; gap: 8px; }
.index { color: var(--muted); font-variant-numeric: tabular-nums; width: 1.6rem; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.score-low { color: #d7b4a8; }
.score-ok { color: #b7cbb4; }
a { overflow-wrap: anywhere; }
.vanilla { margin-top: 22px; }
.vanilla summary { cursor: pointer; color: var(--ink); }
.muted, .sub { color: var(--muted); }
.error { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

.calm {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
  display: grid;
  gap: 1.35rem;
}
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
h1.status {
  font-weight: 400;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}
.confidence, .quiet, .refresh-result, .refresh-sources { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.45; }
.refresh-result { color: var(--ink); }
.refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  color: var(--ink);
}
.refresh:hover { border-color: var(--accent); }
.refresh[disabled] { cursor: progress; }
.refresh .spin {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
}
.refresh[aria-busy="true"] .spin { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.boards { display: flex; flex-wrap: wrap; gap: 8px; }
.boards button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
  cursor: pointer;
  color: var(--muted);
}
.boards button[aria-pressed="true"], .boards button.on { background: rgba(143, 180, 255, 0.12); color: var(--ink); }
.tiers { display: grid; gap: 0.2rem; }
.tier-block { display: grid; }
.tier-letter { font-size: 0.82rem; margin: 1rem 0 0.15rem; letter-spacing: 0.12em; font-weight: 600; }
.tier-S { color: #c4b8a4; }
.tier-A { color: #b7a6c9; }
.tier-B { color: #9aabbd; }
.tier-C { color: #8fa394; }
.tier-D { color: #8d8d8d; }
.tier-row, .move {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: inherit;
  cursor: pointer;
  padding: 8px 8px;
  min-height: 44px;
}
.tier-row:hover, .move:hover { background: rgba(255, 255, 255, 0.035); }
.who-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.class-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  flex: none;
  object-fit: cover;
  background: #2a2e34;
}
.class-icon.fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.role-icon { width: 16px; height: 16px; flex: none; color: var(--muted); display: inline-flex; }
.role-icon svg { display: block; }
.tier-row .who, .move .who, .spec-title { font-weight: 600; }
.tier-row.is-quiet .who { color: var(--muted); font-weight: 500; }
.row-meta { color: var(--muted); font-size: 0.92rem; }
.trend { font-weight: 600; min-width: 1.2rem; text-align: right; }
.trend-up { color: var(--accent); }
.trend-down { color: #c4b8a8; }
.trend-new { color: var(--ink); font-size: 0.78rem; letter-spacing: 0.04em; }
.trend-flat { color: rgba(163, 160, 151, 0.7); }
.moves { display: grid; gap: 0.7rem; margin-top: 0.6rem; }
.moves h2 { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 0; }
.move { grid-template-columns: 1fr; align-items: start; gap: 4px; padding: 12px 8px; }
.move-top { display: flex; gap: 10px; align-items: center; }
.move-top .who-line { flex: 1; }
.move-summary { color: var(--ink); }
.move-source { color: var(--muted); font-size: 0.95rem; }
.tier-pip { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.08em; }
.spec-title { display: flex; align-items: center; gap: 8px; }
.details-btn, .close-btn {
  justify-self: start;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 1.3rem;
  min-height: 48px;
  font-size: 1rem;
  cursor: pointer;
}
.details-btn:hover, .close-btn:hover { border-color: var(--accent); }
.tier-row.is-updated, .move.is-updated {
  box-shadow: inset 0 0 0 1px var(--accent);
  background: rgba(143, 180, 255, 0.08);
}
.tier-row.is-updated .trend, .move.is-updated .trend { animation: trend-slide 1.6s ease; }
@keyframes trend-slide {
  0% { transform: translateY(6px); opacity: 0.2; }
  35% { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

body.drawer-open { overflow: hidden; }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.46);
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: min(100%, 42rem);
  height: 100%;
  background: #16191d;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  outline: none;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 8px;
}
.drawer-head h2 { margin: 0; font-size: 1.2rem; }
.drawer-tools { display: flex; align-items: center; gap: 10px; }
.drawer-tools select { min-height: 44px; width: auto; padding: 8px 10px; }
.drawer-nav { display: flex; gap: 6px; overflow-x: auto; padding: 8px 20px 12px; }
.drawer-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.drawer-nav a.active { color: var(--ink); background: rgba(143, 180, 255, 0.12); }
.drawer-scroll { overflow: auto; overscroll-behavior: contain; padding: 8px 20px 48px; flex: 1; }

@media (min-width: 860px) {
  .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(6, 1fr); }
  .grid-5 .card { grid-column: span 2; }
  .grid-5 .card:nth-child(4), .grid-5 .card:nth-child(5) { grid-column: span 3; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .calm { padding: 1.75rem 1rem 4rem; }
  .topbar { flex-direction: column; align-items: stretch; }
  .refresh, .details-btn { width: 100%; justify-content: center; }
  .drawer { width: 100%; }
  .drawer-tools { flex-wrap: wrap; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .tier-row.is-updated, .move.is-updated { box-shadow: inset 0 0 0 1px var(--accent); }
}
