﻿
:root {
  --bg: #eef1f5;
  --viewport-height: 100dvh;
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
  --card: #ffffff;
  --line: #dde3ea;
  --text: #1a2332;
  --muted: #6b7788;
  --accent: #008f7e;
  --accent-soft: rgba(0, 143, 126, .1);
  --warn: #9a6700;
  --warn-bg: rgba(191, 123, 19, .1);
  --danger: #b4233b;
  --danger-soft: rgba(255, 59, 79, .1);
  --mobile-nav-offset: 0px;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  min-height: var(--viewport-height, 100dvh);
  scroll-behavior: smooth;
  scroll-padding-bottom: calc(var(--mobile-nav-offset) + var(--safe-area-inset-bottom));
}

body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  min-height: var(--viewport-height, 100dvh);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}

html.app-ready,
html.app-ready body,
body.app-ready {
  height: auto;
  min-height: var(--viewport-height, 100dvh);
  background: var(--bg) !important;
  overflow: auto;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 8px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #ff5265, #d91938);
  font-size: 17px;
}

.brand-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #5f6d80;
  text-align: left;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, .06);
}

.nav-btn:hover {
  background: #f4f6f8;
}

.nav-btn.active {
  color: #ad1731;
  border-color: rgba(217, 25, 56, .22);
  background: rgba(255, 59, 79, .1);
  font-weight: 700;
}

.nav-btn.active .nav-icon {
  border-color: rgba(217, 25, 56, .25);
  box-shadow: 0 0 0 2px rgba(255, 59, 79, .12);
}

.nav-btn-claim {
  color: #ffffff;
  border-color: #16a34a;
  background: #22c55e;
  font-weight: 700;
}

.nav-btn-claim .nav-icon {
  border-color: rgba(255, 255, 255, .35);
}

.nav-btn-claim.active {
  color: #ffffff;
  border-color: #15803d;
  background: #16a34a;
  box-shadow: 0 4px 14px rgba(22, 163, 74, .22);
}

.main {
  min-width: 0;
  min-height: var(--viewport-height, 100dvh);
  padding: 14px 16px 24px;
  background: var(--bg);
}

.page-title {
  display: none;
}

.content {
  display: none;
  max-width: 560px;
  margin: 0 auto;
}

.content.active {
  display: block;
}

.msg-card {
  padding: 14px 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(26, 35, 50, .05);
}

.page-hero {
  display: block;
  width: 100%;
  height: 88px;
  margin: 0 0 10px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(0, 0, 0, .06);
}

.msg-banner {
  margin: 0 0 8px;
  color: #ad1731;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}

.msg-line {
  margin: 4px 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.msg-line.accent {
  color: var(--accent);
  font-weight: 700;
}

.msg-line.warn {
  color: var(--warn);
}

.msg-line strong {
  color: var(--accent);
}

.msg-hint {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.msg-hint.accent {
  color: var(--accent);
  font-weight: 700;
}

.msg-divider {
  margin: 8px 0;
  border: 0;
  border-top: 1px dashed var(--line);
}

.copy-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 6px 0;
  padding: 10px 12px;
  border: 1px solid rgba(0, 143, 126, .25);
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  background: var(--accent-soft);
  cursor: pointer;
}

.copy-block code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
  font-size: 14px;
  line-height: 1.35;
}

.copy-block span {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.watch-stats {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
}

.watch-stats strong {
  font-size: 19px;
}

.watch-form {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.watch-form input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
}

.watch-form input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(0, 143, 126, .12);
}

.chain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.chain-btn {
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #526077;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.chain-btn.active {
  border-color: rgba(0, 143, 126, .4);
  color: var(--accent);
  background: var(--accent-soft);
}

.chain-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-primary,
.btn-ghost,
.btn-danger {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
}

.btn-ghost {
  padding: 6px 10px;
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-danger {
  padding: 6px 10px;
  color: var(--danger);
  background: var(--danger-soft);
}

.btn-primary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.watch-message {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
}

.watch-message.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.claim-loading:not([hidden]) {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 20px 12px 16px;
  text-align: center;
}

.claim-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 143, 126, .18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: claim-spin 1s linear infinite;
}

@keyframes claim-spin {
  to {
    transform: rotate(360deg);
  }
}

.claim-loading-title {
  margin: 0;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

.claim-loading-address {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

.claim-loading-progress {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.claim-loading-progress strong {
  color: var(--accent);
  font-size: 16px;
}

.claim-loading-done {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.claim-result:not([hidden]) {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

#claimRetryPanel .msg-line {
  color: #dc2626;
  font-weight: 600;
}

.watch-list-head,
.price-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.watch-list {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.watch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.watch-item-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.watch-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.watch-item-meta strong {
  font-size: 13px;
}

.watch-chain {
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.watch-item-info code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.watch-status {
  width: max-content;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.watch-status.enabled {
  color: var(--accent);
  background: var(--accent-soft);
}

.watch-status.paused {
  color: var(--warn);
  background: var(--warn-bg);
}

.watch-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.watch-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.price-panel {
  display: grid;
  gap: 6px;
}

.price-header {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.price-merchant-list {
  display: grid;
  gap: 4px;
}

.price-merchant-item {
  padding: 6px 8px;
  border-radius: 6px;
  background: #f6f8fb;
  font-size: 14px;
  line-height: 1.35;
}

.price-footer {
  margin: 4px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 700;
}

/* ============================================================
   实时 U 价 —— 欧易 OKX 报价面板
   ============================================================ */

/* ---- 顶部报价卡 ---- */
.okx-quote {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(160deg, #fbfdff 0%, #f3f7fb 100%);
}

.okx-quote-main {
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.okx-quote-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .3px;
}

.okx-quote-price {
  margin: 2px 0 1px;
  color: var(--accent);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}

.okx-quote-src {
  color: #93a1b3;
  font-size: 11px;
}

.okx-quote-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.okx-side-box {
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
}

.okx-side-buy {
  background: rgba(0, 143, 126, .07);
  border: 1px solid rgba(0, 143, 126, .18);
}

.okx-side-sell {
  background: rgba(180, 35, 59, .06);
  border: 1px solid rgba(180, 35, 59, .16);
}

.okx-side-label {
  color: var(--muted);
  font-size: 11.5px;
}

.okx-side-price {
  margin: 1px 0;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.okx-side-buy .okx-side-price { color: var(--accent); }
.okx-side-sell .okx-side-price { color: var(--danger); }

.okx-side-sub {
  color: #93a1b3;
  font-size: 11px;
}

/* ---- 买卖切换 ---- */
.okx-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0 6px;
}

.okx-tab {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.okx-tab:hover {
  background: #f7fafc;
}

.okx-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark, #007064);
}

/* ---- 商家挂单列表 ---- */
.okx-list {
  display: grid;
  gap: 5px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}

.okx-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #fbfcfe;
  transition: border-color .15s, background .15s;
}

.okx-row:hover {
  border-color: #d7e0ea;
  background: #f7fafc;
}

.okx-row-left {
  min-width: 0;
  flex: 1;
}

.okx-row-name {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.okx-badge {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ffe9a8, #ffd060);
  color: #7a5200;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}

.okx-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 2px;
  color: #93a1b3;
  font-size: 11.5px;
}

.okx-row-right {
  flex-shrink: 0;
  text-align: right;
}

.okx-row-price {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.okx-row-limit,
.okx-row-avail {
  color: #93a1b3;
  font-size: 11px;
  line-height: 1.4;
}

/* ---- 底部信息条 ---- */
.okx-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f4f7fa;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.okx-disclaimer {
  margin: 6px 0 0;
  color: #a8b3c1;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

/* ---- TRX 兑换实时汇率 ---- */
.trx-rate {
  margin: 4px 0 8px;
}

.trx-rate .trx-rate-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.trx-rate-val {
  font-weight: 700;
  transition: color .25s ease;
}

/* 中文习惯：涨红跌绿 */
.trx-rate-val.is-up { color: #d1382c; }
.trx-rate-val.is-down { color: #0f9d58; }

.trx-rate-badge {
  align-self: center;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .2px;
}

.trx-rate-badge.is-off {
  background: rgba(150, 160, 175, .14);
  color: var(--muted);
}

.trx-rate-meta {
  margin: 3px 0 0;
  color: #93a1b3;
  font-size: 11px;
  line-height: 1.4;
}

.trx-rate-meta.is-stale { color: var(--warn); }

/* ---- 移动端压缩 ---- */
@media (max-width: 560px) {
  .okx-quote-price { font-size: 27px; }
  .okx-quote { padding: 10px; }
  .okx-side-price { font-size: 17px; }
  .okx-list { max-height: 260px; }
  .okx-row { padding: 7px 8px; }
  .okx-row-price { font-size: 15px; }
  .okx-row-meta { font-size: 11px; }
  .okx-tab { padding: 6px; font-size: 12.5px; }
}

/* ---- 暗色适配（若外层将来加 dark 类） ---- */
@media (prefers-color-scheme: dark) {
  /* 站点为浅色设计，此处不主动切换，仅防止系统暗色模式反色 */
  .okx-quote,
  .okx-row,
  .okx-foot,
  .okx-tab { color-scheme: light; }
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--danger);
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .4);
}

.confirm-dialog:not([hidden]) {
  display: grid;
}

.confirm-dialog-panel {
  width: min(100%, 340px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.confirm-dialog-title {
  margin: 0 0 8px;
  font-size: 17px;
}

.confirm-dialog-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.mobile-nav {
  display: none;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 6px;
  border: 1.5px solid #c5ced9;
  border-radius: 10px;
  color: #334155;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(26, 35, 50, .06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.mobile-nav-btn:active {
  transform: scale(.96);
}

.mobile-nav-emoji {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid #dbe3ec;
  font-size: 12px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
  flex: 0 0 auto;
}

.mobile-nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .01em;
}

.mobile-nav-btn-claim {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 5px 10px;
  color: #ffffff;
  border-color: #16a34a;
  background: #22c55e;
  box-shadow: 0 4px 12px rgba(22, 163, 74, .18);
}

.mobile-nav-btn-claim .mobile-nav-emoji {
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .22);
}

.mobile-nav-btn.active {
  color: #9f1239;
  border-color: #e11d48;
  background: linear-gradient(180deg, #fff1f3 0%, #ffe4e8 100%);
  box-shadow: 0 6px 18px rgba(225, 29, 72, .22), inset 0 0 0 1px rgba(255, 255, 255, .75);
}

.mobile-nav-btn.active .mobile-nav-emoji {
  border-color: rgba(225, 29, 72, .35);
  background: linear-gradient(180deg, #fff 0%, #ffe4e8 100%);
  box-shadow: 0 3px 10px rgba(225, 29, 72, .16), inset 0 1px 0 rgba(255, 255, 255, .95);
}

.mobile-nav-btn-claim.active {
  color: #ffffff;
  border-color: #15803d;
  background: #16a34a;
  box-shadow: 0 6px 16px rgba(22, 163, 74, .24), inset 0 0 0 1px rgba(255, 255, 255, .2);
}

.mobile-nav-btn-claim.active .mobile-nav-emoji {
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding:
      calc(8px + var(--safe-area-inset-top))
      10px
      calc(var(--mobile-nav-offset) + var(--safe-area-inset-bottom) + 8px);
  }

  .msg-card {
    padding: 10px 11px 12px;
  }

  .page-hero {
    height: 68px;
    margin-bottom: 8px;
    border-radius: 8px;
  }

  .msg-banner {
    margin-bottom: 6px;
  }

  .msg-line {
    margin: 2px 0;
    line-height: 1.4;
  }

  .msg-hint {
    margin: 2px 0 6px;
  }

  .msg-divider {
    margin: 6px 0;
  }

  .copy-block {
    margin: 4px 0;
    padding: 8px 10px;
  }

  .watch-stats {
    margin: 6px 0 8px;
    padding: 6px 8px;
  }

  .watch-form {
    gap: 6px;
    margin-bottom: 8px;
  }

  .watch-form input {
    padding: 8px 10px;
  }

  .chain-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .chain-btn {
    padding: 5px 2px;
  }

  .btn-primary {
    padding: 9px 12px;
  }

  .claim-loading {
    padding: 16px 8px 12px;
  }

  .watch-list-head,
  .price-toolbar {
    margin: 6px 0 4px;
  }

  .watch-list {
    max-height: 96px;
  }

  .price-merchant-list {
    gap: 2px;
  }

  .price-merchant-item {
    padding: 4px 6px;
    line-height: 1.3;
  }

  .price-footer {
    margin-top: 2px;
    padding: 6px 8px;
  }

  .mobile-nav {
    position: fixed;
    right: 8px;
    bottom: calc(8px + var(--safe-area-inset-bottom));
    left: 8px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid #c8d1dc;
    border-radius: 14px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 10px 30px rgba(26, 35, 50, .18), 0 2px 8px rgba(26, 35, 50, .08);
    backdrop-filter: blur(10px);
  }

  .mobile-nav-btn {
    min-height: 32px;
    padding: 4px 6px;
  }

  .mobile-nav-emoji {
    width: 18px;
    height: 18px;
  }

  body.keyboard-open .mobile-nav {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(calc(100% + 16px));
  }

  .toast {
    right: 12px;
    left: 12px;
    bottom: calc(var(--mobile-nav-offset) + var(--safe-area-inset-bottom) + 8px);
    justify-content: center;
  }
}

@media (min-width: 901px) {
  .watch-actions {
    flex-direction: row;
    align-items: center;
  }

  .watch-list {
    max-height: 220px;
  }
}

html.tg-mini-app .shell {
  display: block;
}

html.tg-mini-app .sidebar {
  display: none !important;
}

html.tg-mini-app .main {
  padding:
    calc(8px + var(--safe-area-inset-top))
    10px
    calc(var(--mobile-nav-offset) + var(--safe-area-inset-bottom) + 8px);
}

html.tg-mini-app .msg-card {
  padding: 10px 11px 12px;
}

html.tg-mini-app .page-hero {
  height: 68px;
  margin-bottom: 8px;
  border-radius: 8px;
}

/* 底部导航在 TMA 里必须常显，盖掉 @media (max-width:900px) 里的 grid 与桌面端 none */
html.tg-mini-app .mobile-nav {
  position: fixed;
  right: 8px;
  bottom: calc(8px + var(--safe-area-inset-bottom));
  left: 8px;
  z-index: 30;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid #c8d1dc;
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 10px 30px rgba(26, 35, 50, .18), 0 2px 8px rgba(26, 35, 50, .08);
  backdrop-filter: blur(10px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

html.tg-mini-app .mobile-nav-btn {
  min-height: 32px;
  padding: 4px 6px;
}

html.tg-mini-app .mobile-nav-btn-claim {
  grid-column: 1 / -1;
  min-height: 34px;
}

html.tg-mini-app .toast {
  right: 12px;
  left: 12px;
  bottom: calc(var(--mobile-nav-offset) + var(--safe-area-inset-bottom) + 8px);
  justify-content: center;
}

html.tg-mini-app body.keyboard-open .mobile-nav {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(100% + 16px));
}

/* ---- Telegram Mini App 专属细节 ---- */

/* 全屏后不再让整页跟着手指"橡皮筋"回弹，否则顶栏跟着抖 */
html.tg-mini-app,
html.tg-mini-app body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* 主区域至少撑满可视高度，短页面也不露白底 */
html.tg-mini-app .main {
  min-height: var(--viewport-height, 100dvh);
}

/* 验证门是 z-index:100 的全屏层，导航在它下面，天然被盖住；
   这里不隐藏导航，否则量不出它的高度，--mobile-nav-offset 会一直是 0，
   放行后主内容底部就会空一块。 */

/* 顶部刘海/状态栏的让位由 .main 的 padding-top 承担
   （见 html.tg-mini-app .main 里的 calc(8px + var(--safe-area-inset-top))），
   不再单独插占位元素。 */

#appRoot:not([hidden]) {
  min-height: var(--viewport-height, 100dvh);
  background: var(--bg);
}

/* ============================================================
   访问验证门（access gate）
   与 v8.trxcan.com 同款：进入站点先显示安全验证，
   勾选「我是真人」后 4 秒放行，会话内不再重复验证。
   ============================================================ */

:root {
  --gate-bg: #ffffff;
}

/* 验证进行中：锁死滚动，纯白背景 */
html.access-gate-active,
html.access-gate-active body,
body.access-gate-active {
  margin: 0;
  width: 100%;
  height: 100%;
  height: var(--viewport-height, 100dvh);
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background: var(--gate-bg) !important;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  margin: 0;
  padding: max(24px, var(--safe-area-inset-top))
           max(16px, var(--safe-area-inset-right))
           max(24px, var(--safe-area-inset-bottom))
           max(16px, var(--safe-area-inset-left));
  background: var(--gate-bg) !important;
  transition: opacity .28s;
}

.access-gate[hidden] {
  display: none !important;
}

.access-gate:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 放行时的淡出 */
.access-gate.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.access-gate-panel {
  width: min(560px, 100%);
}

.access-gate-title {
  margin: 0 0 12px;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
}

.access-gate-desc {
  margin: 0 0 24px;
  color: #374151;
  font-size: 15px;
  line-height: 1.55;
}

/* ---- 验证控件外框 ---- */
.access-gate-widget {
  display: flex;
  align-items: stretch;
  min-height: 68px;
  border: 1px solid #d1d5db;
  border-radius: 2px;
  background: #fafafa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.access-gate-widget-main {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid #e5e7eb;
}

/* ---- 转圈 ---- */
.access-gate-loading:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4b5563;
  font-size: 14px;
}

.access-gate-spinner {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
}

.access-gate-spinner i {
  position: absolute;
  inset: 0;
  animation: access-gate-dot-pulse 1.1s ease-in-out infinite;
}

.access-gate-spinner i::before {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  margin: 0 auto;
  border-radius: 50%;
  background: #f97316;
}

.access-gate-spinner i:nth-child(1) { transform: rotate(0deg);   animation-delay: 0s; }
.access-gate-spinner i:nth-child(2) { transform: rotate(45deg);  animation-delay: -.1375s; }
.access-gate-spinner i:nth-child(3) { transform: rotate(90deg);  animation-delay: -.275s; }
.access-gate-spinner i:nth-child(4) { transform: rotate(135deg); animation-delay: -.4125s; }
.access-gate-spinner i:nth-child(5) { transform: rotate(180deg); animation-delay: -.55s; }
.access-gate-spinner i:nth-child(6) { transform: rotate(225deg); animation-delay: -.6875s; }
.access-gate-spinner i:nth-child(7) { transform: rotate(270deg); animation-delay: -.825s; }
.access-gate-spinner i:nth-child(8) { transform: rotate(315deg); animation-delay: -.9625s; }

@keyframes access-gate-dot-pulse {
  0%, 100% { opacity: .25; }
  50%      { opacity: 1; }
}

/* ---- 复选框 ---- */
.access-gate-check:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.access-gate-human-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.access-gate-checkbox {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #c4c4c4;
  border-radius: 3px;
  background: #fff;
  transition: border-color .15s, background .15s;
}

.access-gate-checkbox::after {
  content: "";
  width: 6px;
  height: 11px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s;
}

.access-gate-human-input:checked + .access-gate-checkbox {
  border-color: #22c55e;
  background: #22c55e;
}

.access-gate-human-input:checked + .access-gate-checkbox::after {
  transform: rotate(45deg) scale(1);
}

.access-gate-check-label {
  color: #374151;
  font-size: 14px;
}

/* ---- 右侧品牌 ---- */
.access-gate-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 108px;
  padding: 8px 12px;
  color: #6b7280;
  text-align: center;
}

.access-gate-brand-cloud {
  display: flex;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  /* 兜底：即使日后有人给 svg 加回没有属性的写法，也不允许它超出去 */
  max-width: 32px;
  max-height: 32px;
  overflow: hidden;
}

.access-gate-brand-cloud svg {
  width: 32px;
  height: 32px;
  /* 用固定像素而不是 100%，并加 !important：
     老版本 HTML 里的 svg 没有 width/height 属性，只靠这条兜底。
     不加 !important 时，别的 svg 全局规则（如有）会把它改小。 */
  width: 32px !important;
  height: 32px !important;
  max-width: 32px;
  max-height: 32px;
  display: block;
}

.access-gate-brand-text {
  display: grid;
  gap: 2px;
  font-size: 10px;
  line-height: 1.2;
}

.access-gate-brand-text strong {
  color: #374151;
  font-size: 11px;
  letter-spacing: .04em;
}

@media (max-width: 360px) {
  .access-gate-brand { min-width: 84px; padding: 8px; }
  .access-gate-title { font-size: 22px; }
  .access-gate-desc { font-size: 14px; }
}

