/* ============== 变量 ============== */
:root {
  --c-bg-1: #eef4ff;
  --c-bg-2: #f7f1ff;
  --c-bg-3: #e6f6ff;
  --c-primary: #5b8def;
  --c-primary-2: #7ba7ff;
  --c-primary-dark: #3f6fd4;
  --c-text: #1c2540;
  --c-text-soft: #5b6784;
  --c-text-mute: #8a94ab;
  --c-card: #ffffff;
  --c-border: #e6ecf8;
  --c-border-strong: #d4ddf0;
  --c-danger: #ef5b6b;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(80,110,170,.06);
  --shadow: 0 10px 30px rgba(80,110,170,.10);
  --ease: cubic-bezier(.22,1,.36,1);
  --dur: .28s;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.6; color: var(--c-text);
  background: linear-gradient(160deg, var(--c-bg-1) 0%, var(--c-bg-2) 50%, var(--c-bg-3) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

/* 背景光晕 */
.bg-decor { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.b1 { width: 480px; height: 480px; background: #c8ddff; top: -160px; left: -120px; animation: float1 22s ease-in-out infinite; }
.b2 { width: 420px; height: 420px; background: #ffd9a8; top: 20%; right: -140px; animation: float2 26s ease-in-out infinite; }
.b3 { width: 460px; height: 460px; background: #d9c8ff; bottom: -180px; left: 30%; animation: float3 30s ease-in-out infinite; }
@keyframes float1 { 50% { transform: translate(40px, 60px); } }
@keyframes float2 { 50% { transform: translate(-50px, 40px); } }
@keyframes float3 { 50% { transform: translate(60px, -50px); } }

/* 布局 */
.container { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid rgba(220,230,248,.8);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand .title {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .3px;
  background: linear-gradient(135deg, #3f6fd4, #7b6ff0 50%, #e39a3c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .subtitle { margin: 2px 0 0; font-size: 12px; color: var(--c-text-mute); letter-spacing: 2px; }

.account-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--c-border-strong); border-radius: 999px;
  background: #fff; color: var(--c-text);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
}
.account-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: #bfd0ee; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary-2), #a48bff);
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }

/* 页面 */
.page { padding-top: 24px; padding-bottom: 60px; }

/* 主标签 */
.tabs {
  display: flex; gap: 6px; padding: 5px; margin-bottom: 18px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--c-border);
  border-radius: 14px; box-shadow: var(--shadow-sm);
}
.tab {
  flex: 1; padding: 10px 14px;
  border: none; border-radius: 10px; background: transparent;
  color: var(--c-text-soft); font-size: 15px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.tab:hover { color: var(--c-text); }
.tab.is-active {
  background: linear-gradient(135deg, var(--c-primary), #7b6ff0);
  color: #fff;
  box-shadow: 0 6px 18px rgba(91,141,239,.35);
}

/* 面板 */
.panel { display: none; }
.panel.is-active { display: block; animation: fadeUp .4s var(--ease); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 卡片 */
.card {
  padding: 20px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-title { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.divider { height: 1px; background: var(--c-border); margin: 22px 0; }

/* 表单 */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block; margin-bottom: 7px;
  font-size: 13px; font-weight: 600; color: var(--c-text-soft); letter-spacing: .3px;
}
.req { color: var(--c-danger); font-style: normal; }
.opt { color: var(--c-text-mute); font-weight: 400; font-size: 12px; }

.input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--c-border-strong); border-radius: 12px;
  background: #fbfcff; color: var(--c-text);
  font-size: 15px; font-family: inherit; outline: none;
  transition: all var(--dur) var(--ease);
}
.input::placeholder { color: #aab3c7; }
.input:focus {
  border-color: var(--c-primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(91,141,239,.13);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6784' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px; cursor: pointer;
}
.input-row { display: flex; gap: 10px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: all var(--dur) var(--ease);
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), #7b6ff0);
  color: #fff;
  box-shadow: 0 8px 20px rgba(91,141,239,.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(91,141,239,.45);
}
.btn-ghost {
  background: #fff; color: var(--c-text-soft);
  border: 1.5px solid var(--c-border-strong);
}
.btn-ghost:hover { border-color: #bfd0ee; color: var(--c-text); }
.btn-block { width: 100%; }

/* 提示 */
.hint { margin: 9px 0 0; font-size: 12.5px; color: var(--c-text-mute); line-height: 1.5; }
.hint.center { text-align: center; }

/* 子标签组 */
.tabgroup { position: relative; }
.subtabs {
  display: flex; gap: 4px; padding: 5px;
  background: #f1f5fd; border-radius: 12px; margin: 0 0 14px;
}
.subtabs-block { margin-bottom: 18px; }
.subtab {
  flex: 1; padding: 9px 14px;
  border: none; border-radius: 9px; background: transparent;
  color: var(--c-text-soft); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.subtab:hover { color: var(--c-text); }
.subtab.is-active {
  background: #fff; color: var(--c-primary-dark);
  box-shadow: 0 3px 10px rgba(80,110,170,.12);
}
.subview { display: none; }
.subview.is-active { display: block; animation: fadeUp .3s var(--ease); }

/* 结果区 */
.result {
  margin-top: 16px; padding: 16px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: fadeUp .35s var(--ease);
}
.text-result {
  margin: 0; padding: 16px;
  background: #f7f9fd; border-radius: 12px;
  font-family: "SF Mono", Menlo, Consolas, "Courier New", monospace;
  font-size: 13.5px; line-height: 1.9; color: #2b3752;
  white-space: pre-wrap; word-break: break-all; overflow-x: auto;
}
.image-wrap {
  display: flex; justify-content: center; padding: 4px;
  background: #f7f9fd; border-radius: 12px;
}
.result-image { display: block; max-width: 100%; height: auto; border-radius: 8px; }

/* 未登录锁定 */
.lock {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 32px 20px;
}
.lock-icon { font-size: 40px; margin-bottom: 12px; opacity: .55; }
.lock-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.lock-text { margin: 0 0 20px; font-size: 13px; color: var(--c-text-mute); }

/* 绑定列表 */
.bind-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bind-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  background: #f7f9fd; border: 1px solid var(--c-border); border-radius: 12px;
  transition: all var(--dur) var(--ease);
}
.bind-list li:hover { background: #f2f6fd; border-color: var(--c-border-strong); }
.bind-list li.empty {
  justify-content: center; color: var(--c-text-mute); font-size: 13px;
  padding: 22px 0; background: transparent;
  border-style: dashed; border-color: var(--c-border-strong);
}
.bind-info { min-width: 0; flex: 1; }
.bind-name {
  display: block; font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bind-code {
  display: block; font-size: 12px; color: var(--c-text-mute);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px;
}
.btn-delete {
  flex-shrink: 0; width: 32px; height: 32px; padding: 0;
  border: none; border-radius: 8px;
  background: rgba(239,91,107,.1); color: var(--c-danger);
  font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
}
.btn-delete:hover { background: rgba(239,91,107,.18); }

/* 抽屉 */
.drawer-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,30,55,.38);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.drawer-mask.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 51;
  width: min(420px, 100%); height: 100%;
  display: flex; flex-direction: column;
  background: #fff;
  box-shadow: -20px 0 60px rgba(40,60,100,.18);
  transform: translateX(105%);
  transition: transform .35s var(--ease);
}
.drawer.is-open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 1px solid var(--c-border);
}
.drawer-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.icon-btn {
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: transparent; color: var(--c-text-soft);
  font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
}
.icon-btn:hover { background: #f1f5fd; color: var(--c-text); }

/* 用户卡片 */
.user-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; margin-bottom: 18px;
  background: linear-gradient(135deg, #f1f6ff, #f8f1ff);
  border: 1px solid var(--c-border); border-radius: var(--radius);
}
.user-meta { min-width: 0; }
.user-name { margin: 0; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { margin: 3px 0 0; font-size: 12.5px; color: var(--c-text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 100;
  transform: translate(-50%, 20px);
  padding: 11px 20px; border-radius: 12px;
  background: rgba(28,37,64,.92); color: #fff;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(20,30,55,.3);
  opacity: 0; visibility: hidden; pointer-events: none;
  max-width: min(90vw, 420px); text-align: center;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
.toast.success { background: rgba(53,184,124,.95); }
.toast.error   { background: rgba(239,91,107,.95); }

/* 移动端 */
@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .topbar-inner { padding-top: 12px; padding-bottom: 12px; }
  .brand .title { font-size: 17px; }
  .brand .subtitle { font-size: 11px; }
  .account-btn { padding: 5px 10px 5px 5px; font-size: 12px; }
  .account-btn-text { display: none; }
  .page { padding-top: 16px; padding-bottom: 40px; }
  .card { padding: 16px; border-radius: 18px; }
  .result { padding: 14px; border-radius: 18px; }
  .input-row { flex-direction: column; }
  .input-row .btn { width: 100%; }
  .tab { padding: 9px 10px; font-size: 14px; }
  .subtabs { margin-bottom: 12px; }
  .lock { padding: 26px 16px; }
  .text-result { font-size: 12.5px; padding: 14px; }
  .drawer { width: 100%; }
  .drawer-head { padding: 16px 18px; }
  .drawer-body { padding: 18px 18px 40px; }
}