:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fbff;
  --line: #dbe2ec;
  --text: #101828;
  --muted: #657184;
  --blue: #155bd6;
  --blue-dark: #0f3368;
  --red: #e31b2f;
  --green: #0f9f6e;
  --orange: #e98a00;
  --shadow: 0 10px 24px rgba(16, 24, 40, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.5;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #ffffff 0 26%, #0b1220 26% 100%);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 360px;
  padding: 16px 26px;
  color: var(--text);
  text-decoration: none;
  background: #fff;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #111827, #e31b2f);
  border-radius: 8px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 24px;
  letter-spacing: 0;
}

.brand small {
  color: #2f3a4a;
  font-size: 14px;
}

.main-nav {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.main-nav a {
  display: grid;
  min-width: 150px;
  place-items: center;
  padding: 0 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.main-nav a.active,
.main-nav a:hover {
  background: #155bd6;
}

main {
  width: min(1440px, calc(100% - 24px));
  margin: 8px auto 0;
}

#ai-course,
#watchlist,
#sectors,
#review,
#glossary {
  scroll-margin-top: 92px;
}

.ai-course-band,
.status-band,
.panel,
.info-block {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ai-course-band {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.8fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 8px;
  padding: 18px 22px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(21, 91, 214, 0.08), rgba(227, 27, 47, 0.07)),
    #fff;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 6px;
}

.eyebrow {
  display: inline-flex;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.wechat-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid rgba(15, 159, 110, 0.28);
  border-radius: 5px;
  color: #087a55;
  background: rgba(15, 159, 110, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.course-copy h1 {
  font-size: 28px;
}

.course-copy p {
  max-width: 900px;
  margin: 8px 0 0;
  color: #344054;
  font-size: 15px;
}

.course-aside {
  padding: 14px 16px;
  border-left: 3px solid var(--red);
  background: rgba(255, 255, 255, 0.72);
}

.course-aside strong {
  display: block;
  color: var(--red);
  font-size: 16px;
}

.course-aside ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.course-aside li {
  margin: 5px 0;
  color: #344054;
  font-size: 14px;
}

.status-band {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.95fr 0.95fr 1.05fr 1.55fr;
  gap: 0;
  margin-bottom: 8px;
}

.status-item {
  min-height: 96px;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}

.label,
.status-item small,
.panel-header p,
.panel-header span,
.muted,
.table-note,
footer {
  color: var(--muted);
}

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.status-item strong {
  display: block;
  font-size: 26px;
  line-height: 1.2;
  color: var(--blue);
}

.status-item small {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.compliance-card {
  margin: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(227, 27, 47, 0.45);
  border-radius: 6px;
  background: #fffafa;
}

.compliance-card strong {
  color: var(--red);
  font-size: 17px;
}

.compliance-card p {
  margin: 10px 0 0;
  color: #303846;
  font-size: 14px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 8px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}

.panel,
.info-block {
  border-radius: 6px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  align-items: center;
  padding-bottom: 14px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

.panel-header p {
  margin: 5px 0 0;
  font-size: 14px;
}

.term {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted rgba(21, 91, 214, 0.72);
  color: inherit;
  cursor: help;
  outline: 0;
}

.term::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: none;
  width: min(280px, 72vw);
  padding: 9px 11px;
  border: 1px solid #c8d4e4;
  border-radius: 5px;
  color: #1d2939;
  background: #fff;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.14);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
}

.term:hover::after,
.term:focus::after {
  display: block;
}

.term-inline {
  color: var(--muted);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions span {
  color: var(--blue);
  font-weight: 700;
}

.data-stamp {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid #d6e2f2;
  border-radius: 5px;
  color: #43536a;
  background: #f7faff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.panel-actions .data-stamp {
  color: #43536a;
}

button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--blue);
  background: var(--surface-2);
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
}

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

table {
  width: 100%;
  min-width: 1024px;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) {
  width: 54px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 146px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 118px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 158px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 96px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 120px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 140px;
}

th:nth-child(8),
td:nth-child(8) {
  width: 190px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #1d2939;
  background: #f4f7fb;
  font-size: 13px;
}

td strong {
  display: block;
}

td small {
  display: block;
  color: var(--muted);
}

.score,
.accent-red {
  color: var(--red);
}

.risk-low {
  color: var(--green);
}

.risk-mid {
  color: var(--orange);
}

.risk-high {
  color: var(--red);
}

.table-note {
  padding: 12px 18px;
  font-size: 13px;
}

.bar-list,
.strategy-grid,
.risk-layout,
.metric-grid {
  padding: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}

.bar-track {
  height: 14px;
  background: #eef2f7;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4d4f, #e31b2f);
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.strategy-card {
  min-height: 96px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
}

.strategy-card strong,
.metric-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--red);
  font-size: 20px;
}

.strategy-card span,
.metric-grid span {
  color: var(--muted);
  font-size: 12px;
}

.risk-layout {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 14px;
  align-items: center;
}

.donut {
  display: grid;
  width: 120px;
  height: 120px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg 120deg, var(--orange) 120deg 270deg, var(--red) 270deg 360deg);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
}

.donut span {
  position: relative;
  z-index: 1;
  font-weight: 800;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 14px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 7px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.metric-grid div {
  min-height: 78px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.glossary-panel {
  margin-top: 8px;
  border-radius: 6px;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.glossary-grid div {
  min-height: 112px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.glossary-grid dt {
  margin-bottom: 6px;
  color: var(--blue-dark);
  font-weight: 800;
}

.glossary-grid dd {
  margin: 0;
  color: #344054;
  font-size: 14px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.45fr;
  gap: 8px;
  margin: 8px 0 18px;
}

.info-block {
  padding: 18px 20px;
}

.info-block h2 {
  margin-bottom: 10px;
  color: var(--blue-dark);
}

.info-block ul {
  margin: 0;
  padding-left: 18px;
}

.info-block li {
  margin: 8px 0;
  color: #344054;
  font-size: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item strong {
  color: var(--blue);
}

.timeline-item span {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: center;
  gap: 26px;
  padding: 22px;
  border-top: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .site-header {
    display: block;
    background: #0b1220;
  }

  .brand {
    width: 100%;
  }

  .main-nav a {
    min-width: 0;
    height: 54px;
    padding: 0 10px;
    font-size: 14px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: visible;
  }

  #ai-course,
  #watchlist,
  #sectors,
  #review,
  #glossary {
    scroll-margin-top: 148px;
  }

  .status-band {
    grid-template-columns: repeat(3, 1fr);
  }

  .ai-course-band,
  .layout-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .layout-grid > *,
  .side-stack,
  .side-stack > *,
  .panel {
    min-width: 0;
  }

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

}

@media (max-width: 720px) {
  main {
    width: calc(100% - 16px);
    margin-top: 8px;
  }

  .brand {
    padding: 14px 16px;
  }

  .brand strong {
    font-size: 20px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .main-nav a {
    min-width: 0;
    height: 40px;
    padding: 0 6px;
    font-size: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .main-nav a:first-child {
    grid-column: 1 / -1;
  }

  #ai-course,
  #watchlist,
  #sectors,
  #review,
  #glossary {
    scroll-margin-top: 214px;
  }

  .status-band {
    grid-template-columns: 1fr;
  }

  .status-item {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .layout-grid {
    gap: 8px;
  }

  .ai-course-band {
    padding: 16px;
  }

  .course-copy h1 {
    font-size: 23px;
  }

  .course-aside {
    border-left: 0;
    border-top: 3px solid var(--red);
  }

  .panel-header {
    display: block;
  }

  .panel-actions {
    margin-top: 12px;
    justify-content: flex-start;
  }

  table {
    min-width: 0;
  }

  .table-wrap {
    overflow-x: visible;
    background: #f4f7fb;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    border-bottom: 1px solid var(--line);
  }

  #stock-table {
    padding: 8px;
    background: #f4f7fb;
  }

  #stock-table .stock-card-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 84px;
    grid-template-areas:
      "rank stock score"
      "rank industry probability"
      "strategy strategy strategy"
      "risk risk risk"
      "range range range";
    gap: 10px 12px;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(16, 24, 40, 0.06);
  }

  td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
  }

  #stock-table td {
    width: auto;
  }

  td::before {
    content: "";
    display: none;
  }

  #stock-table td[data-key="rank"] {
    grid-area: rank;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 6px;
    color: #fff;
    background: #111827;
    font-size: 14px;
    font-weight: 800;
  }

  td[data-key="stock"] {
    grid-area: stock;
  }

  td[data-key="stock"] strong {
    overflow-wrap: anywhere;
    color: #101828;
    font-size: 16px;
    line-height: 1.25;
  }

  td[data-key="stock"] small {
    margin-top: 3px;
    color: #667085;
    font-size: 12px;
  }

  td[data-key="score"] {
    grid-area: score;
    text-align: right;
  }

  td[data-key="score"]::before,
  td[data-key="probability"]::before {
    display: block;
    margin-bottom: 2px;
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  td[data-key="score"] strong,
  td[data-key="probability"] strong {
    font-size: 18px;
    line-height: 1.1;
  }

  td[data-key="score"] small,
  td[data-key="probability"] small {
    font-size: 11px;
  }

  #stock-table td[data-key="industry"] {
    grid-area: industry;
    align-self: start;
    width: fit-content;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    color: var(--blue-dark);
    background: #eef5ff;
    font-size: 12px;
    font-weight: 700;
  }

  td[data-key="probability"] {
    grid-area: probability;
    text-align: right;
  }

  td[data-key="strategy"] {
    grid-area: strategy;
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid #e1e9f4;
    border-radius: 6px;
    background: #f9fbff;
  }

  td[data-key="strategy"]::before {
    display: block;
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  td[data-key="strategy"] strong {
    color: #101828;
    font-size: 15px;
  }

  td[data-key="strategy"] small {
    font-size: 12px;
  }

  td[data-key="risk"],
  td[data-key="range"] {
    padding-top: 9px;
    border-top: 1px dashed #d9e2ec;
  }

  td[data-key="risk"] {
    grid-area: risk;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  td[data-key="range"] {
    grid-area: range;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
  }

  td[data-key="risk"]::before,
  td[data-key="range"]::before {
    display: block;
    margin-bottom: 0;
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  td[data-key="risk"] strong {
    display: inline-block;
    min-width: 22px;
    font-size: 15px;
  }

  td[data-key="risk"] small {
    margin-top: 0;
    font-size: 11px;
  }

  .table-note {
    padding: 10px 14px 14px;
    background: #fff;
  }

  .strategy-grid,
  .metric-grid,
  .risk-layout,
  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .donut {
    margin: 0 auto;
  }

  footer {
    display: grid;
    gap: 8px;
    text-align: center;
  }
}
