:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e1e6ec;
  --line-soft: #edf0f3;
  --blue: #174ea6;
  --blue-2: #3976c8;
  --red: #c7352c;
  --green: #087443;
  --header-height: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 3px;
  background: var(--blue);
  content: "";
}

.brand-mark::before {
  height: 7px;
  box-shadow: -5px -3px 0 var(--blue), -10px 2px 0 var(--blue);
}

.brand-mark::after {
  display: none;
}

.desktop-nav {
  display: flex;
  align-self: stretch;
  gap: 32px;
}

.desktop-nav a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
}

.desktop-nav a.active {
  color: var(--ink);
}

.desktop-nav a.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--blue);
  content: "";
}

.main-content {
  width: min(1180px, calc(100% - 48px));
  min-height: calc(100vh - 180px);
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-head,
.section-head,
.detail-head,
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.page-title {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 650;
  line-height: 1.3;
}

.page-meta,
.muted {
  color: var(--muted);
}

.page-meta {
  margin-top: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.source-tag {
  padding: 5px 9px;
  border: 1px solid #d0d7e2;
  border-radius: 5px;
  background: var(--surface);
  color: #475467;
  font-size: 12px;
}

.surface {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.section {
  margin-top: 28px;
}

.section-head {
  min-height: 36px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.score-surface {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin-top: 20px;
  padding: 28px;
}

.score-block {
  text-align: center;
}

.score-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  white-space: nowrap;
}

.score-number {
  font-size: clamp(58px, 7vw, 82px);
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-unit {
  margin-left: 5px;
  color: var(--muted);
  font-size: 22px;
}

.score-label {
  margin-top: 15px;
  color: var(--blue);
  font-size: 17px;
  font-weight: 650;
}

.section-actions,
.range-control,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-actions {
  justify-content: flex-end;
  min-width: 0;
}

.range-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-select-wrap {
  display: none;
  position: relative;
}

.range-select {
  min-height: 32px;
  padding: 0 27px 0 12px;
  border: 1px solid #d0d7e2;
  border-radius: 999px;
  background: var(--surface);
  color: #475467;
  font-size: 12px;
  appearance: auto;
}

.fullscreen-button {
  flex: none;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid #d0d7e2;
  border-radius: 999px;
  background: var(--surface);
  color: #475467;
  cursor: pointer;
  font-size: 12px;
}

.fullscreen-button:active,
.range-select:active {
  transform: translateY(1px);
}

.range-button,
.quiet-button {
  min-width: 72px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid #d0d7e2;
  border-radius: 999px;
  background: var(--surface);
  color: #475467;
  cursor: pointer;
  font-size: 12px;
}

.range-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.range-button:active,
.quiet-button:active {
  transform: translateY(1px);
}

.chart-card {
  position: relative;
  padding: 18px 18px 12px;
}

.chart-fullscreen-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 14px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #d0d7e2;
  border-radius: 999px;
  background: var(--surface);
  color: #475467;
  cursor: pointer;
  font-size: 12px;
}

.chart-fullscreen-close[hidden] {
  display: none;
}

.fullscreen-surface.is-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.fullscreen-surface.is-fullscreen .chart-legend {
  flex: none;
  margin-top: 4px;
  font-size: 11px;
}

.fullscreen-surface.is-fullscreen .chart-canvas-wrap,
.fullscreen-surface.is-fullscreen .scatter-scroll {
  flex: 1;
  min-height: 0;
}

.fullscreen-surface.is-fullscreen .chart-canvas-wrap {
  height: auto;
}

.fullscreen-surface.is-fullscreen .scatter-canvas-wrap {
  height: 100%;
}

.fullscreen-surface.is-fullscreen .scatter-help {
  flex: none;
  min-height: 24px;
  padding-top: 4px;
  font-size: 11px;
}

html.h5-fullscreen-open,
html.h5-fullscreen-open body {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 22px;
  height: 0;
  border-top: 2px solid var(--blue);
}

.legend-line.mean {
  border-top: 1px dashed #7a838f;
}

.legend-line.band {
  border-top: 1px dashed #91a8cf;
}

.legend-line.index {
  border-color: var(--red);
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 390px;
  min-height: 280px;
}

.chart-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.chart-selection {
  min-height: 42px;
  padding: 10px 4px 0;
  color: #475467;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.chart-selection.hidden {
  visibility: hidden;
}

.text-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
}

.text-link:hover {
  color: #0f3f8a;
}

.model-link-row {
  margin-top: 18px;
  text-align: center;
}

.loading-state,
.error-state,
.empty-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.error-box {
  max-width: 440px;
}

.error-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
}

.error-message {
  margin: 8px 0 18px;
  line-height: 1.6;
}

.scatter-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.scatter-canvas-wrap {
  position: relative;
  width: 100%;
  min-width: 780px;
  height: 520px;
}

.scatter-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.scatter-help {
  display: flex;
  justify-content: center;
  min-height: 34px;
  padding-top: 8px;
  color: var(--subtle);
  font-size: 12px;
}

.sector-list {
  overflow: hidden;
}

.sector-details-toggle {
  display: none;
}

.sector-details-toggle strong,
.sector-details-toggle small {
  display: block;
  text-align: left;
}

.sector-details-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.toggle-chevron {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  transition: transform 160ms ease;
}

.sector-details-toggle[aria-expanded="true"] .toggle-chevron {
  transform: rotate(90deg);
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(220px, 2fr) 92px 72px;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 58px;
  padding: 10px 18px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.sector-row:last-child {
  border-bottom: 0;
}

.sector-row:hover {
  background: #f8fafc;
}

.sector-name {
  font-weight: 600;
}

.sector-code,
.sector-count {
  margin-top: 3px;
  color: var(--subtle);
  font-size: 11px;
}

.position-cell {
  display: grid;
  grid-template-columns: 1fr 48px;
  align-items: center;
  gap: 12px;
}

.position-track {
  height: 5px;
  overflow: hidden;
  background: #e8edf3;
}

.position-fill {
  height: 100%;
  background: var(--blue-2);
}

.number {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.up {
  color: #b42318;
}

.down {
  color: var(--green);
}

.detail-back {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 14px;
  color: var(--blue);
  font-size: 13px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line-soft);
}

.detail-stat {
  min-height: 88px;
  padding: 18px;
  background: var(--surface);
}

.detail-stat-label {
  color: var(--muted);
  font-size: 12px;
}

.detail-stat-value {
  margin-top: 7px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.method-head {
  padding: 28px;
}

.method-head h1 {
  margin: 0;
  font-size: 24px;
}

.method-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.method-block {
  padding: 22px;
}

.method-intro {
  color: #344054;
  font-size: 16px;
  font-weight: 550;
  line-height: 1.7;
}

.logic-item,
.check-item,
.weight-row {
  border-bottom: 1px solid var(--line-soft);
}

.logic-item {
  padding: 16px 0;
}

.logic-item:last-child,
.check-item:last-child,
.weight-row:last-child {
  border-bottom: 0;
}

.logic-title {
  font-size: 15px;
  font-weight: 650;
}

.logic-description {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.formula-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
  color: #475467;
  font-size: 13px;
}

.rule-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 650;
}

.rule-mark.high {
  background: #fff1f0;
  color: #b42318;
}

.rule-mark.low {
  background: #ecfdf3;
  color: var(--green);
}

.weight-list {
  margin-top: 18px;
}

.weight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  color: #475467;
  font-size: 13px;
}

.weight-row strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.check-lead {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.check-item {
  position: relative;
  min-height: 46px;
  padding: 13px 0 13px 18px;
  color: #344054;
  font-size: 13px;
  line-height: 1.5;
}

.check-item::before {
  position: absolute;
  top: 20px;
  left: 1px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue-2);
  content: "";
}

.usage-text {
  margin: 0;
  color: #475467;
  font-size: 14px;
  line-height: 1.75;
}

.usage-text + .usage-text {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.risk-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 36px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.mobile-nav {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --header-height: 54px;
  }

  .site-header {
    justify-content: center;
    padding: 0 18px;
  }

  .brand {
    font-size: 16px;
  }

  .brand-mark,
  .desktop-nav {
    display: none;
  }

  .main-content {
    width: calc(100% - 28px);
    padding: 20px 0 calc(96px + env(safe-area-inset-bottom));
  }

  .page-head,
  .detail-head {
    align-items: flex-start;
    gap: 12px;
  }

  .page-head .source-tag {
    flex: none;
    margin-top: 2px;
  }

  .page-title {
    font-size: 20px;
  }

  .score-surface {
    min-height: 150px;
    padding: 22px;
  }

  .score-number {
    font-size: 58px;
  }

  .section {
    margin-top: 24px;
  }

  .section-head {
    align-items: center;
    gap: 12px;
  }

  .section-title {
    font-size: 16px;
  }

  .section-actions {
    flex: none;
    gap: 6px;
  }

  .range-control {
    display: block;
  }

  .range-buttons {
    display: none;
  }

  .range-select-wrap {
    display: block;
  }

  .range-select {
    max-width: 102px;
    min-height: 32px;
    padding-left: 10px;
    font-size: 11px;
  }

  .fullscreen-button {
    min-height: 32px;
    padding: 0 11px;
    font-size: 11px;
  }

  .range-button {
    min-width: 64px;
  }

  .chart-card {
    padding: 14px 8px 9px;
  }

  .chart-legend {
    gap: 8px 12px;
    font-size: 10px;
  }

  .chart-canvas-wrap {
    height: 310px;
  }

  .chart-selection {
    min-height: 38px;
    padding-top: 8px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sector-details-heading {
    display: none;
  }

  .sector-details-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 58px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-size: 14px;
  }

  .sector-list {
    display: none;
    margin-top: 8px;
  }

  .sector-list.expanded {
    display: block;
  }

  .sector-row {
    grid-template-columns: minmax(96px, 1fr) minmax(90px, 1.15fr) 56px 44px;
    min-width: 0;
    gap: 8px;
    min-height: 54px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .sector-code,
  .sector-count {
    font-size: 10px;
  }

  .position-cell {
    grid-template-columns: 1fr 38px;
    gap: 6px;
    font-size: 11px;
  }

  .position-track {
    height: 4px;
  }

  .detail-head {
    flex-wrap: wrap;
  }

  .detail-head .detail-actions {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
  }

  .detail-head .range-select {
    max-width: 110px;
  }

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

  .method-head {
    padding: 22px;
  }

  .method-head h1 {
    font-size: 20px;
  }

  .method-block {
    padding: 17px 16px;
  }

  .method-intro {
    font-size: 15px;
  }

  .logic-description,
  .check-lead,
  .check-item,
  .usage-text {
    font-size: 13px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 110;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: 62px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
  }

  .mobile-nav a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-nav a.active {
    color: var(--ink);
  }

  .mobile-nav a.active::after {
    position: absolute;
    bottom: 7px;
    left: 50%;
    width: 24px;
    height: 2px;
    background: var(--blue);
    content: "";
    transform: translateX(-50%);
  }

  .nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 650;
  }

  .risk-footer {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .main-content {
    width: calc(100% - 20px);
  }

  .page-title {
    font-size: 19px;
  }

  .range-select {
    max-width: 92px;
    padding-right: 6px;
  }

  .fullscreen-button {
    padding: 0 9px;
  }

  .chart-legend {
    gap: 7px 9px;
    font-size: 9px;
  }
}
