:root {
  --bg: #0c0e12;
  --card: #16181f;
  --card2: #1c1f29;
  --text: #f3f4f6;
  --muted: #9aa3b2;
  --red: #e23d2d;
  --blue: #4ea3f0;
  --line: #2a2e3a;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif; min-height: 100%; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(12,14,18,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--red), #ff7a3d);
  display: grid; place-items: center; font-weight: 900; color: #fff; flex-shrink: 0;
}
.logo-img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: var(--card); flex-shrink: 0; }
.tag { color: var(--muted); font-size: 12px; font-weight: 500; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; border-radius: 10px;
  padding: 10px 14px; font-weight: 700; font-size: 14px;
}
.btn-red { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #081018; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.08); }

.hero { padding: 36px 0 18px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 640px; }

.kicker { color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; }
.stats { color: var(--muted); font-size: 13px; margin-top: 8px; }
.tabs {
  display: flex; gap: 0; margin: 16px 0 4px; overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer;
  white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: #fff; border-bottom-color: var(--red); }
.thumb { overflow: hidden; background: #101218; height: 180px; width: 100%; flex-shrink: 0; display: grid; place-items: center; }
.thumb img { max-width: 100%; max-height: 180px; width: auto; height: auto; object-fit: contain; object-position: center; display: block; }
.thumb-empty { height: 180px; display: grid; place-items: center; color: #5b6473; font-weight: 800; letter-spacing: .12em; font-size: 12px; }
.dl-tag {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--red); background: rgba(226,61,45,.12);
  border-radius: 6px; padding: 2px 7px; vertical-align: middle; margin-left: 6px;
}
.preview-card { width: 220px; height: 124px; overflow: hidden; border-radius: 10px; background: #101218; margin: 8px 0; display: grid; place-items: center; }
.preview-card img { max-width: 100%; max-height: 124px; width: auto; height: auto; object-fit: contain; display: block; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.crumb { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 13px; padding: 22px 0 8px; }
.crumb a { color: var(--blue); }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 10px 0 40px; align-items: start; }
.post-title { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; margin: 10px 0; }
.post-meta { color: var(--muted); display: flex; gap: 14px; font-size: 13px; margin-bottom: 18px; }
.article { color: #d5dae3; font-size: 16px; line-height: 1.7; }
.hero-thumb { border-radius: 16px; overflow: hidden; margin-bottom: 16px; background: #101218; min-height: 180px; max-height: 360px; display: grid; place-items: center; }
.hero-thumb img { max-width: 100%; max-height: 360px; width: auto; height: auto; object-fit: contain; object-position: center; display: block; }
.dl-box, .note-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 12px;
}
.dl-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.dl-box h3 { font-size: 16px; margin-bottom: 6px; word-break: break-word; }
.dl-box p { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.btn-block { width: 100%; margin-top: 8px; }
.note-box { color: var(--muted); font-size: 13px; line-height: 1.5; }
.related { padding-bottom: 48px; }
.related h2 { font-size: 18px; margin-bottom: 12px; }
.related-grid { padding: 0; }
@media (max-width: 860px) {
  .post-layout { grid-template-columns: 1fr; }
}
.preview img { max-height: 72px; border-radius: 10px; margin: 8px 0; display: block; }
.tiny { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 6px 0; }
.empty-msg { padding-bottom: 40px; }

.search {
  margin: 18px 0 8px;
  display: flex; gap: 10px;
}
.search input, .field input, .field textarea, .field select {
  width: 100%; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 15px;
}
.search input:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--blue); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 18px 0 48px;
}
.card {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  color: inherit;
}
.card:hover { border-color: #3a4154; transform: translateY(-2px); transition: .18s ease; }
.badge {
  align-self: flex-start;
  background: rgba(78,163,240,.12);
  color: var(--blue);
  font-size: 11px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; padding: 4px 8px; border-radius: 999px;
}
.card h2 { font-size: 18px; line-height: 1.3; }
.card p { color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1; }
.badge { margin-bottom: 2px; }
.meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.count { color: #fff; font-weight: 700; }
.count span { color: var(--blue); }

.footer { border-top: 1px solid var(--line); padding: 22px 0 36px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* admin */
.admin-box { max-width: 420px; margin: 80px auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.admin-box h1 { margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.table-wrap { overflow-x: auto; margin: 20px 0 40px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.ok { background: #12351f; color: #8dffb2; }
.err { background: #3a1512; color: #ffb4ab; }
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 24px; }

@media (max-width: 640px) {
  .hero { padding-top: 22px; }
  .card { min-height: 0; }
}
