:root {
  --bg: #060d1c;
  --surface: rgba(255, 255, 255, .06);
  --surface-2: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .1);
  --text: #eaf2ff;
  --muted: #8fa3c2;
  --accent: #37e0c8;
  --warn: #ffb648;
  --danger: #ff6b7a;
  --tabs-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); overscroll-behavior: none;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none; user-select: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

main { height: 100dvh; }
.page { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--tabs-h) + var(--safe-b) + 24px); }

/* ---------- 首页气泡 ---------- */
.home { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; overflow: hidden; position: relative;
  --liq1: #3ee8d0; --liq2: #1487d6; --glow: rgba(46, 214, 220, .55); }
.home.lv-warn { --liq1: #ffd166; --liq2: #f08a24; --glow: rgba(255, 170, 60, .5); }
.home.lv-low { --liq1: #ff9a9a; --liq2: #d63a5a; --glow: rgba(255, 90, 110, .5); }
.home::before, .home::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0; transition: opacity 1s; pointer-events: none; }
.home::before { width: 70vw; height: 70vw; left: -25vw; top: 6vh; background: var(--liq2); }
.home::after { width: 60vw; height: 60vw; right: -22vw; bottom: 14vh; background: var(--liq1); }
.home.on::before { opacity: .35; animation: drift 14s ease-in-out infinite alternate; }
.home.on::after { opacity: .22; animation: drift 18s ease-in-out infinite alternate-reverse; }
.home-top { position: absolute; top: calc(var(--safe-t) + 18px); left: 20px; right: 20px; display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 14px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(255, 182, 72, .16); color: var(--warn); }

.bubble { position: relative; z-index: 1; width: min(80vw, 46vh, 340px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .26), rgba(255, 255, 255, .03) 46%, rgba(255, 255, 255, .1) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .34), inset 0 22px 50px rgba(255, 255, 255, .1), inset 0 -26px 46px rgba(0, 0, 0, .22),
    0 34px 90px -24px var(--glow), 0 0 110px -18px var(--glow);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  filter: saturate(.2) brightness(.78);
  transition: transform .28s cubic-bezier(.3, 1.7, .5, 1), filter .6s, box-shadow .6s; }
.bubble:active { transform: scale(.93); }
.home.on .bubble { filter: none; animation: bob 5.5s ease-in-out infinite; }
.home.wait .bubble { filter: saturate(.55) brightness(.9); }
.bubble.busy { pointer-events: none; opacity: .8; }

.liquid { position: absolute; inset: 0; border-radius: 50%; clip-path: circle(50%); }
.level { position: absolute; left: 0; right: 0; bottom: 0; height: var(--pct, 0%); opacity: .86;
  background: linear-gradient(180deg, var(--liq1), var(--liq2)); transition: height 1.4s cubic-bezier(.4, 0, .2, 1), background .6s; }
.wave { position: absolute; left: 0; bottom: calc(100% - 1px); width: 200%; height: 20px; fill: var(--liq1); transition: fill .6s;
  animation: wave 3.6s linear infinite; animation-play-state: paused; }
.wave.back { height: 30px; opacity: .45; animation-duration: 6.5s; animation-direction: reverse; }
.home.on .wave { animation-play-state: running; }
.level i { position: absolute; bottom: -12px; width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .5); opacity: 0; }
.home.on .level i { animation: rise 4.2s ease-in infinite; }
.level i:nth-child(3) { left: 22%; }
.level i:nth-child(4) { left: 41%; width: 6px; height: 6px; animation-delay: 1.3s !important; }
.level i:nth-child(5) { left: 58%; width: 12px; height: 12px; animation-delay: 2.1s !important; }
.level i:nth-child(6) { left: 72%; width: 5px; height: 5px; animation-delay: .6s !important; }
.level i:nth-child(7) { left: 33%; width: 7px; height: 7px; animation-delay: 3s !important; }

.shine { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.shine::before { content: ""; position: absolute; left: 17%; top: 11%; width: 34%; height: 20%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 70%); transform: rotate(-28deg); }
.shine::after { content: ""; position: absolute; right: 19%; bottom: 15%; width: 9%; height: 9%; border-radius: 50%;
  background: rgba(255, 255, 255, .28); filter: blur(2px); }

.label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #fff; text-shadow: 0 2px 14px rgba(0, 20, 50, .55); }
.label b { font-size: 19px; font-weight: 600; letter-spacing: .08em; }
.label strong { font-size: clamp(54px, 19vw, 82px); font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.label small { font-size: 13px; opacity: .92; }
.home-hint { z-index: 1; margin: 6px 0 0; font-size: 15px; color: var(--text); min-height: 22px; text-align: center; }
.home-meta { z-index: 1; margin: -12px 0 0; font-size: 13px; color: var(--muted); }

@keyframes wave { to { transform: translateX(-50%); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes drift { to { transform: translate(12vw, -6vh) scale(1.15); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .8; } 100% { transform: translateY(-46vw); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .home.on .bubble, .home.on .wave, .home.on .level i, .home.on::before, .home.on::after { animation: none; } }

/* ---------- 底部导航 ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(8, 15, 32, .82); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0;
  font-size: 11px; color: var(--muted); }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }

/* ---------- 通用 ---------- */
h2 { margin: 4px 4px 14px; font-size: 24px; font-weight: 700; }
h3 { margin: 22px 6px 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 14px; width: 100%; text-align: left; background: none; border: 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .title { display: block; }
.row .desc { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chev { color: var(--muted); font-size: 18px; }
.btn { border: 0; border-radius: 12px; padding: 9px 16px; background: var(--surface-2); font-weight: 500; white-space: nowrap; }
.btn.primary { background: var(--accent); color: #04221f; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { display: block; width: 100%; padding: 13px; font-size: 16px; }
.btn:disabled { opacity: .5; }
.sw { flex: none; position: relative; width: 50px; height: 30px; border-radius: 99px; border: 0; background: rgba(255, 255, 255, .16); transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.sw[aria-checked="true"] { background: var(--accent); }
.sw[aria-checked="true"]::after { transform: translateX(20px); }
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #5b6a85; }
.dot.online { background: var(--accent); box-shadow: 0 0 0 4px rgba(55, 224, 200, .18); }
.dot.offline, .dot.verify { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 107, 122, .18); }
.dot.qr_pending { background: var(--warn); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- 订单记录 ---------- */
.seg { display: flex; padding: 3px; background: var(--surface); border-radius: 12px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 8px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 18px 6px 8px; }
.group-head b { font-size: 17px; }
.group-head span { font-size: 13px; color: var(--muted); }
.order { padding: 13px 14px; }
.order + .order { border-top: 1px solid var(--line); }
.order-top { display: flex; align-items: flex-start; gap: 10px; }
.order-top .dest { flex: 1; font-weight: 600; font-size: 16px; }
.order-top time { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.order p { margin: 3px 0 0; font-size: 13px; color: var(--muted); -webkit-user-select: text; user-select: text; }
.order-foot { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.chip { display: inline-block; font-size: 12.5px; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.chip.failed { background: rgba(255, 107, 122, .14); color: var(--danger); }
.chip.grabbing { background: rgba(55, 224, 200, .14); color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.chip.unknown { background: rgba(255, 182, 72, .14); color: var(--warn); }
.chip.grabbed { background: rgba(55, 224, 200, .14); color: var(--accent); }
.order-foot .grow { flex: 1; min-width: 0; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- 我的 ---------- */
.balance { padding: 18px 16px 16px; background: linear-gradient(135deg, rgba(62, 232, 208, .16), rgba(20, 135, 214, .14)); }
.balance .num { font-size: 40px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.balance .num small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.balance .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); margin: 14px 0; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .8s; }
.bar.warn i { background: var(--warn); }
.bar.low i { background: var(--danger); }
.balance .actions { display: flex; gap: 10px; }
.balance .actions .btn { flex: 1; }

/* ---------- 弹层 ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(2, 6, 16, .6); animation: fade .2s; }
.sheet-card { width: 100%; max-height: 88dvh; overflow-y: auto; padding: 18px 16px calc(var(--safe-b) + 18px); border-radius: 22px 22px 0 0;
  background: #101a30; border-top: 1px solid var(--line); animation: up .28s cubic-bezier(.2, .9, .3, 1); }
.sheet-head { display: flex; align-items: center; margin-bottom: 14px; }
.sheet-head b { flex: 1; font-size: 18px; }
.sheet-head button { background: none; border: 0; color: var(--muted); font-size: 15px; padding: 4px; }
.sheet p { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.sheet ol { color: var(--muted); font-size: 14px; padding-left: 20px; margin: 0 0 14px; }
.sheet ol b { color: var(--text); font-weight: 500; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="time"], input:not([type]), textarea { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05); outline: none; -webkit-user-select: text; user-select: text; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 84px; resize: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips button { padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); background: none; color: var(--muted); }
.chips button.on { border-color: var(--accent); background: rgba(55, 224, 200, .14); color: var(--accent); }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.packs button { padding: 14px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.packs button.on { border-color: var(--accent); background: rgba(55, 224, 200, .12); }
.packs b { display: block; font-size: 20px; }
.packs span { display: block; font-size: 12.5px; color: var(--muted); }
.qr { display: grid; place-items: center; margin: 4px auto 14px; width: 232px; height: 232px; border-radius: 18px; background: #fff; color: #333; }
.qr img { width: 208px; height: 208px; -webkit-touch-callout: default; }
.code { font: 700 30px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .12em; text-align: center; margin: 10px 0 14px; -webkit-user-select: all; user-select: all; }
.ledger-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.ledger-row .grow { flex: 1; min-width: 0; }
.ledger-row small { display: block; color: var(--muted); font-size: 12px; }
.ledger-row .plus { color: var(--accent); font-weight: 600; }
.ledger-row .minus { font-weight: 600; }
.remote { position: relative; overflow: auto; max-height: 58dvh; margin-bottom: 12px; border-radius: 14px; background: #fff; min-height: 120px; }
.remote img { display: block; width: 100%; height: auto; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* 整页画面是电脑版布局，缩到手机宽度看不清：放大到可读尺寸，左右上下拖动查看。 */
.remote.page img { width: 960px; max-width: none; }
.remote .tap { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; pointer-events: none;
  border: 2px solid #ff4d6d; background: rgba(255, 77, 109, .25); animation: tap .7s ease-out forwards; }
.remote-keys { display: flex; gap: 8px; }
.remote-keys input { flex: 1; min-width: 0; padding: 8px 10px; }
@keyframes tap { to { transform: scale(1.8); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 22px); z-index: 40; transform: translate(-50%, 12px); max-width: 84vw;
  padding: 10px 16px; border-radius: 12px; background: rgba(240, 246, 255, .96); color: #0b1528; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 登录 ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.login-orb { width: 110px; height: 110px; border-radius: 50%; margin-bottom: 22px;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .7), rgba(62, 232, 208, .55) 38%, rgba(20, 135, 214, .7));
  box-shadow: 0 20px 60px -10px rgba(46, 214, 220, .6), inset 0 0 0 1.5px rgba(255, 255, 255, .4); }
.login h1 { margin: 0; font-size: 26px; }
.login p { color: var(--muted); margin: 6px 0 22px; }
.login form { width: 100%; max-width: 320px; display: grid; gap: 12px; }
.login input { text-align: center; font: 600 22px/1.3 ui-monospace, Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; padding: 13px; }
.login input::placeholder { font: 400 15px/1.9 -apple-system, "PingFang SC", sans-serif; letter-spacing: 0; }
.login .btn { padding: 13px; font-size: 16px; }
.login .tip { font-size: 13px; margin-top: 22px; max-width: 320px; }
