:root {
  --bg: #f4f2ee;
  --panel: #fffdfa;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --line: #e2d9cc;
  --accent: #b45309;
  --accent-dark: #7c2d12;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8f6f2, var(--bg));
  min-height: 100vh;
}

.container {
  width: min(900px, 92vw);
  margin: 40px auto;
  display: grid;
  gap: 18px;
}

.hero,
.composer-card,
.post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(33, 18, 8, 0.05);
}

.user-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid #d8cdbf;
  background: #fff;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 6px 16px rgba(33, 18, 8, 0.1);
}

.user-btn:hover {
  background: #fff8ef;
}

.avatar {
  display: block;
  font-size: 22px;
  line-height: 1;
  transform: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  display: grid;
  place-items: center;
  z-index: 19;
}

.modal-card {
  width: min(360px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h2 {
  margin-bottom: 10px;
}

.hero p {
  color: var(--muted);
  margin-top: 6px;
}

.login-form,
.comment-form,
.post-head,
.author-wrap,
.composer-head,
.edit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fffcf7;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

button.ghost {
  background: #efe8dd;
  color: #4b5563;
}

button.ghost:hover {
  background: #e5dccf;
}

.posts {
  display: grid;
  gap: 10px;
}

.load-more {
  margin: 12px auto 0;
  display: block;
}

.post-head {
  justify-content: space-between;
}

.post-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: #efe8dd;
  color: #4b5563;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.comment-toggle-btn {
  background: #e6edf1;
  color: #476276;
  border-color: #d1dde5;
}

.icon-btn.comment-toggle-btn:hover {
  background: #dce5eb;
}

.icon-btn.edit-btn {
  background: #e8efe8;
  color: #4f6b54;
  border-color: #d4dfd4;
}

.icon-btn.edit-btn:hover {
  background: #dde7dd;
}

.icon-btn.delete-btn {
  background: #f2e7e4;
  color: #7a524a;
  border-color: #e3d2ce;
}

.icon-btn.delete-btn:hover {
  background: #eadfdb;
}

.icon-btn.logout-btn {
  background: #ece9f1;
  color: #605578;
  border-color: #dad3e6;
}

.icon-btn.logout-btn:hover {
  background: #e4dfeb;
}

.author-avatar {
  font-size: 20px;
}

.author-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.time {
  color: var(--muted);
  font-size: 12px;
}

.content {
  margin-top: 10px;
  white-space: pre-wrap;
}

.comments-block {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e7dece;
}

.composer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.tool-btn {
  min-width: 96px;
}

.media-frame {
  margin-top: 10px;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  isolation: isolate;
  display: grid;
  place-items: center;
}

.media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  transform: scale(1.12);
  filter: blur(18px) saturate(0.95);
  opacity: 0.58;
  z-index: 0;
}

.post-media {
  width: min(100%, 320px);
  height: auto;
}

.preview-frame {
  width: min(100%, 260px);
  height: auto;
}

.upload-preview,
.post-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 1;
  display: block;
}

.post-image {
  cursor: zoom-in;
  max-height: 260px;
}

.upload-preview {
  max-height: 220px;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.lightbox-image {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.comments {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.edit-block {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.comment-item {
  font-size: 14px;
  background: #fff;
  border: 1px solid #eee3d3;
  border-radius: 8px;
  padding: 6px 8px;
}

.comment-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.hint {
  margin-top: 8px;
  min-height: 18px;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {

  .login-form,
  .comment-form {
    flex-direction: column;
    align-items: stretch;
  }

  .composer-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
