:root {
  --bg: #F4F4F5;
  --surface: #FFFFFF;
  --surface-muted: #F7F7F8;
  --text: #171717;
  --text-muted: #52525B;
  --border: rgba(23, 23, 23, 0.10);
  --green: #02743B;
  --green-soft: #E5FFF2;
  --green-text: #004D26;
  --blue: #3B82F6;
  --blue-soft: #EFF6FF;
  --red: #E8463A;
  --red-soft: #FEF2F1;
  --amber: #D97706;
  --amber-soft: #FFFBEB;
  --radius: 10px;
  --radius-card: 14px;
  --shadow: 0 1px 2px rgba(23, 23, 23, 0.04), 0 8px 24px rgba(23, 23, 23, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

/* ---------- gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.gate[hidden] { display: none; }

.gate form {
  width: 100%;
  max-width: 340px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.gate h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.gate p {
  margin: 6px 0 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.gate input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  outline: none;
}

.gate input:focus { border-color: var(--green); }

.gate button {
  width: 100%;
  height: 40px;
  margin-top: 12px;
  color: #FFFFFF;
  background: var(--green);
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.gate button:hover { background: #015E30; }

.gate-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 12px;
}

/* ---------- page ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

.page[hidden] { display: none; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.top h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.top .sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.versions {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.versions button {
  padding: 6px 16px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.versions button:hover { color: var(--text); }

.versions button[aria-pressed="true"] {
  color: var(--green-text);
  background: var(--green-soft);
  font-weight: 500;
}

/* ---------- kpi ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

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

.kpi .value {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.kpi .hint {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.value.up { color: var(--green-text); }
.value.down { color: var(--red); }

/* ---------- card ---------- */
.card {
  padding: 20px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card .meta {
  color: var(--text-muted);
  font-size: 12px;
}

.thesis {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.7;
}

.note-line {
  display: flex;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.note-line b {
  flex: none;
  color: var(--text);
  font-weight: 500;
}

.verdict {
  padding: 10px 12px;
  margin-top: 12px;
  color: #7C2D12;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  font-size: 13px;
}

/* ---------- chart ---------- */
.chart-wrap {
  position: relative;
  margin-top: 4px;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.lg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lg i {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}

.lg i.dashed { background: none; height: 0; border-top: 2px dashed var(--text-muted); }
.lg i.bull { background: none; height: 0; border-top: 2px dashed var(--blue); }
.lg i.usd { background: none; height: 0; border-top: 1px dotted var(--blue); }
.lg i.event { width: 0; height: 14px; border-radius: 0; border-left: 2px dashed var(--amber); }

.stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.stage-chip {
  padding: 5px 10px;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}

.stage-chip b {
  color: var(--text);
  font-weight: 500;
}

.tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 236px;
  max-width: calc(100% - 16px);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(23, 23, 23, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--tip-x, 0), var(--tip-y, 0), 0);
  transition: opacity 120ms ease;
}

.tip[data-visible="true"] { opacity: 1; }

.tip .t {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.tip[data-kind="buy"] .t { color: var(--green-text); }
.tip[data-kind="sell"] .t { color: var(--red); }

.tip .m {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.tip .b {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- grid ---------- */
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
}

/* ---------- table ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 8px 10px;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }

td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: 0; }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.tag.buy { color: var(--green-text); background: var(--green-soft); }
.tag.sell { color: #991B1B; background: var(--red-soft); }
.tag.actual { color: #065F46; background: #ECFDF5; }
.tag.est { color: #92400E; background: #FFFBEB; }

/* ---------- checklist ---------- */
.check {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.check:last-child { border-bottom: 0; }

.check input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--amber);
  cursor: pointer;
}

.check span { font-size: 13px; line-height: 1.5; }

.check input:checked + span {
  color: var(--text-muted);
  text-decoration: line-through;
}

.check-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
}

.check-status.hot {
  color: #92400E;
  background: var(--amber-soft);
}

.footer {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.8;
}

.footer a { color: var(--text-muted); }

/* ---------- chart svg ---------- */
.chart-wrap svg text { font-family: inherit; }
.grid { stroke: rgba(23, 23, 23, 0.07); stroke-width: 1; }
.band.b1 { fill: #F1F1F3; }
.band.b2 { fill: rgba(2, 116, 59, 0.045); }
.band.b3 { fill: rgba(217, 119, 6, 0.05); }
.band.b4 { fill: rgba(59, 130, 246, 0.05); }
.path-main { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.path-crisis { fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-dasharray: 5 3; stroke-linecap: round; stroke-linejoin: round; }
.path-bull { fill: none; stroke: var(--blue); stroke-width: 1.75; stroke-dasharray: 6 4; stroke-linecap: round; stroke-linejoin: round; }
.path-usd { fill: none; stroke: rgba(59, 130, 246, 0.55); stroke-width: 1; stroke-dasharray: 2 3; stroke-linecap: round; }
.today { stroke: rgba(82, 82, 91, 0.55); stroke-width: 1.5; }
.event { stroke: rgba(217, 119, 6, 0.6); stroke-width: 1; stroke-dasharray: 3 3; }
.today-label { fill: var(--text); font-size: 12px; font-weight: 500; }
.event-label { fill: var(--amber); font-size: 12px; font-weight: 500; }
.stage-box { fill: #FFFFFF; stroke: rgba(23, 23, 23, 0.10); stroke-width: 1; }
.stage-box.active { stroke: #0FDC78; stroke-width: 1.5; }
.stage-text { fill: var(--text); font-size: 12px; font-weight: 500; }
.stage-text.active { fill: var(--green-text); }
.tick { fill: var(--text-muted); font-size: 12px; }
.unit { fill: var(--text-muted); font-size: 12px; }
.price-label { fill: var(--text); font-size: 12px; font-weight: 500; paint-order: stroke; stroke: #FFFFFF; stroke-width: 3px; stroke-linejoin: round; }
.dot-buy { fill: #1DC981; stroke: #FFFFFF; stroke-width: 2; }
.dot-sell { fill: var(--red); stroke: #FFFFFF; stroke-width: 2; }
.dot-crisis { fill: #1DC981; stroke: #FFFFFF; stroke-width: 2; }
.mark-dark { fill: #171717; font-size: 12px; font-weight: 500; }
.mark-light { fill: #FFFFFF; font-size: 12px; font-weight: 500; }
.hit { fill: transparent; stroke: transparent; stroke-width: 18; cursor: default; }

/* ---------- probability history ---------- */
.prob-svg { display: block; width: 100%; height: auto; margin-top: 8px; }
.pgrid { stroke: rgba(23, 23, 23, 0.07); stroke-width: 1; }
.prob-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.prob-label { font-size: 12px; font-weight: 500; }
.prob-hint { fill: var(--text-muted); font-size: 12px; }
.prob-rules { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; font-size: 12px; }
.rule .sig { color: var(--text); }
.rule .eff { color: var(--text-muted); }

@media (max-width: 640px) {
  .rule { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 24px 14px 56px; }
  .top h1 { font-size: 22px; }
}
