:root {
  --bg: #070a12;
  --gold: #e7c78a;
  --gold-2: #f3dfb4;
  --cyan: #8ee7ff;
  --red: #ff5b6a;
  --green: #2fce8b;
  --line: rgba(231, 199, 138, 0.22);
  --card: rgba(12, 18, 32, 0.78);
  --text: #e8eef8;
  --muted: #8ea0bb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html.desk .only-phone { display: none !important; }
html.phone .only-desk { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(231,199,138,.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(80,140,255,.18), transparent 50%),
    var(--bg);
}
#fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
html.desk .phone-root, html.phone .desk-root { display: none !important; }

.desk-root, .phone-root, .page { position: relative; z-index: 1; }
.desk-app {
  height: 100vh; overflow: hidden;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px; padding: 12px 16px 12px;
}
.top {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: linear-gradient(160deg, #f6e3b5, #b8883d 55%, #6d4c16);
  display: grid; place-items: center; color: #1a1206; font-weight: 800;
}
.back-mark { cursor: pointer; }
.back-mark svg { display: block; }
h1 { margin: 0; font-size: 22px; font-weight: 680; letter-spacing: 1px; }
h1 span { color: var(--gold-2); }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.clock-line { display: flex; align-items: center; }
.author { margin-left: 20px; }
.nav { display: flex; gap: 6px; margin-top: 6px; }
.nav a, .chip, .all-btn, .more, .ghost {
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--gold-2);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.nav a.on, .chip.on, .all-btn.on { background: linear-gradient(180deg, #f8e7c0, #d7b16a); color: #1a1206; border-color: transparent; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
input[type="date"] {
  background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; font-size: 13px;
}
.date-field { position: relative; }
span.date-field { display: inline-block; }
.date-field::after {
  content: "";
  position: absolute; right: 10px; bottom: 10px; width: 16px; height: 16px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e8eef8'%3E%3Cpath d='M7 2h2v2h6V2h2v2h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3V2zm12 8H5v9h14v-9zM5 6v2h14V6H5z'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; pointer-events: none; }
.switch {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 12px;
}
body[data-page="work"] .controls .date-field { display: inline-flex; align-items: center; }
body[data-page="work"] .controls input[type="date"],
body[data-page="work"] .controls .switch {
  height: 36px; box-sizing: border-box; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
}
body[data-page="work"] .controls input[type="date"] { position: relative; padding: 0 34px 0 14px; }
body[data-page="work"] .controls input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0; pointer-events: none; width: 0; height: 0;
}
.date-pop {
  position: fixed; z-index: 25; width: 280px; padding: 12px;
  background: #121a2b; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.date-pop[hidden] { display: none !important; }
.date-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.date-pop-head b { font-size: 14px; font-weight: 650; }
.date-pop-head button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; }
.date-pop-week, .date-pop-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.date-pop-week { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.date-pop-grid button { height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.date-pop-grid button.on { background: linear-gradient(180deg, #f8e7c0, #d7b16a); color: #1a1206; font-weight: 700; }
.date-pop-grid button:hover { background: rgba(255,255,255,.08); }
.date-pop-grid button:disabled,
.date-pop-grid button:disabled.on {
  color: rgba(232,238,248,.28); background: transparent; cursor: not-allowed;
}
.date-pop-grid button:disabled:hover { background: transparent; }
body[data-page="work"] .controls .switch { padding: 0 14px; }
body[data-page="work"] .controls .month-btn,
body[data-page="work"] .controls .source-btn { height: 36px; border-radius: 999px; padding: 0 14px; }
.capture-log {
  flex: none; max-width: none; white-space: nowrap;
  margin: 0 20px 0 0; border: 0; background: transparent; color: var(--gold-2);
  font: inherit; font-size: 13px; line-height: 1.45; text-align: right;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.log-modal { z-index: 22; }
.log-detail { z-index: 28; }
.log-sheet { width: 50vw; height: auto; max-height: 60vh; }
.log-pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px 14px; border-top: 1px solid var(--line);
}
.log-pager span { color: var(--muted); font-size: 13px; }
.log-line {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid rgba(255,255,255,.06);
  background: transparent; color: var(--gold-2); font: inherit; font-size: 14px; line-height: 1.5;
  padding: 12px 20px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.log-line:hover { color: #fff; }
.log-tabs { display: flex; gap: 6px; }
.log-tabs button {
  border: 1px solid rgba(231,199,138,.35); background: transparent; color: var(--text);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.log-tabs button.on { color: #1a1206; background: var(--gold); border-color: var(--gold); }
.source-wrap { position: relative; }
.source-btn { display: inline-flex; align-items: center; gap: 8px; }
.source-btn .caret {
  width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; opacity: .8;
}
.source-menu {
  position: absolute; top: 42px; left: 0; z-index: 25; min-width: 112px;
  background: #172033; border: 1px solid rgba(231,199,138,.35); border-radius: 12px; padding: 4px;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.source-menu[hidden] { display: none; }
.source-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.source-menu button.on, .source-menu button:hover { background: rgba(231,199,138,.14); color: var(--gold-2); }
.src {
  display: inline-block; margin-left: 4px; vertical-align: super; font-size: 9px; line-height: 1.3;
  padding: 0 3px; border-radius: 4px; letter-spacing: 0;
}
.src.yn { color: #9ecbff; background: rgba(80,140,220,.18); }
.src.zn { color: #f3b4c8; background: rgba(220,100,140,.18); }
.src.both { color: #f3dfb4; background: rgba(231,199,138,.18); }
.month-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.month-hint { min-height: 18px; margin: 0; color: var(--gold-2); font-size: 13px; line-height: 1.5; }
#passModal { z-index: 40; }
body[data-page="work"] .controls .date-field::after { top: 50%; bottom: auto; right: 12px; transform: translateY(-50%); }
body[data-page="home"] .controls .date-field { display: inline-flex; align-items: center; }
body[data-page="home"] .controls .date-field::after { top: 50%; bottom: auto; transform: translateY(-50%); }
.switch input { accent-color: #d7b16a; }
button.capture {
  border: 0; cursor: pointer; color: #1a1206; font-weight: 750;
  padding: 9px 14px; border-radius: 12px; background: linear-gradient(180deg, #f8e7c0, #d7b16a);
}
button.capture:disabled { opacity: .65; cursor: progress; }
.agent { font-size: 12px; color: var(--muted); }
.agent.on { color: var(--green); }
.agent.off { color: #ffb4bc; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.metric, .board, .picks, .sheet, .card, .stats, .chart-card, .bt-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(16px);
}
.metric { padding: 8px 12px; }
.metric b { display: block; margin-top: 2px; font-size: 22px; font-variant-numeric: tabular-nums; }
.metric span, .tag { color: var(--muted); font-size: 12px; }
.stage { min-height: 0; display: grid; grid-template-rows: minmax(120px, .78fr) minmax(0, 1.25fr); gap: 8px; }
.stage.solo { grid-template-rows: minmax(0, 1fr); }
.boards { min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.board, .picks { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.board h2, .picks h2 {
  margin: 0; padding: 8px 12px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.pick-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.b1 h2 { box-shadow: inset 0 3px 0 #ff8a3d; }
.b3 h2 { box-shadow: inset 0 3px 0 #ff5a6a; }
.b5 h2 { box-shadow: inset 0 3px 0 #4aa3ff; }
.picks h2 { background: linear-gradient(90deg, rgba(231,199,138,.18), transparent 70%); }
.table-wrap { min-height: 0; overflow: auto; }
.desk-app .preview { overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { position: sticky; top: 0; background: #101828; color: var(--muted); font-weight: 600; text-align: right; padding: 6px; }
.table-wrap th:nth-child(1), .table-wrap td:nth-child(1),
.table-wrap th:nth-child(2), .table-wrap td:nth-child(2),
.sheet-body th:nth-child(1), .sheet-body td:nth-child(1),
.sheet-body th:nth-child(2), .sheet-body td:nth-child(2) { text-align: left; }
.table-wrap th:nth-child(3), .table-wrap td:nth-child(3),
.sheet-body th:nth-child(3), .sheet-body td:nth-child(3) { text-align: right; }
html.desk table.picks-table th:first-child,
html.desk table.picks-table td.code { text-align: center; }
th.sort { cursor: pointer; white-space: nowrap; user-select: none; }
th.sort:hover { color: var(--text); }
.sort-ico { display: inline-flex; flex-direction: column; justify-content: center; gap: 2px; width: 8px; height: 10px; margin-left: 4px; vertical-align: middle; }
.sort-ico::before, .sort-ico::after { content: ""; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; }
.sort-ico::before { border-bottom: 4px solid rgba(232,238,248,.35); }
.sort-ico::after { border-top: 4px solid rgba(232,238,248,.35); }
th.sort.on-asc .sort-ico::before { border-bottom-color: #e7c78a; }
th.sort.on-desc .sort-ico::after { border-top-color: #e7c78a; }
th:nth-child(2), th:nth-child(3), td:nth-child(2), td:nth-child(3) { text-align: left; }
td { padding: 5px 6px; border-top: 1px solid rgba(255,255,255,.04); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr[data-code] { cursor: pointer; }
tr:hover td { background: rgba(231,199,138,.06); }
.name { color: #f4f7fb; }
.code { color: var(--cyan); }
.bd {
  display: inline-block; margin-left: 4px; vertical-align: super; font-size: 9px; line-height: 1.3;
  padding: 0 3px; border-radius: 4px; letter-spacing: 0;
}
.bd.main { color: #f3dfb4; background: rgba(231,199,138,.16); }
.bd.cy { color: #8ee7ff; background: rgba(142,231,255,.14); }
.bd.kc { color: #d8b4fe; background: rgba(216,180,254,.16); }
.bd.bj { color: #86efac; background: rgba(134,239,172,.14); }
.up { color: var(--red); }
.down { color: var(--green); }
.flat { color: var(--muted); }
.hint { color: var(--muted); font-size: 11px; padding: 0 2px; }
.empty-stage { height: 100%; display: grid; place-items: center; text-align: center; }
.empty-art { width: min(280px, 46vw); animation: float 3.2s ease-in-out infinite; }
.empty-stage p { margin: 8px 0 0; color: var(--gold-2); font-size: 18px; }
.empty-stage .quiet { color: var(--muted); font-size: 13px; margin-top: 6px; }
@keyframes float { 50% { transform: translateY(-8px); } }
.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.8);
  display: grid; place-items: center; padding: 24px;
}
.modal[hidden] { display: none; }
.sheet { width: min(1100px, 94vw); height: min(78vh, 760px); display: flex; flex-direction: column; overflow: hidden; }
body[data-page="work"] .sheet { height: auto; width: 50vw; max-height: 60vh; }
body[data-page="work"] .pass-sheet { width: min(380px, 92vw); height: auto; }
.sheet header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.sheet h3 { margin: 0; font-size: 16px; }
.sheet-body { overflow: auto; min-height: 0; }
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  background: #122033; border: 1px solid var(--gold); color: var(--gold-2);
  padding: 12px 14px; border-radius: 12px; opacity: 0; transform: translateY(8px); transition: .25s ease;
}
.toast.show { opacity: 1; transform: none; }
.pass-sheet { width: min(380px, 92vw); height: auto; }
.pass-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pass-body input {
  background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 14px; font-size: 16px;
}
#monthInput { color-scheme: dark; padding-right: 36px; }
#monthInput::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 1;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8eef8' d='M7 2h2v2h6V2h2v2h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3V2zm12 8H5v9h14v-9zM5 6v2h14V6H5z'/%3E%3C/svg%3E");
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
}
.pass-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pass-msg { min-height: 18px; margin: 0; color: #ffb4bc; font-size: 12px; }

.phone-root { height: 100dvh; display: flex; flex-direction: column; background: #070a12; }
.phone-root > .empty-stage { flex: 1; }
.appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.appbar h1 { font-size: 18px; }
.phone-main { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 12px; }
.chips { display: flex; gap: 8px; overflow: auto; padding-bottom: 8px; }
.chip b { display: block; font-size: 16px; color: var(--text); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 10px; }
.seg button { border: 0; border-radius: 12px; padding: 9px 0; background: #121826; color: var(--muted); }
.seg button.on { background: linear-gradient(180deg, #f8e7c0, #d7b16a); color: #1a1206; font-weight: 700; }
.stock-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 12px 2px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.stock-row .px { font-size: 16px; font-weight: 700; text-align: right; }
.stock-row .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.tabbar {
  display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line);
  background: rgba(8,12,20,.94); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { text-align: center; padding: 10px 0 8px; color: var(--muted); font-size: 12px; }
.tabbar a.on { color: var(--gold-2); }
.tabbar svg { display: block; margin: 0 auto 3px; }

.stock-page, .bt-page { height: 100vh; display: flex; flex-direction: column; padding: 10px 14px 12px; gap: 8px; }
.stock-page { min-height: 0; }
.quote-head { display: block; }
.price-line { display: flex; align-items: center; gap: 16px; }
.quote-nav { margin-left: auto; display: flex; gap: 8px; flex: none; }
.quote-nav button:disabled { opacity: .35; cursor: default; }
.big { font-size: 34px; font-weight: 760; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 8px; }
.stats div { font-size: 12px; color: var(--muted); }
.stats b { display: block; color: var(--text); font-size: 14px; margin-top: 2px; }
.periods { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 8px 0; }
.chart-card { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
#kchart { width: 100%; flex: 1; min-height: 280px; cursor: crosshair; }
.legend { display: flex; gap: 12px; padding: 4px 10px 8px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 14px; height: 2px; margin-right: 4px; vertical-align: middle; }
.tip {
  position: absolute; top: 46px; left: 12px; z-index: 2; min-width: 168px;
  background: rgba(10,16,28,.92); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px;
  font-size: 12px; line-height: 1.6; pointer-events: none;
}
html.phone .stock-page { height: 100dvh; padding: 0 0 8px; }
html.phone .quote-head { padding: 8px 14px 0; }
html.phone .quote-nav button { padding: 6px 12px; }
html.phone .big { font-size: 42px; }
html.phone .stats { grid-template-columns: repeat(3, 1fr); margin: 8px 12px; }
html.phone .chart-card { margin: 0 12px; }
html.phone .periods { flex-wrap: nowrap; overflow: auto; }
html.phone .periods .chip { flex: none; white-space: nowrap; }
html.phone .appbar .back-mark { width: 36px; height: 36px; border-radius: 12px; }
html.phone .appbar > div { flex: 1; min-width: 0; }

.bt-page { height: 100vh; min-height: 0; overflow: hidden; }
.summary { flex: none; display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.bt-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; }
html.desk .desk-table { flex: 1; min-height: 0; overflow: auto; }
.bt-table td, .bt-table th { font-size: 12px; }
.daycell { min-width: 68px; }
.bt-table th.today { color: var(--gold-2); }
.radar-wait { flex: 1; min-height: 0; display: grid; place-items: center; text-align: center; }
.radar-disc {
  width: 168px; height: 168px; margin: 0 auto; border-radius: 50%; position: relative; overflow: hidden;
  border: 1px solid rgba(231,199,138,.55);
  background:
    linear-gradient(rgba(142,231,255,.28), rgba(142,231,255,.28)) center / 1px 100% no-repeat,
    linear-gradient(rgba(142,231,255,.28), rgba(142,231,255,.28)) center / 100% 1px no-repeat,
    radial-gradient(circle, transparent 0 18%, rgba(231,199,138,.25) 19% 20%, transparent 21%),
    radial-gradient(circle, transparent 0 42%, rgba(231,199,138,.22) 43% 44%, transparent 45%),
    radial-gradient(circle, transparent 0 68%, rgba(231,199,138,.2) 69% 70%, transparent 71%),
    radial-gradient(circle at center, rgba(16,24,40,.35), rgba(7,10,18,.72));
  box-shadow: 0 0 36px rgba(142,231,255,.16), inset 0 0 24px rgba(231,199,138,.12);
}
.radar-disc::before {
  content: ""; position: absolute; inset: -30%;
  background: conic-gradient(from 0deg, transparent 0 68%, rgba(142,231,255,.1) 84%, rgba(243,223,180,.78) 100%);
  animation: radar-sweep 1.5s linear infinite;
}
.radar-disc::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: #f6e3b5; box-shadow: 0 0 12px #e7c78a;
}
.radar-wait p { margin: 14px 0 0; color: var(--gold-2); letter-spacing: 2px; }
@keyframes radar-sweep { to { transform: rotate(360deg); } }
html.phone .bt-page { height: 100dvh; overflow: hidden; padding: 0; }
html.phone .bt-scroll { padding: 0 12px 12px; }
html.phone .summary { padding: 0 14px 8px; }
html.phone .desk-table { display: none; }
html.desk .phone-cards { display: none; }
.bt-card { padding: 12px; margin-bottom: 10px; }
.days { display: flex; gap: 6px; overflow: auto; margin-top: 8px; }
.days span { flex: none; background: #101828; border-radius: 8px; padding: 6px; font-size: 11px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .empty-art, .radar-disc::before { animation: none; } #fx { display: none; } }
