:root {
  --bg: #0b0f14;
  --bg-soft: #0e141b;
  --panel: #121a23;
  --panel-2: #16202b;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #e8eef5;
  --muted: #8b98a8;
  --faint: #5f6b7a;
  --up: #ff5a5f;
  --up-soft: rgba(255, 90, 95, 0.14);
  --down: #22c55e;
  --down-soft: rgba(34, 197, 94, 0.14);
  --amber: #f5b942;
  --amber-soft: rgba(245, 185, 66, 0.14);
  --blue: #5aa9ff;
  --blue-soft: rgba(90, 169, 255, 0.14);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-height: 66px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(90, 169, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 90, 95, 0.08), transparent 55%),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 18px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(11, 15, 20, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(22, 32, 43, 0.72);
  cursor: pointer;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(90, 169, 255, 0.26), rgba(255, 90, 95, 0.18));
  border: 1px solid rgba(148, 163, 184, 0.22);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 8px 8px 7px;
}

.brand-mark span {
  width: 4px;
  border-radius: 2px;
  background: var(--text);
  opacity: 0.9;
}

.brand-mark span:nth-child(1) {
  height: 9px;
  background: var(--down);
}

.brand-mark span:nth-child(2) {
  height: 15px;
  background: var(--blue);
}

.brand-mark span:nth-child(3) {
  height: 12px;
  background: var(--up);
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asof {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 10px;
  text-align: right;
  line-height: 1.35;
  max-width: 86px;
}

.main {
  padding: 14px 14px 0;
}

.hidden {
  display: none !important;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(90, 169, 255, 0.12), transparent 48%),
    linear-gradient(160deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 95, 0.16), transparent 65%);
  pointer-events: none;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.hero-kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(90, 169, 255, 0.12);
}

.hero h2 {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0.2px;
}

.hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.stat {
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(11, 15, 20, 0.28);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.stat.up b {
  color: var(--up);
}

.stat.down b {
  color: var(--down);
}

.stat.flags b {
  color: var(--amber);
}

.section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  margin-bottom: 9px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.section-note {
  color: var(--faint);
  font-size: 10px;
}

.stock-list {
  display: grid;
  gap: 10px;
}

.stock-card {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: linear-gradient(150deg, rgba(22, 32, 43, 0.96), rgba(16, 23, 31, 0.96));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.stock-card:active {
  transform: scale(0.985);
  border-color: var(--border-strong);
}

.stock-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stock-name {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.stock-code {
  display: inline-block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
}

.price-block {
  text-align: right;
  flex: 0 0 auto;
}

.price {
  display: block;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.price.up {
  color: var(--up);
}

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

.price.flat {
  color: var(--text);
}

.change {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
}

.change.up {
  color: var(--up);
  background: var(--up-soft);
}

.change.down {
  color: var(--down);
  background: var(--down-soft);
}

.stock-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  background: rgba(11, 15, 20, 0.26);
  font-variant-numeric: tabular-nums;
}

.chip.good {
  color: var(--down);
  border-color: rgba(34, 197, 94, 0.28);
  background: var(--down-soft);
}

.chip.warn {
  color: var(--amber);
  border-color: rgba(245, 185, 66, 0.28);
  background: var(--amber-soft);
}

.chip.bad {
  color: var(--up);
  border-color: rgba(255, 90, 95, 0.3);
  background: var(--up-soft);
}

.chip.blue {
  color: var(--blue);
  border-color: rgba(90, 169, 255, 0.28);
  background: var(--blue-soft);
}

.stock-flag {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.stock-flag.high {
  color: var(--up);
}

.stock-flag.watch {
  color: var(--amber);
}

.stock-flag.ok {
  color: var(--down);
}

.stock-error {
  color: var(--up);
  font-size: 12px;
  margin-top: 9px;
}

.detail-head {
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(90, 169, 255, 0.12), transparent 55%),
    linear-gradient(160deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title {
  min-width: 0;
}

.detail-title h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.detail-title p {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.detail-price {
  text-align: right;
  flex: 0 0 auto;
}

.detail-price .price {
  font-size: 26px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.conclusion {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(11, 15, 20, 0.28);
}

.conclusion-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.conclusion-text {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: #cfd8e3;
}

.conclusion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

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

.metric-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 12px 12px 11px;
  background: linear-gradient(150deg, rgba(22, 32, 43, 0.9), rgba(16, 23, 31, 0.9));
  min-height: 84px;
}

.metric-card::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.metric-card.good::before {
  background: var(--down);
  box-shadow: 0 0 0 4px var(--down-soft);
}

.metric-card.warn::before {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.metric-card.bad::before {
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-soft);
}

.metric-label {
  margin-left: 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.metric-value {
  margin-top: 7px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}

.metric-note {
  margin-top: 5px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
}

.flag-list {
  display: grid;
  gap: 8px;
}

.flag-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(22, 32, 43, 0.72);
}

.flag-item.high {
  border-color: rgba(255, 90, 95, 0.28);
  background: linear-gradient(135deg, rgba(255, 90, 95, 0.1), rgba(22, 32, 43, 0.76));
}

.flag-item.watch {
  border-color: rgba(245, 185, 66, 0.26);
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.08), rgba(22, 32, 43, 0.76));
}

.flag-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.flag-title.high {
  color: var(--up);
}

.flag-title.watch {
  color: var(--amber);
}

.flag-detail {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 8px;
  background: linear-gradient(150deg, rgba(22, 32, 43, 0.92), rgba(16, 23, 31, 0.92));
}

.chart-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 4px;
}

.chart-title {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
  letter-spacing: 0.2px;
}

.chart-note {
  color: var(--faint);
  font-size: 10px;
}

.chart {
  width: 100%;
  height: 268px;
}

.chart.short {
  height: 210px;
}

.data-note {
  margin-top: 14px;
  padding: 12px 2px 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.6;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.report-btn,
.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: rgba(22, 32, 43, 0.9);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn {
  border-color: rgba(90, 169, 255, 0.4);
  background: linear-gradient(135deg, rgba(90, 169, 255, 0.24), rgba(90, 169, 255, 0.1));
  color: #cfe6ff;
}

.ghost-btn {
  color: var(--muted);
  background: transparent;
}

.report-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.report-row .report-btn {
  flex: 1;
}

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

.review-card {
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 13px;
  background: linear-gradient(150deg, rgba(22, 32, 43, 0.9), rgba(16, 23, 31, 0.9));
}

.review-card .k {
  color: var(--muted);
  font-size: 10px;
}

.review-card .v {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
}

.review-card .s {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
}

.review-card.up .v {
  color: var(--up);
}

.review-card.down .v {
  color: var(--down);
}

.review-card.flags .v {
  color: var(--amber);
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(22, 32, 43, 0.7);
}

.timeline-item[data-code] {
  cursor: pointer;
}

.timeline-item .name {
  font-size: 13px;
  font-weight: 600;
}

.timeline-item .text {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.about-list {
  display: grid;
  gap: 10px;
}

.about-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(22, 32, 43, 0.7);
}

.about-item h3 {
  margin: 0;
  font-size: 13px;
}

.about-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  font-size: 11px;
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-row span:first-child {
  color: var(--muted);
}

.kv-row span:last-child {
  color: #cfd8e3;
  text-align: right;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 30;
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 14px calc(8px + var(--safe-bottom));
  background: rgba(11, 15, 20, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.tab {
  border: none;
  background: transparent;
  color: var(--faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  font-size: 10px;
  cursor: pointer;
}

.tab svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.active {
  color: var(--blue);
}

.skeleton-wrap {
  display: grid;
  gap: 10px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(148, 163, 184, 0.08);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}

.skeleton.hero {
  height: 168px;
}

.skeleton.card {
  height: 112px;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.error-box {
  border: 1px solid rgba(255, 90, 95, 0.28);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 90, 95, 0.08);
  color: #ffb4b6;
  font-size: 12px;
  line-height: 1.6;
}

.noscript {
  padding: 20px;
  color: var(--up);
  font-size: 13px;
}

.footer {
  padding: 18px 2px 4px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

@media (min-width: 720px) {
  .main {
    padding: 18px 18px 0;
  }

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

  .chart {
    height: 320px;
  }
}
