:root {
  color-scheme: light dark;
  --bg: #07111f;
  --surface: #0e1b2c;
  --surface-2: #13233a;
  --surface-3: #172a45;
  --text: #f6f8fc;
  --muted: #9eb0c8;
  --line: #29405f;
  --accent: #7dd3fc;
  --accent-2: #a78bfa;
  --positive: #5ee6a8;
  --negative: #ff808f;
  --warning: #ffd166;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(89, 80, 255, .16), transparent 34%),
    radial-gradient(circle at top left, rgba(0, 197, 255, .12), transparent 28%),
    var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
a { color: inherit; }

.site-header {
  border-bottom: 1px solid rgba(125, 211, 252, .2);
  background: rgba(7, 17, 31, .86);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
  font-size: .76rem;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.8rem, 4vw, 3.35rem); line-height: 1.12; }
h2 { margin-bottom: 8px; font-size: 1.2rem; }
.subtitle { margin-bottom: 0; color: var(--muted); max-width: 780px; line-height: 1.75; }
.header-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; color: var(--muted); font-size: .9rem; }

.container { width: min(1480px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 46px; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  min-height: 116px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(19, 35, 58, .98), rgba(10, 24, 41, .94));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-card span { color: var(--muted); font-size: .88rem; }
.stat-card strong { font-size: 2rem; }
.stat-card.new { border-color: rgba(94, 230, 168, .4); }
.stat-card.out { border-color: rgba(255, 128, 143, .4); }
.stat-card.up strong { color: var(--positive); }
.stat-card.down strong { color: var(--negative); }
.stat-card.cosmos { border-color: rgba(244, 114, 182, .55); }
.stat-card.cosmos strong { color: #f9a8d4; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 27, 44, .94);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.controls-panel { padding: 18px; display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.control-group { min-width: 150px; display: flex; flex-direction: column; gap: 7px; }
.control-group.grow { flex: 1 1 260px; }
.control-group.compact { min-width: 110px; }
.control-group label { color: var(--muted); font-size: .8rem; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(125, 211, 252, .12); }

.tabs-panel { padding-bottom: 14px; }
.tabs { display: flex; gap: 4px; padding: 14px 14px 0; overflow-x: auto; }
.tab {
  border: 0;
  border-radius: 11px 11px 0 0;
  padding: 11px 16px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 800;
}
.tab.active { color: var(--text); background: var(--surface-3); }
.cosmos-tab { color: #f9a8d4; }
.cosmos-tab.active { color: #fff; background: linear-gradient(135deg, rgba(219, 39, 119, .45), rgba(168, 85, 247, .38)); }
.table-toolbar { padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 14px; border-top: 1px solid var(--line); }
.table-toolbar p { margin: 0; color: var(--muted); }

.button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.button.secondary { color: var(--text); background: var(--surface-2); }
.button:disabled { opacity: .45; cursor: not-allowed; }

.table-wrap { width: 100%; overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 1320px; font-size: .86rem; }
th, td { padding: 12px 11px; border-bottom: 1px solid rgba(41, 64, 95, .72); white-space: nowrap; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #c9d8ec;
  background: #13233a;
  text-align: left;
  cursor: pointer;
  user-select: none;
}
th::after { content: " ↕"; opacity: .35; font-size: .72em; }
th.sort-asc::after { content: " ↑"; opacity: 1; color: var(--accent); }
th.sort-desc::after { content: " ↓"; opacity: 1; color: var(--accent); }
th.num, td.num { text-align: right; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(125, 211, 252, .07); }
tbody tr.clickable { cursor: pointer; }
.code-link { color: var(--accent); text-decoration: none; font-weight: 800; }
.company-name { font-weight: 750; }
.muted { color: var(--muted); }
.positive { color: var(--positive); font-weight: 800; }
.negative { color: var(--negative); font-weight: 800; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.badge.new { color: #052a1e; background: var(--positive); }
.badge.out { color: #3b0711; background: var(--negative); }
.badge.continue { color: #071f39; background: var(--accent); }
.badge.neutral { color: var(--text); background: rgba(158, 176, 200, .18); border: 1px solid var(--line); }
.badge.quality { color: #3d2500; background: #fbbf24; }
.badge.cosmos-focus { color: #4a1233; background: linear-gradient(135deg, #fbcfe8, #f9a8d4); border: 1px solid rgba(244, 114, 182, .7); }
.cosmos-focus-row { background: linear-gradient(90deg, rgba(244, 114, 182, .11), transparent 48%); }
.cosmos-focus-row:hover { background: linear-gradient(90deg, rgba(244, 114, 182, .18), rgba(125, 211, 252, .07)); }
.quality-excluded-row { opacity: .72; background: rgba(251, 191, 36, .045); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 14px; }
.note-panel { padding: 22px; line-height: 1.8; }
.note-panel p { color: var(--muted); }
.note-panel p:last-child { margin-bottom: 0; }
.disclaimer { font-size: .84rem; }
footer { padding: 20px 16px 34px; color: var(--muted); text-align: center; font-size: .8rem; }

.back-link { display: inline-block; margin-bottom: 18px; color: var(--accent); text-decoration: none; font-weight: 800; }
.detail-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chart-panel { padding: 20px; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 14px; }
.section-heading p { color: var(--muted); margin-bottom: 0; }
.chart-mode-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.chart-mode { font-weight: 800; }
.chart-mode.active { color: #fff; background: linear-gradient(135deg, #0284c7, #7c3aed); border-color: transparent; }
.chart-mode:disabled { cursor: not-allowed; opacity: .5; }
.chart-data-notice { margin: 0 0 14px; }
.chart-box { position: relative; width: 100%; }
.price-chart-box { height: 430px; }
.rsi-chart-box { height: 310px; }
.rsi-explanation { margin: 15px 0 0; padding: 13px 15px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; line-height: 1.7; }
.rsi-explanation strong { color: var(--text); }
.event-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; padding: 0 20px 18px; }
.event-card { min-height: 118px; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-content: start; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.event-card time { color: var(--muted); font-size: .8rem; }
.event-card span { justify-self: end; padding: 2px 7px; border-radius: 999px; color: var(--text); background: rgba(125,211,252,.15); font-size: .7rem; font-weight: 900; }
.event-card strong, .event-card small { grid-column: 1 / -1; }
.event-card small { color: var(--muted); line-height: 1.5; }
.event-earnings { border-color: rgba(245, 158, 11, .5); }
.event-rights, .event-dividend { border-color: rgba(16, 185, 129, .45); }
.event-split { border-color: rgba(168, 85, 247, .5); }
.event-source-note { margin: 0; padding: 15px 20px 18px; color: var(--muted); border-top: 1px solid var(--line); font-size: .8rem; line-height: 1.7; }
.event-source-note a { color: var(--accent); }
.fundamentals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.fundamentals-grid > div { min-height: 94px; padding: 18px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.fundamentals-grid dt { color: var(--muted); font-size: .78rem; margin-bottom: 8px; }
.fundamentals-grid dd { margin: 0; font-size: 1.08rem; font-weight: 800; }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }
.error-banner { margin-bottom: 18px; padding: 16px; border: 1px solid rgba(255, 128, 143, .5); border-radius: 14px; background: rgba(255, 128, 143, .08); color: #ffd5da; }

.analysis-container { max-width: 1320px; }
.analysis-guide { padding: 18px 20px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; }
.analysis-guide strong { color: var(--accent); }
.analysis-guide p { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .86rem; }
.analysis-controls { padding: 0; }
.filter-actions { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.filter-actions h2, .filter-actions p { margin: 0; }
.filter-actions p { margin-top: 5px; color: var(--muted); font-size: .86rem; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
.filter-group { border-top: 1px solid var(--line); }
.filter-group summary { padding: 15px 20px; cursor: pointer; color: var(--text); font-weight: 800; background: rgba(125, 211, 252, .035); }
.filter-group summary::marker { color: var(--accent); }
.filter-grid { padding: 16px 20px 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; align-items: end; }
.filter-grid .control-group { min-width: 0; }
.filter-grid .control-group.grow { grid-column: span 2; }
.momentum-presets { padding: 14px 20px 0; display: flex; flex-wrap: wrap; gap: 9px; }
.range-group { min-width: 260px; }
.range-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 7px; }
.range-inputs span { color: var(--muted); }

.comparison-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.analysis-summary-card {
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: linear-gradient(150deg, rgba(19, 35, 58, .98), rgba(10, 24, 41, .94));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}
.analysis-summary-card:hover, .analysis-summary-card.active { border-color: var(--accent); transform: translateY(-1px); }
.analysis-summary-card.active { box-shadow: 0 0 0 3px rgba(125, 211, 252, .12), var(--shadow); }
.analysis-summary-card span, .analysis-summary-card small { color: var(--muted); }
.analysis-summary-card strong { margin-top: auto; font-size: 2rem; }
.analysis-stats { margin-bottom: 18px; }
.analysis-section { padding: 20px; }
.analysis-section .table-wrap { margin: 0 -20px -20px; width: calc(100% + 40px); }
.analysis-section .pagination { margin-bottom: -6px; }
.bucket-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 9px; }
.bucket-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.bucket-card span, .bucket-card small { color: var(--muted); font-size: .78rem; }
.bucket-card strong { font-size: 1.15rem; }
.analysis-table { min-width: 4100px; }
.cohort-table { min-width: 720px; }
.benchmark-heading { align-items: center; }
.benchmark-heading .compact { width: 160px; }
.cost-control small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.analysis-disclosure { margin: 0 0 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-2); font-size: .82rem; line-height: 1.6; }
.quality-notice { margin-bottom: 18px; border-color: rgba(251, 191, 36, .55); color: var(--text); background: rgba(251, 191, 36, .08); }
.benchmark-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.portfolio-card { min-height: 118px; padding: 15px; border: 1px solid var(--line); border-top: 3px solid var(--series-color); border-radius: 13px; background: var(--surface-2); display: flex; flex-direction: column; gap: 7px; }
.portfolio-card span, .portfolio-card small { color: var(--muted); }
.portfolio-card strong { margin-top: auto; font-size: 1.6rem; }
.portfolio-card small { font-size: .76rem; line-height: 1.5; }
.performance-chart-wrap { margin-top: 14px; width: 100%; overflow-x: auto; }
.performance-chart { display: block; width: 100%; min-width: 700px; min-height: 300px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label, .chart-legend, .chart-empty { fill: var(--muted); font-size: 12px; }
.ranking-wrap { margin-top: 0 !important; }
.ranking-table { min-width: 980px; }
.exit-strategy-table { min-width: 1280px; }
.ranking-table th { cursor: default; }
.ranking-table th::after { content: none; }

.table-view-controls { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.column-settings { position: relative; }
.column-settings-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: min(520px, calc(100vw - 36px));
  max-height: min(70vh, 620px);
  padding: 15px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
}
.column-settings-heading { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.column-settings-heading small { color: var(--muted); }
.column-settings-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 13px; }
.column-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); cursor: pointer; font-size: .8rem; }
.column-toggle input { width: auto; margin: 0; }
.column-hidden { display: none !important; }
.sticky-table-wrap {
  position: relative;
  max-height: min(72vh, 760px);
  margin-bottom: 0 !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.cohort-table-wrap { max-height: min(62vh, 650px); }
.sticky-table-wrap th { top: 0; z-index: 6; box-shadow: 0 2px 0 var(--line); }
.episode-table-wrap th { cursor: grab; }
.episode-table-wrap th:active { cursor: grabbing; }
.episode-table-wrap th.column-dragging { opacity: .45; }
.episode-table-wrap th.column-drag-over { box-shadow: inset 3px 0 0 var(--accent), 0 2px 0 var(--line); }

.character-guide {
  min-height: 142px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  border-color: rgba(236, 112, 167, .32);
  background:
    radial-gradient(circle at 5% 15%, rgba(255, 143, 192, .16), transparent 28%),
    radial-gradient(circle at 96% 85%, rgba(151, 114, 255, .14), transparent 30%),
    rgba(14, 27, 44, .96);
}
.character-avatar-rail { display: flex; align-items: center; gap: 8px; }
.character-avatar {
  width: 70px;
  height: 70px;
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  background: #f8d8eb;
  box-shadow: 0 7px 22px rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, opacity .18s ease;
}
.character-avatar:not(.active) { opacity: .7; transform: scale(.9); }
.character-avatar:hover, .character-avatar.active { opacity: 1; transform: translateY(-2px) scale(1); }
.character-avatar[data-character="cosmos"].active { border-color: #ff78ad; }
.character-avatar[data-character="lumo"].active { border-color: #67b9ff; }
.character-avatar[data-character="aile"].active { border-color: #b88cff; }
.character-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("cosmos-trio.webp");
  background-repeat: no-repeat;
  background-size: 300% 100%;
}
.character-avatar-image.cosmos { background-position: 0 50%; }
.character-avatar-image.lumo { background-position: 50% 50%; }
.character-avatar-image.aile { background-position: 100% 50%; }
.character-speech {
  position: relative;
  min-height: 108px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}
.character-speech::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 42px;
  width: 16px;
  height: 16px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  transform: rotate(45deg);
}
.character-speech-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.character-speech-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; }
.character-speech-heading strong { font-size: 1.02rem; }
.character-speech-heading small { color: var(--muted); }
.character-guide[data-active-character="cosmos"] .character-speech-heading strong { color: #ff8fbc; }
.character-guide[data-active-character="lumo"] .character-speech-heading strong { color: #7dc3ff; }
.character-guide[data-active-character="aile"] .character-speech-heading strong { color: #c3a0ff; }
.character-speech p { margin: 9px 0 12px; line-height: 1.75; }
.character-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
}
.character-close:hover { color: var(--text); background: var(--surface-3); }
.character-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.character-actions span { color: var(--muted); font-size: .78rem; }
.character-next { min-height: 36px; padding: 7px 13px; font-size: .82rem; }
.character-reopen {
  display: none;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}
.character-guide.collapsed { min-height: 0; padding: 11px 15px; display: flex; justify-content: center; }
.character-guide.collapsed .character-avatar-rail,
.character-guide.collapsed .character-speech { display: none; }
.character-guide.collapsed .character-reopen { display: block; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-stats { grid-template-columns: repeat(3, 1fr); }
  .fundamentals-grid { grid-template-columns: repeat(3, 1fr); }
  .bucket-grid { grid-template-columns: repeat(4, 1fr); }
  .benchmark-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .character-avatar { width: 62px; height: 62px; }
}

@media (max-width: 720px) {
  .header-inner { width: min(100% - 24px, 1480px); padding: 26px 0 24px; align-items: flex-start; flex-direction: column; }
  .header-meta { align-items: flex-start; }
  .container { width: min(100% - 18px, 1480px); padding-top: 16px; }
  .stats-grid, .detail-stats { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat-card { min-height: 98px; padding: 15px; }
  .stat-card strong { font-size: 1.55rem; }
  .controls-panel { padding: 13px; }
  .control-group, .control-group.compact { flex: 1 1 140px; min-width: 0; }
  .control-group.grow { flex-basis: 100%; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .fundamentals-grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .chart-mode-switch { width: 100%; }
  .chart-mode-switch .button { flex: 1 1 120px; }
  .price-chart-box { height: 340px; }
  .rsi-chart-box { height: 260px; }
  .comparison-grid { grid-template-columns: 1fr; gap: 9px; }
  .analysis-summary-card { min-height: 108px; padding: 16px; }
  .analysis-summary-card strong { font-size: 1.55rem; }
  .range-group { flex-basis: 100%; min-width: 0; }
  .filter-actions { padding: 15px; align-items: flex-start; flex-direction: column; }
  .filter-buttons { width: 100%; }
  .filter-buttons .button { flex: 1 1 auto; }
  .filter-group summary { padding: 14px 15px; }
  .filter-grid { padding: 14px 15px 18px; grid-template-columns: 1fr; }
  .momentum-presets { padding: 12px 15px 0; }
  .momentum-presets .button { flex: 1 1 100%; }
  .filter-grid .control-group.grow { grid-column: auto; }
  .bucket-grid { grid-template-columns: repeat(2, 1fr); }
  .analysis-section { padding: 15px; }
  .analysis-section .table-wrap { margin: 0 -15px -15px; width: calc(100% + 30px); }
  .analysis-section .sticky-table-wrap { margin-bottom: 0; max-height: 68vh; }
  .individual-heading { align-items: flex-start; flex-direction: column; }
  .table-view-controls { width: 100%; justify-content: stretch; }
  .table-view-controls .control-group { flex: 1 1 120px; }
  .column-settings { flex: 1 1 100%; }
  .column-settings > .button { width: 100%; }
  .column-settings-list { grid-template-columns: 1fr; }
  .benchmark-heading { align-items: flex-start; flex-direction: column; }
  .benchmark-heading .compact { width: 100%; }
  .benchmark-grid { grid-template-columns: 1fr; }
  .character-guide { padding: 13px; grid-template-columns: 1fr; gap: 11px; }
  .character-avatar-rail { justify-content: center; }
  .character-avatar { width: 66px; height: 66px; }
  .character-speech { min-height: 0; }
  .character-speech::before { left: calc(50% - 8px); top: -9px; transform: rotate(135deg); }
  .character-actions { align-items: flex-end; }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef4fb;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --surface-3: #eaf2fb;
    --text: #132238;
    --muted: #5c6d83;
    --line: #cad7e6;
    --accent: #0369a1;
    --positive: #047857;
    --negative: #be123c;
    --shadow: 0 18px 45px rgba(42, 64, 92, .12);
  }
  .site-header { background: rgba(238, 244, 251, .88); }
  .stat-card { background: linear-gradient(150deg, #fff, #f4f8fc); }
  .panel { background: #fff; }
  th { color: #263a54; background: #eaf2fb; }
  .badge.new, .badge.out, .badge.continue { color: #fff; }
  .error-banner { color: #9f1239; }
  .analysis-summary-card { background: linear-gradient(150deg, #fff, #f4f8fc); }
  .character-guide {
    background:
      radial-gradient(circle at 5% 15%, rgba(255, 143, 192, .16), transparent 28%),
      radial-gradient(circle at 96% 85%, rgba(151, 114, 255, .12), transparent 30%),
      #fff;
  }
  .character-guide[data-active-character="cosmos"] .character-speech-heading strong { color: #be185d; }
  .character-guide[data-active-character="lumo"] .character-speech-heading strong { color: #0369a1; }
  .character-guide[data-active-character="aile"] .character-speech-heading strong { color: #7e22ce; }
}

@media (prefers-reduced-motion: reduce) {
  .character-avatar { transition: none; }
}
