:root {
  --coral: #e8845c;
  --coral-dark: #d96f43;
  --coral-light: #fbeae0;
  --bg: #fff9f5;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #8a7f78;
  --border: #f0e3da;
  --shadow: 0 6px 20px rgba(232, 132, 92, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--coral-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 249, 245, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-weight: 700;
  font-size: 20px;
  color: var(--coral-dark);
}
.brand:hover {
  text-decoration: none;
}
.nav a {
  margin-left: 18px;
  color: var(--text);
  font-size: 15px;
}
.nav a:hover {
  color: var(--coral);
  text-decoration: none;
}

/* Hero */
.hero {
  text-align: center;
  padding: 42px 0 24px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
  color: var(--coral-dark);
}
.hero .subtitle {
  margin: 0 0 20px;
  color: var(--muted);
}
.search-box input {
  width: 100%;
  max-width: 460px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  outline: none;
  background: var(--card);
}
.search-box input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-light);
}

/* Tag bar */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 22px;
}
.tag-chip {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--coral-light);
  color: var(--coral-dark);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}
.tag-chip:hover {
  text-decoration: none;
}
.tag-chip.active {
  background: var(--coral);
  color: #fff;
}

/* Post list */
.post-list {
  display: grid;
  gap: 18px;
}
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease;
}
.post-card:hover {
  transform: translateY(-3px);
}
.post-card .cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.post-card .body {
  padding: 18px 20px 20px;
}
.post-card h2 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.4;
}
.post-card h2 a {
  color: var(--text);
}
.post-card h2 a:hover {
  color: var(--coral-dark);
}
.post-card .excerpt {
  color: var(--muted);
  margin: 0 0 12px;
  font-size: 15px;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.post-meta .tag {
  background: var(--coral-light);
  color: var(--coral-dark);
  padding: 2px 9px;
  border-radius: 999px;
}
.post-meta .stat {
  white-space: nowrap;
}

/* Pager */
.pager {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 30px 0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--coral);
  background: var(--coral);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover {
  background: var(--coral-dark);
  text-decoration: none;
}
.btn.ghost {
  background: #fff;
  color: var(--coral-dark);
}
.btn.small {
  padding: 5px 12px;
  font-size: 13px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 22px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Forms */
.form-wrap {
  max-width: 380px;
  margin: 50px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
}
.form-wrap h2 {
  margin: 0 0 6px;
  color: var(--coral-dark);
  text-align: center;
}
.form-wrap .tabs {
  display: flex;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--coral-light);
  padding: 4px;
}
.form-wrap .tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--coral-dark);
  font-size: 14px;
}
.form-wrap .tabs button.active {
  background: #fff;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.field input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-light);
}
.msg {
  font-size: 13px;
  margin: 8px 0;
  min-height: 18px;
}
.msg.error {
  color: #d6453b;
}
.msg.ok {
  color: #2e9e5b;
}
.form-wrap .btn {
  width: 100%;
  margin-top: 4px;
}

/* Article detail */
.article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 34px;
  margin: 24px 0;
}
.article h1 {
  margin: 0 0 10px;
  font-size: 28px;
  color: var(--coral-dark);
}
.article .cover {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 18px;
}
.article .post-meta {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article .content h1,
.article .content h2,
.article .content h3 {
  color: var(--text);
  margin: 24px 0 10px;
}
.article .content h2 {
  border-left: 4px solid var(--coral);
  padding-left: 10px;
}
.article .content p {
  margin: 12px 0;
}
.article .content pre {
  background: #2b2b2b;
  color: #f5f5f5;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13px;
}
.article .content code {
  background: var(--coral-light);
  color: var(--coral-dark);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
}
.article .content pre code {
  background: none;
  color: inherit;
  padding: 0;
}
.article .content blockquote {
  border-left: 4px solid var(--coral);
  margin: 14px 0;
  padding: 6px 16px;
  color: var(--muted);
  background: var(--coral-light);
  border-radius: 0 8px 8px 0;
}
.article .content img {
  max-width: 100%;
  border-radius: 8px;
}
.article .content a {
  color: var(--coral-dark);
}

.like-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}
.like-btn {
  border: 1px solid var(--coral);
  background: #fff;
  color: var(--coral-dark);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
}
.like-btn.liked {
  background: var(--coral);
  color: #fff;
}

/* Comments */
.comments {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  margin-bottom: 40px;
}
.comments h3 {
  margin: 0 0 16px;
  color: var(--coral-dark);
}
.comment {
  border-bottom: 1px dashed var(--border);
  padding: 12px 0;
}
.comment .head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.comment .name {
  color: var(--coral-dark);
  font-weight: 600;
}
.comment .text {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment .del {
  color: #d6453b;
  cursor: pointer;
  font-size: 12px;
}
.comment-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  font-family: inherit;
}
.comment-form textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-light);
}

/* Admin */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 16px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-table th,
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
.admin-table th {
  background: var(--coral-light);
  color: var(--coral-dark);
}
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
}
.badge.pub {
  background: #e3f6ea;
  color: #2e9e5b;
}
.badge.draft {
  background: #f3eee9;
  color: var(--muted);
}
.editor {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin: 16px 0 40px;
}
.editor .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.editor .full {
  grid-column: 1 / -1;
}
.editor textarea.body {
  width: 100%;
  min-height: 320px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 13px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  resize: vertical;
}
.editor .preview {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 320px;
  overflow: auto;
  background: #fffdfb;
  font-size: 14px;
}
.editor .preview h1,
.editor .preview h2,
.editor .preview h3 {
  color: var(--text);
}
.editor .preview pre {
  background: #2b2b2b;
  color: #f5f5f5;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}
@media (max-width: 640px) {
  .editor .grid {
    grid-template-columns: 1fr;
  }
  .article {
    padding: 22px 18px;
  }
}
