/**
 * 喵库 - 公共样式
 * 深色科技感主题，无外部 UI 框架依赖
 */

/* ========== CSS 变量 ========== */
:root {
  --primary: #00d4ff;
  --primary-dark: #0099cc;
  --secondary: #ff6b6b;
  --success: #32cd32;
  --warning: #ffd700;
  --danger: #ff6b6b;
  --info: #da70d6;
  --bg-dark: #0a0e27;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --gradient-primary: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
  --gradient-accent: linear-gradient(45deg, #00d4ff, #ff6b6b, #00d4ff);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
  --shadow-glow-hover: 0 0 40px rgba(0, 212, 255, 0.6);
  --radius: 12px;
  --radius-lg: 16px;
}

/* ========== 基础重置 ========== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--gradient-primary);
  color: var(--text-primary);
  font-family: 'Inter', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ========== 布局 ========== */
.mlb-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .mlb-container {
    padding: 0 24px;
  }
}

@media (min-width: 1024px) {
  .mlb-container {
    padding: 0 32px;
  }
}

/* ========== 导航栏 ========== */
.mlb-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.mlb-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .mlb-header-inner {
    height: 70px;
    padding: 0 24px;
  }
}

.mlb-logo {
  display: flex;
  align-items: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

@media (min-width: 768px) {
  .mlb-logo {
    font-size: 24px;
  }
}

.mlb-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mlb-menu-toggle:hover {
  background: rgba(0, 212, 255, 0.2);
  color: var(--primary);
}

@media (min-width: 992px) {
  .mlb-menu-toggle {
    display: none;
  }
}

.mlb-nav {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: rgba(10, 14, 39, 0.98);
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.mlb-nav.show {
  display: flex;
}

@media (min-width: 992px) {
  .mlb-nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    background: transparent;
    border: none;
    padding: 0;
    gap: 8px;
  }
}

.mlb-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 15px;
}

.mlb-nav-item:hover,
.mlb-nav-item.active {
  color: var(--primary);
  background: rgba(0, 212, 255, 0.1);
}

@media (min-width: 992px) {
  .mlb-nav-item {
    padding: 8px 16px;
  }
}

/* ========== 遮罩层 ========== */
.mlb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.mlb-overlay.show {
  display: block;
}

@media (min-width: 992px) {
  .mlb-overlay {
    display: none !important;
  }
}

/* ========== 语言切换器 ========== */
.mlb-lang-switcher {
  position: relative;
  margin-left: 16px;
}

.mlb-lang-current {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
}

.mlb-lang-current:hover {
  background: rgba(255, 255, 255, 0.15);
}

.mlb-lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(30, 30, 40, 0.98);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 140px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10000;
}

.mlb-lang-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 14px;
  transition: all 0.3s;
}

.mlb-lang-item:hover,
.mlb-lang-item.active {
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary);
}

/* ========== 粒子背景 ========== */
#mlb-p5-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ========== 页面主体 ========== */
.mlb-body {
  padding-top: 60px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .mlb-body {
    padding-top: 70px;
  }
}

/* ========== 渐变文字 ========== */
.mlb-gradient-text {
  background: var(--gradient-accent);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ========== 按钮 ========== */
.mlb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  transition: all 0.3s ease;
  cursor: pointer;
}

.mlb-btn--primary {
  background: linear-gradient(45deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.mlb-btn--primary:hover {
  box-shadow: var(--shadow-glow-hover);
  transform: translateY(-2px);
}

.mlb-btn--ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.mlb-btn--ghost:hover {
  background: rgba(0, 212, 255, 0.1);
}

.mlb-btn--sm {
  padding: 6px 16px;
  font-size: 14px;
}

.mlb-btn--lg {
  padding: 14px 32px;
  font-size: 16px;
}

/* ========== 卡片 ========== */
.mlb-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  overflow: hidden;
}

.mlb-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.3);
  background: var(--bg-card-hover);
}

.mlb-card-body {
  padding: 24px;
}

@media (max-width: 767px) {
  .mlb-card-body {
    padding: 16px;
  }
}

/* ========== Hero ========== */
.mlb-hero {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

@media (min-width: 768px) {
  .mlb-hero {
    min-height: calc(100vh - 70px);
    padding: 80px 0;
  }
}

.mlb-hero-content {
  text-align: center;
  max-width: 800px;
  padding: 0 16px;
}

.mlb-hero-title {
  font-size: 32px;
  margin-bottom: 20px;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .mlb-hero-title {
    font-size: 48px;
    margin-bottom: 24px;
  }
}

.mlb-hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

@media (min-width: 768px) {
  .mlb-hero-desc {
    font-size: 20px;
    margin-bottom: 40px;
  }
}

.mlb-hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

@media (min-width: 576px) {
  .mlb-hero-actions {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
  }
}

/* ========== 区块 ========== */
.mlb-section {
  padding: 60px 0;
}

@media (min-width: 768px) {
  .mlb-section {
    padding: 80px 0;
  }
}

.mlb-section-header {
  text-align: center;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .mlb-section-header {
    margin-bottom: 60px;
  }
}

.mlb-section-title {
  font-size: 28px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .mlb-section-title {
    font-size: 36px;
    margin-bottom: 20px;
  }
}

.mlb-section-desc {
  font-size: 16px;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .mlb-section-desc {
    font-size: 18px;
  }
}

/* ========== 工具网格 ========== */
.mlb-tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 576px) {
  .mlb-tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .mlb-tool-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mlb-tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 20px;
}

.mlb-tool-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.mlb-tool-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.mlb-tool-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
  flex: 1;
}

.mlb-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 6px;
  margin-bottom: 6px;
}

/* ========== 页脚 ========== */
.mlb-footer {
  background: rgba(10, 14, 39, 0.8);
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  text-align: center;
}

.mlb-footer-brand {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.mlb-footer-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.mlb-footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

.mlb-footer-link {
  color: #666;
  transition: color 0.3s;
}

.mlb-footer-link:hover {
  color: var(--primary);
}

.mlb-footer-copy {
  color: #666;
  font-size: 14px;
}

/* ========== 工具页通用 ========== */
.mlb-tool-page {
  padding: 40px 0 80px;
}

@media (min-width: 768px) {
  .mlb-tool-page {
    padding: 60px 0 100px;
  }
}

.mlb-tool-header {
  text-align: center;
  margin-bottom: 40px;
}

.mlb-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

@media (max-width: 767px) {
  .mlb-panel {
    padding: 16px;
  }
}

.mlb-panel-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--primary);
}

.mlb-input,
.mlb-textarea,
.mlb-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.3s;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.mlb-input:focus,
.mlb-textarea:focus,
.mlb-select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 212, 255, 0.05);
}

.mlb-textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
}

.mlb-select {
  appearance: none;
  cursor: pointer;
}

.mlb-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.mlb-form-group {
  flex: 1;
  min-width: 200px;
}

.mlb-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.mlb-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.mlb-result {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
  min-height: 60px;
}

.mlb-result--error {
  color: var(--danger);
}

.mlb-result--success {
  color: var(--success);
}

/* ========== 复选框组 ========== */
.mlb-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.mlb-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.mlb-check input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ========== Toast ========== */
.mlb-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  color: #fff;
  background: rgba(30, 30, 40, 0.98);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10001;
  pointer-events: none;
}

.mlb-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mlb-toast--success {
  border-color: var(--success);
}

.mlb-toast--error {
  border-color: var(--danger);
}

/* ========== 滚动显现 ========== */
.mlb-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.mlb-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 动画 ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.mlb-fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* ========== 表格 ========== */
.mlb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mlb-table th,
.mlb-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.mlb-table th {
  color: var(--primary);
  font-weight: 600;
}

.mlb-table td {
  color: var(--text-secondary);
}

/* ========== 响应式 ========== */
@media (max-width: 767px) {
  .mlb-hide-xs {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .mlb-show-xs {
    display: none !important;
  }
}

/* ========== 树形结构（JSON） ========== */
.mlb-tree {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.8;
}

.mlb-tree-key {
  color: var(--primary);
}

.mlb-tree-string {
  color: var(--success);
}

.mlb-tree-number {
  color: var(--warning);
}

.mlb-tree-boolean {
  color: var(--secondary);
}

.mlb-tree-null {
  color: var(--text-muted);
}

/* ========== 音量条 ========== */
.mlb-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
}

.mlb-meter-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 2px;
  opacity: 0.3;
  transition: height 0.05s ease;
}

/* ========== 视频容器 ========== */
.mlb-video-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}

.mlb-video-wrap video {
  width: 100%;
  display: block;
}
