:root {
  --bg: #0f1115;
  --bg-soft: #161922;
  --card: #1b1f2a;
  --card-2: #222735;
  --line: #2c3140;
  --text: #e6e8ee;
  --text-dim: #9aa3b2;
  --text-muted: #6b7385;
  --accent: #7c5cff;
  --accent-2: #5ad1c5;
  --like: #ff5a78;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --header-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2130 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: clamp(15px, 1.05vw + 12px, 17px);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.wrap { width: min(100% - 32px, 980px); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(15, 17, 21, 0.78);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  padding-block: 10px;
}

.brand {
  font-size: clamp(20px, 2vw + 12px, 26px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.tagline { margin: 0; color: var(--text-muted); font-size: 0.82em; }

main.wrap { flex: 1; padding-block: clamp(20px, 4vw, 44px); }

.feed { display: grid; gap: clamp(16px, 2.4vw, 26px); }
.feed--single { max-width: 760px; }

.post {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 30px);
  overflow: hidden;
}

.post-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.post-head h2 { margin: 0 0 8px; font-size: clamp(19px, 1.6vw + 13px, 25px); line-height: 1.35; }
.post-head h2 a { color: var(--text); }
.post-head time { color: var(--text-muted); font-size: 0.78em; white-space: nowrap; }

.post-body { margin-top: 10px; color: var(--text); overflow-wrap: anywhere; }
.post-body br { line-height: 0; }

.gallery { margin-top: 16px; display: grid; gap: 10px; }
.gallery--one { grid-template-columns: 1fr; }
.gallery--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery--many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery img {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-2);
}
.gallery--one img { max-height: 520px; object-fit: contain; }

.post-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.92em;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.like-btn:hover { border-color: var(--like); color: var(--text); }
.like-btn:active { transform: scale(0.97); }
.like-btn.is-liked { color: var(--like); border-color: var(--like); background: rgba(255, 90, 120, 0.12); }
.like-btn[disabled] { cursor: default; opacity: 0.9; }
.like-icon { font-size: 1.15em; line-height: 1; }

.empty { color: var(--text-muted); text-align: center; padding: 40px 0; }

.site-footer { border-top: 1px solid var(--line); color: var(--text-muted); font-size: 0.82em; padding-block: 18px; }

/* ---------------------------------------------------------------- admin */
.admin-shell { display: grid; gap: 20px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 3vw, 26px); }
.panel h1, .panel h2 { margin-top: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.86em; color: var(--text-dim); }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 140px; resize: vertical; }
button.primary {
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
}
button.ghost {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  cursor: pointer;
}
.admin-list { display: grid; gap: 10px; }
.admin-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); flex-wrap: wrap; }
.admin-row .row-actions { display: flex; gap: 8px; }
.status { font-size: 0.86em; color: var(--text-muted); min-height: 1.4em; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .wrap { width: min(100% - 22px, 980px); }
  .gallery--two, .gallery--many { grid-template-columns: 1fr; }
  .gallery img { max-height: 360px; }
  .post-actions { flex-direction: column; align-items: stretch; }
  .like-btn { justify-content: center; }
  .header-inner { align-items: center; }
  .tagline { width: 100%; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .gallery--many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wrap { width: min(100% - 48px, 980px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
