:root {
  --orange: #D4593A;
  --dark:   #161618;
  --mid:    #5A5A5F;
  --light:  #F6F4F1;
  --white:  #FFFFFF;
  --radius: 12px;
  --font:   -apple-system, "PingFang HK", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Nav ─────────────────────────────────────────────────── */
nav {
  background: var(--dark);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.nav-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}
.nav-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-brand-text em {
  color: var(--orange);
  font-style: normal;
}
.nav-links {
  margin-left: auto;
  display: flex;
  gap: 20px;
}
.nav-links a {
  color: rgba(255,255,255,.65);
  font-size: 20px;
  transition: color .2s;
  display: flex;
  align-items: center;
}
.nav-links a:hover { color: var(--white); }

/* ── Hero Banner ─────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0A0A0E 0%, #1a1215 50%, #0A0A0E 100%);
  border-bottom: 3px solid var(--orange);
  padding: 48px 24px 52px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 50% 100%, rgba(212,89,58,.15), transparent);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}
.hero-logo {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(212,89,58,.4);
  margin-bottom: 20px;
  border: 2px solid rgba(212,89,58,.5);
}
.hero-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.hero-title span {
  color: var(--orange);
}
.hero-sub {
  font-size: 15px;
  color: rgba(255,255,255,.55);
  margin-bottom: 28px;
  line-height: 1.7;
}
.hero-socials {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: 24px;
  color: rgba(255,255,255,.8);
  font-size: 13px;
  transition: all .2s;
}
.social-chip:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

/* ── Category chips ──────────────────────────────────────── */
.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 20px 0 4px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  background: var(--white);
  border: 1.5px solid #e0ddd9;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  transition: all .2s;
  white-space: nowrap;
}
.cat-chip:hover {
  border-color: var(--orange);
  color: var(--orange);
}
.cat-chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
  font-weight: 600;
}

/* ── Main container ──────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── Section header ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--orange);
}
.section-header h1,
.section-header h2 {
  font-size: 20px;
  font-weight: 700;
}
.section-header .sub {
  font-size: 13px;
  color: var(--mid);
}

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

.post-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.post-card-img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
  background: var(--dark);
}
.post-card-img-placeholder {
  width: 100%;
  aspect-ratio: 4/5;
  background: linear-gradient(135deg, var(--dark), #2a2a30);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.3);
  font-size: 32px;
}
.post-card-body {
  padding: 16px;
}
.series-badge {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.post-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta {
  font-size: 12px;
  color: var(--mid);
  display: flex;
  justify-content: space-between;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 40px;
}
.btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--orange);
  color: var(--white);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn-outline {
  background: transparent;
  color: var(--orange);
  border: 2px solid var(--orange);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.btn-danger {
  background: #c0392b;
}

/* ── Post detail ─────────────────────────────────────────── */
.post-detail-header {
  margin-bottom: 24px;
}
.post-detail-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 12px 0 8px;
  line-height: 1.4;
}
.post-meta {
  font-size: 13px;
  color: var(--mid);
}

.slide-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.slide-item img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 3px 12px rgba(0,0,0,.15);
  display: block;
}
.slide-num {
  text-align: center;
  font-size: 12px;
  color: var(--mid);
  margin-top: 6px;
}

.post-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.post-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--white);
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  transition: border-color .2s;
}
.post-link-chip:hover { border-color: var(--orange); }

/* ── Admin table ─────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.stat-chip {
  background: var(--white);
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
}
.stat-chip strong {
  color: var(--orange);
  margin-right: 4px;
}

.posts-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.posts-table th {
  background: var(--dark);
  color: var(--white);
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
}
.posts-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  vertical-align: middle;
}
.posts-table tr:hover td { background: #fafafa; }
.posts-table .thumb {
  width: 48px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.posts-table .thumb-empty {
  width: 48px;
  height: 60px;
  background: var(--dark);
  border-radius: 6px;
}

/* ── Login ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .brand {
  font-size: 22px;
  font-weight: 700;
}
.login-logo .brand span { color: var(--orange); }
.login-logo .sub {
  font-size: 13px;
  color: var(--mid);
  margin-top: 4px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--mid);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s;
}
.form-control:focus { border-color: var(--orange); }
.error-msg {
  background: #fdf0ef;
  color: #c0392b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--mid);
}
.empty h2 { font-size: 18px; margin-bottom: 8px; }
.empty p  { font-size: 14px; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 13px;
  color: var(--mid);
  border-top: 1px solid #e8e6e3;
  margin-top: 40px;
}
