:root {
  --orange: #ea5c2e;
  --orange-dark: #c64a22;
  --yellow: #ffde59;
  --dark: #0d0d0d;
  --cream: #fff7f4;
  --ink: #1a1210;
  --muted: #5c473e;
  --line: #efe1db;
  --card: #ffffff;
  --ok: #1c7c4a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 18px;
}

a { color: var(--orange-dark); }

/* ── Header ─────────────────────────────────────────── */
.site-header {
  background: var(--dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 3px solid var(--orange);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.brand-text {
  font-weight: 600;
  font-size: 15px;
  opacity: 0.85;
  white-space: nowrap;
}

.brand-text b { color: var(--yellow); font-weight: 800; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 260px;
}

.search { flex: 1; max-width: 380px; }

.search input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: #1c1c1c;
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  outline: none;
}

.search input::placeholder { color: #8d8d8d; }
.search input:focus { border-color: var(--orange); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }

.btn-ghost {
  background: transparent;
  color: #fff;
  border-color: #4a4a4a;
}
.btn-ghost:hover { border-color: var(--orange); color: var(--yellow); }

.btn-outline {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover { border-color: var(--orange); color: var(--orange-dark); }

.btn-danger { background: #fff; color: #b3261e; border-color: #f0c8c5; }
.btn-danger:hover { background: #b3261e; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── Hero ───────────────────────────────────────────── */
.hero {
  padding: 30px 0 6px;
}

.hero h1 {
  font-size: clamp(24px, 4.5vw, 34px);
  font-weight: 900;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.hero h1 .dot { color: var(--orange); }

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 640px;
}

/* ── Section headings ───────────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--orange-dark);
  margin: 30px 0 12px;
}

/* ── Category / question rows (forum style) ─────────── */
.rows { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.row:hover { border-color: var(--orange); }

.row-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--cream);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--orange-dark);
  font-size: 16px;
  flex-shrink: 0;
}

.row-main { flex: 1; min-width: 0; }

.row-title {
  font-weight: 800;
  font-size: 15.5px;
  line-height: 1.35;
}

.row-desc {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 2px;
}

.row-meta {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row-meta .count { color: var(--orange-dark); font-weight: 700; }

.row-arrow { color: #c9b6ae; font-size: 20px; flex-shrink: 0; }
.row:hover .row-arrow { color: var(--orange); }

.chip {
  display: inline-block;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--orange-dark);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  margin-bottom: 4px;
}

.badge-count {
  background: var(--orange);
  color: #fff;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  padding: 3px 11px;
  flex-shrink: 0;
}

.badge-count.zero { background: #e7d8d2; color: var(--muted); }

/* ── Thread ─────────────────────────────────────────── */
.breadcrumb {
  font-size: 13.5px;
  color: var(--muted);
  margin: 22px 0 10px;
}
.breadcrumb a { text-decoration: none; font-weight: 700; }
.breadcrumb a:hover { text-decoration: underline; }

.thread-title {
  font-size: clamp(21px, 3.6vw, 27px);
  font-weight: 900;
  letter-spacing: -0.4px;
  margin: 4px 0 4px;
  line-height: 1.3;
}

.thread-meta {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.card-question { border-left: 4px solid var(--dark); }

.card-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-label .latest { color: var(--ok); }

.answer-card { border-left: 4px solid var(--orange); }

/* ── Body text rendering ────────────────────────────── */
.body-text p { margin: 0 0 10px; }
.body-text p:last-child { margin-bottom: 0; }

.body-text ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.body-text li { margin-bottom: 4px; }

.body-text code {
  font-family: ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}

.body-text pre {
  background: var(--dark);
  color: #f5efe9;
  border-radius: 10px;
  padding: 13px 15px;
  overflow-x: auto;
  margin: 0 0 12px;
}

.body-text pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 13.5px;
  line-height: 1.55;
}

/* ── Answer actions ─────────────────────────────────── */
.answer-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.copied-note { color: var(--ok); font-size: 13px; font-weight: 700; }

.admin-note {
  background: #fffbe8;
  border: 1px solid #f3e3a0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #6b5b1e;
  margin-bottom: 14px;
}

/* ── Forms ──────────────────────────────────────────── */
textarea, select, input[type="text"], input[type="password"], input[type="search"] {
  font: inherit;
}

.form-card textarea,
.form-card input[type="text"],
.form-card input[type="password"],
.form-card select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  margin-bottom: 10px;
}

.form-card textarea:focus,
.form-card input:focus,
.form-card select:focus {
  outline: none;
  border-color: var(--orange);
}

.form-card textarea { min-height: 170px; resize: vertical; line-height: 1.55; }

.form-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: -4px 0 10px;
}

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.error-text { color: #b3261e; font-size: 13.5px; font-weight: 700; }

/* ── Modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 13, 0.55);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 18px;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  border-top: 4px solid var(--orange);
}

.modal h3 { margin: 0 0 4px; font-size: 19px; font-weight: 900; }
.modal p.sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ── Empty state ────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed #dccbc4;
  border-radius: var(--radius);
}

.empty b { color: var(--ink); display: block; font-size: 17px; margin-bottom: 4px; }

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
  margin-top: 44px;
  background: var(--dark);
  color: #cfc6c1;
  font-size: 13.5px;
  padding: 22px 0;
}

.site-footer p { margin: 0 0 8px; }
.site-footer a { color: var(--yellow); }
.site-footer b { color: #fff; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .header-actions { min-width: 0; }
  .search { max-width: none; }
  .brand { justify-content: center; }
  .row { padding: 12px 13px; gap: 11px; }
  .row-icon { display: none; }
  .card { padding: 15px 15px; }
}
