:root {
  --bg: #f3ede4;
  --bg-layer: #fbf8f2;
  --surface: rgba(255, 252, 247, 0.86);
  --surface-strong: rgba(255, 250, 244, 0.96);
  --surface-dark: rgba(16, 22, 33, 0.84);
  --line: rgba(73, 54, 27, 0.12);
  --line-strong: rgba(73, 54, 27, 0.2);
  --text: #1f1913;
  --muted: #6f6256;
  --muted-strong: #4c433b;
  --gold: #b88543;
  --gold-deep: #8f6024;
  --ink: #1f3158;
  --success: #2c6c49;
  --danger: #b44c36;
  --pending: #a16a1d;
  --shadow-xl: 0 30px 80px rgba(58, 41, 20, 0.14);
  --shadow-lg: 0 18px 50px rgba(58, 41, 20, 0.1);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --ease-premium: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(184, 133, 67, 0.18), transparent 56%),
    radial-gradient(820px 540px at 100% 0%, rgba(31, 49, 88, 0.14), transparent 52%),
    linear-gradient(180deg, #efe7db 0%, #f7f3eb 45%, #f1ebe2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)),
    repeating-linear-gradient(
      90deg,
      rgba(67, 49, 24, 0.024) 0,
      rgba(67, 49, 24, 0.024) 1px,
      transparent 1px,
      transparent 140px
    );
  opacity: 0.7;
  animation: bg-shift 26s ease-in-out infinite alternate;
}

a {
  color: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 60px;
  animation: rise-in 0.8s var(--ease-premium) both;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 30px;
  border-radius: var(--radius-xl);
  color: #fff7ef;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-xl);
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 218, 169, 0.24), transparent 28%),
    linear-gradient(135deg, rgba(17, 28, 49, 0.95), rgba(69, 39, 18, 0.88)),
    linear-gradient(180deg, #1e3059, #55361a);
  animation: rise-in 0.9s var(--ease-premium) both;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 226, 190, 0.24), transparent 70%);
}

.hero-row,
.hero-actions,
.toolbar,
.stack-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-kicker,
.pill,
.status-pill,
.user-chip,
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1;
}

.hero-kicker,
.pill,
.user-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff7ef;
}

.hero-title,
.panel-title,
.section-title,
.auth-title,
.post-title,
.article-title {
  margin: 0;
  font-family: "Cormorant Garamond", "Songti SC", serif;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(2.7rem, 4.5vw, 4.8rem);
  line-height: 0.92;
  margin-top: 8px;
}

.hero-subtitle {
  max-width: 620px;
  margin: 12px 0 0;
  color: rgba(255, 247, 239, 0.82);
  line-height: 1.8;
  font-size: 1rem;
}

.button,
button,
input[type="submit"] {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 11px 18px;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  position: relative;
  overflow: hidden;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  transform: translateY(-1px) scale(1.01);
}

.button::before,
button::before,
input[type="submit"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: -140%;
  width: 120%;
  height: 100%;
  transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transition: left 0.6s var(--ease-premium);
  pointer-events: none;
}

.button:hover::before,
button:hover::before,
input[type="submit"]:hover::before {
  left: 120%;
}

.button-primary,
button,
input[type="submit"] {
  background: linear-gradient(135deg, #d7aa6f, #97652c);
  color: #fff9f3;
  box-shadow: 0 14px 26px rgba(151, 101, 44, 0.22);
}

.button-secondary {
  background: rgba(42, 31, 17, 0.06);
  border-color: var(--line);
  color: var(--text);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff7ef;
}

.button-danger {
  background: linear-gradient(135deg, #d16c4f, #a43e2a);
  color: #fff8f4;
}

.button-success {
  background: linear-gradient(135deg, #60a277, #2e6c49);
  color: #f4fff9;
}

.hero-actions {
  justify-content: flex-end;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  margin-top: 22px;
  align-items: stretch;
}

.card,
.post-card,
.dashboard-card,
.auth-card,
.article-panel {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
}

.post-card,
.dashboard-card,
.article-panel,
.auth-card {
  padding: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  height: 100%;
  transform: translateY(0);
  transition: transform 0.24s var(--ease-premium), box-shadow 0.24s var(--ease-premium), border-color 0.24s var(--ease-premium);
  animation: rise-in 0.7s var(--ease-premium) both;
}

.post-card .button {
  margin-top: auto;
}

.post-card:hover {
  transform: translateY(-6px);
  border-color: rgba(143, 96, 36, 0.28);
  box-shadow: 0 24px 50px rgba(58, 41, 20, 0.16);
}

.post-title {
  font-size: 1.7rem;
  line-height: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.post-meta,
.meta-line {
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.92rem;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.post-excerpt,
.muted-copy {
  color: var(--muted-strong);
  line-height: 1.85;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  white-space: normal;
}

mark {
  background: rgba(255, 215, 122, 0.52);
  color: inherit;
  padding: 0.08em 0.28em;
  border-radius: 0.3em;
}

.post-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.status-pill {
  width: fit-content;
  background: rgba(184, 133, 67, 0.12);
  border: 1px solid rgba(184, 133, 67, 0.18);
  color: var(--gold-deep);
}

.status-pill.pending {
  background: rgba(161, 106, 29, 0.12);
  border-color: rgba(161, 106, 29, 0.18);
  color: var(--pending);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 22px;
}

.article-shell {
  width: min(1360px, calc(100% - 28px));
  --article-main-col: 980px;
  --article-side-col: 340px;
  --article-col-gap: 18px;
}

.article-hero {
  padding: 24px 28px;
  max-width: var(--article-main-col);
  margin: 0 auto;
}

.article-hero-title {
  font-size: clamp(2rem, 3.4vw, 3rem);
}

.article-hero-meta {
  max-width: none;
}

.article-detail-section {
  margin-top: 22px;
}

.article-layout {
  margin-top: 22px;
  position: relative;
  width: 100%;
  max-width: var(--article-main-col);
  margin-left: auto;
  margin-right: auto;
}

.article-detail-panel {
  padding: 26px 30px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  margin: 0;
}

.article-detail-panel .markdown-body {
  font-size: 1.53rem;
  line-height: 1.7;
}

.article-panel {
  padding: 30px;
  background: var(--surface-strong);
  animation: rise-in 0.75s var(--ease-premium) both;
}

.comment-panel {
  padding: 20px;
  position: absolute;
  top: 0;
  left: calc(100% + var(--article-col-gap));
  width: var(--article-side-col);
}

.comment-title {
  font-size: 1.9rem;
  margin-bottom: 10px;
}

.comment-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.comment-form textarea {
  min-height: 110px;
}

.comment-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  max-height: min(68vh, 920px);
  overflow: auto;
  padding-right: 4px;
}

.comment-thread {
  border: 1px solid rgba(184, 133, 67, 0.28);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 246, 0.88);
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.comment-thread-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.comment-thread-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--gold-deep);
  background: rgba(184, 133, 67, 0.14);
  border: 1px solid rgba(184, 133, 67, 0.22);
}

.comment-thread-user {
  font-size: 0.82rem;
  color: var(--muted);
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.root-comment-item {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(184, 133, 67, 0.22);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.comment-meta span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.reply-route {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: #5f513f;
  background: rgba(143, 96, 36, 0.09);
  border: 1px solid rgba(143, 96, 36, 0.18);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comment-content {
  margin: 8px 0 0;
  line-height: 1.7;
  color: var(--muted-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comment-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-reply-form {
  margin-top: 10px;
}

.comment-reply-form textarea {
  min-height: 84px;
}

.comment-expand-toggle {
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 0.86rem;
}

.comment-children {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  padding-left: 0;
  border-left: 0;
}

.comment-branch {
  margin-top: 8px;
}

.is-hidden {
  display: none !important;
}

.comment-delete-form {
  margin: 0;
}

.comment-delete-form .button {
  padding: 8px 14px;
  font-size: 0.86rem;
}

.markdown-body {
  color: var(--muted-strong);
  line-height: 1.92;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 24px 0 12px;
  line-height: 1.08;
  color: var(--text);
  font-family: "Cormorant Garamond", "Songti SC", serif;
}

.markdown-body p {
  margin: 14px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-body ul,
.markdown-body ol {
  margin: 14px 0 14px 24px;
  padding: 0;
}

.markdown-body blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  background: rgba(184, 133, 67, 0.08);
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-body code {
  background: rgba(31, 49, 88, 0.08);
  border-radius: 8px;
  padding: 2px 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  background: #171d29;
  color: #e7eefc;
  padding: 18px;
  border-radius: var(--radius-md);
  overflow: auto;
  max-width: 100%;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 10px;
}

.dashboard-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.panel-title,
.section-title {
  font-size: 2.15rem;
  line-height: 1;
  margin-bottom: 10px;
}

.section-subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.8;
}

.notice {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(184, 133, 67, 0.12), rgba(255, 255, 255, 0.52));
  color: var(--muted-strong);
}

.notice.success {
  background: linear-gradient(135deg, rgba(44, 108, 73, 0.12), rgba(255, 255, 255, 0.56));
  color: var(--success);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field-stack {
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--muted-strong);
}

input,
textarea,
select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(184, 133, 67, 0.54);
  box-shadow: 0 0 0 4px rgba(184, 133, 67, 0.12);
  background: rgba(255, 255, 255, 0.96);
}

input[readonly],
textarea[readonly],
input[disabled] {
  background: rgba(60, 47, 33, 0.05);
  color: rgba(31, 25, 19, 0.7);
}

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

.rich-editor-shell {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  overflow: hidden;
}

.rich-editor-shell .toastui-editor-defaultUI {
  border: 0;
}

.rich-editor-shell .toastui-editor-toolbar {
  background: rgba(255, 255, 255, 0.94);
}

.editor-ready #post-content {
  display: none;
}

.article-editor-ready #edit-content {
  display: none;
}

.article-detail-panel .notice {
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(73, 54, 27, 0.08);
  padding: 14px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.markdown-body table {
  margin: 1rem 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
  max-width: 100%;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid rgba(73, 54, 27, 0.1);
  padding: 10px 12px;
  vertical-align: top;
}

.markdown-body thead th {
  background: rgba(184, 133, 67, 0.1);
  color: var(--muted-strong);
}

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

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

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(1000px, calc(100% - 36px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.04fr;
  gap: 24px;
  align-items: center;
  padding: 30px 0;
  animation: rise-in 0.8s var(--ease-premium) both;
}

.auth-side {
  padding: 30px;
  color: #fff8ef;
}

.auth-card {
  background: rgba(255, 252, 247, 0.92);
  animation: rise-in 0.85s var(--ease-premium) both;
}

.auth-title {
  font-size: 2.35rem;
  line-height: 1;
  margin-bottom: 8px;
}

.auth-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.8;
}

.auth-foot {
  color: var(--muted);
  margin-top: 14px;
}

.auth-foot a {
  color: var(--gold-deep);
  font-weight: 800;
  text-decoration: none;
}

.stats-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.stat-block {
  min-width: 148px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: breathe 3.8s ease-in-out infinite;
}

.grid-cards > .post-card:nth-child(2) { animation-delay: 0.04s; }
.grid-cards > .post-card:nth-child(3) { animation-delay: 0.08s; }
.grid-cards > .post-card:nth-child(4) { animation-delay: 0.12s; }
.grid-cards > .post-card:nth-child(5) { animation-delay: 0.16s; }
.grid-cards > .post-card:nth-child(6) { animation-delay: 0.2s; }

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes bg-shift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, -8px, 0); }
}

.stat-label {
  font-size: 0.82rem;
  color: rgba(255, 247, 239, 0.72);
}

.stat-value {
  display: block;
  margin-top: 6px;
  font-size: 1.28rem;
  font-weight: 800;
}

@media (max-width: 980px) {
  .auth-shell,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .article-layout {
    max-width: 100%;
  }

  .comment-panel {
    position: static;
    width: 100%;
    margin-top: 14px;
  }

  .article-hero {
    transform: none;
  }
}

@media (max-width: 1680px) {
  .article-layout {
    max-width: min(100%, calc(var(--article-main-col) + var(--article-side-col) + var(--article-col-gap)));
  }

  .comment-panel {
    position: static;
    width: 100%;
    margin-top: 14px;
  }
}

@media (max-width: 760px) {
  .page-shell,
  .auth-shell {
    width: min(100% - 22px, 1180px);
  }

  .article-shell {
    width: min(100% - 22px, 980px);
  }

  .hero,
  .post-card,
  .dashboard-card,
  .article-panel,
  .auth-card {
    padding: 20px;
    border-radius: 20px;
  }

  .hero-title {
    font-size: clamp(2.2rem, 10vw, 3.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
