:root {
  --primary:#2563eb;
  --primary-hi:#3b82f6;
  --primary-lo:#1d4ed8;
  --primary-soft:#eff6ff;
  --primary-softer:#f8faff;
  --bg:#f4f5f7;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e6e8ec;
  --danger:#dc2626;
  --ok:#059669;
  --ok-hi:#10b981;
  --ok-soft:#ecfdf5;
  --shadow-xs:0 1px 2px rgba(16,24,40,.05);
  --shadow-sm:0 1px 3px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
  --shadow-md:0 2px 6px rgba(16,24,40,.06), 0 12px 28px rgba(16,24,40,.08);
  --shadow-lg:0 8px 30px rgba(16,24,40,.14);
  --shadow-primary:0 4px 14px rgba(37,99,235,.28);
  --shadow-primary-lg:0 6px 22px rgba(37,99,235,.38);
  --inner-hl:inset 0 1px 0 rgba(255,255,255,.16);
}
[data-theme="dark"] {
  --primary:#3b82f6;
  --primary-hi:#60a5fa;
  --primary-lo:#2563eb;
  --primary-soft:rgba(59,130,246,.14);
  --primary-softer:rgba(59,130,246,.07);
  --bg:#0f1115;
  --card:#181b21;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:#2a2e37;
  --danger:#f87171;
  --ok:#34d399;
  --ok-hi:#10b981;
  --ok-soft:rgba(16,185,129,.12);
  --shadow-xs:0 1px 2px rgba(0,0,0,.35);
  --shadow-sm:0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --shadow-md:0 2px 6px rgba(0,0,0,.4), 0 12px 28px rgba(0,0,0,.4);
  --shadow-lg:0 8px 30px rgba(0,0,0,.55);
  --shadow-primary:0 4px 14px rgba(59,130,246,.3);
  --shadow-primary-lg:0 6px 22px rgba(59,130,246,.4);
  --inner-hl:inset 0 1px 0 rgba(255,255,255,.08);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  background:var(--bg); color:var(--text); font-size:14px;
  -webkit-font-smoothing:antialiased; line-height:1.6;
  transition:background .25s, color .25s;
}
.app-wrapper { min-height:100vh; display:flex; justify-content:center; padding:52px 16px 64px; }
.main-container { width:100%; max-width:460px; }

/* ===== 顶部工具条 ===== */
.top-bar { display:flex; justify-content:flex-end; margin-bottom:32px; }
.top-actions { display:flex; gap:10px; }
.icon-btn {
  width:40px; height:40px; border-radius:12px;
  background:var(--card); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; color:var(--muted);
  box-shadow:var(--shadow-xs);
  transition:all .18s cubic-bezier(.2,.8,.3,1.1);
}
.icon-btn:hover { color:var(--primary); border-color:#bfdbfe; background:var(--primary-soft); transform:translateY(-1px); box-shadow:0 4px 12px rgba(37,99,235,.14); }
.icon-btn:active { transform:translateY(0) scale(.94); }
.icon-btn svg { width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

/* ===== 头部 ===== */
.header-section { text-align:center; margin-bottom:30px; }
.logo-icon {
  width:68px; height:68px; margin:0 auto 18px;
  border-radius:20px;
  background:linear-gradient(135deg,var(--primary-hi),var(--primary-lo));
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow-primary), var(--inner-hl);
  position:relative;
}
.logo-icon svg { width:32px; height:32px; stroke:#fff; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; filter:drop-shadow(0 1px 2px rgba(0,0,0,.2)); }
.app-title { font-size:25px; font-weight:800; margin-bottom:6px; letter-spacing:.5px; }
.app-subtitle { color:var(--muted); font-size:14px; }

/* ===== 卡片 ===== */
.glass-card {
  background:var(--card); border:1px solid var(--border); border-radius:18px;
  padding:26px; margin-bottom:18px; box-shadow:var(--shadow-sm);
  transition:background .25s, border-color .25s, box-shadow .2s;
}
.exchange-card { padding:24px; }

/* ===== 输入区 ===== */
.input-wrapper {
  display:flex; align-items:center; gap:10px;
  border:1.5px solid var(--border); border-radius:12px; padding:0 15px;
  background:var(--bg); transition:all .18s;
  box-shadow:inset 0 1px 2px rgba(16,24,40,.04);
}
.input-wrapper:focus-within { border-color:var(--primary); background:var(--card); box-shadow:0 0 0 3.5px rgba(37,99,235,.13); }
.input-prefix-icon { width:18px; height:18px; stroke:var(--muted); fill:none; stroke-width:2; flex-shrink:0; transition:stroke .18s; }
.input-wrapper:focus-within .input-prefix-icon { stroke:var(--primary); }
.key-input {
  flex:1; border:none; height:48px; outline:none; font-size:16px; background:transparent;
  color:var(--text); letter-spacing:2px; font-weight:600;
  font-family:"SF Mono",Consolas,monospace;
}
.key-input::placeholder { color:var(--muted); letter-spacing:1px; font-weight:400; }

/* ===== 主按钮 ===== */
.submit-btn {
  width:100%; margin-top:16px; height:50px; border-radius:12px; border:none;
  background:linear-gradient(135deg,var(--primary-hi),var(--primary-lo));
  color:#fff; font-size:15px; font-weight:600;
  cursor:pointer; transition:all .18s cubic-bezier(.2,.8,.3,1.1);
  display:flex; align-items:center; justify-content:center; gap:8px;
  letter-spacing:1px;
  box-shadow:var(--shadow-primary), var(--inner-hl);
  position:relative; overflow:hidden;
}
.submit-btn::after { /* 极简悬停高光, 不炫 */
  content:""; position:absolute; top:0; left:0; right:0; height:50%;
  background:linear-gradient(180deg,rgba(255,255,255,.14),transparent);
  border-radius:12px 12px 0 0; pointer-events:none;
}
.submit-btn:hover { transform:translateY(-2px); box-shadow:var(--shadow-primary-lg), var(--inner-hl); filter:saturate(1.08); }
.submit-btn:active { transform:translateY(0) scale(.985); box-shadow:0 2px 8px rgba(37,99,235,.3), var(--inner-hl); }
.submit-btn:disabled { opacity:.6; cursor:wait; transform:none; filter:grayscale(.3); }
.submit-btn svg { stroke:#fff; transition:transform .2s; }
.submit-btn:hover svg { transform:translateY(-1px); }

/* ===== 使用说明 ===== */
.guide-title { font-size:15px; font-weight:700; margin-bottom:16px; display:flex; align-items:center; gap:9px; }
.guide-title::before { content:""; width:4px; height:16px; border-radius:2px; background:linear-gradient(180deg,var(--primary-hi),var(--primary-lo)); }
.guide-list { list-style:none; counter-reset:g; }
.guide-list li {
  counter-increment:g; display:flex; gap:12px; align-items:flex-start;
  color:var(--muted); font-size:14px; padding:8px 0;
}
.guide-list li::before {
  content:counter(g); width:22px; height:22px; border-radius:50%; flex-shrink:0; margin-top:1px;
  background:var(--primary-soft); color:var(--primary); font-size:12px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
}

/* ===== 下载提示卡 ===== */
.download-content { display:flex; align-items:center; gap:14px; }
.download-icon {
  width:46px; height:46px; border-radius:12px; flex-shrink:0;
  background:linear-gradient(135deg,var(--primary-hi),var(--primary-lo));
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow-primary);
}
.download-icon svg { width:22px; height:22px; stroke:#fff; fill:none; stroke-width:2; }
.download-info h4 { font-size:15px; font-weight:600; margin-bottom:2px; }
.download-info p { font-size:13px; color:var(--muted); }

/* ===== 页脚 ===== */
.footer { text-align:center; margin-top:40px; color:var(--muted); font-size:12px; }
.footer-credit { margin-top:4px; opacity:.7; font-size:11px; }

/* ===== 弹窗通用 ===== */
.modal-mask { position:fixed; inset:0; background:rgba(17,24,39,.55); backdrop-filter:blur(5px); -webkit-backdrop-filter:blur(5px); z-index:999; display:flex; align-items:center; justify-content:center; padding:16px; }
.modal-box {
  background:var(--card); border:1px solid var(--border); border-radius:18px;
  width:100%; max-width:480px; max-height:88vh; overflow-y:auto;
  padding:28px 24px; position:relative; animation:pop .25s cubic-bezier(.2,.8,.3,1.15);
  box-shadow:var(--shadow-lg);
}
@keyframes pop { from { transform:scale(.94) translateY(10px); opacity:0; } to { transform:none; opacity:1; } }
.modal-close {
  position:absolute; top:14px; right:14px; width:32px; height:32px; border-radius:10px;
  border:1px solid var(--border); background:var(--bg);
  display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--muted);
  transition:all .15s;
}
.modal-close:hover { color:var(--danger); border-color:rgba(220,38,38,.4); background:rgba(220,38,38,.06); transform:rotate(90deg); }
.modal-close svg { width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:2; }
.modal-title { font-size:18px; font-weight:700; margin-bottom:18px; }

/* ===== 成功弹窗 ===== */
#successModal .modal-box { position:relative; overflow:hidden; }
#fxCanvas { position:absolute; left:0; top:0; width:100%; height:100%; pointer-events:none; z-index:0; }
#successModal .modal-box > *:not(#fxCanvas) { position:relative; z-index:1; }
.success-hero { text-align:center; margin-bottom:24px; }
.success-halo { width:84px; height:84px; margin:0 auto 16px; position:relative; }
.success-check {
  width:84px; height:84px; border-radius:50%;
  background:linear-gradient(135deg,var(--ok-hi),var(--ok));
  display:flex; align-items:center; justify-content:center;
  animation:checkpop .4s cubic-bezier(.2,.9,.3,1.3);
  box-shadow:0 8px 24px rgba(5,150,105,.35), inset 0 1px 0 rgba(255,255,255,.25);
}
@keyframes checkpop { from { transform:scale(.4); opacity:0; } to { transform:scale(1); opacity:1; } }
.success-check svg { width:36px; height:36px; stroke:#fff; fill:none; stroke-width:2.8; stroke-linecap:round; stroke-linejoin:round; filter:drop-shadow(0 1px 2px rgba(0,0,0,.2)); }
.success-title { font-size:22px; font-weight:800; margin-bottom:10px; }
.success-badge {
  display:inline-block; padding:5px 16px; border-radius:999px;
  background:var(--ok-soft); color:var(--ok); font-size:13px; font-weight:600;
  border:1px solid rgba(5,150,105,.15);
}
.success-beam { display:none; }
.sub-title { font-size:14px; font-weight:700; margin-bottom:9px; color:var(--text); }
.op-box {
  background:var(--bg); border:1px solid var(--border); border-radius:12px;
  padding:14px; word-break:break-all; color:var(--text); min-height:44px;
  white-space:pre-wrap; font-size:13px; line-height:1.8;
  font-family:"SF Mono",Consolas,monospace;
  box-shadow:inset 0 1px 3px rgba(16,24,40,.05);
}
.data-wrap { margin-bottom:16px; }
.modal-btn-group { display:flex; gap:10px; }
.modal-btn-group .btn-flex {
  flex:1; height:46px; border-radius:12px; font-size:14px; cursor:pointer;
  border:none; display:flex; align-items:center; justify-content:center; gap:6px; font-weight:600;
  transition:all .16s cubic-bezier(.2,.8,.3,1.1);
}
.btn-primary-solid { background:linear-gradient(135deg,var(--primary-hi),var(--primary-lo)); color:#fff; box-shadow:var(--shadow-primary), var(--inner-hl); }
.btn-primary-solid:hover { transform:translateY(-1px); box-shadow:var(--shadow-primary-lg), var(--inner-hl); }
.btn-primary-solid:active { transform:translateY(0) scale(.98); }
.btn-outline { background:var(--card); border:1.5px solid var(--border); color:var(--text); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-soft); transform:translateY(-1px); }
.btn-outline:active { transform:scale(.98); }
.btn-outline svg { stroke:currentColor; fill:none; stroke-width:2; }

/* ===== 错误弹窗 ===== */
.error-title { font-size:20px; display:flex; align-items:center; gap:10px; font-weight:700; }
.error-title svg { width:30px; height:30px; stroke:var(--danger); fill:none; stroke-width:2; flex-shrink:0; }
.error-desc { font-size:14px; color:var(--muted); margin:14px 0 22px; line-height:1.7; }
.full-close-btn {
  width:100%; padding:13px 0; border-radius:12px; font-size:15px; font-weight:600;
  border:1px solid var(--border); background:var(--bg); color:var(--text); cursor:pointer;
  transition:all .15s;
}
.full-close-btn:hover { border-color:var(--danger); color:var(--danger); background:rgba(220,38,38,.05); }

/* ===== 设置弹窗 ===== */
.setting-row { display:flex; justify-content:space-between; align-items:center; padding:14px 0; border-bottom:1px solid var(--border); }
.setting-row:last-child { border-bottom:none; }
.setting-label h4 { font-size:15px; font-weight:600; margin-bottom:3px; }
.setting-label p { font-size:12px; color:var(--muted); }
.theme-group { display:flex; gap:10px; margin:14px 0; }
.theme-item {
  flex:1; padding:13px 0; border:2px solid var(--border); border-radius:12px;
  text-align:center; cursor:pointer; font-size:14px;
  background:var(--bg); color:var(--text); transition:all .15s;
}
.theme-item:hover { border-color:var(--primary); transform:translateY(-1px); }
.theme-item.active { border-color:var(--primary); background:var(--primary-soft); color:var(--primary); font-weight:700; box-shadow:0 2px 10px rgba(37,99,235,.12); }
.switch-toggle { width:44px; height:24px; border-radius:12px; background:var(--border); position:relative; cursor:pointer; transition:background .2s; flex-shrink:0; }
.switch-toggle.on { background:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.switch-toggle::after { content:""; position:absolute; width:18px; height:18px; background:#fff; border-radius:50%; top:3px; left:3px; transition:left .2s; box-shadow:0 1px 3px rgba(0,0,0,.25); }
.switch-toggle.on::after { left:23px; }

/* ===== 记录弹窗 ===== */
.empty-record { text-align:center; padding:40px 0 20px; color:var(--muted); }
.empty-record svg { width:48px; height:48px; margin:0 auto 12px; opacity:.4; stroke:currentColor; fill:none; stroke-width:1.5; display:block; }
.record-item { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--border); transition:background .12s; }
.record-item:hover { background:var(--primary-softer); }
.record-item:last-child { border-bottom:none; }
.record-left { display:flex; align-items:center; gap:12px; }
.record-dot {
  width:34px; height:34px; border-radius:10px;
  background:linear-gradient(135deg,var(--ok-hi),var(--ok));
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
  box-shadow:0 3px 8px rgba(5,150,105,.3);
}
.record-dot svg { width:16px; height:16px; stroke:#fff; fill:none; stroke-width:2.2; }
.record-code { font-size:13px; font-weight:600; font-family:"SF Mono",Consolas,monospace; }
.record-meta { font-size:12px; color:var(--muted); margin-top:2px; }
.record-right { font-size:12px; color:var(--ok); font-weight:600; flex-shrink:0; background:var(--ok-soft); padding:3px 10px; border-radius:999px; }
.clear-records-btn {
  width:100%; margin-top:14px; height:42px; border-radius:12px; font-size:14px;
  border:1px solid var(--border); background:var(--bg); color:var(--muted); cursor:pointer; transition:all .15s;
}
.clear-records-btn:hover { color:var(--danger); border-color:var(--danger); background:rgba(220,38,38,.05); }

/* ===== Toast ===== */
.toast-tip {
  position:fixed; top:24px; left:50%; transform:translateX(-50%);
  background:var(--card); border:1px solid var(--border); box-shadow:var(--shadow-lg);
  padding:13px 26px; border-radius:12px; display:flex; align-items:center; gap:10px;
  z-index:9999; animation:toastin .25s ease; white-space:nowrap;
}
@keyframes toastin { from { transform:translate(-50%,-14px); opacity:0; } to { transform:translate(-50%,0); opacity:1; } }
.toast-tip svg { width:22px; height:22px; stroke:#f59e0b; fill:none; stroke-width:2; flex-shrink:0; }
.toast-tip span { font-size:14px; color:var(--text); font-weight:500; }

/* ===== 加载 ===== */
.loading-spinner { display:inline-block; width:18px; height:18px; border:2.5px solid rgba(255,255,255,.35); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ===== 响应式 ===== */
@media (max-width:520px) {
  .app-wrapper { padding:28px 14px 56px; }
  .glass-card { padding:20px; border-radius:16px; }
  .modal-box { padding:24px 18px; border-radius:16px; }
  .modal-btn-group { flex-wrap:wrap; }
  .modal-btn-group .btn-flex { flex:1 1 auto; min-width:calc(50% - 5px); }
  .op-box { max-height:32vh; overflow-y:auto; }
  #successModal .modal-box { max-width:340px; }
  .success-title { font-size:19px; }
  .success-halo { width:68px; height:68px; margin-bottom:13px; }
  .success-check { width:68px; height:68px; }
  .success-check svg { width:28px; height:28px; }
  .table-row { padding:10px 13px; font-size:13px; }
  .submit-btn { height:48px; }
}
