:root {
  --paper: #fff;
  --canvas: #f4f6f7;
  --ink: #17211e;
  --muted: #78817d;
  --line: #e3e9e6;
  --red: #e12739;
  --gold: #d8a033;
  --gold-soft: #fff7e4;
  --green: #1f855f;
  --green-soft: #edf8f3;
  --shadow: 0 9px 23px rgba(27, 43, 37, .075), 0 2px 5px rgba(27, 43, 37, .035);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { border: 0; color: inherit; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(225, 39, 57, .22); outline-offset: 2px; }

.quant-mobile-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
}

.quant-mobile-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #dfe5e2;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(14px);
  box-shadow: 0 5px 18px rgba(24, 39, 34, .07);
}

.quant-mobile-titlebar {
  min-height: 67px;
  padding: 10px 14px 8px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.quant-back {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 4px 11px rgba(32, 45, 40, .055);
}

.quant-mobile-titlebar div { min-width: 0; }
.quant-mobile-titlebar small { color: #a2731d; font-size: 8.5px; font-weight: 900; letter-spacing: 1.1px; }
.quant-mobile-titlebar h1 { margin: 2px 0 0; font-size: 18px; line-height: 1.25; }
.quant-svip-tag { padding: 6px 8px; border: 1px solid #e8cf95; border-radius: 8px; color: #765111; background: var(--gold-soft); font-size: 10px; font-weight: 900; }

.quant-tabs {
  margin: 0 12px 9px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  display: grid;
  grid-template-columns: .9fr 1.35fr;
  gap: 4px;
  background: #f5f7f6;
}

.quant-tabs button {
  min-height: 39px;
  border-radius: 10px;
  color: #76807b;
  font-size: 11px;
  font-weight: 800;
}

.quant-tabs button.is-active {
  color: #fff;
  background: linear-gradient(145deg, #efbf57, #c98b24);
  box-shadow: 0 5px 12px rgba(181, 120, 26, .2), inset 0 1px 0 rgba(255, 255, 255, .4);
}

.quant-mobile-main { min-height: calc(100vh - 125px); padding: 13px 10px calc(28px + env(safe-area-inset-bottom)); background: var(--canvas); }
.quant-pane { display: none; }
.quant-pane.is-active { display: block; }

.quant-page-heading { margin: 1px 3px 10px; display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.quant-page-heading small { color: #a07426; font-size: 9px; font-weight: 800; }
.quant-page-heading h2 { margin: 2px 0 0; font-size: 19px; }
.quant-page-heading > button, .quant-page-heading > span { min-height: 29px; padding: 0 10px; border: 1px solid #e7d5ad; border-radius: 999px; display: inline-flex; align-items: center; color: #855f18; background: var(--gold-soft); font-size: 10px; font-weight: 800; }

.quant-state {
  margin-bottom: 10px;
  padding: 12px 13px;
  border: 1px solid #e4e9e6;
  border-radius: 14px;
  display: grid;
  gap: 3px;
  background: #fff;
  box-shadow: var(--shadow);
}
.quant-state strong { font-size: 13px; }
.quant-state span { color: var(--muted); font-size: 9.5px; line-height: 1.5; }
.quant-state.is-ready { border-color: #bfe4d2; background: var(--green-soft); }
.quant-state.is-ready strong { color: #176948; }
.quant-state.is-empty { border-color: #ead9b2; background: #fffaf0; }
.quant-state.is-error { border-color: #efcdd2; background: #fff5f6; }
.quant-state.is-error strong { color: #b82638; }

.quant-summary { margin-bottom: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.quant-metric { min-width: 0; min-height: 69px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 13px; display: grid; align-content: center; gap: 4px; background: #fff; box-shadow: 0 5px 14px rgba(29, 44, 38, .05); }
.quant-metric span { color: var(--muted); font-size: 9px; }
.quant-metric strong { overflow-wrap: anywhere; font-size: 15px; }
.quant-metric.is-profit strong { color: var(--red); }
.quant-metric.is-loss strong { color: var(--green); }

.quant-list, .quant-history-list { display: grid; gap: 9px; }
.quant-empty { padding: 30px 18px; border: 1px dashed #d9e0dc; border-radius: 15px; color: var(--muted); background: rgba(255, 255, 255, .82); font-size: 11px; line-height: 1.7; text-align: center; }

.quant-monthly-panel { margin: 3px 0 14px; }
.quant-subheading { margin: 0 3px 8px; display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.quant-subheading small { color: #a07426; font-size: 8.5px; font-weight: 800; }
.quant-subheading h3 { margin: 2px 0 0; font-size: 15px; }
.quant-subheading > span { color: var(--muted); font-size: 9px; }
.quant-history-heading { margin-top: 1px; }
.quant-monthly-list { display: grid; gap: 8px; }
.quant-month-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  display: grid;
  gap: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.quant-month-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quant-month-head strong { font-size: 13px; }
.quant-month-roi { font-size: 16px; font-weight: 900; }
.quant-month-roi.positive { color: var(--red); }
.quant-month-roi.negative { color: var(--green); }
.quant-month-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.quant-month-grid div { min-width: 0; padding: 7px 6px; border-radius: 9px; display: grid; gap: 3px; background: #f6f8f7; text-align: center; }
.quant-month-grid span { color: var(--muted); font-size: 8px; }
.quant-month-grid b { overflow-wrap: anywhere; font-size: 10px; }
.quant-month-profit { padding-top: 8px; border-top: 1px solid #edf1ef; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.quant-month-profit strong { font-size: 11px; }
.quant-month-profit strong.positive { color: var(--red); }
.quant-month-profit strong.negative { color: var(--green); }

.quant-today-card {
  padding: 13px;
  border: 1px solid #e5dfd1;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #fffaf0);
  box-shadow: var(--shadow);
}
.quant-today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.quant-today-head div { min-width: 0; display: grid; gap: 3px; }
.quant-today-head strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.quant-today-head small { color: var(--muted); font-size: 9px; }
.quant-track { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #fff; background: #d29428; font-size: 9px; font-weight: 900; }
.quant-track.rail-two { background: #4779bf; }
.quant-today-grid { margin-top: 11px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.quant-today-grid div { min-width: 0; padding: 8px 9px; border: 1px solid #eee9dc; border-radius: 10px; display: grid; gap: 3px; background: rgba(255,255,255,.8); }
.quant-today-grid span { color: var(--muted); font-size: 8.5px; }
.quant-today-grid strong { overflow-wrap: anywhere; font-size: 11px; }

.quant-history-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  display: grid;
  gap: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}
.quant-history-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.quant-history-date { color: #6f7a75; font-size: 9px; font-weight: 800; }
.quant-history-title { min-width: 0; overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.quant-result { padding: 4px 7px; border-radius: 999px; font-size: 8.5px; font-weight: 900; }
.quant-result.hit { color: #b82638; background: #fff0f2; }
.quant-result.miss { color: #176948; background: var(--green-soft); }
.quant-result.pending { color: #78662d; background: var(--gold-soft); }
.quant-history-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.quant-history-detail span { color: var(--muted); font-size: 9px; }
.quant-history-detail b { margin-left: 4px; color: #39423e; font-size: 9.5px; }
.quant-history-profit { padding-top: 8px; border-top: 1px solid #eef1ef; display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.quant-history-profit strong.positive { color: var(--red); }
.quant-history-profit strong.negative { color: var(--green); }

@media (max-width: 350px) {
  .quant-mobile-titlebar { padding-right: 10px; padding-left: 10px; }
  .quant-mobile-titlebar h1 { font-size: 16px; }
  .quant-tabs { margin-right: 9px; margin-left: 9px; }
  .quant-tabs button { font-size: 10px; }
  .quant-mobile-main { padding-right: 8px; padding-left: 8px; }
  .quant-month-grid { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
