/* styles/main.css — 仙缘令认证平台 v2（东方玉韵 · 现代设计系统） */
/* ============================================================ */
/*  1. Design Tokens                                              */
/* ============================================================ */
:root {
  /* ---- 主色调：玉 ---- */
  --jade-50:  #eafaf6;
  --jade-100: #c8f0e4;
  --jade-200: #8fe3cc;
  --jade-300: #52d1af;
  --jade-400: #2fbe97;
  --jade:     #2f8f7f;
  --jade-600: #267366;
  --jade-700: #1f6a5d;
  --jade-800: #1a5448;
  --jade-900: #124037;
  --jade-950: #0a2c26;

  /* ---- 中性色 ---- */
  --ink:      #1e2d2b;
  --ink-soft: #3a4e4b;
  --muted:    #6b7d7b;
  --stone:    #94a3a0;
  --border:   #dce8e4;
  --border-light: #eef4f2;
  --bg:       #f4f8f6;
  --bg-soft:  #fafcfb;
  --card:     #ffffff;
  --card-alt: #f9fbfa;

  /* ---- 语义色 ---- */
  --danger:       #d93a3a;
  --danger-bg:    #fef2f2;
  --danger-border:#fecaca;
  --success:      #1d8c5e;
  --success-bg:   #ecfdf5;
  --success-border:#a7f3d0;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --info:         #2563eb;
  --info-bg:      #eff6ff;

  /* ---- 阴影 ---- */
  --shadow-sm:  0 1px 2px rgba(30, 45, 43, 0.06);
  --shadow:     0 4px 16px rgba(30, 45, 43, 0.07), 0 1px 3px rgba(30, 45, 43, 0.05);
  --shadow-md:  0 8px 30px rgba(30, 45, 43, 0.09), 0 2px 6px rgba(30, 45, 43, 0.05);
  --shadow-lg:  0 16px 48px rgba(30, 45, 43, 0.12), 0 4px 12px rgba(30, 45, 43, 0.06);
  --shadow-glow: 0 0 0 3px rgba(47, 143, 127, 0.15);

  /* ---- 圆角 ---- */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* ---- 过渡 ---- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration: 250ms;
  --duration-slow: 400ms;

  /* ---- 排版 ---- */
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

/* ============================================================ */
/*  2. Reset & Base                                               */
/* ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- 背景装饰纹路 ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.4;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(47, 143, 127, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 80% 80%, rgba(47, 143, 127, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 30% 40% at 20% 70%, rgba(31, 106, 93, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

/* ============================================================ */
/*  3. Topbar                                                     */
/* ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: linear-gradient(135deg, var(--jade-800) 0%, var(--jade-900) 100%);
  color: #fff;
  box-shadow: 0 2px 16px rgba(10, 44, 38, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: all var(--duration-fast) var(--ease-out);
  font-weight: 500;
  position: relative;
}
.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 600;
}

/* ============================================================ */
/*  4. App Container & Page Transitions                           */
/* ============================================================ */
.app {
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 40px auto 20px;
  padding: 0 20px;
  animation: pageIn var(--duration-slow) var(--ease-out);
}
.app.wide-layout { max-width: 600px; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================ */
/*  5. Card System                                                */
/* ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--duration) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  text-align: center;
  margin-bottom: 28px;
}
.card-header .card-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--jade-100), var(--jade-200));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--jade-700);
}
.card-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.2px;
}
.card-header .subtitle {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 6px;
}

.card-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 24px 0;
}

/* ---- Wide Card ---- */
.card.wide { max-width: 640px; margin: 0 auto; }

/* ============================================================ */
/*  6. Form Elements                                              */
/* ============================================================ */
.form { display: flex; flex-direction: column; gap: 4px; }

/* ---- Field Wrapper ---- */
.field {
  margin-bottom: 14px;
  position: relative;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

/* ---- Input Group ---- */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--card);
  outline: none;
  transition: all var(--duration-fast) var(--ease-out);
}
.form input:focus {
  border-color: var(--jade);
  box-shadow: var(--shadow-glow);
}
.form input.error-input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(217, 58, 58, 0.1);
}
.form input::placeholder { color: var(--stone); opacity: 0.7; }

/* ---- Password Toggle ---- */
.pwd-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--stone);
  padding: 6px;
  line-height: 1;
  transition: color var(--duration-fast);
  z-index: 1;
}
.pwd-toggle:hover { color: var(--ink-soft); }

/* ---- Field Error ---- */
.field-error {
  color: var(--danger);
  font-size: 12px;
  min-height: 18px;
  margin-top: 4px;
  display: none;
  animation: fadeInUp var(--duration-fast) var(--ease-out);
}

/* ---- Inline Message ---- */
.msg {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: none;
  animation: fadeInUp var(--duration-fast) var(--ease-out);
}
.msg.error   { display: block; background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.msg.success { display: block; background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.msg.warning { display: block; background: var(--warning-bg); color: var(--warning); }
.msg.info    { display: block; background: var(--info-bg); color: var(--info); }

/* ============================================================ */
/*  7. Buttons                                                    */
/* ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn.primary {
  background: linear-gradient(135deg, var(--jade), var(--jade-600));
  color: #fff;
  box-shadow: 0 2px 8px rgba(47, 143, 127, 0.3);
}
.btn.primary:hover {
  background: linear-gradient(135deg, var(--jade-600), var(--jade-700));
  box-shadow: 0 4px 14px rgba(47, 143, 127, 0.4);
  transform: translateY(-1px);
}
.btn.primary:active { transform: translateY(0) scale(0.98); }
.btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.secondary {
  background: var(--bg);
  color: var(--ink-soft);
  border-color: var(--border);
}
.btn.secondary:hover {
  background: var(--border-light);
  border-color: var(--stone);
}

.btn.danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn.danger:hover {
  background: var(--danger-bg);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}
.btn.ghost:hover {
  background: var(--bg);
  color: var(--ink-soft);
}

.btn.full { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; }

/* ---- Loading Spinner inside Button ---- */
.btn .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: 0.6; }
.btn.loading { pointer-events: none; }

.btn.secondary .spinner {
  border-color: rgba(107, 125, 123, 0.2);
  border-top-color: var(--muted);
}

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

/* ============================================================ */
/*  8. Links & Footer                                             */
/* ============================================================ */
.links {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 13.5px;
}
.links a {
  color: var(--jade);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--duration-fast);
  padding: 4px 0;
  position: relative;
}
.links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--jade);
  transition: width var(--duration-fast) var(--ease-out);
}
.links a:hover::after { width: 100%; }
.links a:hover { color: var(--jade-700); }

.links-between { justify-content: space-between; }

.footer {
  text-align: center;
  color: var(--stone);
  font-size: 12px;
  padding: 20px;
  margin-top: auto;
}

/* ============================================================ */
/*  9. Toast Notification System                                  */
/* ============================================================ */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  pointer-events: auto;
  animation: toastIn var(--duration-slow) var(--ease-out);
  font-size: 14px;
  line-height: 1.5;
}
.toast.removing {
  animation: toastOut var(--duration) var(--ease-in-out) forwards;
}
.toast .toast-body { flex: 1; }
.toast .toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--stone);
  padding: 2px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity var(--duration-fast);
}
.toast .toast-close:hover { opacity: 1; }

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* ============================================================ */
/* 10. User Center — Profile & Sections                          */
/* ============================================================ */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, var(--jade-50), var(--bg-soft));
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--jade-300), var(--jade));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(47, 143, 127, 0.25);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.profile-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.profile-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.profile-badge.admin {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
}
.profile-badge.user {
  background: var(--jade-100);
  color: var(--jade-800);
}

/* ---- Info Grid ---- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.info-item {
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.info-item-label {
  font-size: 11.5px;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.info-item-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

/* ---- Section Title ---- */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 18px;
  background: var(--jade);
  border-radius: 2px;
}

/* ---- Action Bar ---- */
.action-bar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ============================================================ */
/* 11. Radio Group                                               */
/* ============================================================ */
.radio-group {
  display: flex;
  gap: 8px;
  margin: 2px 0 8px;
}
.radio-pill {
  position: relative;
  flex: 1;
}
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill label {
  display: block;
  text-align: center;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  background: var(--card);
}
.radio-pill input:checked + label {
  border-color: var(--jade);
  background: var(--jade-50);
  color: var(--jade-700);
}
.radio-pill label:hover { border-color: var(--jade-300); }

/* ============================================================ */
/* 11b. Nav — Notification Bell & Avatar                         */
/* ============================================================ */
.nav-notif { position: relative; }
.nav-notif .notif-badge {
  position: absolute;
  top: -3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--jade-900);
  pointer-events: none;
}

.nav-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
  transition: box-shadow var(--duration-fast) var(--ease-out);
}
.nav-avatar:hover { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================ */
/* 11c. Notifications (站内信)                                    */
/* ============================================================ */
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.notif-head .section-title { margin-bottom: 0; }

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all var(--duration-fast) var(--ease-out);
}
.notif-item.unread {
  background: var(--jade-50);
  border-color: var(--jade-100);
  cursor: pointer;
}
.notif-item.unread:hover { box-shadow: var(--shadow); }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
  background: transparent;
}
.notif-item.unread .notif-dot {
  background: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-100);
}
.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  word-break: break-word;
}
.notif-content {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.notif-time {
  font-size: 12px;
  color: var(--stone);
  margin-top: 6px;
}
.notif-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  font-size: 14px;
}

/* ============================================================ */
/* 11d. Avatar Upload (用户中心)                                  */
/* ============================================================ */
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar { position: relative; cursor: pointer; overflow: hidden; }
.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.avatar-edit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 44, 38, 0.5);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.profile-avatar:hover .avatar-edit { opacity: 1; }

/* ============================================================ */
/* 11e. Textarea & Small Button                                   */
/* ============================================================ */
.form-textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--card);
  outline: none;
  resize: vertical;
  transition: all var(--duration-fast) var(--ease-out);
}
.form-textarea:focus {
  border-color: var(--jade);
  box-shadow: var(--shadow-glow);
}
.form-textarea::placeholder { color: var(--stone); opacity: 0.7; }

.btn.sm { padding: 6px 14px; font-size: 13px; }

/* ============================================================ */
/* 11f. Modal Dialog & Avatar Cropper                            */
/* ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 44, 38, 0.45);
  backdrop-filter: blur(2px);
  animation: modalIn var(--duration) var(--ease-out);
}
.modal-overlay.closing { animation: modalOut var(--duration-fast) var(--ease-in-out) forwards; }

.modal-box {
  width: 384px;
  max-width: calc(100vw - 40px);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scaleIn var(--duration) var(--ease-out);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--stone);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
}
.modal-close:hover { background: var(--bg); color: var(--ink-soft); }

.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}
.modal-footer .btn { min-width: 92px; }

/* ---- 裁剪 ---- */
.crop-body { text-align: center; }
.crop-hint { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.crop-stage-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.crop-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 2px solid var(--jade);
  box-shadow: var(--shadow);
  cursor: grab;
  background: #1a5448;
  user-select: none;
  touch-action: none;
}
.crop-stage.grabbing { cursor: grabbing; }
.crop-img {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  will-change: left, top, width, height;
}
.crop-zoom-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.crop-zoom-label { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.crop-zoom { flex: 1; max-width: 240px; accent-color: var(--jade); }

@keyframes modalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ============================================================ */
/* 11.5 新功能：仙晶 / 游戏 / CDKey                                */
/* ============================================================ */

/* 导航 仙晶余额 chip */
.nav-balance {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--jade-100), var(--jade-200));
  color: var(--jade-800);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--jade-200);
  white-space: nowrap;
}

/* 按钮行（查询 + 激活） */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.btn-row .btn { flex: 1; }

/* 小号按钮 */
.btn.sm { padding: 6px 14px; font-size: 13px; min-height: 34px; }

/* 危险按钮 */
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { background: #c22f2f; }

/* CDKey 预览 */
.cdkey-preview {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card-alt);
  border: 1px solid var(--border);
  animation: fadeUp .3s var(--ease-out);
}
.cdkey-preview-title { font-weight: 600; margin-bottom: 8px; }
.cdkey-preview-title.ok { color: var(--success); }
.cdkey-preview-title.bad { color: var(--danger); }
.cdkey-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.cdkey-key { color: var(--muted); }
.cdkey-val { color: var(--ink); font-weight: 600; }
.cdkey-val.xj { color: var(--jade-600); }

/* 通用区块标题 / 空提示 */
.section-title {
  margin: 22px 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  border-left: 3px solid var(--jade-300);
  padding-left: 10px;
}
.empty-tip {
  color: var(--muted);
  font-size: 13.5px;
  background: var(--card-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
}
.muted-center { color: var(--muted); text-align: center; padding: 30px 0; }

/* 游戏网格 */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.game-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all .25s var(--ease-out);
}
.game-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.game-tile.add { border-style: dashed; background: var(--card-alt); }
.game-thumb {
  width: 56px; height: 56px;
  border-radius: 14px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--jade-100), var(--jade-300));
  color: #fff; font-size: 24px; font-weight: 700;
}
.game-thumb.empty { color: var(--jade-800); }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-name { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.game-desc {
  font-size: 12.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 32px;
}

/* 仙晶余额卡片 */
.xj-balance {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  margin: 8px 0 20px;
  padding: 22px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--jade-50), var(--jade-100));
  border: 1px solid var(--jade-200);
}
.xj-balance-label { font-size: 13px; color: var(--jade-700); }
.xj-balance-num { font-size: 30px; font-weight: 800; color: var(--jade-800); letter-spacing: .5px; }

/* 面板标题 */
.panel-title {
  font-size: 15px; font-weight: 700; color: var(--ink-soft);
  margin: 6px 0 14px;
}

/* select 样式（与 input 一致） */
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--jade-300);
  box-shadow: var(--shadow-glow);
}
.exchange-note {
  font-size: 12.5px; color: var(--muted);
  background: var(--info-bg); border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px;
}

/* CDKey 生成结果 */
.cdkey-result { margin-top: 18px; }
.cdkey-result-title { font-weight: 700; color: var(--jade-700); margin-bottom: 8px; }
.cdkey-codes {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-alt);
  resize: vertical;
  margin-bottom: 8px;
  color: var(--ink);
}

/* CDKey 已生成列表 */
.cdkey-list-wrap { margin-top: 8px; }
.cdkey-rows {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 360px; overflow: auto;
}
.cdkey-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 1fr 0.8fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13.5px;
}
.ck-code { font-family: ui-monospace, Menlo, monospace; font-weight: 600; letter-spacing: .5px; }
.ck-xj { color: var(--jade-600); font-weight: 600; }
.ck-game { color: var(--muted); }
.ck-status {
  justify-self: end;
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.ck-status.unused { background: var(--success-bg); color: var(--success); }
.ck-status.used { background: var(--bg-soft); color: var(--stone); }
.ck-status.disabled { background: var(--danger-bg); color: var(--danger); }

/* 游戏管理列表 */
.game-admin-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.game-admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card);
}
.game-admin-name { font-weight: 600; color: var(--ink); }
.game-admin-desc { font-size: 12.5px; color: var(--muted); }

/* ============================================================ */
/* 12. Responsive                                                 */
/* ============================================================ */
@media (max-width: 520px) {
  .topbar { padding: 0 16px; height: 50px; }
  .brand { font-size: 15px; }
  .nav a { font-size: 12.5px; padding: 5px 10px; }
  .app { margin-top: 24px; padding: 0 14px; max-width: 100%; }
  .card { padding: 24px 18px; border-radius: var(--radius-md); }
  .card-header h2 { font-size: 20px; }
  .info-grid { grid-template-columns: 1fr; }
  .toast-container { right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: unset; }
  .btn-row { flex-direction: column; }
  .profile-card { flex-direction: column; text-align: center; }
}
