/* ======================================================================
   爱牛马工具箱 — Design System v4 (Quiet Place Edition)
   像素艺术 · 复古静谧 · 薄荷绿 + 珊瑚红
   ====================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=VT323&family=Press+Start+2P&display=swap');

:root {
  /* ── 主色：薄荷绿 / 珊瑚红 / 米白 ── */
  --bg-primary:    #cfe4dc;   /* 主背景：淡薄荷绿 */
  --bg-secondary:  #b8d4ca;   /* 次背景 */
  --bg-tertiary:   #e8f0ec;   /* 浅米绿（输入框/卡片次层） */
  --bg-card:       #f5efe6;   /* 米白卡片 */
  --bg-hover:      #f9f3eb;   /* 悬停 */
  --bg-paper:      #fbf6ed;   /* 纸张色 */

  --border-primary: #2f4a47;  /* 主边框：深墨绿 */
  --border-soft:    #98b8b0;  /* 柔软边框 */
  --border-hover:   #1f3a36;

  --text-primary:   #1f3a36;  /* 主文字：深墨绿 */
  --text-secondary: #4a6864;  /* 次文字 */
  --text-muted:     #7a9590;  /* 弱文字 */
  --text-paper:     #5a4f44;  /* 米色背景上的文字 */

  /* 强调色：珊瑚红 */
  --accent:         #e87463;
  --accent-hover:   #d85f4d;
  --accent-light:   #f4a397;
  --accent-glow:    rgba(232,116,99,0.15);
  --accent-glow-strong: rgba(232,116,99,0.32);

  /* 辅助色 */
  --success:    #5b8c6b;
  --success-bg: rgba(91,140,107,0.14);
  --warning:    #d4a04a;
  --danger:     #c4564a;
  --danger-bg:  rgba(196,86,74,0.12);

  /* 像素艺术：用硬阴影代替模糊阴影 */
  --shadow-pixel:    3px 3px 0 var(--border-primary);
  --shadow-pixel-lg: 5px 5px 0 var(--border-primary);
  --shadow-pixel-sm: 2px 2px 0 var(--border-primary);
  --shadow-soft:     0 4px 0 rgba(31,58,54,0.15);

  /* 像素风圆角较小，更硬朗 */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 100px;

  /* 字体 */
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
  --font-pixel:   'VT323', 'JetBrains Mono', monospace;
  --font-display: 'JetBrains Mono', 'Courier New', monospace;

  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

* , *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-mono);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* 全局像素颗粒感（很轻，营造质感） */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(rgba(31,58,54,0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 0;
}

/* ===================== NAV ===================== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-primary);
  border-bottom: 2px solid var(--border-primary);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
  font-weight: 700; font-size: 16px; white-space: nowrap;
  letter-spacing: 0.02em;
}
.nav-logo-img {
  width: 36px; height: 36px;
  object-fit: contain;
  /* 像素艺术：禁用平滑，保留方块感 */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: block;
}
/* logo 占位（无图时显示） */
.nav-logo-fallback {
  width: 36px; height: 36px;
  background: var(--accent);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow-pixel-sm);
}
.nav-links {
  display: flex; align-items: center; gap: 4px;
  list-style: none;
}
.nav-links a {
  padding: 6px 12px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-color: var(--border-soft);
}
.nav-links a.active {
  color: #fff;
  background: var(--text-primary);
  border-color: var(--border-primary);
}
.nav-menu-btn {
  display: none;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  color: var(--text-primary);
  cursor: pointer; padding: 6px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pixel-sm);
}
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-menu-btn { display: block; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 64px; left: 0; right: 0;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-primary);
    padding: 12px; z-index: 101; gap: 4px;
  }
  .nav-links.open a { width: 100%; }
}

/* ===================== TOOL LAYOUT ===================== */
.tool-layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 340px 1fr;
  height: calc(100vh - 64px);
  max-width: 1400px; margin: 0 auto;
  background: var(--bg-primary);
}

.tool-sidebar {
  border-right: 2px solid var(--border-primary);
  overflow: hidden;
  position: sticky; top: 64px;
  height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  background: var(--bg-card);
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 22px 20px 12px; }
.sidebar-actions {
  flex-shrink: 0;
  padding: 14px 20px 18px;
  border-top: 2px solid var(--border-primary);
  background: var(--bg-card);
}

.tool-main {
  overflow: hidden;
  display: flex; flex-direction: column; height: 100%;
}
.main-scroll {
  flex: 1; overflow-y: auto;
  padding: 22px 28px 12px;
  display: flex; flex-direction: column;
}
.result-bar {
  flex-shrink: 0;
  padding: 14px 28px 18px;
  border-top: 2px solid var(--border-primary);
  background: var(--bg-card);
  display: none;
}
.result-bar.visible { display: block; }

@media (max-width: 960px) {
  .tool-layout { grid-template-columns: 1fr; height: auto; }
  .tool-sidebar {
    position: static; height: auto;
    border-right: none; border-bottom: 2px solid var(--border-primary);
  }
  .sidebar-scroll { padding: 18px 18px 10px; }
  .main-scroll { padding: 18px 18px 10px; }
  .result-bar { padding: 12px 18px 14px; }
}

/* ===================== SIDEBAR HEADER ===================== */
.sidebar-header { margin-bottom: 18px; }
.sidebar-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; margin-bottom: 10px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.sidebar-title {
  font-family: var(--font-mono);
  font-size: 24px; font-weight: 700; line-height: 1.2;
  margin-bottom: 6px; color: var(--text-primary);
  letter-spacing: -0.01em;
}
.sidebar-title em {
  font-style: normal; color: var(--accent);
}
.sidebar-desc {
  font-size: 12.5px; color: var(--text-secondary);
  line-height: 1.5; font-weight: 500;
}
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 10px; padding-bottom: 7px;
  border-bottom: 1.5px solid var(--border-primary);
}

/* ===================== DROP ZONE ===================== */
.drop-zone {
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-md);
  padding: 30px 16px;
  text-align: center; cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--bg-paper);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-pixel-sm);
}
.drop-zone-icon {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-pixel-sm);
}
.drop-zone-title {
  font-size: 13.5px; font-weight: 700;
  margin-bottom: 4px; color: var(--text-primary);
}
.drop-zone-subtitle {
  font-size: 11.5px; color: var(--text-secondary);
}
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ===================== CONTROLS ===================== */
.control-group { margin-bottom: 14px; }
.control-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px; display: block;
}
.control-hint {
  font-size: 10px; color: var(--text-muted);
  font-weight: 500; text-transform: none; letter-spacing: 0;
}
.control-input {
  padding: 8px 11px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 500;
  transition: var(--transition); outline: none; width: 100%;
}
.control-input:focus {
  border-color: var(--accent);
  box-shadow: 2px 2px 0 var(--accent);
  transform: translate(-1px, -1px);
}
.control-select {
  padding: 8px 11px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono); font-size: 12.5px;
  outline: none; width: 100%; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231f3a36' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}
.control-range-wrap { display: flex; align-items: center; gap: 10px; }
.control-range {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-pill);
  outline: none;
}
.control-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--border-primary);
  cursor: pointer;
  transition: var(--transition);
}
.control-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.control-range::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--border-primary); cursor: pointer;
}
.control-range-val {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 700;
  color: var(--accent); min-width: 40px; text-align: right;
}
.control-range-labels {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-size: 10px; color: var(--text-muted);
}

/* Pills (button-like radio group) */
.pill-group { display: flex; flex-wrap: wrap; gap: 5px; }
.pill-option {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-primary);
  background: var(--bg-paper);
  color: var(--text-secondary);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  font-family: var(--font-mono);
}
.pill-option:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}
.pill-option.active {
  background: var(--text-primary);
  color: var(--bg-card);
  border-color: var(--border-primary);
}
.pill-option input { display: none; }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  border: 2px solid var(--border-primary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap; text-decoration: none;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-pixel-sm);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--border-primary);
}
.btn-primary:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--border-primary); }
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed;
  transform: none; box-shadow: var(--shadow-pixel-sm);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-pixel-sm);
}
.btn-danger {
  background: var(--bg-card);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-bg);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--danger);
}
.btn-full { width: 100%; }
.btn-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===================== PROGRESS ===================== */
.progress-bar {
  width: 100%; height: 6px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 12px 0;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
  width: 0%;
}

/* ===================== RESULTS ===================== */
.result-section {
  margin-top: 18px; padding: 16px;
  background: var(--success-bg);
  border: 2px solid var(--success);
  border-radius: var(--radius-md);
  display: none;
}
.result-section.visible { display: block; }
.result-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.result-stat-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
}
.result-stat-value {
  font-family: var(--font-mono);
  font-size: 17px; font-weight: 700;
  color: var(--success);
}

/* ===================== PREVIEW ===================== */
.preview-area {
  background: var(--bg-paper);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 200px;
  display: flex; align-items: flex-start; justify-content: center;
  overflow: auto; flex: 1;
}
.preview-area img,
.preview-area video,
.preview-area canvas {
  max-width: 100%; max-height: 100%;
  border-radius: var(--radius-sm);
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; width: 100%;
}
.preview-grid-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  aspect-ratio: 1;
  cursor: pointer;
  transition: var(--transition);
}
.preview-grid-item:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-pixel-sm);
}
.preview-grid-item img,
.preview-grid-item canvas {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.preview-grid-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 4px 8px;
  background: rgba(31,58,54,0.85);
  font-size: 10.5px; color: #f5efe6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-mono);
}
.preview-grid-remove {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--border-primary);
  color: #fff;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.18s; z-index: 2;
  box-shadow: var(--shadow-pixel-sm);
}
.preview-grid-item:hover .preview-grid-remove { opacity: 1; }
.preview-grid-remove:hover { background: var(--accent-hover); }
.preview-grid-loading {
  position: absolute; inset: 0;
  background: rgba(245,239,230,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== LIGHTBOX ===================== */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(31,58,54,0.92);
  z-index: 1000;
  display: none; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img, .lightbox canvas {
  max-width: 92vw; max-height: 90vh;
  border-radius: var(--radius-sm);
  border: 3px solid var(--bg-card);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.4);
}
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  color: var(--text-primary);
  font-size: 18px; font-weight: 700;
  width: 42px; height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-pixel-sm);
}
.lightbox-close:hover { background: var(--accent); color: #fff; }

/* ===================== MAIN TOOLBAR ===================== */
.main-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
}
.main-toolbar-title {
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.main-toolbar-count {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1.5px solid var(--accent);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

/* ===================== TOGGLE ===================== */
.toggle-wrap {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
}
.toggle-track {
  width: 38px; height: 20px;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-pill);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: var(--transition);
}
.toggle-wrap input { display: none; }
.toggle-wrap input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--border-primary);
}
.toggle-wrap input:checked + .toggle-track::after {
  left: 20px; background: #fff;
}
.toggle-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ===================== FOOTER ===================== */
.footer {
  text-align: center;
  padding: 26px 20px;
  border-top: 2px solid var(--border-primary);
  color: var(--text-secondary);
  font-size: 12px;
  background: var(--bg-card);
  font-family: var(--font-mono);
}
.footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.footer a:hover { text-decoration: underline; }
.footer-contact { color: var(--accent); text-decoration: none; font-weight: 600; }
.footer-contact:hover { text-decoration: underline; }

/* ===================== ANCHOR GRID (image-crop) ===================== */
.anchor-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px; width: 70px;
}
.anchor-cell {
  width: 20px; height: 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  border: 1.5px solid var(--border-primary);
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.anchor-cell:hover { border-color: var(--accent); }
.anchor-cell.active {
  background: var(--accent);
  border-color: var(--border-primary);
}
.anchor-cell.active::after {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: #fff;
}

/* ===================== LEVEL CARDS (pdf/video compress) ===================== */
.level-cards { display: flex; flex-direction: column; gap: 8px; }
.level-card {
  position: relative;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-primary);
  background: var(--bg-paper);
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; gap: 11px;
}
.level-card:hover {
  background: var(--bg-card);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-pixel-sm);
}
.level-card.active {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: var(--shadow-pixel-sm);
}
.level-card input { display: none; }
.level-card-icon { font-size: 22px; }
.level-card-info { flex: 1; }
.level-card-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.level-card-desc { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.level-card-badge {
  position: absolute; top: 8px; right: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 9px; font-weight: 700;
  background: var(--accent); color: #fff;
  border: 1.5px solid var(--border-primary);
}

/* ===================== COMPARE GRID (image-compress) ===================== */
.compare-container {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%;
}
.compare-panel {
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  overflow: hidden;
}
.compare-panel video { width: 100%; border-radius: var(--radius-sm); }
.compare-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 7px;
}
@media (max-width: 700px) { .compare-container { grid-template-columns: 1fr; } }

/* ===================== BOOKMARK BUTTON ===================== */
.bookmark-btn {
  position: fixed; bottom: 84px; right: 22px;
  z-index: 200;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--border-primary);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-pixel);
  transition: var(--transition);
}
.bookmark-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--border-primary);
}
.bookmark-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--border-primary);
}
.bookmark-toast {
  position: fixed; bottom: 144px; right: 18px;
  z-index: 201;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 11px 15px;
  font-size: 12px;
  color: var(--text-primary);
  max-width: 240px;
  line-height: 1.5;
  box-shadow: var(--shadow-pixel);
  display: none;
  font-family: var(--font-mono);
}
.bookmark-toast.show { display: block; animation: fadeUp 0.25s ease; }

/* ===================== LEAVE CONFIRM DIALOG ===================== */
.leave-mask {
  position: fixed; inset: 0;
  background: rgba(31,58,54,0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.leave-mask.show { opacity: 1; pointer-events: all; }
.leave-dialog {
  background: var(--bg-card);
  border: 2.5px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  max-width: 420px; width: 100%;
  box-shadow: 6px 6px 0 var(--border-primary);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s ease, opacity 0.22s ease;
  opacity: 0;
}
.leave-mask.show .leave-dialog { transform: translateY(0) scale(1); opacity: 1; }
.leave-dialog-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-pixel-sm);
}
.leave-dialog-title {
  font-size: 17px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px; line-height: 1.3;
}
.leave-dialog-desc {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.65; margin-bottom: 22px;
}
.leave-dialog-desc strong { color: var(--text-primary); font-weight: 700; }
.leave-dialog-actions { display: flex; gap: 10px; }
.leave-dialog-actions .btn { flex: 1; justify-content: center; }

/* ===================== PAGE LAYOUT (用于次要页面) ===================== */
.page-container {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 48px 24px 80px;
}
.page-header { text-align: center; margin-bottom: 48px; }
.page-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-pixel-sm);
}
.page-title {
  font-family: var(--font-mono);
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 700; line-height: 1.1;
  letter-spacing: -0.02em; margin-bottom: 14px;
  color: var(--text-primary);
}
.page-title em { font-style: normal; color: var(--accent); }
.page-desc {
  font-size: 15px; color: var(--text-secondary);
  max-width: 560px; margin: 0 auto;
  line-height: 1.7;
}

/* ===================== UTILITIES ===================== */
.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 11.5px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp 0.45s cubic-bezier(0.4,0,0.2,1) both; }

/* ===================== PIXEL DECORATION (可选) ===================== */
.pixel-divider {
  display: block;
  width: 100%; height: 4px;
  background-image: linear-gradient(
    to right,
    var(--border-primary) 0%, var(--border-primary) 50%,
    transparent 50%, transparent 100%
  );
  background-size: 8px 4px;
  margin: 12px 0;
  border: none;
}

/* ══════════════════════════════════════════
   补丁：修复图3 所有问题 (v4.1)
   ══════════════════════════════════════════ */

/* 1. 去掉 nav 底部线 */
.nav {
  border-bottom: none !important;
  /* 固定定位 */
  position: sticky;
  top: 0; z-index: 200;
  background: rgba(207,228,220,0.88);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

/* 2. NAV hover 动效（子页面也生效） */
.nav-links a {
  position: relative;
  transition:
    color 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s cubic-bezier(.34,1.56,.64,1),
    box-shadow 0.18s ease !important;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%; right: 50%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: left 0.28s cubic-bezier(0.22,1,0.36,1),
              right 0.28s cubic-bezier(0.22,1,0.36,1);
}
.nav-links a:hover {
  color: var(--text-primary) !important;
  background: rgba(245,239,230,0.75) !important;
  border-color: var(--border-primary) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 3px 0 var(--border-primary) !important;
}
.nav-links a:hover::after { left: 18%; right: 18%; }
.nav-links a.active::after { display: none; }

/* 3. 子页面 tool-layout：顶底对齐，占满视口，无额外线条 */
.tool-layout {
  border-top: none !important;
  height: calc(100vh - 52px) !important; /* 52px = nav高度 */
}

/* sidebar 无多余线 */
.tool-sidebar {
  border-top: none !important;
}

/* 4. Footer：去掉边框和纹理背景 */
.footer {
  border-top: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 5. body 去掉顶部的点阵噪点（子页面不需要） */
/* body::before 在子页面也保留，但不显示线条 */

/* 6. 自定义光标（子页面也生效） */
body {
  cursor: url('assets/cursor.png') 16 16, auto;
}
a, button, [onclick], label, .drop-zone, .pill-option, .level-card, .anchor-cell, .tool-card {
  cursor: url('assets/cursor.png') 16 16, pointer;
}

/* 7. 点击粒子动画（所有页面） */
.click-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 20px;
  user-select: none;
  animation: float-up-global 0.9s cubic-bezier(0.22,1,0.36,1) forwards;
  will-change: transform, opacity;
}
@keyframes float-up-global {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
  60%  { opacity: 0.7; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% - 80px)) scale(var(--ds)); opacity: 0; }
}

/* 8. nav-links hover 移除 open 状态下的 transform */
@media (max-width: 960px) {
  .nav-links.open a:hover { transform: none !important; box-shadow: none !important; }
  .nav-links.open a::after { display: none; }
}
