:root {
  --bg: #0f131a;
  --bg-elevated: #141923;
  --surface: #181e2a;
  --surface-hover: #1f2736;
  --code-bg: #0c1017;
  --border: #283142;
  --border-strong: #3a465e;
  --text: #eef2f7;
  --text-muted: #98a4b8;
  --primary: #4f7cff;
  --primary-hover: #638cff;
  --primary-fg: #ffffff;
  --primary-soft: rgba(79, 124, 255, 0.14);
  --accent: #2ea068;
  --var-bg: rgba(79, 124, 255, 0.16);
  --var-border: rgba(122, 158, 255, 0.55);
  --radius: 8px;
  --radius-sm: 6px;
}

[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8faff;
  --code-bg: #f2f5f9;
  --border: #dce3ee;
  --border-strong: #bcc8dc;
  --text: #161d29;
  --text-muted: #5c687c;
  --primary: #335eea;
  --primary-hover: #264cd1;
  --primary-fg: #ffffff;
  --primary-soft: rgba(51, 94, 234, 0.1);
  --accent: #228654;
  --var-bg: rgba(51, 94, 234, 0.1);
  --var-border: rgba(51, 94, 234, 0.4);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 74px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background-color 0.18s ease, color 0.18s ease;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  gap: 26px;
}

.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 0;
  transition: color 0.15s ease;
}

.main-nav a:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ctrl {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-ctrl:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.btn-icon {
  width: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="dark"] .icon-moon {
  display: none;
}

html[data-theme="light"] .icon-sun {
  display: none;
}

.mobile-only {
  display: none;
}

/* Hero */
.hero {
  padding: 44px 0 32px;
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.hero h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.75rem, 3.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  max-width: 740px;
  margin-bottom: 12px;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 680px;
  font-size: 0.98rem;
  margin-bottom: 18px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.hero-meta strong {
  color: var(--text);
  font-weight: 600;
}

.meta-dot {
  color: var(--border-strong);
}

/* Search & Filters */
.search-wrapper {
  position: relative;
  max-width: 560px;
  margin-bottom: 14px;
}

.search-wrapper input {
  width: 100%;
  padding: 11px 74px 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
}

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
}

.clear-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.tag.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

/* RSYA Blocks */
.ad-slot {
  margin: 22px auto;
}

.ad-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-align: right;
}

.rsya-box {
  min-height: 86px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.84rem;
  padding: 14px;
  text-align: center;
}

/* Sections */
.section {
  padding: 34px 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.results-counter {
  font-size: 0.84rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Prompt Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.prompt-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.role-badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}

.model-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.prompt-card h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.35;
}

.prompt-code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 185px;
  overflow-y: auto;
  transition: max-height 0.18s ease;
}

.prompt-code.expanded {
  max-height: none;
}

.prompt-var {
  background: var(--var-bg);
  border-bottom: 1px dashed var(--var-border);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text);
  cursor: text;
}

.prompt-var:focus {
  outline: 1px solid var(--primary);
  background: var(--surface);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.expand-btn {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.expand-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.copy-btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.copy-btn:hover {
  background: var(--primary-hover);
}

.copy-btn.copied {
  background: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 28px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.empty-state[hidden] {
  display: none;
}

/* Tools & Formula Grids */
.tools-grid,
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.tool-card,
.formula-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.tool-code {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.step-num {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.tool-access {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tool-card h3,
.formula-step h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.tool-card p,
.formula-step p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.faq-item summary {
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  margin-top: 44px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 32px 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: 24px;
}

.footer-brand p {
  margin-top: 8px;
  max-width: 340px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col h4 {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 2px;
}

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

.footer-col a:hover {
  color: var(--text);
}

/* Scroll Top & Toast */
.scroll-top-btn {
  position: fixed;
  bottom: 18px;
  left: 18px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  z-index: 90;
}

.scroll-top-btn:hover {
  border-color: var(--primary);
}

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 14px 20px;
    gap: 12px;
  }
  .main-nav.open {
    display: flex;
  }
  .mobile-only {
    display: inline-flex;
    align-items: center;
  }
  .filter-tags {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .tag {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.show-more-bar {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.show-more-bar[hidden] {
  display: none;
}

.show-more-btn {
  height: 38px;
  padding: 0 20px;
  font-size: 0.86rem;
}

/* Dedicated SEO Category Pages & Topic Links */
.topic-pages-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.topic-pages-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.topic-page-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.topic-page-link:hover,
.topic-page-link.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--text);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.workflow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.workflow-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.workflow-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.workflow-compare {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.compare-box {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.48;
}

.compare-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.compare-label.bad {
  color: #e06c75;
}

.compare-label.good {
  color: var(--accent);
}

.footer-grid {
  grid-template-columns: 2fr 1fr 1fr 1.4fr;
}

@media (max-width: 820px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
