/* ============================================================
   NYXAION NEBULA — deep-space minimal design system
   ============================================================ */

:root {
  /* type */
  --font-sans: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* accent */
  --accent: #5b8cff;
  --accent-ink: #07080c;
  --accent-soft: rgba(91, 140, 255, 0.15);
  --accent-line: rgba(91, 140, 255, 0.38);
  --accent-glow: rgba(91, 140, 255, 0.4);

  /* colors */
  --bg: #07080c;
  --bg-1: #0a0c12;
  --bg-2: #0d1018;
  --bg-3: #12151f;
  
  --panel: rgba(255, 255, 255, 0.025);
  --panel-hi: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  
  --fg: #eef1f6;
  --fg-2: #c4cad6;
  --fg-muted: #8a93a4;
  --fg-faint: #565f70;
  
  --ok: #4fb6a8;
  --warn: #c9a86a;
  --error: #ff6b6b;
  --run: #5b8cff;

  /* legacy overrides for compatibility */
  --bg-color: var(--bg);
  --sidebar-bg: var(--bg-1);
  --card-bg: var(--bg-2);
  --text-primary: var(--fg);
  --text-secondary: var(--fg-muted);
  --accent-color: var(--accent);
  --accent-rgb: 91, 140, 255;
  --accent-hover: #7ba3ff;
  --border-color: var(--line);
  --success-color: var(--ok);
  --error-color: var(--error);

  /* layout */
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --radius: 12px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  
  color-scheme: dark;
}

/* Modern browser enhancements with fallback support */
@supports (color: color-mix(in oklab, red, white)) {
  :root {
    --accent-soft: color-mix(in oklab, var(--accent) 15%, transparent);
    --accent-line: color-mix(in oklab, var(--accent) 38%, transparent);
    --accent-glow: color-mix(in oklab, var(--accent) 40%, transparent);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--fg); }
a { color: inherit; text-decoration: none; transition: color 0.2s; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); }

.mono { font-family: var(--font-mono); }

/* ---------- buttons ---------- */
.btn, .b {
  height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.1s, box-shadow 0.18s;
}
.btn:active, .b:active { transform: translateY(0.5px); }
.btn svg, .b svg { width: 15px; height: 15px; }

.btn-primary, .b-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover, .b-primary:hover { background: var(--accent-hover); box-shadow: 0 0 15px var(--accent-soft); }

.btn-secondary, .b-ghost { background: var(--bg-3); color: var(--fg); border-color: var(--line-2); }
.btn-secondary:hover, .b-ghost:hover { border-color: var(--accent-line); background: var(--bg-2); }

.btn-danger { background: rgba(255, 107, 107, 0.1); color: var(--error); border-color: rgba(255, 107, 107, 0.2); }
.btn-danger:hover { background: var(--error); color: white; border-color: transparent; }

.btn-quiet, .b-quiet { background: transparent; color: var(--fg-muted); }
.btn-quiet:hover, .b-quiet:hover { color: var(--fg); background: var(--panel-hi); }

.btn-sm, .b-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ---------- layout ---------- */
.main-layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar, .side {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header, .side-top {
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
}

.sidebar-nav, .side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 8px;
}

.side-group { margin-bottom: 24px; }
.side-label { padding: 0 12px; margin-bottom: 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); }

.nav-item, .sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--fg-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: 0.15s;
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item:hover, .sidebar-nav li a:hover {
  background: var(--panel);
  color: var(--fg);
}

.nav-item.active, .sidebar-nav li a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge {
  margin-left: auto;
  background: var(--line-2);
  color: var(--fg-muted);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--line);
}

/* Content Area */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  height: var(--topbar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}

.topbar-brand {
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.tbar-grow { flex: 1; }

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}
.search-wrap input {
  width: 100%; height: 34px; background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 0 12px 0 34px; color: var(--fg); font-size: 13px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--fg-faint); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Page Headers */
.content-header, .page-head {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-header h1, .page-head h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.content-header p, .page-head .sub {
  color: var(--fg-muted);
  font-size: 14px;
}

/* Cards & Panels */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Tables */
.table-container {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto; /* Fix for Issue #170: Prevents table from overlapping inspector on narrow screens */
}

@media (max-width: 1200px) {
  .file-grid {
    flex-direction: column !important;
  }
  .inspector-container {
    width: 100% !important;
    position: static !important;
    max-height: none !important;
    border-left: none !important;
    border-top: 1px solid var(--line);
  }
  #inspector-resizer {
    display: none !important;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  background: var(--bg-3);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-faint);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: -24px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  transition: 0.15s;
}

tr.file-row:hover, tr:hover td {
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
}

tr.active-file td {
  background: var(--accent-soft) !important;
  color: var(--accent);
}

/* Grid View */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.gallery-flex .grid-item {
  opacity: 0;
  animation: entrance 0.4s var(--ease) forwards;
}

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

.grid-item {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  cursor: pointer;
  position: relative;
}

.grid-item:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--accent-line);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 0 1px var(--accent-glow);
}

.grid-thumb {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  position: relative;
}

.grid-thumb::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--panel), transparent);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite;
  z-index: 1;
  pointer-events: none;
}

.grid-thumb img { 
  width: 100%; 
  height: auto; 
  display: block;
  object-fit: contain;
  position: relative;
  z-index: 2;
  transition: opacity 0.3s var(--ease);
}

.grid-thumb.loaded::before {
  display: none;
}

.gallery-solve-status {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
}

.spinner-sm {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.grid-info { padding: 12px; }
.grid-name { font-weight: 500; font-size: 13px; color: var(--fg); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-meta { font-size: 11.5px; color: var(--fg-muted); }

/* Inspector */
.inspector-container {
  width: 380px;
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: width 0.3s var(--ease);
  position: sticky;
  top: 24px;
  max-height: calc(100vh - var(--topbar-h) - 48px);
}

.inspector-container.expanded {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh;
  z-index: 2500;
  border-left: none;
}

.inspector-container.expanded #zoom-wrapper {
  aspect-ratio: auto !important;
  height: 60vh;
  width: 100%;
}

.inspector-header {
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
}

#preview-container {
  padding: 16px;
  background: #000;
  border-bottom: 1px solid var(--line);
}

.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: 0.2s;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Modals */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}

.modal-overlay .card {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-2);
}

.modal-overlay .card.card-lg {
  max-width: 640px;
}

.input-modern {
  width: 100%;
  height: 38px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--fg);
  font-size: 14px;
  outline: none;
  transition: 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.input-modern:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-sm {
  height: 34px;
  font-size: 13px;
  border-radius: 6px;
  padding: 0 10px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--fg); }

/* Floating Action Button (Mobile Only) */
.mobile-fab {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: none; /* Hidden on desktop */
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(91, 140, 255, 0.4);
  z-index: 5000;
  border: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s;
}

.mobile-fab:active {
  transform: scale(0.92);
}

/* Mobile & Tablet */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    height: 64px;
    flex-direction: row !important;
    border-right: none;
    border-top: 1px solid var(--line);
    padding: 0;
    background: var(--bg-1);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
    z-index: 2000;
  }
  
  .sidebar-header, .side-top, .side-label, .tree, .sidebar-footer { 
    display: none !important; 
  }
  
  .sidebar-nav, .side-scroll { 
    padding: 0; 
    display: flex !important; 
    flex-direction: row !important;
    align-items: center; 
    justify-content: space-around; 
    width: 100%; 
    height: 100%;
    overflow: visible;
    flex-wrap: nowrap;
  }
  
  .nav-item { 
    padding: 0; 
    margin: 0 !important; 
    flex: 1;
    min-width: 0;
    border-radius: 0;
    background: none !important;
    color: var(--fg-muted);
    height: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: none;
    gap: 0 !important;
  }
  
  .nav-item i, .nav-item svg { 
    width: 24px; 
    height: 24px; 
    margin: 0 !important; 
  }
  
  .nav-label, .nav-item .badge { 
    display: none !important; 
  }
  
  .nav-item.active {
    color: var(--accent);
    background: var(--accent-soft) !important;
    border-top: 3px solid var(--accent);
  }
  
  .content-wrapper { 
    padding-bottom: 64px; 
  }
  
  .topbar { padding: 0 16px; }
  .topbar-brand { display: flex; }
  .search-wrap { display: none; }
  
  .content { padding: 16px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .page-actions { width: 100%; overflow-x: auto; padding-bottom: 8px; }
  
  /* Table Responsiveness */
  th:nth-child(3), td:nth-child(3) {
    display: none;
  }
  
  .modal-overlay {
    padding: 1rem;
  }

  .modal-overlay .card {
    width: 95% !important;
    margin: 0;
  }
}

@media (max-width: 768px) {
  .mobile-fab { display: flex; }
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Resizer for Inspector */
.resizer {
  width: 4px; cursor: col-resize;
  background: transparent; transition: background 0.2s;
}
.resizer:hover { background: var(--accent-line); }

/* Path Links (Breadcrumbs) */
.path-link {
  color: var(--fg-muted);
  text-decoration: none;
  transition: 0.2s;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.path-link:hover {
  color: var(--accent);
}

.path-link.active {
  color: var(--fg);
}

.path-link i {
  opacity: 0.6;
}

.path-link.active i {
  opacity: 1;
  color: var(--accent);
}

.menu-item:hover {
  background: var(--bg-3) !important;
  color: var(--accent) !important;
}

.plan-card:hover div {
  border-color: var(--accent-line) !important;
}

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Toasts (Base) */
#toast-container { pointer-events: none; }
.toast { pointer-events: auto; }

/* ============================================================
   HELP & TUTORIALS
   ============================================================ */

/* ---------- page shell (two-column) ---------- */
.help-page {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  padding: 24px 0;
  min-height: calc(100vh - var(--topbar-h));
}

/* ---------- sidebar nav ---------- */
.help-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.help-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--fg-muted);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s var(--ease);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.help-nav-link i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.2s var(--ease);
}

.help-nav-link:hover {
  color: var(--fg);
  background: var(--panel-hi);
}

.help-nav-link:hover i {
  opacity: 0.85;
}

.help-nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.help-nav-link.active i {
  opacity: 1;
  color: var(--accent);
}

.help-nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  padding: 14px 12px 4px;
}

/* ---------- content area ---------- */
.help-content {
  max-width: 820px;
  width: 100%;
  min-width: 0;
}

/* ---------- hero ---------- */
.help-hero {
  text-align: center;
  padding: 48px 32px 40px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, var(--accent-soft) 0%, transparent 70%),
    var(--bg-1);
  border: 1px solid var(--line);
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.help-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -20%, var(--accent-glow), transparent 60%);
  opacity: 0.25;
  pointer-events: none;
}

.help-hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--fg) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 12px;
  position: relative;
}

.help-hero p {
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

/* ---------- search ---------- */
.help-search {
  position: relative;
  max-width: 480px;
  margin: 24px auto 0;
}

.help-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--fg-faint);
  pointer-events: none;
}

.help-search input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.help-search input::placeholder {
  color: var(--fg-faint);
}

.help-search input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- table-of-contents chips (mobile) ---------- */
.help-toc {
  display: none;                 /* hidden on desktop */
  overflow-x: auto;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 20px;
  scrollbar-width: none;
}

.help-toc::-webkit-scrollbar { display: none; }

.help-toc a {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}

.help-toc a:hover,
.help-toc a.active {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* ---------- sections ---------- */
.help-section {
  margin-bottom: 48px;
  padding-top: 8px;
  scroll-margin-top: 80px;
  animation: helpFadeUp 0.5s var(--ease) both;
}

.help-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin: 0 0 20px;
}

.help-section h2 i {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.help-section h3 {
  font-size: 16px;
  font-weight: 650;
  color: var(--fg-2);
  margin: 28px 0 10px;
}

.help-section p {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.7;
  max-width: 680px;
  margin: 0 0 14px;
}

.help-section ul,
.help-section ol {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.7;
  padding-left: 22px;
  margin: 0 0 14px;
}

.help-section li + li { margin-top: 6px; }

.help-section code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- step-by-step cards ---------- */
.help-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin: 20px 0 24px;
}

.help-step {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              border-color 0.25s var(--ease);
  animation: helpStepIn 0.45s var(--ease) both;
}

.help-step:nth-child(1) { animation-delay: 0.05s; }
.help-step:nth-child(2) { animation-delay: 0.12s; }
.help-step:nth-child(3) { animation-delay: 0.19s; }
.help-step:nth-child(4) { animation-delay: 0.26s; }
.help-step:nth-child(5) { animation-delay: 0.33s; }
.help-step:nth-child(6) { animation-delay: 0.40s; }

.help-step:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--accent-line);
  border-color: var(--accent-line);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #7ba3ff 100%);
  box-shadow: 0 2px 12px var(--accent-glow);
  flex-shrink: 0;
}

.help-step h4 {
  font-size: 14px;
  font-weight: 650;
  color: var(--fg);
  margin: 0;
}

.help-step p {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin: 0;
}

/* ---------- tip callout ---------- */
.help-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 18px 0;
}

.help-tip i {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.help-tip p {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0;
}

/* ---------- warning callout ---------- */
.help-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(201, 168, 106, 0.1);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 18px 0;
}

.help-warning i {
  width: 18px;
  height: 18px;
  color: var(--warn);
  flex-shrink: 0;
  margin-top: 1px;
}

.help-warning p {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0;
}

/* ---------- feature grid ---------- */
.help-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0 24px;
}

.help-feature-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.help-feature-card:hover {
  border-color: var(--accent-line);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.help-feature-card i {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.help-feature-card h4 {
  font-size: 15px;
  font-weight: 650;
  color: var(--fg);
  margin: 0;
}

.help-feature-card p {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin: 0;
}

/* ---------- keyboard shortcut badge ---------- */
kbd,
.help-kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.4;
  vertical-align: baseline;
  box-shadow: 0 1px 0 var(--line);
}

/* ---------- FAQ accordion ---------- */
.help-faq {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
}

.help-faq-item {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s var(--ease);
}

.help-faq-item.open {
  border-color: var(--accent-line);
}

.help-faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--fg);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s var(--ease);
}

.help-faq-q:hover { color: var(--accent); }

.help-faq-q i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--fg-faint);
  transition: transform 0.3s var(--ease), color 0.2s var(--ease);
}

.help-faq-item.open .help-faq-q i {
  transform: rotate(180deg);
  color: var(--accent);
}

.help-faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease), padding 0.35s var(--ease);
  padding: 0 18px;
}

.help-faq-item.open .help-faq-a {
  max-height: 400px;
  padding: 0 18px 18px;
}

.help-faq-a p {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.7;
  margin: 0;
}

/* ---------- animations ---------- */
@keyframes helpFadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .help-page {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px 0;
  }

  .help-sidebar {
    display: none;
  }

  .help-toc {
    display: flex;
  }

  .help-hero {
    padding: 32px 20px 28px;
  }

  .help-hero h1 {
    font-size: 24px;
  }

  .help-steps {
    grid-template-columns: 1fr 1fr;
  }

  .help-feature-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .help-page {
    padding: 12px 0;
  }

  .help-hero {
    padding: 24px 16px 22px;
    border-radius: var(--radius);
  }

  .help-hero h1 {
    font-size: 20px;
  }

  .help-hero p {
    font-size: 13px;
  }

  .help-section h2 {
    font-size: 18px;
  }

  .help-steps {
    grid-template-columns: 1fr;
  }

  .help-feature-grid {
    grid-template-columns: 1fr;
  }

  .help-step {
    padding: 16px;
  }

  .help-feature-card {
    padding: 16px;
  }

  .help-search input {
    font-size: 13px;
    padding: 10px 14px 10px 38px;
  }

  .help-section {
    margin-bottom: 36px;
  }
}
