@import url("https://fonts.googleapis.cn/css2?family=Noto+Sans+SC:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap");

:root {
  --bg-base: #0f172a;
  --bg-deep: #020617;
  --surface: #1e293b;
  --primary: #3b82f6;
  --gold: #f59e0b;
  --crypto: #06b6d4;
  --options: #8b5cf6;
  --up: #10b981;
  --down: #ef4444;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-padding-top: 80px;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: "Noto Sans SC", system-ui, sans-serif;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

/* 数字等宽防抖动 */
.font-mono,
.tabular {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ===== 背景网格 ===== */
.bg-grid {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ===== 远景光晕 ===== */
.blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
}
.blob-blue {
  width: 520px;
  height: 520px;
  background: #3b82f6;
  top: -120px;
  left: -100px;
  animation: float 18s ease-in-out infinite;
}
.blob-gold {
  width: 420px;
  height: 420px;
  background: #f59e0b;
  top: 200px;
  right: -120px;
  opacity: 0.22;
  animation: float 22s ease-in-out infinite reverse;
}
.blob-violet {
  width: 460px;
  height: 460px;
  background: #8b5cf6;
  bottom: -160px;
  left: 30%;
  opacity: 0.18;
  animation: float 26s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -40px) scale(1.08); }
}

/* ===== 跑马灯 ===== */
.ticker-mask {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}
.ticker-track {
  animation: ticker 40s linear infinite;
  will-change: transform;
}
.ticker-mask:hover .ticker-track {
  animation-play-state: paused;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-card {
  flex: 0 0 auto;
  min-width: 168px;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.625rem 0.875rem;
}
.tick-flash-up { animation: flashUp 0.6s ease-out; }
.tick-flash-down { animation: flashDown 0.6s ease-out; }
@keyframes flashUp {
  0% { background-color: rgba(16, 185, 129, 0.25); }
  100% { background-color: rgba(15, 23, 42, 0.6); }
}
@keyframes flashDown {
  0% { background-color: rgba(239, 68, 68, 0.25); }
  100% { background-color: rgba(15, 23, 42, 0.6); }
}

/* ===== Tabs ===== */
.tab-btn {
  color: #94a3b8;
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(245, 158, 11, 0.12));
  color: #f1f5f9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.tab-panel {
  animation: tabIn 0.28s ease-out;
}
@keyframes tabIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 滚动揭示 ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  min-width: 0;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 计算器结果卡 ===== */
.result-card {
  animation: resultPop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes resultPop {
  0% { opacity: 0; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== 测验 ===== */
.quiz-option {
  cursor: pointer;
  transition: all 0.18s ease;
}
.quiz-option:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}
.quiz-option.correct {
  border-color: rgba(16, 185, 129, 0.6) !important;
  background: rgba(16, 185, 129, 0.12) !important;
}
.quiz-option.wrong {
  border-color: rgba(239, 68, 68, 0.6) !important;
  background: rgba(239, 68, 68, 0.12) !important;
}
.quiz-option.disabled {
  pointer-events: none;
  opacity: 0.7;
}

/* 答题后 2.6s 停顿倒计时进度条 */
.quiz-countdown { width: 100%; }
.quiz-countdown-bar { height: 6px; }
.quiz-countdown-fill {
  transition: width 0.1s linear;
  box-shadow: 0 0 12px currentColor;
}
@media (prefers-reduced-motion: reduce) {
  .quiz-countdown-fill { transition: none; }
}

/* 分享给朋友 */
.share-link-input {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 8px;
  border: 2px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ===== 全局响应式微调 ===== */
.ticker-card {
  min-width: 150px;
}
@media (min-width: 640px) {
  .ticker-card {
    min-width: 168px;
  }
}

/* 触控目标最小 44px */
.tab-btn,
.country-item,
button,
select,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}
.tab-btn {
  min-height: 42px;
}
.country-item {
  min-height: 40px;
}

/* 表单元素在 iOS 上不自动缩放（字号 >= 16px 已由 Tailwind text-sm=14px 处理，这里聚焦选择框） */
@media (max-width: 639px) {
  /* 小屏缩小区块纵向间距，减少滚动长度 */
  section {
    scroll-margin-top: 70px;
  }
  .pitfall-card {
    padding: 1rem;
  }
}

/* 大屏优化：Hero 标题更大、留白更舒展 */
@media (min-width: 1024px) {
  section {
    scroll-margin-top: 80px;
  }
}

/* 尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ===== 登录/注册弹窗 ===== */
.auth-modal {
  display: none;
}
.auth-modal.open {
  display: flex;
  justify-content: center;
}
@media (min-width: 640px) {
  .auth-modal.open {
    align-items: center;
  }
}
.auth-modal .auth-card {
  animation: authIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
body.auth-lock {
  overflow: hidden;
}

.auth-mode-btn {
  color: #94a3b8;
}
.auth-mode-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.08));
  color: #f1f5f9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.auth-method-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
}

/* 区号下拉 */
.auth-dropdown {
  animation: dropIn 0.18s ease-out;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.country-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #cbd5e1;
  transition: background 0.12s;
}
.country-item:hover,
.country-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}
.country-item .ci-flag {
  font-size: 16px;
  line-height: 1;
}
.country-item .ci-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.country-item .ci-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: #94a3b8;
}

/* 验证码倒计时 */
#sendCodeBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
