* {
  box-sizing: border-box;
}
[hidden] { display: none !important; }
.mobile-nav { display: none; }
.compact-info { border: 0; padding: 0; margin: 8px 0; }
.compact-info > summary, .order-reason > summary { font-size: 12px; color: #476172; cursor: pointer; }
.order-reason { margin: 2px 0; border: 0; padding: 0; }
.button-link {
  display: inline-block;
  border: 1px solid #cbd5dc;
  border-radius: 6px;
  padding: 7px 15px;
  background: white;
  color: #263c4d;
  text-decoration: none;
  white-space: nowrap;
}

.button-link:hover { background: #eef3f6; }
.history-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.history-filters label { color: #5e6c75; font-size: 12px; }
.history-filters input, .history-filters select { margin-top: 5px; }
.status-bar.history-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* 七项状态在窄屏自动降列，避免最后一项被挤到下一行留下大片空白。 */
@media (max-width: 1080px) { .status-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .status-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
.history-details { margin-top: 18px; }
.history-details .table-scroll { max-height: none; }
.history-details td small { display: block; color: #75848e; }
.history-reveal-note { display: none; }
.revealing-draw .history-reveal-note { display: block; }
body {
  margin: 0;
  background: #f3f5f6;
  color: #1c2b36;
  font:
    14px/1.6 "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px;
}
.site-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  max-width: 1116px;
  margin: 18px auto 0;
  padding: 10px 14px;
  border-left: 3px solid #245b7b;
  background: #e8eef2;
  color: #476172;
  font-size: 12px;
}
.site-identity strong { color: #1c2b36; font-size: 16px; overflow-wrap: anywhere; }
#site-port { margin-left: auto; white-space: nowrap; }
.sites-panel { margin-bottom: 18px; }
/* 站点卡片：三列自适应，卡片内部统一为 头部 / 指标 / 状态 / 操作 四段，
   避免按钮换行错位导致各卡片高度参差。 */
.sites-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; padding: 0; list-style: none; align-items: stretch; }
.sites-list > li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  min-width: 0;
  background: #fff;
}
.site-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.site-card-head strong { font-size: 15px; overflow-wrap: anywhere; }
.sites-list p { margin: 0; overflow-wrap: anywhere; }
.site-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; }
.site-meta > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.site-meta dt { color: #7a8790; font-size: 11px; }
.site-meta dd { margin: 0; color: #1c2b36; font-size: 13px; overflow-wrap: anywhere; }
.site-state { color: #526675; font-size: 12px; line-height: 1.5; min-height: 2.9em; }
/* 操作区固定在卡片底部，行列对齐。 */
.site-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.site-card-actions > * { flex: 0 1 auto; }
.site-card-default { border-color: #cfdde6; background: #f7fafc; }
.site-card-default .hint { flex-basis: 100%; }
.sites-add { border-top: 1px solid #dce3e8; padding-top: 12px; }
.sites-add > summary { color: #245b7b; cursor: pointer; }
.sites-add fieldset { padding: 0; border: 0; }
.sites-add button { justify-self: start; }
.sites-created { margin-top: 16px; padding: 14px; background: #edf4ef; border: 1px solid #c9dbcf; border-radius: 6px; }
.sites-created input { font-family: Consolas, monospace; }
@media (max-width: 1180px) { .site-identity { margin-right: 32px; margin-left: 32px; } }
@media (max-width: 600px) { .site-identity { margin: 12px 12px 0; } }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.brand {
  font-size: 11px;
  letter-spacing: 3px;
  color: #677785;
  font-weight: 700;
}
h1 {
  font-size: 30px;
  letter-spacing: 1px;
  margin: 0;
  font-weight: 650;
}
header p {
  margin: 4px 0;
  color: #687782;
}
h2 {
  font-size: 17px;
  margin: 0;
}
.actions,
.button-row,
.section-head,
.rule-footer {
  display: flex;
  gap: 10px;
  align-items: center;
}
.section-head,
.rule-footer {
  justify-content: space-between;
}
.button-row {
  margin-top: 14px;
  flex-wrap: wrap;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #cbd5dc;
  background: white;
  color: #263c4d;
  padding: 7px 15px;
  border-radius: 6px;
  white-space: nowrap;
}
button:hover {
  background: #eef3f6;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: #245b7b;
  border-color: #245b7b;
  color: #fff;
}
.primary:hover {
  background: #1c4b68;
}
.stop {
  border-color: #dfc8c2;
  color: #944333;
}
.subtle {
  border-color: transparent;
  background: transparent;
  color: #4b6c81;
}
.badge {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 16px;
  background: #e3e8eb;
  color: #5a6b77;
  font-size: 12px;
}
.badge.on {
  background: #e0eee6;
  color: #285e41;
}
#home-page > header { flex-wrap: wrap; gap: 16px; }
#home-page > header > :first-child { min-width: 0; }
#home-page header .actions { flex-wrap: wrap; margin-left: auto; }
.status-bar {
  background: #fff;
  border: 1px solid #dce3e7;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 16px 20px;
  gap: 20px;
}
.status-bar small {
  display: block;
  color: #75848e;
  font-size: 12px;
}
.status-bar strong {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.status-bar .daily-profit {
  min-width: 0;
}
#daily-summary {
  font-size: 11px;
  line-height: 1.5;
  margin-top: 3px;
}
#clock {
  font-size: 17px;
}
.paper-day-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 24px;
  margin-top: 8px;
  padding: 12px 24px;
  border: 1px solid #dce3e7;
  border-radius: 8px;
  background: #fff;
}
.paper-day-metrics > div { min-width: 0; }
.paper-day-metrics small { display: block; color: #75848e; font-size: 12px; }
.paper-day-metrics strong { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.paper-day-info { grid-column: 1/-1; margin: 0; padding: 0; border: 0; }
.paper-day-info > summary { color: #476172; font-size: 11px; cursor: pointer; }
.paper-day-info > summary span { margin-left: 10px; color: #75848e; }
.paper-day-info p { margin: 6px 0 0; color: #5d6e7a; font-size: 12px; overflow-wrap: anywhere; }
.latest-draw {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  margin-top: 8px;
  border: 1px solid #dce3e7;
  border-radius: 8px;
  background: #fff;
}
.draw-label,
.draw-time {
  color: #75848e;
  font-size: 12px;
}
.draw-numbers {
  display: flex;
  gap: 7px;
}
.draw-ball {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e8f0f5;
  color: #245b7b;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.draw-time {
  margin-left: auto;
}
.draw-reveal-status {
  color: #75848e;
  font-size: 12px;
}
.revealing-draw
  :is(
    #balance,
    #daily-profit,
    #daily-summary,
    .paper-day-money,
    .paper-day-info,
    #history-results,
    #total,
    #orders,
    #logs,
    #total-amount,
    #ratio-preview,
    #strategy-state,
    .activity-money,
    .rules input[type="number"]
  ) {
  visibility: hidden;
}
.activity-card { margin: 0 0 20px; }
.bet-summary { margin: 12px 0; padding: 12px 14px; background: #eef4f7; border: 1px solid #dbe5ec; border-radius: 8px; }
#activity-bets-summary { margin-top: 5px; font-size: 16px; font-weight: 600; line-height: 1.8; white-space: pre-line; overflow-wrap: anywhere; }
.activity-card td { padding: 12px 8px; }
.activity-card .decision-explanation { min-width: 300px; max-width: 660px; white-space: normal; line-height: 1.7; overflow-wrap: anywhere; }
.decision-explanation div + div { margin-top: 6px; }
.decision-explanation strong { font-weight: 600; }
#allocation-note { line-height: 1.8; white-space: normal; overflow-wrap: anywhere; }
.activity-card th { text-align: left; padding: 8px; }
.activity-card[data-stage="blocked"] { border-color: #c17365; }
.activity-card[data-stage="unknown"] { border-color: #c17365; }
.activity-card[data-stage="partial"] { border-color: #b38a4c; }
.activity-card[data-stage="accepted"] { border-color: #79ac92; }
#message {
  padding: 10px 2px;
  color: #476172;
  min-height: 42px;
}
.columns {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  align-items: start;
}
.panel {
  background: white;
  border: 1px solid #dce3e7;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}
.hint {
  font-size: 12px;
  color: #75828b;
  margin: 9px 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-grid label {
  font-size: 12px;
  color: #5e6c75;
}
.wide {
  grid-column: 1/-1;
}
input,
select {
  display: block;
  border: 1px solid #ced8df;
  border-radius: 5px;
  background: #fff;
  padding: 7px 9px;
  min-width: 0;
  width: 100%;
  color: #223a4a;
}
input:focus,
select:focus {
  outline: 2px solid #b8d3e3;
  outline-offset: 1px;
}
input:disabled,
select:disabled {
  background: #f4f6f7;
}
fieldset {
  border: 0;
  margin: 12px 0 0;
  padding: 0;
  min-width: 0;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.check input {
  width: auto;
}
.captcha-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.captcha-row img {
  max-width: 100px;
  max-height: 38px;
}
.captcha-row input {
  font-size: 12px;
  flex: 1;
}
.account-panel { min-width: 0; }
.account-panel-head,
.account-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.account-panel-head h2,
.account-editor-head h3 { margin: 0; }
.account-editor-head h3 { font-size: 15px; }
.account-caption { margin: 2px 0 0; color: #526675; font-size: 12px; overflow-wrap: anywhere; }
.account-panel-head button,
.account-editor-head button,
.account-edit,
.account-editor-actions button { white-space: nowrap; }
.account-panel-head #add-account {
  border-color: #c4d7e1;
  background: #eef5f8;
  color: #245675;
  font-weight: 600;
}
.account-panel-head #add-account:hover { background: #e3eef4; }
.account-roster {
  margin-top: 13px;
  border: 1px solid #dce5ea;
  border-radius: 7px;
  overflow: hidden;
}
.account-roster table { table-layout: fixed; font-size: 13px; }
.account-roster thead { background: #f0f5f7; }
.account-roster th,
.account-roster td { padding: 8px 9px; }
.account-roster thead th { color: #526675; font-weight: 600; white-space: nowrap; }
.account-roster th:nth-child(2) { width: 6.25em; }
.account-roster th:nth-child(3) { width: 7.45em; }
.account-roster th:last-child { width: 5.3em; }
.account-roster th:nth-child(n+3),
.account-roster td:nth-child(n+3) { text-align: right; }
.account-roster tbody tr:last-child > * { border-bottom: 0; }
.account-roster tbody tr[data-editing="true"] { background: #eef6fa; }
.account-roster tbody th { color: #223a4a; }
.account-roster tbody th strong,
.account-user,
.account-balance { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-roster tbody th strong,
.account-user { display: block; }
.account-user { color: #526675; font-size: 12px; margin-top: 1px; }
.account-balance { font-variant-numeric: tabular-nums; color: #243d4d; }
.account-state-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #526675;
  font-size: 12px;
  white-space: nowrap;
}
.account-state-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.account-state-chip[data-tone="online"] { color: #226247; }
.account-state-chip[data-tone="attention"] { color: #805719; }
.account-edit {
  padding: 5px 9px;
  border-color: #d4e0e6;
  background: #fff;
  color: #285671;
  font-size: 12px;
}
.account-edit:hover { background: #edf4f7; }
/* 账号编辑：电脑端居中弹窗，手机端全屏。 */
.account-editor-layer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.account-editor-layer[hidden] { display: none; }
.account-editor-backdrop { position: absolute; inset: 0; background: rgba(18, 32, 42, .45); }
.account-editor {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 18px;
  background: #fff;
  border: 1px solid #dce5ea;
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(16, 34, 46, .22);
}
.account-editor[hidden] { display: none; }
body.editor-open { overflow: hidden; }
.account-editor input::placeholder { color: #526675; }
.account-editor .captcha-row label { width: 8rem; color: #526675; font-size: 12px; }
.account-editor .captcha-row img { align-self: end; margin-bottom: 2px; }
.account-editor-actions { gap: 7px; }
.account-issue-limit { border-top: 1px solid #e1e8ec; margin-top: 14px; padding-top: 12px; }
.account-editor[data-primary="false"] #open-site { display: none; }
.account-editor-actions .account-remove { color: #8a3732; }
.account-panel button:focus-visible,
.account-editor input:focus-visible { outline: 2px solid #286889; outline-offset: 2px; }
@media (max-width: 600px) {
  .account-roster th,
  .account-roster td { padding: 7px 6px; }
  .account-roster th:nth-child(2) { width: 5.8em; }
  .account-roster th:nth-child(3) { width: 6.1em; }
  .account-roster th:last-child { width: 4.5em; }
  .account-state-chip { gap: 3px; }
  .account-state-chip::before { width: 5px; height: 5px; }
  .account-roster .account-edit { padding-inline: 8px; }
  .sites-list { grid-template-columns: 1fr; gap: 10px; }
  .sites-list > li { padding: 13px; }
  .site-state { min-height: 0; }
  .site-card-actions { gap: 6px; }
  .site-card-actions > * { flex: 1 1 auto; justify-content: center; text-align: center; }
  /* 手机端：编辑区占满整屏，避免小屏被弹窗挤成一条窄栏。 */
  .account-editor-layer { padding: 0; }
  .account-editor {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }
  .account-editor-actions { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }
}
summary {
  cursor: pointer;
  font-weight: 600;
}
summary span {
  font-weight: 400;
  font-size: 12px;
  color: #6d7c87;
  margin-left: 8px;
}
details:not(.panel):not(.compact-info):not(.order-reason):not(.reveal-help):not(.compare-date-filter) {
  margin-top: 18px;
  border-top: 1px solid #e7ecef;
  padding-top: 13px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
}
th {
  color: #7a8790;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #e1e7eb;
  padding: 9px 8px;
}
td {
  padding: 10px 8px;
  border-bottom: 1px solid #eef1f3;
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.rules td {
  padding: 7px 5px;
}
.rules th:first-child,
.rules td:first-child {
  padding-left: 0;
}
.rules input {
  min-width: 65px;
}
.rules select {
  min-width: 90px;
}
.rules th:nth-child(3) {
  width: 31%;
}
.rules button {
  padding: 6px;
  color: #9c6358;
}
.rule-footer {
  border-top: 1px solid #e6ecef;
  margin-top: 12px;
  padding-top: 14px;
}
.rule-footer strong {
  font-size: 23px;
  color: #245b7b;
  margin: 0 5px;
}
.empty {
  padding: 30px 0;
  text-align: center;
  color: #929da5;
}
.compare-filters, .compare-views { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.compare-filters { max-width: 620px; }
.compare-views { max-width: 560px; margin-bottom: 14px; }
.compare-presets { margin: 12px 0; }
#compare-title:focus { outline: none; }
#compare-progress { width: 100%; height: 8px; accent-color: #245b7b; }
#compare-status { min-height: 1.5em; margin-bottom: 10px; }
.compare-summary .compare-summary-scroll { max-height: 420px; }
.compare-daily .compare-daily-scroll { max-height: 65vh; }
.compare-summary table { min-width: 650px; }
.compare-daily #compare-day-table { min-width: 1040px; }
.compare-daily #compare-day-table[data-single="true"] { min-width: 340px; }
.compare-summary th, .compare-daily th { position: sticky; top: 0; background: #f7fafb; z-index: 2; white-space: nowrap; }
.compare-summary th:first-child, .compare-summary td:first-child,
.compare-daily th:first-child, .compare-daily td:first-child { position: sticky; left: 0; background: #f7fafb; z-index: 1; }
.compare-summary th:first-child, .compare-daily th:first-child { z-index: 3; }
.compare-summary td, .compare-daily td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare-daily td:first-child { min-width: 120px; }
.compare-daily td.compare-combined { min-width: 180px; background: #edf4f8; }
.compare-combined > strong { font-weight: 650; }
.compare-date { border: 0; background: transparent; padding: 7px 0; color: #245b7b; font: inherit; font-weight: 600; min-height: 36px; }
.compare-daily td small, .compare-summary td small { display: block; font-size: 11px; color: #73838d; white-space: normal; max-width: 190px; }
.compare-detail > td { padding: 12px; background: #f8fbfc; position: static !important; }
.compare-detail table { min-width: 650px; font-size: 13px; }
.compare-detail table th, .compare-detail table td { position: static !important; }
.compare-detail p { margin: 3px 0 8px; color: #5d6e7a; font-size: 12px; white-space: normal; }
.revealing-draw #compare-results { visibility: hidden; }
#compare-results[data-pending="true"] { visibility: hidden; }
.compare-phone-mode-control, #compare-phone-status, .compare-phone-summary, .compare-phone-days { display: none; }
#compare-phone-more { display: none; }
.compare-date-filter { margin: 0; border: 0; padding: 0; }
.compare-date-filter > summary { display: none; }
.compare-live-tools { margin-top: 12px; }
#compare-cancel:disabled { display: none; }
@media (max-width: 600px) {
  .mobile-nav { grid-template-columns: repeat(5,1fr) !important; }
  #compare-page header { display: flex; gap: 10px; align-items: center; }
  #compare-page header p { display: none; }
  #compare-page h1 { font-size: 23px; }
  .compare-filters, .compare-views { gap: 10px; }
  .compare-presets { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
  .compare-presets button { padding-inline: 5px; font-size: 12px; }
  #compare-page .button-row:not(.compare-presets) button { flex: 1; padding-inline: 8px; }
  .compare-summary .compare-summary-scroll, .compare-daily .compare-daily-scroll { max-height: 60vh; }
  .compare-summary td, .compare-summary th, .compare-daily td, .compare-daily th { padding: 11px 10px; font-size: 13px; }
  .compare-daily td:first-child { min-width: 112px; }
  .compare-date { font-size: 12px; padding: 5px 0; min-height: 36px; }
  #compare-range { font-size: 11px; }
  #compare-status, .compare-views, .compare-summary-scroll, .compare-daily-scroll { display: none; }
  #compare-phone-status { display: block; margin: 8px 0 0; min-height: 18px; color: #526976; font-size: 12px; line-height: 1.5; }
  .compare-phone-mode-control { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; margin-top: 10px; }
  .compare-phone-mode-control label { margin: 0; font-size: 12px; color: #526976; }
  .compare-phone-mode-control select { margin: 0; }
  .compare-phone-mode-control > span { font-size: 11px; color: #245b7b; background: #edf4f8; border-radius: 5px; padding: 5px; white-space: nowrap; }
  .compare-date-filter > summary { display: list-item; cursor: pointer; min-height: 40px; line-height: 40px; color: #526976; font-size: 12px; }
  #compare-date-range { float: right; font-size: 11px; color: #697e8a; }
  .compare-date-filter[open] .compare-filters { padding-top: 8px; }
  .compare-date-filter[open] { padding-bottom: 10px; border-bottom: 1px solid #e5edf1; }
  .compare-date-filter:not([open]) + .compare-live-tools #compare-query { display: none; }
  .compare-date-filter[open] + .compare-live-tools .compare-phone-mode-control { flex-basis: 100%; order: -1; }
  .compare-live-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
  .compare-live-tools .compare-phone-mode-control { flex: 1; min-width: 180px; margin: 0; grid-template-columns: minmax(0,1fr) auto; }
  .compare-live-tools .compare-phone-mode-control label { display: none; }
  #compare-page .compare-live-tools #compare-refresh, #compare-page .compare-live-tools #compare-cancel { flex: 0 0 auto; padding-inline: 10px; }
  #compare-page .compare-help { margin-bottom: 0; }
  #compare-page .compare-help > summary { min-height: 30px; line-height: 30px; }
  .compare-phone-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .compare-phone-summary-card { min-width: 0; border: 1px solid #e0e8ed; border-radius: 9px; padding: 10px; background: #f8fbfc; }
  .compare-phone-summary-card h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: #334f60; }
  .compare-phone-summary-card > strong { display: block; font-size: 22px; line-height: 1.35; font-weight: 650; letter-spacing: -.35px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .compare-phone-summary-card dl { margin: 7px 0 5px; display: grid; gap: 3px; }
  .compare-phone-summary-card dl > div { display: flex; justify-content: space-between; gap: 4px; min-width: 0; }
  .compare-phone-summary-card dt { font-size: 12px; color: #657985; }
  .compare-phone-summary-card dd { margin: 0; font-size: 13px; color: #253e4e; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .compare-phone-summary-card > small { font-size: 11px; color: #657985; line-height: 1.5; display: block; }
  .compare-phone-days { display: grid; gap: 12px; }
  .compare-phone-day { min-width: 0; border: 1px solid #dfe8ed; border-radius: 10px; padding: 12px; background: #fbfdfe; }
  .compare-phone-day-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid #e5edf1; }
  .compare-phone-day-head > strong { font-size: 14px; color: #334f60; }
  .compare-phone-day-head > span { color: #697e8a; font-size: 11px; }
  .compare-phone-combined { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: baseline; gap: 3px 8px; padding: 9px 0; border-bottom: 1px solid #e5edf1; }
  .compare-phone-combined > span { font-size: 13px; color: #334f60; font-weight: 600; }
  .compare-phone-combined > strong { font-size: 22px; line-height: 1.5; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .compare-phone-combined > small { grid-column: 1/-1; color: #697e8a; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  .compare-phone-mode-row { padding-top: 9px; min-width: 0; }
  .compare-phone-mode-row + .compare-phone-mode-row { margin-top: 8px; border-top: 1px solid #e5edf1; }
  .compare-phone-mode-net { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .compare-phone-mode-net > span { font-size: 13px; color: #526976; }
  .compare-phone-mode-net > strong { font-size: 22px; line-height: 1.5; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .compare-phone-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin: 8px 0 0; }
  .compare-phone-facts dt { color: #697e8a; font-size: 11px; margin-bottom: 4px; }
  .compare-phone-facts dd { margin: 0; color: #253e4e; font-size: 14px; line-height: 1.5; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .compare-phone-mode-row > p { margin: 6px 0 0; color: #697e8a; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  .compare-phone-day-toggle { width: 100%; margin-top: 10px; color: #245b7b; background: #eef4f7; border: 0; min-height: 38px; }
  #compare-phone-more { display: block; width: 100%; margin-top: 12px; }
}
.table-scroll {
  max-height: 340px;
  overflow: auto;
}
.orders-panel td {
  font-size: 13px;
}
.orders-panel td small {
  display: block;
  color: #8b969e;
}
.order-issue-total { display: block; font-size: 15px; }
.order-issue-purchases { margin: 5px 0; line-height: 1.8; }
.orders-panel .section-head { flex-wrap: wrap; align-items: flex-start; }
.orders-panel .section-head h2 { flex-shrink: 0; white-space: nowrap; }
.orders-panel .section-head .compact-info { min-width: 0; max-width: 100%; }
.success {
  color: #26714b;
}
.failure {
  color: #a25741;
}
.logs {
  font:
    12px/1.9 Consolas,
    "Microsoft YaHei",
    monospace;
  max-height: 200px;
  overflow: auto;
  margin-top: 10px;
}
.path {
  word-break: break-all;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 85vw;
  background: #263e4f;
  color: white;
  border-radius: 7px;
  padding: 12px 20px;
  box-shadow: 0 5px 25px #243b4c30;
  z-index: 20;
}
#toast.error {
  background: #8d453b;
}
@media (max-width: 950px) {
  .shell {
    padding: 18px;
  }
  .columns {
    grid-template-columns: 1fr;
  }
  header {
    gap: 15px;
  }
  .status-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
  }
  .status-bar.history-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .status-bar strong {
    font-size: 18px;
  }
}

/* Phone layout shares the same controls and API as the desktop. */
@media (max-width: 600px) {
  .shell { padding: 12px max(12px, env(safe-area-inset-right)) 24px max(12px, env(safe-area-inset-left)); }
  header { display: block; margin-bottom: 16px; }
  h1 { font-size: 23px; line-height: 1.4; overflow-wrap: anywhere; }
  header .actions { display: flex; flex-wrap: wrap; margin-top: 12px; gap: 8px; }
  header .actions .button-link { margin-right: auto; }
  .status-bar, .status-bar.history-totals { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .status-bar strong { overflow-wrap: anywhere; }
  .paper-day-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 14px; gap: 4px 12px; }
  .paper-day-metrics small { font-size: 11px; }
  .paper-day-metrics strong { font-size: 24px; line-height: 1.35; }
  .paper-day-info > summary { min-height: 30px; line-height: 30px; }
  .paper-day-info > summary span { margin-left: 7px; font-size: 10px; }
  .panel { padding: 14px; min-width: 0; }
  .columns > *, .form-grid > *, .history-filters > * { min-width: 0; }
  .form-grid, .history-filters { grid-template-columns: 1fr; }
  input, select, .captcha-row input { font-size: 16px; min-height: 44px; }
  input[type="checkbox"] { min-height: 22px; width: 22px; height: 22px; }
  button, .button-link { min-height: 44px; padding: 9px 12px; touch-action: manipulation; }
  .section-head, .rule-footer { flex-wrap: wrap; }
  .latest-draw { padding: 12px; gap: 8px; }
  .captcha-row { flex-wrap: wrap; }
  .captcha-row input { flex-basis: 100%; }
  .table-scroll { width: 100%; overscroll-behavior-x: contain; }
  .table-scroll table { min-width: 500px; }
  .logs { overflow-wrap: anywhere; }
  #lan-panel p, #message { overflow-wrap: anywhere; }
}

/* Phone navigation and content density are independent of the desktop layout. */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .shell { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  #home-page > header { margin-bottom: 12px; }
  #home-page .brand { font-size: 10px; }
  #home-page h1 { font-size: 19px; letter-spacing: 0; line-height: 1.5; }
  .mode-info { margin: 2px 0; }
  .mode-info p { font-size: 12px; }
  #home-page header .actions { margin-top: 10px; display: grid; grid-template-columns: 1fr auto auto; }
  #home-page header .actions > .button-link { display: none; }
  #run-state { justify-self: start; }
  #home-page > .status-bar { gap: 0; padding: 4px 14px; }
  #home-page > .status-bar > div { padding: 10px 0; }
  /* 手机上保留当前期号、距开奖、可用余额、今日盈亏；隐藏距封盘和北京时间。 */
  #home-page > .status-bar > div:nth-child(2), #home-page > .status-bar > div:nth-child(6) { display: none; }
  #home-page > .status-bar > div:nth-child(4), #home-page > .status-bar > div:nth-child(5) { border-top: 1px solid #e5eaed; }
  #home-page .status-bar strong { font-size: 24px; line-height: 1.35; }
  #home-page .status-bar small { font-size: 11px; color: #5d6e7a; }
  #daily-summary { display: none; }
  .latest-draw { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; }
  #draw-issue { font-size: 12px; text-align: right; color: #5d6e7a; }
  .draw-numbers { grid-column: 1/-1; justify-content: space-between; }
  .draw-ball { width: 42px; height: 42px; font-size: 22px; }
  #draw-time { display: none; }
  #draw-reveal-status:empty { display: none; }
  #draw-reveal-status { grid-column: 1/-1; }
  #message { min-height: 0; font-size: 12px; padding: 9px 2px; }
  .activity-card .section-head { gap: 4px; }
  .activity-card h2 { font-size: 15px; }
  #activity-state { font-size: 12px; max-width: 62%; }
  #activity-card > p { font-size: 12px; margin: 5px 0; color: #5d6e7a; }
  #activity-updated { display: none; }
  .bet-summary { padding: 10px; margin: 10px 0; }
  .bet-summary > strong { display: none; }
  #activity-bets-summary { margin: 0; font-size: 14px; line-height: 1.85; }
  .compact-info > summary { min-height: 36px; display: list-item; line-height: 36px; }
  .activity-info > p { font-size: 12px; overflow-wrap: anywhere; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; z-index: 10; inset: auto 0 0; padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #dce3e7; }
  .mobile-nav a { display: grid; place-items: center; min-height: 46px; color: #586c7a; text-decoration: none; font-size: 14px; border-radius: 8px; }
  .mobile-nav a[aria-current="page"] { color: #194e6d; background: #e8f0f5; font-weight: 650; }
  .mobile-nav a:focus-visible { outline: 2px solid #245b7b; }
  body[data-mobile-page="home"] [data-mobile-section]:not([data-mobile-section="home"]),
  body[data-mobile-page="records"] [data-mobile-section]:not([data-mobile-section="records"]),
  body[data-mobile-page="settings"] [data-mobile-section]:not([data-mobile-section="settings"]) { display: none; }
  #history-page header p { display: none; }
  #history-page header { display: flex; }
  .history-filters { grid-template-columns: 1fr 1fr; gap: 12px; }
  .history-filters > label:last-child { grid-column: 1/-1; }
  #history-page .button-row { gap: 6px; }
  #history-page .button-row button { flex: 1; padding-inline: 8px; }
  .history-totals > div:first-child { grid-column: 1/-1; }
  .history-totals > div:first-child strong { font-size: 32px; }
  .history-details .table-scroll { max-height: none; }
  .history-details table { min-width: 0; display: block; }
  .history-details thead { display: none; }
  .history-details tbody { display: block; }
  .history-details tr { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; border-bottom: 1px solid #dce3e7; padding: 14px 0; }
  .history-details td { border: 0; padding: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .history-details td:first-child { grid-column: 1/3; font-weight: 650; }
  .history-details td:nth-child(2) { grid-column: 1/-1; }
  .history-details td:nth-child(2)::before { content: "下注 "; color: #5d6e7a; font-size: 12px; }
  .history-details td:nth-child(3) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; }
  .history-details td:nth-child(4)::before, .history-details td:nth-child(5)::before, .history-details td:nth-child(6)::before { display: block; font-size: 11px; color: #5d6e7a; }
  .history-details td:nth-child(4)::before { content: "已结算"; }
  .history-details td:nth-child(5)::before { content: "待结算"; }
  .history-details td:nth-child(6)::before { content: "待确认"; }
  .orders-panel .table-scroll { max-height: none; overflow: visible; }
  .orders-panel table { min-width: 0; display: block; }
  .orders-panel thead { display: none; }
  .orders-panel tbody { display: block; }
  .orders-panel tr { display: grid; grid-template-columns: 1fr auto; padding: 12px 0; border-bottom: 1px solid #dce3e7; gap: 8px; }
  .orders-panel td { border: 0; padding: 0; min-width: 0; overflow-wrap: anywhere; }
  .orders-panel td:first-child { font-size: 15px; font-weight: 650; }
  .orders-panel td:first-child small { font-size: 11px; font-weight: 400; }
  .orders-panel td:nth-child(2) { grid-column: 1/-1; grid-row: 2; }
  .orders-panel td:nth-child(3) { grid-column: 1/-1; grid-row: 3; font-size: 12px; }
  .orders-panel td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; font-size: 16px; }
  .orders-panel td:nth-child(4)::before { content: "净盈亏 "; font-size: 11px; color: #5d6e7a; }
  .orders-panel td[colspan] { grid-column: 1/-1; }
  .orders-panel .section-head { align-items: start; }
  .orders-panel .section-head .compact-info { margin: 0; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
/* Shared by the desktop window and the browser; cancel is the initial focus. */
.task-confirm { width: min(440px, calc(100vw - 32px)); box-sizing: border-box; border: 1px solid #dce3e7; border-radius: 16px; padding: 24px; color: #203340; background: #fff; box-shadow: 0 24px 80px #152a3c40; }
.task-confirm::backdrop { background: #14212d80; }
.task-confirm h2 { margin: 0 0 12px; font-size: 21px; }
.task-confirm p { margin: 0 0 24px; line-height: 1.7; overflow-wrap: anywhere; }
.task-confirm .button-row { justify-content: flex-end; }
.task-confirm button { min-width: 94px; }
.compare-chart-link { border: 0; background: transparent; color: #245b7b; padding: 4px 0; font: inherit; text-align: left; }
.compare-chart-day { display: block; font-size: 11px; min-height: 32px; }
.compare-phone-day-head .compare-chart-day { margin-left: auto; white-space: nowrap; }
.simulation-chart { width: min(1260px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); margin: auto; padding: 22px; color: #203340; border: 1px solid #dce3e7; border-radius: 14px; background: #f6f9fa; box-shadow: 0 24px 80px #152a3c40; overflow-y: auto; }
.simulation-chart::backdrop { background: #14212d80; }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.chart-heading h2 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.chart-heading button { flex-shrink: 0; }
.chart-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-block: 1px solid #dce5eb; }
.chart-tools fieldset { display: flex; flex: 1 1 600px; flex-wrap: wrap; gap: 7px; border: 0; margin: 0; padding: 0; min-width: 0; }
.chart-tools fieldset label { display: flex; align-items: center; gap: 5px; margin: 0; padding: 5px 8px; border: 1px solid #dce5eb; border-radius: 6px; background: white; font-size: 12px; cursor: pointer; }
.chart-tools fieldset input { width: auto; margin: 0; accent-color: #245b7b; }
.chart-tools > label { display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; margin: 0; }
.chart-tools input[type=range] { width: 120px; margin: 0; padding: 0; accent-color: #245b7b; }
.chart-status-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.chart-status-row p { flex: 1; margin: 10px 0; }
.chart-views { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.chart-views[data-count="1"] > .chart-panel { grid-column: 1/-1; }
.chart-panel { padding: 12px; min-width: 0; border: 1px solid #dce5eb; border-radius: 9px; background: white; }
.chart-panel h3 { margin: 0 0 4px; font-size: 15px; }
.chart-panel > .hint { margin: 0 0 7px; min-height: 36px; font-size: 11px; }
.chart-scroll { position: relative; width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border-block: 1px solid #edf1f4; }
.chart-y-axis { position: sticky; left: 0; width: 68px; height: 0; z-index: 1; pointer-events: none; }
.chart-y-axis::before { content: ""; position: absolute; left: 0; top: 0; width: 68px; height: 228px; background: white; }
.chart-y-axis span { position: absolute; left: 0; width: 62px; text-align: right; transform: translateY(-50%); font-size: 10px; font-variant-numeric: tabular-nums; color: #71818d; }
.chart-scroll svg { display: block; max-width: none; font: 10px "Segoe UI",sans-serif; fill: #71818d; }
.chart-grid { stroke: #e4ebef; }
.chart-zero { stroke: #97a9b5; stroke-dasharray: 4 3; }
.chart-up { fill: #168267; stroke: #168267; }
.chart-down { fill: #b44f54; stroke: #b44f54; }
.chart-flat { fill: #547886; stroke: #547886; }
.chart-gap { fill: #e8edf1; opacity: .7; }
.chart-segment { stroke: #8c7b47; stroke-dasharray: 2 3; }
.chart-crosshair { stroke: #263c4d; stroke-dasharray: 3 3; pointer-events: none; }
.chart-detail { min-height: 42px; margin: 8px 0 0; font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .simulation-chart { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 14px; border-radius: 10px; }
  .chart-heading h2 { font-size: 16px; }
  .chart-views { grid-template-columns: minmax(0,1fr); }
  .chart-panel { padding: 10px; }
  .chart-tools { gap: 8px; }
}

/* 总管理入口（Linux 8787）：只保留「手机与远程访问」和「网站总管理」两个板块。
   用 data-management 而不是 data-mobile-section，桌面与手机同一套规则。 */
body[data-management="1"] #home-page > header,
body[data-management="1"] #home-page > .status-bar,
body[data-management="1"] #home-page > .latest-draw,
body[data-management="1"] #home-page > #activity-card,
body[data-management="1"] #home-page > .columns,
body[data-management="1"] #home-page > .orders-panel,
body[data-management="1"] #home-page > #logs-panel,
body[data-management="1"] #history-page,
body[data-management="1"] #compare-page,
body[data-management="1"] .mobile-nav { display: none !important; }
body[data-management="1"] .shell { max-width: 920px; }
body[data-management="1"] #home-page > #lan-panel,
body[data-management="1"] #home-page > #sites-panel { display: block; }
body[data-management="1"] #home-page > #lan-panel { margin-top: 0; }
body[data-management="1"] #home-page > #sites-panel { margin-top: 18px; }

/* 资金平衡（对冲）弹窗 */
.hedge-heading { margin: 18px 0 8px; font-size: 14px; color: #1c2b36; }
.hedge-loss { text-align: right; color: #5e6c75; }
.hedge-warn { color: #b45309; }
.hedge-win { color: #15803d; }
.hedge-lose { color: #b91c1c; }
#hedge-pnl-rows td, #hedge-record-rows td { white-space: nowrap; }
#hedge-target-fieldset { border: 1px solid #dde5ea; border-radius: 8px; padding: 12px 14px; }
