* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* CSS 变量定义 - 基础变量（所有主题共享） */
:root {
  /* 通用动效与圆角 */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 16px; 
  --border-radius-small: 10px;
  
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;

  /* 功能色 */
  --accent-warning: #f59e0b;
  --accent-error: #ef4444;
  --accent-success: #10b981;

  /* ----- Light Theme 耀白 ----- */
  --bg-primary: #f8fafc;
  --bg-secondary: rgba(255, 255, 255, 0.7);
  --bg-tertiary: rgba(241, 245, 249, 0.6);
  --bg-hover: rgba(59, 130, 246, 0.08);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-color: rgba(15, 23, 42, 0.06);
  --border-light: rgba(255, 255, 255, 0.6);

  /* 主题强调色 */
  --accent-primary: #3b82f6; 
  --accent-primary-rgb: 59, 130, 246;
  --accent-secondary: #8b5cf6;
  
  --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));

  /* 高级多层物理阴影 */
  --shadow-light: 0 4px 12px -2px rgba(15, 23, 42, 0.04), 0 2px 4px -2px rgba(15, 23, 42, 0.02);
  --shadow-medium: 0 12px 32px -4px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-heavy: 0 24px 64px -8px rgba(15, 23, 42, 0.1), 0 12px 24px -4px rgba(15, 23, 42, 0.06);

  /* 背景弥散光效 */
  --body-glow: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 30%), 
               radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 30%);
}

/* 深色主题 */
html.theme-dark,
body.theme-dark {
  --bg-primary: #020617; 
  --bg-secondary: rgba(15, 23, 42, 0.7);
  --bg-tertiary: rgba(30, 41, 59, 0.5);
  --bg-hover: rgba(255, 255, 255, 0.08);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.05);

  --accent-primary: #60a5fa;
  --accent-primary-rgb: 96, 165, 250;
  --accent-secondary: #a78bfa;

  --shadow-light: 0 4px 12px -2px rgba(0, 0, 0, 0.3), 0 1px 1px 0 rgba(255,255,255,0.02) inset;
  --shadow-medium: 0 16px 32px -4px rgba(0, 0, 0, 0.5), 0 2px 3px -2px rgba(255,255,255,0.03) inset;
  --shadow-heavy: 0 32px 64px -8px rgba(0, 0, 0, 0.7), 0 4px 8px -3px rgba(255,255,255,0.05) inset;

  --body-glow: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 40%), 
               radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 40%);
}

/* 蓝色科技主题等废弃，统一并入基础深浅体系 */
/* legacy themes removed */

/* Empty State Styles */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
  opacity: 0.7;
}
.empty-icon {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  transition: all var(--transition-medium);
}
.empty-state:hover .empty-icon {
  transform: scale(1.1) rotate(5deg);
  stroke: var(--accent-primary);
}

/* 基础布局 */
/* 辅助类 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

body {
  font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: var(--body-glow);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-medium), color var(--transition-medium);
  min-height: 100vh;
  overflow-x: hidden;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 100%;
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  transition: all var(--transition-medium);
  min-height: 100vh;
  box-sizing: border-box;
}

/* 头部样式 */
header {
  margin-bottom: var(--spacing-sm);
  text-align: center;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px; 
}

h2::after {
  display: none;
}

/* 悬浮 Dock 导航 (Floating Dock) */
.desktop-nav {
  position: fixed;
  bottom: var(--spacing-xl);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 8px 12px;
  background: var(--bg-secondary);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow: var(--shadow-heavy);
  z-index: 1000;
  transition: all var(--transition-medium);
  flex-wrap: nowrap;
  max-width: 95vw;
  overflow-x: auto;
}

/* Hide scrollbar for dock if it overflows */
.desktop-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: var(--bg-hover);
  color: var(--accent-primary);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.nav-btn.active:hover {
  transform: translateY(-2px);
}

.tool-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: all var(--transition-fast);
}

.nav-btn:hover .tool-icon {
  transform: scale(1.1);
}

/* 工具面板 */
.tool-section {
  display: none;
  width: 100%;
}

.tool-section.animate-in {
  animation: fadeInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.tool-section.active {
  display: block;
}

.tool-layout {
  display: flex;
  gap: 20px;
  flex-direction: column;
  height: auto;
}

.tools-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  padding-bottom: 120px; /* 留出底部 Dock 的空间 */
}

.tool-panel {
  width: 100%;
  padding: var(--spacing-lg);
}

.tool-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.tool-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  letter-spacing: -0.5px;
}

.tool-description {
  color: var(--text-muted);
  font-size: 1rem;
}

/* 输入输出区域 (Glassmorphism) */
.input-section,
.output-section {
  background: var(--bg-tertiary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-light);
  transition: all var(--transition-medium);
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.input-section:hover,
.output-section:hover {
  box-shadow: var(--shadow-medium);
  border-color: rgba(59, 130, 246, 0.2);
}

label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* 统一的输入输出框样式 */
#rich-text-input,
#plain-text-output,
#json-input,
#json-output,
textarea {
  width: 100%;
  min-height: 450px;
  max-height: 900px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  padding: var(--spacing-md);
  font-size: 14px;
  line-height: 1.6;
  overflow-y: auto;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  resize: vertical;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

#json-output,
#plain-text-output {
  background-color: var(--bg-secondary);
  margin-bottom: var(--spacing-md);
  box-shadow: none;
}

#rich-text-input:focus,
#json-input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15), inset 0 1px 2px rgba(0,0,0,0.02);
  background-color: var(--bg-primary);
}

#rich-text-input:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  font-style: italic;
}

/* 按钮样式系统 */
.button-group {
  display: flex;
  gap: var(--spacing-sm);
  margin: var(--spacing-md) 0 0 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex-shrink: 0;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-small);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

button:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all var(--transition-fast);
}

button:active:before {
  width: 300px;
  height: 300px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* 按钮变体 */
#convert-btn,
#format-btn,
#generate-qr-btn,
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-primary:hover,
#convert-btn:hover,
#format-btn:hover,
#generate-qr-btn:hover {
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}

#clear-btn,
#copy-btn,
#download-btn,
.btn-outline,
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

#clear-btn:hover,
.btn-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-error);
  border-color: rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

#copy-btn:hover,
#download-btn:hover,
.btn-success:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
}

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

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

.loading {
  animation: spin 1s linear infinite;
}