:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-card: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --badge-toggle: #34c759;
  --badge-slider: #5856d6;
  --badge-picker: #ff9500;
  --badge-stepper: #ff2d55;
  --badge-button: #007aff;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-bg: rgba(255,255,255,0.72);
  --hero-gradient: linear-gradient(180deg, #f5f5f7 0%, #ffffff 100%);
  --code-bg: #f5f5f7;
  --search-bg: #f5f5f7;
  --pill-bg: #f5f5f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-secondary: #1c1c1e;
    --bg-card: #1c1c1e;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --border: #38383a;
    --border-light: #2c2c2e;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
    --nav-bg: rgba(0,0,0,0.72);
    --hero-gradient: linear-gradient(180deg, #1c1c1e 0%, #000000 100%);
    --code-bg: #2c2c2e;
    --search-bg: #2c2c2e;
    --pill-bg: #2c2c2e;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border-light);
  height: 52px;
}

.nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

.nav-brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-search {
  margin-left: auto;
  position: relative;
}

.nav-search input {
  width: 200px;
  padding: 6px 12px 6px 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--search-bg);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: width 0.3s, border-color 0.2s;
}

.nav-search input:focus {
  width: 280px;
  border-color: var(--accent);
}

.nav-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
}

/* ── Hero ── */

.hero {
  padding: 140px 22px 80px;
  text-align: center;
  background: var(--hero-gradient);
}

.hero-icon {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  margin-bottom: 28px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero .subtitle {
  font-size: 21px;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.4;
}

.hero-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--pill-bg);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Content Layout ── */

.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 22px 120px;
}

/* ── Section ── */

.section {
  margin-top: 64px;
}

.section-header {
  margin-bottom: 32px;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.section-header p {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 20px;
}

/* ── Quick Start ── */

.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  counter-reset: step;
}

.step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  counter-increment: step;
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.step-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Settings Category ── */

.category {
  margin-top: 48px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.category-icon {
  font-size: 24px;
}

.category-header h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.category-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Setting Card ── */

.setting-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.setting-card:last-child {
  border-bottom: none;
}

.setting-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.setting-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
}

.setting-badge.toggle { background: var(--badge-toggle); }
.setting-badge.slider { background: var(--badge-slider); }
.setting-badge.picker { background: var(--badge-picker); }
.setting-badge.stepper { background: var(--badge-stepper); }
.setting-badge.button { background: var(--badge-button); }

.setting-default {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--pill-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.setting-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.setting-options {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.setting-options strong {
  color: var(--text-primary);
  font-weight: 500;
}

.setting-tip {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(0,113,227,0.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.setting-tip strong {
  color: var(--accent);
  font-weight: 600;
}

/* ── Search Results ── */

.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

.search-overlay.active { display: block; }

.search-modal {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  max-height: 70vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  overflow: hidden;
  z-index: 201;
  display: none;
}

.search-modal.active { display: block; }

.search-modal-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-primary);
  font-size: 17px;
  outline: none;
}

.search-results {
  overflow-y: auto;
  max-height: calc(70vh - 60px);
  padding: 8px;
}

.search-result-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

.search-result-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-category {
  font-size: 13px;
  color: var(--text-tertiary);
}

.search-result-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.search-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 15px;
}

/* ── Sidebar (Desktop) ── */

@media (min-width: 1080px) {
  .content {
    max-width: 980px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 48px;
  }

  .sidebar {
    display: block;
    position: sticky;
    top: 76px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-width: thin;
  }

  .sidebar-nav {
    list-style: none;
  }

  .sidebar-nav li {
    margin-bottom: 2px;
  }

  .sidebar-nav a {
    display: block;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
  }

  .sidebar-nav a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
  }

  .sidebar-nav a.active {
    background: rgba(0,113,227,0.1);
    color: var(--accent);
    font-weight: 500;
  }

  .sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: 16px 12px 6px;
  }

  .main-content {
    min-width: 0;
  }
}

@media (max-width: 1079px) {
  .sidebar { display: none; }
  .main-content { width: 100%; }
}

/* ── Mobile Nav ── */

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: block; }

  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(20px);
    padding: 16px 22px;
    border-bottom: 0.5px solid var(--border-light);
    gap: 12px;
    z-index: 99;
  }

  .nav-search input {
    width: 140px;
  }

  .nav-search input:focus {
    width: 180px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero .subtitle {
    font-size: 17px;
  }

  .hero-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  .section-header h2 {
    font-size: 26px;
  }

  .category-header h3 {
    font-size: 19px;
  }
}

/* ── Footer ── */

.footer {
  text-align: center;
  padding: 40px 22px;
  border-top: 1px solid var(--border-light);
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Back to Top ── */

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,113,227,0.3);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}

.back-to-top.visible {
  display: flex;
}

.back-to-top:hover {
  transform: scale(1.08);
}

/* ── Keyboard shortcut hint ── */

.kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 12px;
  font-family: -apple-system, monospace;
  color: var(--text-tertiary);
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-left: 6px;
}

/* ── Animations ── */

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

.section {
  animation: fadeIn 0.4s ease-out;
}

/* ── Print ── */

@media print {
  .nav, .sidebar, .back-to-top, .nav-search { display: none !important; }
  .hero { padding-top: 40px; }
  .content { max-width: 100%; display: block; }
  .setting-card { break-inside: avoid; }
}
