:root {
  --ink: #1f2328;
  --muted: #6d7682;
  --line: #e4e8ec;
  --soft: #f6f8fa;
  --panel: #ffffff;
  --green: #00c73c;
  --green-deep: #07913a;
  --blue: #2f6fed;
  --pin: #ff6f3d;
  --shadow: 0 14px 45px rgba(21, 33, 45, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f4;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  min-height: 100vh;
}

.admin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 20px;
  background: #121820;
  color: #fff;
}

.admin__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #92ffb4;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.admin h2 {
  margin: 0 0 14px;
  color: #eaf0f7;
  font-size: 16px;
}

.admin h3 {
  margin: 18px 0 10px;
  color: #d8e1eb;
  font-size: 14px;
}

.admin small {
  color: #95a3b1;
}

.icon-btn,
.admin button,
.file-label {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #222b36;
  color: #fff;
  min-height: 36px;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  font-size: 18px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.post-switcher {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-bottom: 14px;
}

.post-switcher select,
.field input,
.field textarea,
.field select,
.number-row input,
.json-box {
  width: 100%;
  border: 1px solid #d7dde4;
  border-radius: 8px;
  background: #fff;
  color: #111820;
  outline: none;
}

.post-switcher select {
  min-width: 0;
  padding: 0 10px;
}

.post-switcher button,
.tab,
.admin .mini-btn,
.admin .danger,
.admin .primary,
.file-label {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  height: 38px;
  color: #aab6c3;
}

.tab.is-active {
  border-color: rgba(0, 199, 60, 0.75);
  background: var(--green);
  color: #06210f;
}

.panel {
  display: grid;
  gap: 14px;
}

.admin-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px;
  background: #18212b;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #c6d0db;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  min-height: 40px;
  padding: 9px 10px;
  font-weight: 500;
}

.field textarea {
  min-height: 136px;
  resize: vertical;
}

.code-textarea {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.rich-help {
  color: #95a3b1;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.rich-editor {
  min-height: 260px;
  max-height: 560px;
  overflow: auto;
  padding: 14px;
  border: 1px solid #d7dde4;
  border-radius: 8px;
  background: #fff;
  color: #111820;
  font-weight: 500;
  line-height: 1.7;
  outline: none;
}

.rich-editor:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 199, 60, 0.18);
}

.rich-editor img {
  max-width: 100%;
  height: auto;
}

.rich-editor table {
  width: 100%;
  border-collapse: collapse;
}

.rich-editor td,
.rich-editor th {
  border: 1px solid #ccd4dc;
  padding: 6px;
}

.number-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 12px;
  color: #c6d0db;
  font-size: 13px;
  font-weight: 800;
}

.switch-row input {
  width: 42px;
  height: 22px;
  accent-color: var(--green);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.admin .primary {
  border-color: rgba(0, 199, 60, 0.9);
  background: var(--green);
  color: #06210f;
}

.admin .danger {
  border-color: rgba(255, 114, 85, 0.45);
  background: #40232a;
  color: #ffd0c6;
}

.image-editor,
.comment-editor,
.reply-editor {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.image-editor + .image-editor,
.comment-editor + .comment-editor,
.reply-editor + .reply-editor {
  margin-top: 10px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: #e8eef5;
  font-size: 13px;
  font-weight: 800;
}

.editor-head .badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  background: rgba(255, 111, 61, 0.18);
  color: #ffbea8;
  font-size: 12px;
}

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

.admin .mini-btn {
  min-height: 30px;
  padding: 0 9px;
  color: #d9e3ee;
}

.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.file-label input {
  display: none;
}

.json-box {
  min-height: 220px;
  padding: 10px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.preview-wrap {
  min-width: 0;
  padding: 32px clamp(18px, 4vw, 48px);
  overflow: auto;
}

.public-shell {
  min-height: 100vh;
  padding: 32px clamp(14px, 4vw, 48px);
  background: #eef2f4;
}

.public-shell .blog-frame {
  box-shadow: none;
}

.blog-frame {
  width: min(1040px, 100%);
  margin: 0 auto;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.blog-global {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: #6a737d;
  font-size: 12px;
}

.blog-global strong {
  color: var(--green-deep);
}

.blog-title {
  min-height: 208px;
  padding: 34px 42px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72)),
    var(--cover, linear-gradient(135deg, #dff9e8, #f9fbff));
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}

.blog-title h2 {
  margin: 0 0 8px;
  color: #15191d;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  font-weight: 800;
}

.blog-title p {
  margin: 0;
  color: #5e6874;
  font-size: 14px;
}

.blog-menu {
  display: flex;
  gap: 24px;
  align-items: center;
  min-height: 48px;
  padding: 0 42px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--line);
  color: #7d8792;
  font-size: 13px;
}

.blog-menu span:first-child {
  color: var(--green-deep);
  font-weight: 800;
}

.blog-body {
  padding: 32px 34px 42px;
}

.profile-box {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.profile-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--soft);
}

.profile-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.profile-name .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.profile-box p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.profile-actions {
  display: grid;
  gap: 6px;
}

.profile-actions button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #3d4650;
  font-size: 12px;
  font-weight: 800;
}

.post {
  min-width: 0;
  max-width: 820px;
  margin: 0 auto;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #98a1ab;
  font-size: 12px;
}

.post-meta .category {
  color: var(--green-deep);
  font-weight: 800;
}

.post h2 {
  margin: 0;
  color: #222;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.32;
  font-weight: 500;
}

.author-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 28px;
  color: #717b86;
  font-size: 13px;
}

.post-content {
  color: #333;
  font-size: 16px;
  line-height: 1.9;
}

.post-content p {
  margin: 0 0 20px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
}

.post-content table {
  width: 100%;
  margin: 22px 0;
  border-collapse: collapse;
}

.post-content td,
.post-content th {
  border: 1px solid #d9dee4;
  padding: 8px 10px;
}

.post-image {
  margin: 28px 0;
}

.post-image img {
  width: 100%;
  max-height: 620px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--soft);
}

.post-image figcaption {
  margin-top: 8px;
  color: #87909a;
  font-size: 12px;
  text-align: center;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 34px 0 22px;
  padding-top: 22px;
  border-top: 1px solid #edf0f2;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #505a64;
  font-size: 13px;
  font-weight: 800;
}

.pill.like {
  border-color: rgba(0, 199, 60, 0.3);
  color: var(--green-deep);
}

.comments {
  border-top: 1px solid #d7dde4;
}

.comments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.comment {
  display: block;
  padding: 15px 0;
  border-top: 1px solid #edf0f2;
}

.comment.is-reply {
  margin-left: 44px;
  padding-left: 14px;
  border-left: 2px solid #edf0f2;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #222;
  font-size: 13px;
  font-weight: 800;
}

.pin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 99px;
  background: rgba(255, 111, 61, 0.12);
  color: var(--pin);
  font-size: 11px;
  font-weight: 800;
}

.comment-body {
  margin: 6px 0 8px;
  color: #343a40;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.comment-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: #8a949f;
  font-size: 12px;
}

.hidden-note {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed #cfd6dd;
  border-radius: 8px;
  color: #77818c;
  text-align: center;
  font-size: 13px;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .admin {
    position: relative;
    height: auto;
    max-height: none;
  }

  .blog-body {
    grid-template-columns: 1fr;
  }

  .profile-box {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 14px;
  }

  .profile-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .preview-wrap {
    padding: 12px;
  }

  .public-shell {
    padding: 0;
    background: #fff;
  }

  .public-shell .blog-frame {
    width: 100%;
    min-height: 100vh;
  }

  .blog-title,
  .blog-menu,
  .blog-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .post-switcher {
    grid-template-columns: 1fr 1fr;
  }

  .post-switcher select {
    grid-column: 1 / -1;
  }

  .number-row {
    grid-template-columns: 1fr;
  }

  .comment.is-reply {
    margin-left: 18px;
  }
}
