:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --text: #18212f;
  --muted: #6d7787;
  --line: #dbe2e8;
  --accent: #1d66d1;
  --accent-strong: #174ea6;
  --accent-soft: #e4efff;
  --warning: #b35c00;
  --danger: #9c3d4a;
  --shadow: 0 16px 40px rgba(24, 33, 47, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0b1118;
  --surface: #121b24;
  --surface-soft: #18322f;
  --text: #edf4f7;
  --muted: #9aa8b8;
  --line: #263543;
  --accent: #5b9dff;
  --accent-strong: #9fc5ff;
  --accent-soft: #142b4f;
  --warning: #f2ad5f;
  --danger: #ee8fa0;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: #101820;
  color: #f7fbfc;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: hidden;
  transition: transform 180ms ease;
}

:root[data-theme="dark"] .sidebar {
  background: #071018;
}

.menu-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  line-height: 1;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.drawer-close {
  position: absolute;
  top: 18px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  z-index: 2;
}

.sidebar-restore {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 25;
  width: 40px;
  height: 40px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.brand,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand {
  padding-right: 42px;
  align-items: flex-start;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.brand-name {
  display: block;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: #a8b4bf;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-link,
.view-chip {
  border: 0;
  cursor: pointer;
}

.side-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cad5dc;
  text-align: left;
  text-decoration: none;
}

.side-link.active,
.side-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.side-panel {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.side-panel.compact {
  margin-top: -12px;
}

.theme-switch {
  margin-top: auto;
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.theme-button {
  width: 36px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #a8b4bf;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.theme-button.active {
  background: var(--accent);
  color: #ffffff;
}

.panel-kicker {
  color: #a8b4bf;
  font-size: 12px;
}

.panel-value {
  margin-top: 6px;
  font-weight: 700;
  line-height: 1.35;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: none;
}

.drawer-backdrop {
  display: none;
}

.toolbar {
  width: 100%;
  max-width: none;
  margin: 0 0 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.toolbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.score-note {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  text-align: right;
}

.score-note span,
.score-note strong {
  display: block;
}

.score-note span {
  font-size: 12px;
  font-weight: 800;
}

.score-note strong {
  margin-top: 2px;
  font-size: 14px;
}

.filters {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

:root[data-theme="dark"] .search,
:root[data-theme="dark"] .category-chip {
  background: #0f1821;
}

.search-icon {
  color: var(--muted);
  font-size: 18px;
}

.search input {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
  cursor: pointer;
}

.category-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

:root[data-theme="dark"] .category-chip.active {
  background: var(--accent);
  color: #ffffff;
}

.timeline {
  width: 100%;
  max-width: none;
  margin: 0;
}

.day {
  margin-top: 20px;
}

.day-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.day-head h2 {
  margin: 0;
}

.day-toggle {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.day-toggle:hover {
  background: var(--accent-soft);
}

.day-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.day-title {
  font-size: 15px;
  font-weight: 800;
}

.day-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.day-chevron {
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 160ms ease;
}

.day.collapsed .day-chevron {
  transform: rotate(-45deg) translateY(1px);
}

.day-items {
  display: grid;
  gap: 12px;
}

.day.collapsed .day-items,
.day-items[hidden] {
  display: none;
}

.news-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
}

.time {
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.card-body {
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(24, 33, 47, 0.05);
}

:root[data-theme="dark"] .card-body::before {
  background: var(--bg);
}

.card-body::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 22px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.source {
  font-weight: 700;
  color: #405064;
}

:root[data-theme="dark"] .source,
:root[data-theme="dark"] .summary {
  color: #c9d4df;
}

.badge,
.score {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf1f4;
  color: #526170;
  white-space: nowrap;
}

:root[data-theme="dark"] .badge,
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .score-cell {
  background: #182330;
  color: #cbd6e1;
}

:root[data-theme="dark"] .selected-badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.selected-badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.verification.low {
  background: #f7e5e8;
  color: var(--danger);
}

.verification.pending {
  background: #f7ead9;
  color: var(--warning);
}

.score {
  margin-left: auto;
  background: #101820;
  color: #ffffff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="dark"] .score {
  background: #e8f3f1;
  color: #0d1820;
}

.title {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}

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

.summary {
  margin: 9px 0 0;
  color: #3e4b5b;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f0f3f5;
  color: #4d5b69;
  font-size: 12px;
}

.score-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.score-grid::-webkit-scrollbar {
  display: none;
}

.score-cell {
  min-width: 0;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #f7f9fa;
}

.score-cell span {
  display: inline;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-cell strong {
  display: inline;
  margin-top: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.related-toggle {
  margin-top: 12px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--accent-strong);
  cursor: pointer;
}

:root[data-theme="dark"] .related-toggle {
  background: #0f1821;
}

.related-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.related-item {
  display: grid;
  gap: 4px;
  padding: 8px 0;
}

.related-item a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.related-item small {
  color: var(--muted);
}

.method-main {
  display: grid;
  gap: 18px;
  align-content: start;
}

.method-hero,
.method-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.method-hero {
  padding: 24px;
}

.method-hero h1 {
  display: block;
  margin-top: 12px;
}

.method-hero p,
.method-block p,
.method-block li {
  color: var(--muted);
  line-height: 1.7;
}

.back-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  text-decoration: none;
}

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

.method-wide {
  overflow: hidden;
}

.method-block {
  padding: 20px;
}

.method-block h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.method-block ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.method-table-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.method-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.method-table th,
.method-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.method-table th {
  color: var(--text);
  background: var(--accent-soft);
  font-weight: 800;
}

.method-table td {
  color: var(--muted);
}

.method-table td:first-child {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.compact-table {
  min-width: 480px;
}

.formula {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
  line-height: 1.6;
}

.empty {
  max-width: none;
  margin: 20px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty h2 {
  margin: 0;
}

.empty p {
  margin: 8px 0 0;
  color: var(--muted);
}

@media (min-width: 861px) {
  .shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .shell.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    pointer-events: none;
  }

  .shell.sidebar-collapsed .sidebar-restore {
    display: grid;
  }
}

@media (max-width: 860px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .sidebar-restore {
    display: none;
  }

  .main {
    padding: 12px;
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -12px -12px 12px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    min-height: 58px;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 248, 251, 0.94);
    backdrop-filter: blur(12px);
  }

  :root[data-theme="dark"] .topbar {
    background: rgba(11, 17, 24, 0.94);
  }

  .mobile-brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: calc(100% - 168px);
    text-align: center;
  }

  .mobile-menu-toggle {
    position: relative;
    z-index: 1;
  }

  .mobile-menu-toggle {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 30;
    width: min(86vw, 340px);
    max-width: calc(100vw - 44px);
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    display: flex;
    transform: translateX(-100%);
    box-shadow: 18px 0 40px rgba(16, 24, 32, 0.22);
  }

  .shell.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: rgba(16, 24, 32, 0.36);
  }

  .shell.mobile-sidebar-open ~ .drawer-backdrop {
    display: block;
  }

  .view-toggle {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .view-chip {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
  }

  .view-chip.active {
    background: var(--accent);
    color: #ffffff;
  }

  .toolbar {
    margin-bottom: 14px;
    padding: 12px;
    overflow: hidden;
  }

  .toolbar-head {
    display: block;
  }

  .toolbar p {
    margin-top: 0;
    font-size: 15px;
    line-height: 1.45;
  }

  h1 {
    display: none;
  }

  .score-note {
    display: none;
  }

  .filters {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .search {
    gap: 6px;
    padding: 0 10px;
  }

  .search-icon {
    font-size: 15px;
  }

  .search input {
    min-height: 36px;
    font-size: 14px;
  }

  .category-strip {
    gap: 7px;
  }

  .category-chip {
    min-height: 32px;
    padding: 0 11px;
    font-size: 14px;
  }

  .news-card {
    grid-template-columns: 1fr;
    gap: 6px;
    min-width: 0;
  }

  .time {
    padding: 0;
    text-align: left;
  }

  .card-body::before {
    display: none;
  }

  .score {
    margin-left: 0;
  }

  .score-grid {
    gap: 4px;
    max-width: 100%;
  }

  .score-cell {
    flex: 0 0 auto;
    min-width: 70px;
  }

  .related-toggle {
    min-height: 32px;
    padding: 0 9px;
    font-size: 14px;
  }

  .related-item a {
    font-size: 15px;
    line-height: 1.45;
  }

  .related-item small {
    font-size: 13px;
  }

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

@media (max-width: 620px) {
  .method-main {
    gap: 12px;
  }

  .method-hero,
  .method-block {
    padding: 16px;
  }

  .method-hero h1 {
    font-size: 24px;
  }

  .method-block h2 {
    font-size: 17px;
  }

  .method-hero p,
  .method-block p,
  .method-block li {
    font-size: 14px;
    line-height: 1.6;
  }

  .method-table-wrap {
    overflow-x: visible;
  }

  .method-table,
  .compact-table {
    display: block;
    min-width: 0;
    font-size: 13px;
    line-height: 1.45;
  }

  .method-table thead {
    display: none;
  }

  .method-table tbody,
  .method-table tr,
  .method-table td {
    display: block;
  }

  .method-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .method-table tr:last-child {
    border-bottom: 0;
  }

  .method-table td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    padding: 4px 0;
    border-bottom: 0;
    white-space: normal;
  }

  .method-table td::before {
    color: var(--muted);
    font-weight: 700;
  }

  .method-table td:first-child {
    white-space: normal;
  }

  .score-dimension-table td:nth-child(1)::before {
    content: "维度";
  }

  .score-dimension-table td:nth-child(2)::before {
    content: "权重";
  }

  .score-dimension-table td:nth-child(3)::before {
    content: "判断";
  }

  .score-dimension-table td:nth-child(4)::before {
    content: "用途";
  }

  .relevance-band-table td:nth-child(1)::before {
    content: "分档";
  }

  .relevance-band-table td:nth-child(2)::before {
    content: "定义";
  }

  .relevance-band-table td:nth-child(3)::before {
    content: "示例";
  }

  .source-rule-table td:nth-child(1)::before {
    content: "来源";
  }

  .source-rule-table td:nth-child(2)::before {
    content: "说明";
  }

  .source-rule-table td:nth-child(3)::before {
    content: "加分";
  }

  .source-rule-table td:nth-child(4)::before {
    content: "精选";
  }

  .source-rule-table td:nth-child(5)::before {
    content: "优先";
  }

  .category-threshold-table td:nth-child(1)::before {
    content: "主题";
  }

  .category-threshold-table td:nth-child(2)::before {
    content: "代码";
  }

  .category-threshold-table td:nth-child(3)::before {
    content: "门槛";
  }
}

@media (max-width: 440px) {
  .brand-name {
    font-size: 14px;
  }

  .card-meta {
    gap: 6px;
  }

  .card-body {
    padding: 14px 12px;
  }

  .title {
    font-size: 17px;
  }

  .summary {
    font-size: 14px;
    line-height: 1.6;
  }

  .category-strip {
    gap: 6px;
  }

  .category-chip {
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
  }

  .score-grid {
    gap: 3px;
    margin-right: -12px;
    padding-right: 12px;
  }

  .score-cell {
    min-width: 0;
    flex: 1 1 0;
    padding: 5px 5px;
    gap: 4px;
  }

  .score-cell span {
    font-size: 0;
  }

  .score-cell span::after {
    content: attr(data-short);
    font-size: 11px;
  }

  .score-cell strong {
    font-size: 14px;
  }

  .related-toggle {
    min-height: 30px;
    padding: 0 8px;
    font-size: 13px;
  }

  .related-list {
    margin-top: 8px;
    padding-top: 8px;
  }

  .related-item {
    gap: 3px;
    padding: 7px 0;
  }

  .related-item a {
    font-size: 14px;
    line-height: 1.45;
  }

  .related-item small {
    font-size: 12px;
  }
}
