/* ============================================================
   NodeAllocator — 全局样式
   设计语言：玻璃拟态 + 极光渐变 + 微质感
   双主题：深色（默认）/ 浅色，均经过独立调校
   ============================================================ */

/* ============================================================
   1. 主题变量 — 深色（默认）
   ============================================================ */
:root {
  /* 背景 */
  --bg-deep: #0a0e1a;
  --bg-mid: #0f1626;
  --bg-aurora-1: rgba(56, 189, 248, 0.12);
  --bg-aurora-2: rgba(129, 140, 248, 0.10);
  --bg-aurora-3: rgba(34, 211, 238, 0.06);
  --grid-line: rgba(100, 160, 220, 0.04);

  /* 卡片 */
  --card-bg-1: rgba(22, 32, 54, 0.72);
  --card-bg-2: rgba(15, 22, 40, 0.68);
  --card-border: rgba(100, 180, 255, 0.12);
  --card-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  --card-highlight: rgba(255, 255, 255, 0.05);
  --card-top-line: rgba(125, 211, 252, 0.4);

  /* 文字 */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0f172a;

  /* 强调色 */
  --accent-1: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #a78bfa;
  --accent-soft: rgba(56, 189, 248, 0.15);

  /* 渐变 */
  --grad-primary: linear-gradient(135deg, #0ea5e9, #818cf8);
  --grad-primary-hover: linear-gradient(135deg, #38bdf8, #a78bfa);

  /* 状态环 */
  --ring-1: #38bdf8;
  --ring-2: #818cf8;
  --ring-3: #22d3ee;
  --ring-4: #a78bfa;
  --core-grad: radial-gradient(circle at 35% 35%, #7dd3fc, #0ea5e9 60%, #0369a1);
  --core-glow: 0 0 24px rgba(56, 189, 248, 0.5), 0 0 48px rgba(56, 189, 248, 0.2);

  /* 进度条 */
  --progress-track: rgba(100, 160, 220, 0.1);
  --progress-grad: linear-gradient(90deg, #0ea5e9, #818cf8);

  /* 按钮 */
  --btn-primary-bg: linear-gradient(135deg, #2563eb, #1d4ed8);
  --btn-primary-hover: linear-gradient(135deg, #3b82f6, #2563eb);
  --btn-primary-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  --btn-primary-shadow-hover: 0 6px 24px rgba(37, 99, 235, 0.5);
  --btn-secondary-bg: rgba(51, 65, 85, 0.6);
  --btn-secondary-hover: rgba(71, 85, 105, 0.7);
  --btn-secondary-border: rgba(148, 163, 184, 0.15);

  /* 错误 */
  --err-bg-1: rgba(40, 20, 30, 0.6);
  --err-bg-2: rgba(30, 16, 24, 0.55);
  --err-border: rgba(248, 113, 113, 0.2);
  --err-title: #fca5a5;
  --err-desc: #b8c2cc;
  --err-icon: #f87171;
  --err-icon-glow: drop-shadow(0 0 8px rgba(248, 113, 113, 0.4));

  /* 域名状态 */
  --domain-chip-bg: rgba(56, 189, 248, 0.08);
  --domain-chip-border: rgba(56, 189, 248, 0.15);
  --status-ok: #34d399;
  --status-checking: #38bdf8;
  --status-blocked: #fbbf24;

  /* 备用线路 */
  --fallback-bg: rgba(30, 41, 59, 0.5);
  --fallback-hover: rgba(51, 65, 85, 0.7);
  --fallback-border: rgba(100, 180, 255, 0.1);

  /* 其他 */
  --footer-text: #475569;
  --toast-bg: rgba(30, 41, 59, 0.95);
  --toast-border: rgba(100, 180, 255, 0.2);
  --retry-dot: #38bdf8;
  --theme-toggle-bg: rgba(51, 65, 85, 0.5);
  --theme-toggle-hover: rgba(71, 85, 105, 0.6);
  --particle: rgba(125, 211, 252, 0.5);
  --selection-bg: rgba(56, 189, 248, 0.3);
  --scrollbar-thumb: rgba(100, 160, 220, 0.3);
}

/* ============================================================
   2. 主题变量 — 浅色
   ============================================================ */
[data-theme="light"] {
  --bg-deep: #eef2f8;
  --bg-mid: #e3ebf7;
  --bg-aurora-1: rgba(56, 189, 248, 0.18);
  --bg-aurora-2: rgba(129, 140, 248, 0.12);
  --bg-aurora-3: rgba(34, 211, 238, 0.08);
  --grid-line: rgba(50, 100, 180, 0.05);

  --card-bg-1: rgba(255, 255, 255, 0.88);
  --card-bg-2: rgba(248, 250, 252, 0.82);
  --card-border: rgba(50, 120, 200, 0.15);
  --card-shadow: 0 20px 56px rgba(30, 80, 160, 0.12);
  --card-highlight: rgba(255, 255, 255, 0.7);
  --card-top-line: rgba(56, 189, 248, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #f8fafc;

  --accent-1: #0284c7;
  --accent-2: #4f46e5;
  --accent-3: #7c3aed;
  --accent-soft: rgba(2, 132, 199, 0.1);

  --grad-primary: linear-gradient(135deg, #0284c7, #4f46e5);
  --grad-primary-hover: linear-gradient(135deg, #0ea5e9, #6366f1);

  --ring-1: #0284c7;
  --ring-2: #4f46e5;
  --ring-3: #06b6d4;
  --ring-4: #7c3aed;
  --core-grad: radial-gradient(circle at 35% 35%, #7dd3fc, #0284c7 60%, #0369a1);
  --core-glow: 0 0 20px rgba(2, 132, 199, 0.35), 0 0 40px rgba(2, 132, 199, 0.15);

  --progress-track: rgba(50, 120, 200, 0.1);
  --progress-grad: linear-gradient(90deg, #0284c7, #4f46e5);

  --btn-primary-bg: linear-gradient(135deg, #2563eb, #1d4ed8);
  --btn-primary-hover: linear-gradient(135deg, #3b82f6, #2563eb);
  --btn-primary-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  --btn-primary-shadow-hover: 0 6px 20px rgba(37, 99, 235, 0.35);
  --btn-secondary-bg: rgba(255, 255, 255, 0.7);
  --btn-secondary-hover: rgba(241, 245, 249, 0.9);
  --btn-secondary-border: rgba(148, 163, 184, 0.25);

  --err-bg-1: rgba(254, 242, 242, 0.9);
  --err-bg-2: rgba(254, 226, 226, 0.8);
  --err-border: rgba(239, 68, 68, 0.2);
  --err-title: #dc2626;
  --err-desc: #7f1d1d;
  --err-icon: #ef4444;
  --err-icon-glow: drop-shadow(0 0 6px rgba(239, 68, 68, 0.25));

  --domain-chip-bg: rgba(2, 132, 199, 0.06);
  --domain-chip-border: rgba(2, 132, 199, 0.12);
  --status-ok: #059669;
  --status-checking: #0284c7;
  --status-blocked: #d97706;

  --fallback-bg: rgba(255, 255, 255, 0.6);
  --fallback-hover: rgba(241, 245, 249, 0.9);
  --fallback-border: rgba(50, 120, 200, 0.1);

  --footer-text: #94a3b8;
  --toast-bg: rgba(255, 255, 255, 0.95);
  --toast-border: rgba(50, 120, 200, 0.15);
  --retry-dot: #0284c7;
  --theme-toggle-bg: rgba(255, 255, 255, 0.6);
  --theme-toggle-hover: rgba(255, 255, 255, 0.85);
  --particle: rgba(56, 189, 248, 0.4);
  --selection-bg: rgba(2, 132, 199, 0.2);
  --scrollbar-thumb: rgba(50, 120, 200, 0.25);
}

/* ============================================================
   3. 基础重置
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  position: relative;
  background: var(--bg-deep);
  color: var(--text-primary);
  transition: background 0.8s ease, color 0.8s ease;
}

/* 选中文字颜色 */
::selection {
  background: var(--selection-bg);
  color: var(--text-primary);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

/* ============================================================
   4. 动态背景层
   ============================================================ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* 极光渐变 */
.bg-aurora {
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse at 20% 30%, var(--bg-aurora-1), transparent 50%),
    radial-gradient(ellipse at 80% 70%, var(--bg-aurora-2), transparent 50%),
    radial-gradient(ellipse at 50% 50%, var(--bg-aurora-3), transparent 70%);
  animation: auroraShift 20s ease-in-out infinite alternate;
  transition: background 0.8s ease;
}

@keyframes auroraShift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-2%, 1%) scale(1.05); }
  100% { transform: translate(2%, -1%) scale(1.02); }
}

/* 网格叠加 */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 25%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, black 25%, transparent 75%);
  transition: background-image 0.8s ease;
}

/* 浮动粒子 */
.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--particle), transparent 70%);
  pointer-events: none;
  animation: particleFloat linear infinite;
  transition: background 0.8s ease;
}

@keyframes particleFloat {
  0%   { transform: translateY(110vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ============================================================
   5. 主题切换按钮
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  right: calc(env(safe-area-inset-right) + 16px);
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--theme-toggle-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--theme-toggle-hover);
  transform: scale(1.08);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 22px;
  height: 22px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle .icon-sun { display: none; color: #f59e0b; }
.theme-toggle .icon-moon { display: block; color: #e2e8f0; }

[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.theme-toggle.spinning svg {
  transform: rotate(360deg);
}

/* ============================================================
   6. 主容器 + 卡片
   ============================================================ */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  text-align: center;
  padding: 0 16px;
}

.card {
  background: linear-gradient(145deg, var(--card-bg-1), var(--card-bg-2));
  border-radius: clamp(16px, 4vw, 22px);
  padding: clamp(36px, 8vw, 52px) clamp(24px, 6vw, 40px) clamp(32px, 7vw, 44px);
  border: 1px solid var(--card-border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--card-shadow), inset 0 1px 0 var(--card-highlight);
  position: relative;
  overflow: hidden;
  animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  transition: background 0.8s ease, border-color 0.8s ease, box-shadow 0.8s ease;
}

/* 卡片顶部高光线 */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-top-line), transparent);
  transition: background 0.8s ease;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   7. 状态图标 — 双环旋转 + 脉冲核心
   ============================================================ */
.status-icon {
  width: clamp(60px, 16vw, 76px);
  height: clamp(60px, 16vw, 76px);
  margin: 0 auto clamp(18px, 4vw, 26px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--ring-1);
  border-right-color: var(--ring-2);
  animation: ringSpin 1.1s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
  transition: border-color 0.8s ease;
}

.ring-inner {
  inset: clamp(5px, 1.5vw, 8px);
  animation-duration: 1.6s;
  animation-direction: reverse;
  border-top-color: var(--ring-3);
  border-right-color: var(--ring-4);
  opacity: 0.65;
}

.core {
  width: clamp(22px, 6vw, 30px);
  height: clamp(22px, 6vw, 30px);
  border-radius: 50%;
  background: var(--core-grad);
  box-shadow: var(--core-glow);
  animation: corePulse 2s ease-in-out infinite;
  transition: background 0.8s ease, box-shadow 0.8s ease;
}

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

@keyframes corePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ============================================================
   8. 文字内容
   ============================================================ */
.title {
  font-size: clamp(17px, 4.5vw, 21px);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: clamp(8px, 2vw, 12px);
  letter-spacing: 0.3px;
  transition: color 0.8s ease;
}

.desc {
  font-size: clamp(13px, 3.5vw, 14.5px);
  color: var(--text-secondary);
  margin-bottom: clamp(4px, 1vw, 6px);
  line-height: 1.6;
  transition: color 0.8s ease;
}

/* ============================================================
   9. 域名信息芯片（新增）
   ============================================================ */
.domain-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: clamp(14px, 3vw, 20px) 0 clamp(4px, 1vw, 6px);
  padding: 8px 14px;
  background: var(--domain-chip-bg);
  border: 1px solid var(--domain-chip-border);
  border-radius: 10px;
  font-size: clamp(11.5px, 3vw, 13px);
  transition: all 0.8s ease;
  flex-wrap: wrap;
}

.domain-chip-label {
  color: var(--text-tertiary);
  font-size: 0.9em;
}

.domain-chip-host {
  color: var(--text-primary);
  font-weight: 500;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.3px;
}

.domain-chip-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9em;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.domain-chip-status .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dotPulse 1.2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

.status-checking { color: var(--status-checking); background: rgba(56, 189, 248, 0.1); }
.status-ok       { color: var(--status-ok);       background: rgba(52, 211, 153, 0.1); }
.status-blocked  { color: var(--status-blocked);  background: rgba(251, 191, 36, 0.1); }

/* ============================================================
   10. 重试提示
   ============================================================ */
.retry-tip {
  font-size: clamp(11.5px, 3vw, 13px);
  color: var(--text-tertiary);
  margin-bottom: clamp(18px, 4vw, 28px);
  height: clamp(16px, 4vw, 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.8s ease;
}

.retry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--retry-dot);
  animation: dotBlink 1s ease-in-out infinite;
  transition: background 0.8s ease;
}

@keyframes dotBlink {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ============================================================
   11. 进度条
   ============================================================ */
.progress-wrap {
  width: 100%;
  height: 3px;
  background: var(--progress-track);
  border-radius: 2px;
  overflow: hidden;
  margin-top: clamp(4px, 1vw, 8px);
  transition: background 0.8s ease;
}

.progress-bar {
  height: 100%;
  background: var(--progress-grad);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease, background 0.8s ease;
  position: relative;
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: progressShimmer 1.5s linear infinite;
}

@keyframes progressShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   12. 错误面板
   ============================================================ */
.error-panel {
  background: linear-gradient(145deg, var(--err-bg-1), var(--err-bg-2));
  border: 1px solid var(--err-border);
  border-radius: clamp(14px, 3.5vw, 18px);
  padding: clamp(22px, 5vw, 30px) clamp(20px, 5vw, 26px);
  margin-top: clamp(14px, 3vw, 20px);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: errorIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition: background 0.8s ease, border-color 0.8s ease;
}

@keyframes errorIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.error-icon {
  color: var(--err-icon);
  filter: var(--err-icon-glow);
  margin-bottom: clamp(8px, 2vw, 12px);
  transition: color 0.8s ease, filter 0.8s ease;
}

.error-icon svg {
  width: clamp(28px, 7vw, 36px);
  height: clamp(28px, 7vw, 36px);
}

.error-title {
  color: var(--err-title);
  font-size: clamp(14.5px, 3.8vw, 16.5px);
  font-weight: 600;
  margin-bottom: clamp(8px, 2vw, 10px);
  transition: color 0.8s ease;
}

.error-desc {
  font-size: clamp(12.5px, 3.3vw, 14px);
  color: var(--err-desc);
  line-height: 1.8;
  margin-bottom: clamp(18px, 4vw, 24px);
  transition: color 0.8s ease;
}

/* ============================================================
   13. 备用线路列表（新增）
   ============================================================ */
.fallback-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: clamp(18px, 4vw, 24px);
}

.fallback-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--fallback-bg);
  border: 1px solid var(--fallback-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
}

.fallback-item:hover {
  background: var(--fallback-hover);
  transform: translateX(4px);
  border-color: var(--accent-1);
}

.fallback-item:active {
  transform: translateX(2px) scale(0.99);
}

.fallback-item:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}

.fallback-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 70px;
}

.fallback-host {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  word-break: break-all;
}

.fallback-arrow {
  color: var(--text-tertiary);
  transition: transform 0.25s ease, color 0.25s ease;
  flex-shrink: 0;
}

.fallback-arrow svg {
  width: 16px;
  height: 16px;
}

.fallback-item:hover .fallback-arrow {
  transform: translateX(3px);
  color: var(--accent-1);
}

/* ============================================================
   14. 按钮
   ============================================================ */
.btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: clamp(10px, 2.5vw, 12px) clamp(20px, 5vw, 26px);
  border: none;
  border-radius: clamp(8px, 2vw, 11px);
  font-size: clamp(12.5px, 3.3vw, 14px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  letter-spacing: 0.3px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}

/* 主按钮 */
.btn-primary {
  background: var(--btn-primary-bg);
  color: #fff;
  box-shadow: var(--btn-primary-shadow);
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--btn-primary-shadow-hover);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

/* 次按钮 */
.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--text-primary);
  border: 1px solid var(--btn-secondary-border);
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.97);
}

/* ============================================================
   15. 底部信息
   ============================================================ */
.footer {
  margin-top: clamp(18px, 4vw, 26px);
  font-size: clamp(10px, 2.5vw, 11.5px);
  color: var(--footer-text);
  letter-spacing: 1.5px;
  transition: color 0.8s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-sep {
  opacity: 0.5;
}

/* ============================================================
   16. Toast 提示
   ============================================================ */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  color: var(--text-primary);
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 13.5px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ============================================================
   17. 响应式 — 平板 / 小桌面（≥640px）
   ============================================================ */
@media (min-width: 640px) {
  .container {
    max-width: 480px;
  }
  .card {
    padding: 56px 44px 48px;
  }
}

/* ============================================================
   18. 响应式 — 超小屏手机（< 360px）
   ============================================================ */
@media (max-width: 359px) {
  .container {
    padding: 0 12px;
  }
  .card {
    padding: 32px 20px 28px;
  }
  .btn-group {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-group .btn {
    width: 100%;
  }
  .domain-chip {
    padding: 6px 10px;
    gap: 6px;
  }
}

/* ============================================================
   19. 响应式 — 横屏手机（高度不足）
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    align-items: flex-start;
    padding-top: 16px;
  }
  .card {
    padding: 24px 32px;
  }
  .status-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }
  .core {
    width: 20px;
    height: 20px;
  }
  .title {
    margin-bottom: 6px;
  }
  .domain-chip {
    margin-top: 10px;
    margin-bottom: 4px;
  }
  .retry-tip {
    margin-bottom: 14px;
  }
  .footer {
    display: none;
  }
}

/* ============================================================
   20. 减少动效偏好（无障碍）
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   21. 高对比度模式适配
   ============================================================ */
@media (prefers-contrast: high) {
  .card {
    border-width: 2px;
  }
  .btn-primary,
  .btn-secondary {
    border-width: 2px;
  }
}
