:root {
  --bg: #efe4d2;
  --bg-2: #e7d8c2;
  --panel: #fff8ed;
  --panel-2: #ead8bf;
  --panel-3: #f8efe3;
  --text: #241a12;
  --muted: #6f5b47;
  --soft: #8a7356;
  --line: rgba(112, 83, 52, 0.24);
  --line-strong: rgba(112, 83, 52, 0.38);
  --accent: #8b5e34;
  --accent-2: #70451f;
  --accent-3: #a06d3a;
  --accent-soft: rgba(139, 94, 52, 0.14);
  --header: rgba(255, 248, 237, 0.86);
  --input-bg: #fffaf2;
  --danger: #9b3f2d;
  --success: #3f7c4a;
  --shadow: rgba(74, 45, 22, 0.12);
  --shadow-strong: rgba(74, 45, 22, 0.22);
  --radius: 20px;
  --radius-sm: 12px;
  --max: 1180px;
}

/* =========================================================
   Base
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(160, 109, 58, 0.18), transparent 34rem),
    radial-gradient(circle at 90% 8%, rgba(255, 255, 255, 0.58), transparent 28rem),
    linear-gradient(180deg, #f6eddf 0%, #eadcc8 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.58;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: #6f3f1d;
  text-decoration: none;
}

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

img {
  max-width: 100%;
}

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 18px;
}

.page {
  padding: 34px 0;
  flex: 1;
}

/* =========================================================
   Header / Navigation
   ========================================================= */

.site-header,
.site-footer {
  background: var(--header);
  backdrop-filter: blur(14px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(74, 45, 22, 0.05);
}

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

.header-bar {
  min-height: 74px;
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
}

/* Brand / Logo */
.brand {
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  font-weight: 850;
  font-size: 23px;
  letter-spacing: -0.055em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

/* Disable old generated TRO square logo */
.brand::before {
  content: none !important;
  display: none !important;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  display: block !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  flex: 0 0 42px !important;
  overflow: hidden !important;
  border: 1px solid rgba(90, 63, 38, 0.35);
  box-shadow: 0 2px 8px rgba(70, 45, 20, 0.18);
}

.brand span {
  display: inline-block;
  font-weight: 850;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.brand-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

.site-nav a {
  color: #5f3a1f;
  font-size: 15px;
  padding: 9px 11px;
  border-radius: 999px;
  transition: 0.18s ease;
}

.site-nav a:hover {
  background: var(--accent-soft);
  color: #211409;
  text-decoration: none;
}

.site-nav a[href*="admin"],
.site-nav a[href*="logout"] {
  opacity: 0.88;
}

/* =========================================================
   Cards / Layout
   ========================================================= */

.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 248, 237, 0.78)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 14px 34px var(--shadow);
}

.card:hover {
  border-color: rgba(139, 94, 52, 0.42);
}

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 46px 38px;
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 248, 237, 0.76)),
    var(--panel);
  box-shadow: 0 18px 48px var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -110px;
  width: 290px;
  height: 290px;
  border-radius: 999px;
  background: rgba(139, 94, 52, 0.12);
  filter: blur(3px);
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.075em;
}

.hero p {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 .card {
  min-height: 178px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.grid-2 .card h2,
.grid-3 .card h2,
.card h1,
.card h2,
.card h3 {
  margin-top: 0;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.grid-2 .card h2 {
  margin-bottom: 12px;
  font-size: 28px;
}

.grid-2 .card p {
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 20px;
}

.grid-2 .card .button {
  margin-top: auto;
}

.grid-3 .card {
  min-height: 98px;
}

.grid-3 .card h3 {
  margin: 0;
  font-size: 19px;
}

.stack {
  display: grid;
  gap: 16px;
}

/* =========================================================
   Buttons / Inputs
   ========================================================= */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  background: linear-gradient(180deg, var(--accent-3), var(--accent));
  color: #fffaf2;
  border: 1px solid var(--accent-2);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 20px rgba(111, 66, 28, 0.17);
  transition: 0.18s ease;
}

.button:hover {
  background: linear-gradient(180deg, #aa7542, var(--accent-2));
  color: #fffaf2;
  text-decoration: none;
  transform: translateY(-1px);
}

.button.secondary {
  background: #fffaf2;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.secondary:hover {
  background: var(--panel-2);
  color: var(--text);
}

.button.danger {
  background: var(--danger);
  border-color: #7c2f22;
  color: #fff;
}

button,
input[type="submit"] {
  font-family: inherit;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 12px;
  border-radius: 999px;
  background: #fffaf2;
  border: 1px solid var(--line);
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #fffaf2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 94, 52, 0.15);
}

textarea {
  resize: vertical;
}

.error {
  color: var(--danger);
}

.success {
  color: var(--success);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

/* =========================================================
   Auth
   ========================================================= */

.auth-page {
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  display: grid;
  gap: 12px;
}

/* =========================================================
   Articles / Content
   ========================================================= */

.article-body {
  line-height: 1.75;
  white-space: normal;
}

.article-excerpt {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 18px;
}

.list-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rich-content {
  line-height: 1.78;
  font-size: 17px;
}

.rich-content p,
.rich-content ul,
.rich-content ol,
.rich-content blockquote,
.rich-content h2,
.rich-content h3,
.rich-content h4 {
  margin: 0 0 16px;
}

.rich-content h2,
.rich-content h3,
.rich-content h4 {
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-top: 30px;
}

.rich-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 16px 18px;
  color: var(--muted);
  background: rgba(255, 250, 242, 0.7);
  border-radius: 0 12px 12px 0;
}

.rich-content ul,
.rich-content ol {
  padding-left: 24px;
}

.rich-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

.content-cover {
  margin: 24px 0;
}

.content-cover img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: 20px;
  display: block;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px var(--shadow);
}

.rich-content figure {
  margin: 24px 0;
}

.rich-content figure img {
  width: 100%;
  max-width: 100%;
  border-radius: 16px;
  display: block;
}

.rich-content figcaption {
  margin-top: 8px;
  font-size: 0.9rem;
  opacity: 0.7;
}

/* =========================================================
   Admin
   ========================================================= */

.admin-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.admin-links,
.section-head,
.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.content-admin-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.admin-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fffaf2;
  font-size: 12px;
  font-weight: 700;
}

/* =========================================================
   Rich Editor
   ========================================================= */

.editor-shell {
  display: grid;
  gap: 10px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-toolbar button {
  padding: 8px 10px;
  background: #fffaf2;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.editor-toolbar button:hover {
  background: var(--panel-2);
}

.editor-toolbar button.is-active {
  background: var(--accent);
  color: #fffaf2;
  border-color: var(--accent-2);
}

.editor-source {
  display: none;
}

.rich-editor,
.rich-preview {
  min-height: 360px;
  padding: 14px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1.7;
}

.rich-editor:focus {
  outline: 2px solid rgba(139, 94, 52, 0.22);
}

#rich-editor,
.rich-editor,
#rich-preview,
.rich-preview {
  width: 100%;
  max-width: 100%;
  min-height: 360px;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  word-break: normal;
  overflow-wrap: break-word;
}

.dev-reset-box {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  word-break: break-word;
}

/* =========================================================
   Library
   ========================================================= */

.library-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.library-toolbar input {
  max-width: 300px;
}

.library-grid,
.library-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.folder-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 10px 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #fffaf2;
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  transition: 0.16s ease;
}

.folder-btn:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crumb-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  color: var(--accent);
}

.crumb-sep {
  opacity: 0.7;
}

/* =========================================================
   Preview Modal
   ========================================================= */

.modal.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(47, 36, 27, 0.62);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 99999;
}

.modal-inner,
.modal-panel {
  position: relative;
  background: var(--panel);
  color: var(--text);
  width: min(1180px, calc(100vw - 48px));
  height: min(88vh, 920px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 56px 18px 18px;
  box-shadow: 0 30px 90px rgba(74, 45, 22, 0.28);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(139, 94, 52, 0.16);
  color: var(--text);
  font-size: 28px;
  line-height: 38px;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(139, 94, 52, 0.28);
}

#preview-body {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.preview-block {
  min-width: 720px;
}

.preview-frame {
  width: 100%;
  height: calc(88vh - 100px);
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.preview-image {
  width: 100%;
  height: calc(88vh - 100px);
  object-fit: contain;
  border: 0;
  border-radius: 10px;
  background: #fffaf2;
}

.preview-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
}

.preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--input-bg);
  color: var(--text);
}

.preview-table th,
.preview-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  white-space: normal;
  min-width: 120px;
  max-width: 420px;
  word-break: break-word;
}

.preview-table th {
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.preview-head h3 {
  margin: 0 0 6px;
}

.preview-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.preview-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preview-control span {
  color: var(--muted);
  font-size: 13px;
}

.preview-control select {
  min-width: 240px;
  max-width: 420px;
}

.preview-pager {
  display: flex;
  gap: 10px;
  align-items: center;
}

.preview-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.preview-table-wrap {
  width: 100%;
  height: calc(88vh - 210px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input-bg);
}

/* =========================================================
   Comments + Comment Images
   ========================================================= */

.comments-section {
  max-width: 980px;
  margin: 36px auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 248, 237, 0.82);
  box-shadow: 0 10px 28px var(--shadow);
}

.comments-section h2 {
  margin: 0 0 18px;
}

.comments-list {
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
}

.comment-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.72);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.comment-meta strong {
  color: var(--text);
}

.comment-meta span {
  color: var(--muted);
}

.comment-body {
  line-height: 1.7;
  color: var(--text);
  overflow-wrap: anywhere;
}

.comment-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.comment-image-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
}

.comment-image-button img {
  width: 150px;
  height: 110px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
}

.comment-image-button:hover img {
  opacity: 0.86;
}

.comment-form {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.72);
}

.comment-form textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  box-sizing: border-box;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
}

.comment-form input[type="file"] {
  width: 100%;
  box-sizing: border-box;
}

.comment-form button,
.comment-reply-btn {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent-2);
  background: var(--accent);
  color: #fffaf2;
  cursor: pointer;
  font-weight: 700;
}

.comment-form button:hover,
.comment-reply-btn:hover {
  background: var(--accent-2);
}

.comment-help {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.comment-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.comment-image-preview img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
}

.comment-message {
  min-height: 20px;
  margin: 0;
}

.comment-message.success {
  color: var(--success);
}

.comment-message.error,
.error {
  color: var(--danger);
}

.login-to-comment {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.72);
}

.reply-form {
  margin-top: 12px;
}

/* Comment image lightbox */

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  background: rgba(47, 36, 27, 0.86);
  padding: 24px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox img {
  max-width: min(100%, 1100px);
  max-height: 86vh;
  border-radius: 14px;
  object-fit: contain;
  background: #fffaf2;
}

.image-lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 248, 237, 0.22);
  color: #fffaf2;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover {
  background: rgba(255, 248, 237, 0.34);
}

/* =========================================================
   Front-end Article Image Display Fix
   ========================================================= */

.article-body,
.rich-content {
  max-width: 100%;
  overflow-wrap: break-word;
}

.article-body figure,
.rich-content figure {
  width: 100% !important;
  max-width: 680px !important;
  margin: 24px auto !important;
  padding: 0 !important;
}

.article-body img,
.rich-content img,
.article-body figure img,
.rich-content figure img,
.article-body .editor-image,
.rich-content .editor-image,
.article-body .content-image img,
.rich-content .content-image img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  margin: 0 auto !important;
  border-radius: 16px !important;
}

.article-body figcaption,
.rich-content figcaption {
  margin-top: 8px !important;
  text-align: center !important;
  color: var(--muted) !important;
  font-size: 0.92rem !important;
}

.article-body .editor-image,
.rich-content .editor-image {
  width: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  border: 0 !important;
  background: transparent !important;
}

/* =========================================================
   Final Global Comment Image Fix
   ========================================================= */

.comments-section .comment-images,
#comments .comment-images,
.comments-list .comment-images,
.comment-images {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 10px !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.comments-section .comment-image-button,
#comments .comment-image-button,
.comments-list .comment-image-button,
.comment-image-button {
  width: 140px !important;
  height: 100px !important;
  max-width: 140px !important;
  max-height: 100px !important;
  display: inline-block !important;
  flex: 0 0 140px !important;
  padding: 0 !important;
  margin: 8px 8px 8px 0 !important;
  border: 0 !important;
  background: transparent !important;
  overflow: hidden !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  vertical-align: top !important;
}

.comments-section .comment-image-button img,
#comments .comment-image-button img,
.comments-list .comment-image-button img,
.comment-image-button img {
  width: 140px !important;
  height: 100px !important;
  max-width: 140px !important;
  max-height: 100px !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: var(--input-bg) !important;
}

.comments-section .comment-item,
#comments .comment-item,
.comments-list .comment-item,
.comment-item {
  max-width: 100% !important;
  overflow: hidden !important;
}

/* =========================================================
   Section title links
   ========================================================= */

.section-title-link {
  color: inherit;
  text-decoration: none;
}

.section-title-link:hover {
  color: #8a5a2b;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
  .grid-2,
  .grid-3,
  .library-grid,
  .library-layout,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .header-bar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .hero {
    padding: 34px 24px;
  }

  .item-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    padding: 12px;
  }

  .modal-inner,
  .modal-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    padding: 54px 12px 12px;
  }

  .preview-block {
    min-width: 640px;
  }

  .preview-control {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .preview-control select {
    width: 100%;
    max-width: none;
  }

  .preview-table-wrap {
    height: calc(100vh - 230px);
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 0 14px;
  }

  .brand {
    font-size: 21px;
  }

  .brand-logo {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    flex: 0 0 38px !important;
  }

  .site-nav {
    gap: 7px;
  }

  .site-nav a {
    padding: 7px 9px;
    font-size: 14px;
  }

  .comments-section {
    padding: 18px;
  }

  .comment-image-button img {
    width: 120px;
    height: 90px;
  }

  .comment-image-preview img {
    width: 100px;
    height: 76px;
  }

  .comments-section .comment-image-button,
  #comments .comment-image-button,
  .comments-list .comment-image-button,
  .comment-image-button {
    width: 120px !important;
    height: 90px !important;
    max-width: 120px !important;
    max-height: 90px !important;
    flex-basis: 120px !important;
  }

  .comments-section .comment-image-button img,
  #comments .comment-image-button img,
  .comments-list .comment-image-button img,
  .comment-image-button img {
    width: 120px !important;
    height: 90px !important;
    max-width: 120px !important;
    max-height: 90px !important;
  }
}
.hero-with-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px; /* 标题和搜索框间距 */
  padding: 40px 20px;
}

.hero-left h1 {
  font-size: 3rem;
  margin: 0;
}

.hero-left p {
  margin-top: 8px;
  font-size: 1.2rem;
}

.hero-right {
  flex-shrink: 0;
}

.hero-search {
  display: flex;
  align-items: center;
}

.hero-search input[type="text"] {
  padding: 10px 14px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
}

.hero-search button {
  padding: 10px 14px;
  margin-left: 8px;
  border-radius: 8px;
  background-color: #8b5e3c;
  color: #fff;
  border: none;
  cursor: pointer;
}

.hero-search button:hover {
  opacity: 0.9;
}

@media (max-width: 768px) {
  .hero-with-search {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-right {
    width: 100%;
    margin-top: 12px;
  }
  .hero-search {
    width: 100%;
  }
  .hero-search input[type="text"] {
    width: calc(100% - 100px);
  }
}
/* 顶部大框收敛 */
.header-main {
  margin-bottom: 12px;   /* 减少底部空白 */
  padding: 12px 16px;    /* 减少内边距 */
}

.header-main .title-wrapper {
  gap: 12px;             /* logo 与文字间距稍微小一点 */
}

.header-main .search-box input {
  padding: 6px 10px;     /* 输入框高度稍低 */
  min-width: 200px;      /* 可根据需要调整宽度 */
}

.header-main .search-box button {
  padding: 6px 10px;     /* 按钮高度略小 */
}
/* =========================================================
   顶部大框收敛
   ========================================================= */
.header-main {
  margin-bottom: 12px;   /* 减少底部空白 */
  padding: 12px 16px;    /* 减少内边距 */
}

.header-main .title-wrapper {
  gap: 12px;             /* logo 与文字间距稍微小一点 */
}

.header-main .search-box input {
  padding: 6px 10px;     /* 输入框高度稍低 */
  min-width: 200px;      /* 可根据需要调整宽度 */
}

.header-main .search-box button {
  padding: 6px 10px;     /* 按钮高度略小 */
}

/* =========================================================
   首页 hero / 大卡片收紧
   ========================================================= */
.hero,
.hero-with-search {
  padding: 24px 20px;    /* 内边距收紧 */
  margin-bottom: 16px;   /* 底部间距收紧 */
  border-radius: 20px;   /* 保持圆角 */
}

/* 标题与副标题收紧 */
.hero-left h1 {
  margin: 0;
  font-size: 2.5rem;     /* 可根据需要略缩小 */
}

.hero-left p {
  margin-top: 6px;
  font-size: 1rem;
}

/* =========================================================
   首页板块卡片收紧
   ========================================================= */
.card {
  padding: 16px 18px;    /* 内边距收紧 */
  margin-bottom: 12px;   /* 卡片间距收紧 */
  box-shadow: 0 10px 28px var(--shadow); /* 保留阴影效果 */
}

/* grid-2 和 grid-3 内卡片 */
.grid-2 .card,
.grid-3 .card {
  min-height: auto;      /* 不强制高度，内容自适应 */
  padding: 14px 16px;    /* 内边距收紧 */
}

/* 标题与文字间距收紧 */
.grid-2 .card h2,
.grid-3 .card h2,
.card h1,
.card h2,
.card h3 {
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.2;
}

.grid-2 .card p,
.grid-3 .card p {
  margin: 0 0 12px;
  font-size: 15px;
}

/* 小卡片 / 栏目卡片 */
.stack > .card {
  padding: 10px 12px;
  margin-bottom: 8px;
}

/* =========================================================
   页脚与评论板块收紧
   ========================================================= */
.comments-section,
.comment-form,
.comment-item {
  padding: 16px 14px;
  margin-bottom: 12px;
  border-radius: 16px;
}

/* Library / Latest 小卡片 */
.library-grid,
.library-layout {
  gap: 12px;            /* 卡片间距收紧 */
}

.folder-btn,
.item-row {
  padding: 8px 10px;    /* 内边距收紧 */
  margin-bottom: 6px;   /* 间距收紧 */
}

/* 全局调整文字间距、行高 */
body, .shell, .page, .card, .hero {
  line-height: 1.45;    /* 稍微收紧行距 */
}
.success-message {
  color: var(--success);
  margin-top: 8px;
}

.hidden {
  display: none !important;
}