:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #171b24;
  background: #f7f8fa;
  letter-spacing: 0;
  --line: #e6e9ee;
  --accent: #007597;
  --muted: #606978;
}

* { box-sizing: border-box; }
body { min-width: 0; margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
button, a { touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #1677ff; outline-offset: 3px; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }
.topbar {
  min-height: calc(64px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.home-link { min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; }
.home-link:active, .balance:active, #login:active { opacity: .7; }
.balance { min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.balance strong { color: #1677ff; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.connection-page { width: min(1120px, calc(100% - 48px)); margin: 28px auto 0; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.section-heading { position: relative; min-height: 52px; padding: 0 52px; display: flex; align-items: center; justify-content: center; }
h1 { margin: 0; color: var(--accent); font-size: 36px; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
button { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
button:hover:not(:disabled) { border-color: #d8dde5; background: #f2f4f7; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:active:not(:disabled) { opacity: .8; }
.icon-button { position: absolute; right: 0; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }
.connection { max-width: 480px; margin: 0 auto; text-align: center; }
#wechat-status { margin: 10px 0 18px; color: #687385; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
#wechat-qr { width: 224px; height: auto; max-width: 100%; aspect-ratio: 1; margin: 24px auto; display: block; object-fit: contain; }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.actions button { min-width: 132px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }
.actions .primary { border-color: #171b24; background: #171b24; color: #fff; font-weight: 700; }
.actions .primary:hover:not(:disabled) { border-color: var(--accent); background: var(--accent); }
#wechat-cancel { border-color: #e5b7b3; color: #a5271c; background: #fff7f6; }
#wechat-cancel:hover:not(:disabled) { border-color: #d98d86; background: #fff0ee; }
#login { min-height: 44px; margin-top: 12px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--accent); text-decoration: underline; font-size: 14px; }
.compute-cost { max-width: 640px; margin: 40px auto 0; text-align: left; }
.compute-cost h2 { font-size: 20px; line-height: 1.5; }
.compute-cost-row { border-top: 1px solid var(--line); padding: 20px 0; overflow-wrap: anywhere; }
.compute-cost-row h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.5; }
.compute-cost p { font-size: 14px; line-height: 1.6; color: var(--muted); }
.compute-cost .cost-state { font-weight: 700; color: #171b24; }
.compute-cost form { display: grid; gap: 16px; }
.compute-cost label { display: grid; gap: 8px; font-size: 14px; line-height: 1.6; }
.compute-cost input:not([type="checkbox"]) { box-sizing: border-box; min-width: 0; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid #8792a1; border-radius: 6px; background: #fff; color: #171b24; font: inherit; font-size: 16px; }
.compute-cost .cost-consent { display: flex; align-items: flex-start; gap: 12px; }
.cost-consent input { flex: 0 0 auto; width: 24px; height: 24px; margin: 0; }
.compute-cost button { min-height: 48px; justify-self: start; color: #fff; background: #171b24; }
.compute-cost button:hover:not(:disabled) { color: #fff; background: #007597; }
.compute-cost .cost-feedback { color: #943324; margin: 0; }
.compute-cost .cost-feedback[data-state="success"] { color: #146a3f; }
.cost-result { color: var(--accent); text-decoration: underline; min-height: 44px; display: inline-flex; align-items: center; }

@media (max-width: 860px) {
  .topbar { min-height: calc(52px + env(safe-area-inset-top)); padding-inline: 14px; }
  .connection-page { width: calc(100% - 24px); margin-top: 12px; }
  .section-heading { min-height: 44px; }
  h1 { font-size: 24px; }
  #wechat-status { font-size: 12px; margin: 8px 0 14px; }
  .connection { max-width: 360px; }
  .actions { gap: 10px; }
  .actions button { min-height: 48px; flex: 1 1 132px; }
}
