* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --orange: #FF6B00;
  --orange-light: #FF8C33;
  --orange-dim: rgba(255,107,0,0.08);
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface2: #f7f7fa;
  --border: #e5e5ea;
  --text: #1c1c1e;
  --text-secondary: #3a3a3c;
  --muted: #8e8e93;
  --green: #34c759;
  --red: #ff3b30;
  --blue: #007aff;
  --header-bg: #1c1c1e;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Top bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.top-bar .search-wrap {
  flex: 1;
  margin-bottom: 0;
}

/* Back button - large touch target */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--orange);
  border: none;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.back-btn:active { background: var(--orange-light); transform: scale(0.95); }
.back-btn svg { flex-shrink: 0; width: 22px; height: 22px; stroke: #fff; }

/* Content */
.content { padding: 20px; }

/* Search */
.search-wrap {
  position: relative;
  margin-bottom: 24px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 14px 42px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.search-input::placeholder { color: var(--muted); opacity: 0.7; }
.search-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,0,0.12);
}
.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--muted);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}
.search-clear.show { display: flex; }

/* Section heading */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  padding-left: 4px;
}

/* Category card */
.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}
.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.category-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.category-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}
.category-desc {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Help item link */
.help-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  cursor: pointer;
}
.help-item:active { background: var(--bg); }
.help-item-text {
  font-size: 0.88rem;
  font-weight: 500;
}
.help-item-arrow {
  color: var(--muted);
  flex-shrink: 0;
}
.help-item.hidden { display: none; }

/* No results */
.no-results {
  text-align: center;
  padding: 40px 20px;
  display: none;
}
.no-results.show { display: block; }
.no-results-icon { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.5; }
.no-results-text { font-size: 0.92rem; color: var(--muted); }

/* ─── Article page styles ─── */
.article-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.article-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 14px;
}
.article-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}
.article-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 6px;
}

.article-body {
  padding: 24px 20px;
  background: var(--surface);
}
.article-body h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.article-body h2::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--orange);
  border-radius: 2px;
  flex-shrink: 0;
}
.article-body h2:first-child { margin-top: 0; }
.article-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}
.article-body ul, .article-body ol {
  padding-left: 20px;
  margin-bottom: 14px;
}
.article-body li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}
.article-body strong { color: var(--text); font-weight: 600; }

/* Tip box */
.tip-box {
  background: var(--orange-dim);
  border: 1px solid rgba(255,107,0,0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tip-box .tip-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.tip-box .tip-text { font-size: 0.82rem; color: #b35400; line-height: 1.6; }

/* Warning box */
.warn-box {
  background: rgba(244,67,54,0.08);
  border: 1px solid rgba(244,67,54,0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.warn-box .warn-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.warn-box .warn-text { font-size: 0.82rem; color: #c0392b; line-height: 1.6; }

/* Info box */
.info-box {
  background: rgba(66,165,245,0.08);
  border: 1px solid rgba(66,165,245,0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.info-box .info-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.info-box .info-text { font-size: 0.82rem; color: #1565c0; line-height: 1.6; }

/* Step list */
.steps-list {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 16px 0;
}
.steps-list li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  flex-wrap: wrap;
}
.steps-list li .step-text {
  flex: 1;
  min-width: 0;
}
.steps-list li:last-child { border-bottom: none; }
.steps-list li::before {
  content: counter(step);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--orange-dim);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Related links */
.related-section {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.related-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}
.related-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  transition: background 0.15s;
}
.related-link:active { background: var(--bg); }

/* App screenshot */
.app-screenshot {
  display: block;
  max-width: 260px;
  margin: 16px auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.app-screenshot-caption {
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  margin: -8px 0 16px;
  font-style: italic;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }

/* Safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}
