/* ============================================================
   常用工具 · Cosmos 主题 · 公共样式
   云顶智慧 (ws.yundingzhihui.cn)
   版本: 1.0 | 2026-06-03
   ============================================================ */

/* ========== CSS 变量 (Design Token) ========== */
:root {
  /* 字体 */
  --font-display: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;

  /* 背景色系 */
  --bg-deep: #0a0e1a;
  --bg-base: #0f1326;
  --bg-elevated: #141832;
  --bg-glass: rgba(20, 24, 50, 0.65);
  --bg-glass-hover: rgba(26, 30, 60, 0.75);
  --bg-input: rgba(10, 14, 28, 0.6);

  /* 边框 */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-accent: rgba(99, 179, 237, 0.3);

  /* 文字 */
  --text-primary: #e8edf5;
  --text-secondary: #8b95ae;
  --text-tertiary: #5a6480;
  --text-muted: #3d4559;

  /* 品牌色 */
  --accent: #63b3ed;
  --accent-glow: rgba(99, 179, 237, 0.25);
  --accent-soft: rgba(99, 179, 237, 0.08);

  /* 分类色彩 (首页专用) */
  --cat-network: #38bdf8;
  --cat-network-bg: rgba(56, 189, 248, 0.1);
  --cat-network-glow: rgba(56, 189, 248, 0.2);
  --cat-dev: #34d399;
  --cat-dev-bg: rgba(52, 211, 153, 0.1);
  --cat-dev-glow: rgba(52, 211, 153, 0.2);
  --cat-convert: #fbbf24;
  --cat-convert-bg: rgba(251, 191, 36, 0.1);
  --cat-convert-glow: rgba(251, 191, 36, 0.2);
  --cat-generate: #c084fc;
  --cat-generate-bg: rgba(192, 132, 252, 0.1);
  --cat-generate-glow: rgba(192, 132, 252, 0.2);

  /* 语义色 */
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;

  /* 间距 */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px;  --space-16: 64px;  --space-20: 80px;

  /* 圆角 */
  --radius-sm: 8px;  --radius-md: 12px; --radius-lg: 16px;
  --radius-xl: 20px; --radius-full: 9999px;

  /* 阴影 */
  --shadow-card: 0 2px 8px rgba(0,0,0,.3), 0 1px 0 rgba(255,255,255,.04) inset;
  --shadow-card-hover: 0 8px 32px rgba(0,0,0,.4), 0 1px 0 rgba(255,255,255,.06) inset;
  --shadow-glow: 0 0 20px var(--accent-glow);
  --shadow-modal: 0 20px 60px rgba(0,0,0,.6);

  /* 动效 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* 布局 */
  --nav-height: 64px;
  --max-width: 1200px;
  --tool-max-width: 960px;

  /* 动画参数 */
  --stagger-delay: 60ms;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

input, textarea, .code-block, pre {
  -webkit-touch-callout: default;
  user-select: text;
  -webkit-user-select: text;
}

a { color: var(--accent); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--text-primary); }

::selection { background: rgba(99, 179, 237, 0.3); color: white; }

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

/* ========== 宇宙背景 ========== */
.cosmos-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cosmos-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(56, 189, 248, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 30%, rgba(192, 132, 252, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 80%, rgba(99, 179, 237, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 10% 70%, rgba(52, 211, 153, 0.03) 0%, transparent 50%);
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--twinkle-dur) ease-in-out infinite;
  animation-delay: var(--twinkle-delay);
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.6; }
}

/* ========== 导航栏 ========== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  gap: var(--space-4);
}

/* Logo */
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 2px 12px rgba(99, 179, 237, 0.3);
}

.nav-brand-text {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-brand:hover { color: var(--text-primary); }

/* 导航按钮 */
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.nav-btn svg { width: 20px; height: 20px; }

/* 汉堡菜单 */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.nav-hamburger:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.hamburger-lines { display: flex; flex-direction: column; gap: 4px; }
.hamburger-lines span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s var(--ease-out);
}

/* 抽屉遮罩 */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drawer-overlay.show { display: block; }

/* 移动端抽屉 */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 160;
  width: 300px;
  max-width: 85vw;
  height: 100%;
  height: 100dvh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-default);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.35s var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

.mobile-drawer.show { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-header-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.3rem;
  transition: all var(--duration-fast);
}

.drawer-close:hover { background: var(--bg-glass); color: var(--text-primary); }

.drawer-search {
  position: relative;
  margin-bottom: var(--space-5);
}

.drawer-search-input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--duration-fast);
}

.drawer-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.drawer-search-input::placeholder { color: var(--text-tertiary); }

.drawer-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.drawer-sections { flex: 1; }

.drawer-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
  margin-top: var(--space-4);
}

.drawer-section-title:first-child { margin-top: 0; }

.drawer-tool-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 2px;
  min-height: 44px;
}

.drawer-tool-link:hover, .drawer-tool-link:active {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.drawer-tool-link svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }

.drawer-actions {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.drawer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--duration-fast);
  font-family: var(--font-display);
  font-weight: 500;
  min-height: 44px;
}

.drawer-btn:hover { background: var(--bg-glass-hover); color: var(--text-primary); border-color: var(--border-hover); }
.drawer-btn svg { width: 18px; height: 18px; }

/* ========== 首页搜索栏 ========== */
.nav-search-wrap {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.nav-search-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-4) 0 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-search-input::placeholder { color: var(--text-tertiary); }

.nav-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

.nav-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color var(--duration-fast);
}

.nav-search-input:focus ~ .nav-search-icon,
.nav-search-wrap:focus-within .nav-search-icon { color: var(--accent); }

/* ========== 工具页下拉切换 ========== */
.nav-tool-switcher {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.nav-tool-select {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: all var(--duration-fast) var(--ease-out);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a6480' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.nav-tool-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

.nav-tool-switcher-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

/* 返回首页 */
.nav-back {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: var(--font-display);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-back:hover { background: var(--bg-glass); color: var(--text-primary); border-color: var(--border-hover); }
.nav-back svg { width: 16px; height: 16px; }

/* ========== 主容器 ========== */
.main-container {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.main-container--tool {
  max-width: var(--tool-max-width);
}

/* ========== 面包屑 ========== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-primary); }

/* ========== 工具头部 ========== */
.tool-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--space-8) 0 var(--space-10);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-8);
}

.tool-header-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  color: var(--accent);
  flex-shrink: 0;
  font-size: 1.5rem;
}

.tool-header-icon svg { width: 28px; height: 28px; }

.tool-header-info { flex: 1; min-width: 0; }

.tool-header-info h1 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--space-2);
}

.tool-header-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  max-width: 60ch;
  line-height: 1.6;
}

/* ========== 组件库 ========== */

/* 面板 */
.panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  backdrop-filter: blur(12px);
  margin-bottom: var(--space-4);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-desc { font-size: 0.8125rem; color: var(--text-tertiary); }
.panel-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* 输入/输出双栏 */
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 768px) { .io-grid { grid-template-columns: 1fr; } }

.io-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.io-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.io-panel-title {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.io-panel-body { flex: 1; padding: var(--space-4) var(--space-5); }

/* 表单 */
input[type="text"], input[type="url"], input[type="number"], input[type="password"],
textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  min-height: 200px;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a6480' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-group { margin-bottom: var(--space-4); }
.form-hint { font-size: 0.75rem; color: var(--text-tertiary); margin-top: var(--space-1); }
.form-inline { display: flex; gap: var(--space-3); align-items: end; }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  line-height: 1.4;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: linear-gradient(135deg, #63b3ed, #818cf8); color: #fff; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 20px var(--accent-glow); transform: translateY(-1px); }

.btn-secondary { background: var(--bg-glass); border: 1px solid var(--border-default); color: var(--text-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-glass-hover); border-color: var(--border-hover); }

.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-glass); color: var(--text-primary); }

.btn-success { background: var(--success); color: #fff; }
.btn-warn { background: var(--warning); color: #000; }
.btn-danger { background: var(--error); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* 状态标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-display);
}

.tag-success { background: rgba(52,211,153,.12); color: var(--success); }
.tag-warn { background: rgba(251,191,36,.12); color: var(--warning); }
.tag-error { background: rgba(248,113,113,.12); color: var(--error); }
.tag-info { background: var(--accent-soft); color: var(--accent); }
.tag-mono { background: rgba(255,255,255,.06); color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.7rem; }

/* 代码块 */
.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  min-height: 80px;
}

/* 结果卡片 */
.result-card {
  padding: var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
}

.result-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) 0; font-size: 0.875rem; }
.result-row + .result-row { border-top: 1px solid var(--border-subtle); }
.result-key { color: var(--text-tertiary); }
.result-val { color: var(--text-primary); font-family: var(--font-mono); font-size: 0.8125rem; }

/* 开关 */
.toggle { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; user-select: none; }
.toggle input[type="checkbox"] { display: none; }
.toggle-track { width: 40px; height: 22px; background: var(--border-default); border-radius: var(--radius-full); transition: background var(--duration-fast); position: relative; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform var(--duration-fast); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-label { font-size: 0.8125rem; color: var(--text-secondary); }

/* 提示消息 */
.tip { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: 0.8125rem; line-height: 1.6; }
.tip-info { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border-accent); }
.tip-success { background: rgba(52,211,153,.1); color: var(--success); border: 1px solid rgba(52,211,153,.15); }
.tip-warn { background: rgba(251,191,36,.1); color: var(--warning); border: 1px solid rgba(251,191,36,.15); }
.tip-error { background: rgba(248,113,113,.1); color: var(--error); border: 1px solid rgba(248,113,113,.15); }

/* 空状态 */
.empty-state { text-align: center; padding: var(--space-12) var(--space-4); color: var(--text-tertiary); }
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-3); opacity: 0.4; }
.empty-state-text { font-size: 0.9375rem; }

/* 加载动画 */
.spinner-wrap { display: flex; align-items: center; justify-content: center; padding: var(--space-6); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-default); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 进度条 */
.progress { height: 6px; background: var(--border-default); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #818cf8); transition: width var(--duration-normal) var(--ease-out); }

/* 相关工具 */
.related-tools { margin-top: var(--space-12); padding-top: var(--space-8); border-top: 1px solid var(--border-subtle); }
.related-tools h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-5); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
.related-card {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4);
  background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 0.875rem; text-decoration: none;
  backdrop-filter: blur(12px); transition: all var(--duration-normal) var(--ease-out);
}
.related-card:hover { background: var(--bg-glass-hover); border-color: var(--border-hover); transform: translateY(-2px); }
.related-card-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.related-card-icon svg { width: 16px; height: 16px; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  z-index: 300;
  box-shadow: var(--shadow-modal);
  transition: transform 0.3s var(--ease-out);
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--error); color: var(--error); }

/* ========== 反馈弹窗 ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  padding: var(--space-8);
  position: relative;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.3s var(--ease-out);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all var(--duration-fast);
}

.modal-close:hover { background: var(--bg-glass); color: var(--text-primary); border-color: var(--border-hover); }

.modal h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin-bottom: var(--space-6); }

.modal select, .modal textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  margin-bottom: var(--space-4);
  transition: all var(--duration-fast);
}

.modal textarea { resize: vertical; min-height: 100px; }
.modal select:focus, .modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.modal .char-count { text-align: right; font-size: 0.75rem; color: var(--text-tertiary); margin-top: -8px; margin-bottom: var(--space-4); }
.modal .char-count.warn { color: var(--warning); }

.modal .btn-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #63b3ed, #818cf8);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.modal .btn-submit:hover { box-shadow: 0 4px 20px var(--accent-glow); transform: translateY(-1px); }
.modal .btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.modal .tip { font-size: 0.75rem; color: var(--text-tertiary); margin-top: var(--space-4); text-align: center; }

/* ========== 页脚 ========== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  margin-top: var(--space-12);
}

.footer-inner { max-width: var(--max-width); margin: 0 auto; }

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.footer-links a { color: var(--text-tertiary); font-size: 0.8125rem; transition: color var(--duration-fast); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 0.75rem; color: var(--text-muted); }

/* ========== 动画关键帧 ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}

/* ========== 响应式设计 ========== */

/* 平板/小屏 (≤768px) */
@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .nav { padding: 0 var(--space-4); }
  .nav-inner { gap: var(--space-2); }

  /* 汉堡菜单 */
  .nav-hamburger { display: flex; }
  .nav-search-wrap { display: none; }
  .nav-tool-switcher { display: none; }
  .nav-btn { width: 44px; height: 44px; }
  .nav-back { padding: 8px 14px; font-size: 0.8125rem; min-height: 44px; }

  /* 主容器 */
  .main-container { padding: 0 var(--space-4); }

  /* 工具头部 */
  .tool-header { flex-direction: column; align-items: flex-start; padding: var(--space-6) 0 var(--space-6); }
  .tool-header-icon { width: 48px; height: 48px; }

  /* 面板 & 表单 */
  .panel { padding: var(--space-4); }
  .form-inline { flex-direction: column; }
  .io-grid { grid-template-columns: 1fr; }
  textarea { min-height: min(160px, 30vh); }
  .code-block { font-size: 0.75rem; }

  /* 弹窗 → 底部 Sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-6);
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
    animation: sheetUp 0.35s var(--ease-out);
  }

  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-close { width: 44px; height: 44px; }

  /* Toast */
  .toast { bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); }

  /* 页脚 */
  .footer-links { gap: var(--space-4); }
  .footer-links a { padding: var(--space-1) 0; min-height: 44px; display: inline-flex; align-items: center; }
  .related-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* 手机 (≤480px) */
@media (max-width: 480px) {
  .nav-back { padding: 6px 10px; font-size: 0.75rem; }
  .tool-header-icon { width: 44px; height: 44px; }
  .related-grid { grid-template-columns: 1fr; }
  .modal { padding: var(--space-5); }
  .modal h2 { font-size: 1.1rem; }
  .btn { padding: 10px 16px; font-size: 0.8125rem; }
}

/* 偏好减少动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
