:root {
  --ink: #101820;
  --muted: #66717d;
  --line: #e7e5df;
  --paper: #f5f3ed;
  --panel: #ffffff;
  --red: #d92d3d;
  --red-dark: #a91f2d;
  --red-soft: #fff0f1;
  --green: #087a5b;
  --green-soft: #eaf7f2;
  --amber: #a86800;
  --amber-soft: #fff6df;
  --navy: #111820;
  --blue: #2f62d0;
  --shadow: 0 16px 40px rgba(16, 24, 32, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background: var(--paper);
}

body {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background: radial-gradient(circle at 70% -10%, rgba(217, 45, 61, 0.09), transparent 32rem), var(--paper);
}

img, svg { max-width: 100%; }

button, a { font: inherit; }

.challenge-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 0;
  background: linear-gradient(118deg, #c91320 0%, #e82f3a 58%, #f34a53 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(120, 0, 12, 0.14);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.topbar-inner { display: flex; align-items: center; gap: 14px; max-width: 1320px; min-height: 70px; margin: 0 auto; padding: 10px 24px; }

.back-link { display: inline-flex; min-width: 42px; min-height: 42px; align-items: center; justify-content: center; gap: 6px; border: 1px solid rgba(255,255,255,.28); border-radius: 13px; padding: 0 10px; background: rgba(255,255,255,.12); color: #fff; text-decoration: none; font-size: 13px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.back-link:hover { color: #fff; }

.back-icon { font-size: 21px; line-height: 1; }

.page-mark { display: grid; flex: 0 0 auto; width: 44px; height: 44px; margin-left: 2px; overflow: hidden; place-items: center; border: 1px solid rgba(255,255,255,.38); border-radius: 13px; background: #fff; box-shadow: 0 7px 18px rgba(112,0,10,.18); }
.page-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }

.topbar-copy { display: grid; gap: 2px; }
.topbar-copy strong { font-size: 15px; letter-spacing: .02em; }
.topbar-copy span { color: rgba(255,255,255,.78); font-size: 11px; }

.topbar-right { display: flex; min-width: 0; align-items: center; gap: 8px; margin-left: auto; color: rgba(255,255,255,.82); font-size: 12px; }
.runtime-dot { width: 8px; height: 8px; border-radius: 50%; background: #9da7af; box-shadow: 0 0 0 4px rgba(157,167,175,.12); }
.runtime-dot.running { background: #32c48d; box-shadow: 0 0 0 4px rgba(50,196,141,.14); }

main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 26px 24px 48px; overflow-x: clip; }

.challenge-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.challenge-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-width: 0; min-height: 72px; border: 1px solid #dfddd7; border-radius: 16px; padding: 12px 15px; background: rgba(255,255,255,.82); color: var(--ink); text-align: left; box-shadow: 0 6px 18px rgba(16,24,32,.035); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease; }
.challenge-option:hover { border-color: #e9b5ba; transform: translateY(-1px); }
.challenge-option.active { border-color: #e0717b; background: linear-gradient(140deg, #fff 0%, #fff2f3 100%); box-shadow: 0 8px 22px rgba(176,25,42,.09), inset 3px 0 0 var(--red); }
.option-copy, .option-live { display: grid; min-width: 0; gap: 2px; }
.option-copy small, .option-live small { color: #8d969d; font-size: 9px; }
.option-copy strong { overflow: hidden; font-size: 15px; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.option-copy em { color: var(--muted); font-size: 10px; font-style: normal; }
.option-live { justify-items: end; text-align: right; }
.option-live strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.option-live em { font-size: 10px; font-style: normal; font-weight: 750; font-variant-numeric: tabular-nums; }
.challenge-option.active .option-copy small, .challenge-option.active .option-copy strong { color: var(--red-dark); }

.summary-shell { margin-bottom: 16px; overflow: hidden; border: 1px solid #efc9cd; border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.hero-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 36px; align-items: end; min-height: 0; padding: 26px 30px 22px; background: linear-gradient(145deg, #ffffff 0%, #fff9f9 68%, #fff1f2 100%); color: var(--ink); }
.hero-copy { min-width: 0; }
.eyebrow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 14px; }
.status-badge, .paper-badge, .session-chip, .lock-badge, .count-badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; font-size: 10px; font-weight: 750; }
.status-badge { background: var(--red); color: #fff; }
.paper-badge { border: 1px solid #f0c7cb; background: #fff; color: var(--red-dark); }
.session-chip { margin-left: auto; background: #f4ebec; color: #815b5f; font-variant-numeric: tabular-nums; }
.hero-card h1 { margin: 0; color: var(--ink); font-size: clamp(34px, 4vw, 54px); letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1; }
.hero-card h1 span { color: inherit; font-weight: 750; }
.hero-card h1 i { margin: 0 .16em; color: #db5966; font-style: normal; font-weight: 400; }
.mobile-target, .mobile-copy { display: none; }
.hero-card p { max-width: 720px; margin: 11px 0 12px; color: #65717a; font-size: 12px; line-height: 1.55; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 7px 18px; color: #8c7477; font-size: 10px; }

.hero-progress { display: grid; gap: 9px; align-self: center; border: 1px solid #f0d5d8; border-radius: 14px; padding: 14px 15px; background: rgba(255,255,255,.76); }
.progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-copy span { color: #896c70; font-size: 10px; }
.progress-copy strong { color: var(--red-dark); font-size: 17px; font-variant-numeric: tabular-nums; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #f2dcdf; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e34856, #c91f30); transition: width .7s ease; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin: 0; border-top: 1px solid #efdfe1; background: #e9e7e2; }
.metric-card { display: grid; min-width: 0; min-height: 94px; align-content: center; gap: 5px; border: 0; border-radius: 0; padding: 14px 16px; background: #fff; }
.metric-card span { color: var(--muted); font-size: 10px; }
.metric-card strong { overflow: hidden; font-size: clamp(17px, 1.7vw, 23px); line-height: 1.1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.metric-card small { overflow: hidden; color: #929aa1; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.metric-primary { background: linear-gradient(145deg, #fff, #fff4f5); }
.metric-primary strong { color: var(--red-dark); }
.positive { color: var(--red) !important; }
.negative { color: var(--green) !important; }
.neutral { color: var(--ink) !important; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .8fr); gap: 16px; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 8px 26px rgba(16,24,32,.035); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; }
.panel-head h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.015em; }
.section-kicker { color: var(--red); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.count-badge { min-width: 26px; justify-content: center; padding: 0 8px; background: #f0f2f3; color: #54616b; vertical-align: 2px; }
.lock-badge { background: var(--green-soft); color: var(--green); }
.updated-text { color: #929aa1; font-size: 11px; }

.chart-wrap { min-height: 260px; padding: 4px 20px 0; }
#equityChart { display: block; width: 100%; height: 260px; overflow: visible; }
.chart-grid { stroke: #e8e9e6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-target { stroke: #d9a6ac; stroke-width: 1.5; stroke-dasharray: 6 7; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#equityGradient); }
.chart-line { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-point { fill: #fff; stroke: var(--red); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart-label { fill: #8a939a; font-size: 10px; font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 10px; }
.chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 5px; vertical-align: 3px; }
.legend-equity::before { background: var(--red); }
.legend-target::before { border-top: 2px dashed #d9a6ac; }
.goal-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.goal-strip > div { display: grid; gap: 4px; padding: 14px 20px; border-right: 1px solid var(--line); }
.goal-strip > div:last-child { border-right: 0; }
.goal-strip span { color: var(--muted); font-size: 10px; }
.goal-strip strong { font-size: 14px; }

.risk-gates { display: grid; gap: 0; padding: 0 20px; }
.risk-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 49px; border-bottom: 1px solid #efefec; }
.risk-row:last-child { border-bottom: 0; }
.risk-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 900; }
.risk-row strong { display: block; font-size: 12px; }
.risk-row small { color: var(--muted); font-size: 10px; }
.risk-row em { color: var(--green); font-size: 10px; font-style: normal; font-weight: 700; }
.guard-note { margin: 14px 20px 20px; border-radius: 10px; padding: 11px 12px; background: #f6f7f7; color: var(--muted); font-size: 10px; line-height: 1.6; }

.holdings-panel, .audit-panel { margin-top: 16px; }
.positions-grid { display: grid; gap: 12px; padding: 0 20px 20px; }
.position-card { display: grid; grid-template-columns: minmax(180px, 1.15fr) repeat(5, minmax(105px, .72fr)); gap: 12px; min-width: 0; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow-wrap: anywhere; background: #fcfcfa; }
.stock-id { display: grid; gap: 3px; }
.stock-id strong { font-size: 16px; }
.stock-id span { color: var(--muted); font-size: 11px; }
.lane-chip, .state-chip, .event-chip { display: inline-flex; width: fit-content; align-items: center; min-height: 22px; border-radius: 999px; padding: 0 8px; font-size: 9px; font-weight: 800; }
.lane-chip { background: #edf1f8; color: #395a87; }
.lane-chip.startup { background: var(--red-soft); color: var(--red-dark); }
.state-chip { background: var(--amber-soft); color: var(--amber); }
.position-stat { display: grid; gap: 4px; }
.position-stat span { color: var(--muted); font-size: 10px; }
.position-stat strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.empty-state { display: grid; min-height: 150px; place-items: center; border: 1px dashed #d9d8d2; border-radius: 14px; padding: 24px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 14px; }
.empty-state span { max-width: 430px; font-size: 11px; line-height: 1.6; }

.candidate-list { display: grid; gap: 10px; padding: 0 20px 20px; }
.candidate-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 13px; padding: 14px; }
.candidate-index { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: #f2f3f4; color: #6c757c; font-size: 11px; font-weight: 800; }
.candidate-card h3 { margin: 0; font-size: 14px; }
.candidate-card p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.candidate-price { text-align: right; }
.candidate-price strong { display: block; font-size: 15px; }
.candidate-price small { font-size: 10px; }

.model-route { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 20px 16px; }
.model-stage { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.model-stage:not(:last-child)::after { content: "→"; position: absolute; z-index: 2; top: 21px; right: -11px; width: 14px; color: #9ba3a9; font-size: 12px; text-align: center; }
.model-stage strong { display: block; color: var(--red-dark); font-size: 13px; }
.model-stage span, .model-stage small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.schedule-list { border-top: 1px solid var(--line); padding: 8px 20px 16px; }
.schedule-row { display: grid; grid-template-columns: 50px 80px minmax(0, 1fr); gap: 8px; padding: 9px 0; font-size: 10px; }
.schedule-row time { color: var(--red-dark); font-weight: 800; font-variant-numeric: tabular-nums; }
.schedule-row strong { font-size: 10px; }
.schedule-row span { color: var(--muted); line-height: 1.45; }

.audit-head { align-items: center; }
.timeline-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.timeline-filters button { min-height: 30px; border: 1px solid var(--line); border-radius: 999px; padding: 0 11px; background: #fff; color: var(--muted); font-size: 10px; cursor: pointer; }
.timeline-filters button.active { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); font-weight: 750; }
.audit-timeline { position: relative; display: grid; gap: 0; padding: 2px 22px 24px 48px; }
.audit-timeline::before { content: ""; position: absolute; top: 10px; bottom: 26px; left: 30px; width: 1px; background: #dddeda; }
.event-card { position: relative; display: grid; min-width: 0; gap: 8px; border-bottom: 1px solid #ecece8; padding: 14px 0 16px; overflow-wrap: anywhere; }
.event-card::before { content: ""; position: absolute; top: 19px; left: -23px; width: 9px; height: 9px; border: 3px solid #fff; border-radius: 50%; background: #aab0b5; box-shadow: 0 0 0 1px #d5d7d8; }
.event-card.trade::before { background: var(--red); }
.event-card.ai_review::before { background: var(--blue); }
.event-card.signal::before { background: var(--amber); }
.event-card:last-child { border-bottom: 0; }
.event-top { display: flex; align-items: center; gap: 8px; }
.event-chip { background: #f0f2f3; color: #55616a; }
.event-chip.ai_review { background: #edf2ff; color: #315ab5; }
.event-chip.trade { background: var(--red-soft); color: var(--red-dark); }
.event-chip.signal { background: var(--amber-soft); color: var(--amber); }
.event-time { color: #8c959c; font-size: 10px; font-variant-numeric: tabular-nums; }
.event-symbol { margin-left: auto; color: var(--muted); font-size: 10px; }
.event-card h3 { margin: 0; font-size: 14px; }
.event-detail { margin: 0; color: #4f5a62; font-size: 11px; line-height: 1.75; }
.event-next { border-left: 2px solid #d9dcde; padding-left: 10px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.event-facts { display: flex; flex-wrap: wrap; gap: 5px; }
.event-facts span { border-radius: 6px; padding: 4px 7px; background: #f4f5f5; color: #56616a; font-size: 9px; }
.review-chain { display: grid; gap: 6px; margin-top: 2px; }
.review-stage { display: grid; grid-template-columns: 54px 76px minmax(0, 1fr); gap: 8px; border-radius: 9px; padding: 9px 10px; background: #f7f8fa; font-size: 9px; line-height: 1.55; }
.review-stage strong { color: #315ab5; text-transform: capitalize; }
.review-stage span { color: #56616a; }
.review-stage p { margin: 0; color: #3d474f; }

.page-disclaimer { max-width: 900px; margin: 22px auto 0; color: #8b9399; font-size: 10px; line-height: 1.7; text-align: center; }
#toast { position: fixed; z-index: 40; right: 20px; bottom: 20px; transform: translateY(20px); border-radius: 10px; padding: 11px 14px; background: #111820; color: #fff; font-size: 11px; opacity: 0; pointer-events: none; transition: .2s ease; }
#toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .position-card { grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(100px, .7fr)); }
  .position-stat:nth-last-child(-n+2) { display: none; }
}

@media (max-width: 760px) {
  .topbar-inner { min-height: 64px; padding: 9px 14px; }
  .back-label, .topbar-copy span { display: none; }
  .back-link { width: 42px; padding: 0; }
  .page-mark { width: 40px; height: 40px; margin-left: 0; line-height: 40px; }
  .topbar-copy strong { font-size: 13px; }
  .topbar-right { font-size: 10px; }
  main { padding: 14px 12px calc(30px + env(safe-area-inset-bottom, 0px)); }
  .challenge-switcher { gap: 7px; margin-bottom: 9px; }
  .challenge-option { grid-template-columns: minmax(0, 1fr); gap: 7px; min-height: 92px; border-radius: 13px; padding: 10px 11px; }
  .option-copy strong { font-size: 13px; }
  .option-copy em { font-size: 9px; }
  .option-live { grid-template-columns: auto auto; align-items: baseline; justify-content: space-between; justify-items: stretch; width: 100%; padding-top: 5px; border-top: 1px solid #ece9e4; text-align: left; }
  .option-live small { display: none; }
  .option-live strong { font-size: 11px; }
  .option-live em { text-align: right; }
  .summary-shell { margin-bottom: 10px; border-radius: 17px; }
  .hero-card { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 16px 14px; }
  .desktop-target, .desktop-copy { display: none; }
  .mobile-target, .mobile-copy { display: inline; }
  .hero-card h1 { font-size: 30px; }
  .hero-card p { margin: 8px 0; font-size: 10px; line-height: 1.45; }
  .hero-meta { display: flex; gap: 5px 14px; font-size: 9px; }
  .eyebrow-row { margin-bottom: 10px; }
  .hero-progress { gap: 6px; padding: 9px 11px; border-radius: 11px; }
  .progress-copy strong { font-size: 14px; }
  .progress-track { height: 6px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; }
  .metric-card { min-height: 72px; gap: 4px; border-radius: 0; padding: 10px 13px; }
  .metric-card strong { font-size: clamp(15px, 4.6vw, 18px); }
  .split-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .dashboard-grid { gap: 10px; }
  .panel { border-radius: 15px; }
  .panel-head { padding: 17px 16px 12px; }
  .panel-head h2 { font-size: 16px; }
  .chart-wrap { min-height: 210px; padding: 0 10px; }
  #equityChart { height: 210px; }
  .goal-strip > div { padding: 12px; }
  .goal-strip strong { font-size: 11px; }
  .risk-gates, .candidate-list, .model-route, .schedule-list { padding-right: 14px; padding-left: 14px; }
  .holdings-panel, .audit-panel { margin-top: 10px; }
  .positions-grid { padding: 0 12px 14px; }
  .position-card { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 8px; padding: 14px; }
  .stock-id { grid-column: 1 / -1; }
  .position-stat:nth-last-child(-n+2) { display: grid; }
  .model-route { grid-template-columns: 1fr; }
  .model-stage:not(:last-child)::after { top: auto; right: 50%; bottom: -12px; transform: rotate(90deg); }
  .audit-head { display: grid; }
  .timeline-filters { justify-content: flex-start; overflow: visible; flex-wrap: wrap; width: 100%; padding-bottom: 2px; }
  .audit-timeline { padding-right: 14px; padding-left: 39px; }
  .audit-timeline::before { left: 23px; }
  .event-card::before { left: -21px; }
  .review-stage { grid-template-columns: 48px 66px minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-card h1 { font-size: 28px; letter-spacing: -.055em; }
  .topbar-right #runtimeText { display: none; }
  .metric-card strong { font-size: clamp(15px, 4.6vw, 17px); }
  .goal-strip { grid-template-columns: 1fr; }
  .goal-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .goal-strip > div:last-child { border-bottom: 0; }
  .chart-legend { display: none; }
  .schedule-row { grid-template-columns: 48px minmax(0, 1fr); }
  .schedule-row span { grid-column: 2; }
  .review-stage { grid-template-columns: 44px minmax(0, 1fr); }
  .review-stage p { grid-column: 1 / -1; }
}
