:root {
  --bg: #0f1420;
  --bg-soft: #161d2e;
  --bg-card: #1c2438;
  --bg-input: #101624;
  --border: #2a3550;
  --border-light: #35425f;
  --text: #e8ecf4;
  --text-muted: #9aa7bd;
  --accent: #3b82f6;
  --accent-strong: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(59, 130, 246, 0.14), transparent 60%),
    radial-gradient(700px 350px at 10% 110%, rgba(96, 165, 250, 0.1), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

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

a:hover {
  color: var(--accent-strong);
}

img {
  max-width: 100%;
}

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

/* ---------- Top bar ---------- */
.topbar {
  background: rgba(15, 20, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.3px;
}

.brand .logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  border-radius: 9px;
  color: #0f1420;
  flex-shrink: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav a.active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav .cta {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  color: #0f1420;
  font-weight: 700;
}

.nav .cta:hover {
  color: #0f1420;
  filter: brightness(1.08);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  border-color: transparent;
  color: #0f1420;
}

.btn-primary:hover {
  color: #0f1420;
  filter: brightness(1.08);
  border-color: transparent;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
}

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}

.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  max-width: 800px;
  margin: 0 auto 18px;
}

.hero h1 .accent {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 auto 30px;
}

.hero .actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 8px 0 56px;
}

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

.stat-card .num {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--accent-strong);
}

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

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

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

.section-head h2 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.section-head .sub {
  color: var(--text-muted);
  margin-top: 6px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
}

.card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card .meta {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Thread cards ---------- */
.thread-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: block;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s;
}

.thread-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: inherit;
}

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

.thread-card h3 {
  font-size: 1.08rem;
  line-height: 1.4;
  color: var(--text);
}

.thread-card .thread-preview {
  color: var(--text-muted);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thread-card .thread-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.thread-card .thread-meta .dot {
  opacity: 0.4;
}

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag.accent {
  color: var(--accent-strong);
  border-color: rgba(59, 130, 246, 0.35);
  background: var(--accent-soft);
}

.tag.green {
  color: var(--green);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}

.tag.blue {
  color: var(--blue);
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08);
}

.tag.red {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

/* ---------- Forum toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

input[type="search"],
input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input {
  padding-left: 38px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

select {
  cursor: pointer;
}

select option {
  background: var(--bg-card);
}

/* ---------- Forms ---------- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 30px;
}

.form-card h3 {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  margin-bottom: 14px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

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

/* ---------- Thread detail ---------- */
.thread-detail {
  max-width: 860px;
  margin: 0 auto;
}

.thread-head {
  margin-bottom: 22px;
}

.thread-head h1 {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 12px 0 12px;
}

.thread-head .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  flex-wrap: wrap;
}

.post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.post.question {
  border-left: 3px solid var(--accent);
}

.post.reply {
  border-left: 3px solid var(--blue);
}

.post.reply.mechanic {
  border-left-color: var(--green);
}

.post .post-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f1420;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  flex-shrink: 0;
}

.avatar.mechanic {
  background: linear-gradient(135deg, var(--green), #059669);
}

.post .author {
  font-weight: 700;
  font-size: 0.95rem;
}

.post .time {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.post .post-body {
  color: var(--text);
  font-size: 0.98rem;
  white-space: pre-wrap;
}

/* ---------- Tips page ---------- */
.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
}

.tip-card .tip-num {
  position: absolute;
  top: 20px;
  right: 22px;
  font-size: 2.4rem;
  font-weight: 800;
  color: rgba(59, 130, 246, 0.16);
}

.tip-card h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  padding-right: 40px;
}

.tip-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tip-card .tag {
  margin-top: 14px;
}

/* ---------- Alert ---------- */
.alert {
  display: none;
  padding: 14px 18px;
  border-radius: 9px;
  font-size: 0.92rem;
  margin-bottom: 18px;
  border: 1px solid;
}

.alert.show {
  display: block;
}

.alert.error {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--red);
}

.alert.success {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--green);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty svg {
  opacity: 0.35;
  margin-bottom: 12px;
}

/* ---------- Loading ---------- */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Footer ---------- */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 36px 0;
  background: var(--bg-soft);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer .links {
  display: flex;
  gap: 18px;
}

.footer .links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer .links a:hover {
  color: var(--accent-strong);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .topbar .container {
    height: auto;
    flex-direction: column;
    padding: 12px 20px;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 48px 0 40px;
  }

  .stats {
    margin-bottom: 40px;
  }
}
