/* ==========================================================================
   卡猿杯 · 基础设计系统（颜色令牌 / 重置 / 通用组件）
   仅使用系统字体，不依赖任何外部 CDN，保证微信内置浏览器秒开。
   ========================================================================== */

:root {
  /* 深色主题（默认） */
  --bg: #070a16;
  --bg-2: #0b1024;
  --bg-3: #131a35;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.075);
  --panel-3: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eef2ff;
  --text-2: #a9b3d4;
  --text-3: #6d789e;
  --gold: #ffcd6b;
  --gold-2: #ffa23a;
  --accent: #5b8dff;
  --accent-2: #8b5cf6;
  --ok: #35d68e;
  --warn: #ffb020;
  --danger: #ff5f6d;
  --info: #4bb8ff;

  --radius-xl: 26px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow-lg: 0 26px 60px -28px rgba(0, 0, 0, 0.9);
  --shadow: 0 16px 40px -22px rgba(0, 0, 0, 0.85);
  --shadow-sm: 0 8px 20px -12px rgba(0, 0, 0, 0.7);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --vh: 1vh;
}

/* 浅色主题 */
[data-theme="light"] {
  --bg: #f4f6fd;
  --bg-2: #e9eefb;
  --bg-3: #dde5f7;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-2: rgba(255, 255, 255, 0.94);
  --panel-3: rgba(17, 26, 58, 0.06);
  --border: rgba(21, 33, 71, 0.1);
  --border-strong: rgba(21, 33, 71, 0.18);
  --text: #131a35;
  --text-2: #4a5580;
  --text-3: #7c86ab;
  --gold: #b8801a;
  --gold-2: #d98b1c;
  --accent: #2f62e0;
  --accent-2: #6d3ce0;
  --shadow-lg: 0 24px 50px -30px rgba(24, 37, 84, 0.4);
  --shadow: 0 14px 34px -22px rgba(24, 37, 84, 0.35);
  --shadow-sm: 0 6px 16px -10px rgba(24, 37, 84, 0.3);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4, p, figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-touch-callout: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(255, 205, 107, 0.28);
}

/* 滚动条（桌面端后台） */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* --------------------------------------------------------------------------
   背景层：极光渐变 + 网格。全部用纯渐变实现，避免 filter: blur 在低端机掉帧。
   -------------------------------------------------------------------------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-layer .blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.72;
  will-change: transform;
}

.bg-aurora .b1 {
  width: 78vw;
  height: 78vw;
  max-width: 620px;
  max-height: 620px;
  top: -22vw;
  left: -20vw;
  background: radial-gradient(circle at 50% 50%, rgba(91, 141, 255, 0.5), transparent 68%);
  animation: drift1 22s ease-in-out infinite alternate;
}

.bg-aurora .b2 {
  width: 70vw;
  height: 70vw;
  max-width: 560px;
  max-height: 560px;
  top: 12vh;
  right: -26vw;
  background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.45), transparent 68%);
  animation: drift2 26s ease-in-out infinite alternate;
}

.bg-aurora .b3 {
  width: 82vw;
  height: 82vw;
  max-width: 620px;
  max-height: 620px;
  bottom: -28vw;
  left: -14vw;
  background: radial-gradient(circle at 50% 50%, rgba(255, 162, 58, 0.26), transparent 68%);
  animation: drift3 30s ease-in-out infinite alternate;
}

.bg-grid .b1,
.bg-grid .b2,
.bg-grid .b3,
.bg-plain .b1,
.bg-plain .b2,
.bg-plain .b3 {
  display: none;
}

.bg-layer .grid {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 78%);
  display: none;
}

.bg-grid .grid {
  display: block;
}

[data-theme="light"] .bg-layer .grid {
  background-image: linear-gradient(rgba(21, 33, 71, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 33, 71, 0.05) 1px, transparent 1px);
}

.bg-aurora::after,
.bg-grid::after,
.bg-plain::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% -14%, transparent 42%, var(--bg) 100%);
  opacity: 0.58;
}

@keyframes drift1 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vw, 5vh, 0) scale(1.12); }
}
@keyframes drift2 {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to { transform: translate3d(-7vw, -6vh, 0) scale(0.92); }
}
@keyframes drift3 {
  from { transform: translate3d(0, 0, 0) scale(0.95); }
  to { transform: translate3d(5vw, -4vh, 0) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   通用组件
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chip--gold {
  color: var(--gold);
  border-color: rgba(255, 205, 107, 0.32);
  background: rgba(255, 205, 107, 0.09);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  border: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #241703;
  box-shadow: 0 14px 30px -14px rgba(255, 164, 58, 0.75);
}

/* 浅色主题下改用更亮的琥珀金 + 深棕字，对比度与质感都更好 */
[data-theme="light"] .btn--primary {
  background: linear-gradient(135deg, #ffc857, #e58f11);
  color: #3a2600;
  box-shadow: 0 14px 28px -16px rgba(229, 143, 17, 0.65);
}

.btn--ghost {
  background: transparent;
}

.btn--danger {
  color: var(--danger);
  border-color: rgba(255, 95, 109, 0.35);
  background: rgba(255, 95, 109, 0.08);
}

.btn--sm {
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 10px;
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.field {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  /* 关键：iOS / 微信聚焦时不缩放，font-size 必须 ≥16px */
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field::placeholder {
  color: var(--text-3);
}

.field:focus {
  border-color: rgba(91, 141, 255, 0.65);
  background: var(--panel-2);
  box-shadow: 0 0 0 4px rgba(91, 141, 255, 0.14);
}

textarea.field {
  resize: vertical;
  min-height: 88px;
}

.label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 90;
  transform: translate(-50%, 16px);
  max-width: min(88vw, 420px);
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(12, 16, 36, 0.92);
  color: #fff;
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

[data-theme="light"] .toast {
  background: rgba(19, 26, 53, 0.92);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 骨架加载 */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--panel);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}
