@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Fraunces:opsz,wght@9..144,600;700&display=swap");

:root {
  --bg: #f4efe3;
  --bg-deep: #e6dcc8;
  --paper: rgba(255, 251, 243, 0.84);
  --paper-strong: #fffaf2;
  --ink: #16120d;
  --ink-soft: #665e57;
  --line: rgba(22, 18, 13, 0.09);
  --line-strong: rgba(22, 18, 13, 0.16);
  --teal: #18383c;
  --teal-soft: #dfeae6;
  --orange: #d47a42;
  --orange-soft: #fde7d6;
  --hot: #c3472b;
  --mine: #2f6649;
  --muted: #7d756e;
  --shadow: 0 28px 90px rgba(24, 56, 60, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Apple SD Gothic Neo", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(212, 122, 66, 0.18), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(24, 56, 60, 0.12), transparent 25%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

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

button {
  border: 0;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 20px calc(40px + env(safe-area-inset-bottom, 0px));
}

.hero,
.content {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 430px);
  align-items: start;
}

.content {
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 0.88fr);
  margin-top: 18px;
}

.panel {
  border-radius: 28px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.subtle-panel {
  background: rgba(245, 240, 231, 0.88);
}

.warm {
  background: rgba(255, 239, 224, 0.86);
}

.hero-copy {
  padding: 30px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 0.84rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  font-weight: 700;
}

.hero-top,
.section-head,
.row,
.meta,
.post-top,
.thread-actions,
.board-row,
.activity-stats,
.pagination {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-top,
.section-head {
  justify-content: space-between;
  align-items: flex-start;
}

.pagination {
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.side-panels {
  display: grid;
  gap: 16px;
}

.detail-head,
.detail-head-side,
.mobile-main-nav,
.mobile-panel-nav {
  display: flex;
  gap: 10px;
}

.detail-head-side {
  flex-direction: column;
  align-items: flex-end;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--orange);
}

.hero-chip,
.badge,
.hint-box,
.credential-box,
.notice,
.mini-empty,
.stat-pill {
  border-radius: 999px;
}

.hero-chip {
  padding: 8px 12px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}

h1,
h2,
h3,
h4 {
  font-family: "Fraunces", serif;
  letter-spacing: -0.04em;
  margin: 0;
}

h1 {
  margin-top: 14px;
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: 0.98;
  max-width: 14ch;
}

h4 {
  margin-top: 18px;
  margin-bottom: 10px;
}

.hero-text,
.panel p,
.thread-body,
.comment-card p,
.admin-report-card p {
  color: var(--ink-soft);
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
}

.stat-card span {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
}

.notice,
.hint-box,
.credential-box,
.mini-empty,
.empty-card,
.stat-pill {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
}

.notice {
  margin-top: 18px;
  color: var(--teal);
  background: rgba(223, 234, 230, 0.92);
}

.notice.error {
  color: #9d3a2a;
  background: #fae5df;
}

.board-row {
  margin-top: 22px;
}

.board-tab {
  cursor: pointer;
  padding: 13px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  display: inline-flex;
  gap: 10px;
  align-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.board-tab.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 18px 36px rgba(24, 56, 60, 0.18);
}

.count {
  font-size: 0.84rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(22, 18, 13, 0.08);
}

.board-tab.active .count {
  background: rgba(255, 255, 255, 0.16);
}

.search-row,
.stack,
.admin-auth-row {
  display: grid;
  gap: 12px;
}

.search-row {
  grid-template-columns: minmax(0, 1fr) 160px auto auto;
  margin-top: 18px;
}

.admin-auth-row {
  grid-template-columns: minmax(0, 1fr) 120px auto auto;
  margin-top: 16px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(22, 18, 13, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(102, 94, 87, 0.78);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(24, 56, 60, 0.35);
  box-shadow: 0 0 0 4px rgba(24, 56, 60, 0.08);
}

textarea {
  resize: vertical;
}

.primary,
.secondary,
.ghost,
.danger,
.activity-item,
.tiny-action,
.compact-button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger:hover,
.activity-item:hover,
.tiny-action:hover,
.compact-button:hover,
.board-tab:hover,
.post-card:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 16px 30px rgba(24, 56, 60, 0.16);
}

.secondary {
  background: var(--orange-soft);
  color: #8b471a;
  box-shadow: 0 12px 24px rgba(212, 122, 66, 0.12);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.danger {
  background: #fce3dd;
  color: #a33f2c;
}

.tiny-action {
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 600;
}

.tiny-action.subtle {
  color: var(--muted);
}

.compact-button {
  padding: 10px 14px;
  border-radius: 12px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.post-list,
.comment-list,
.admin-report-list,
.admin-post-list,
.admin-backup-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.post-card,
.activity-item,
.admin-report-card {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(22, 18, 13, 0.08);
}

.post-card,
.admin-report-card {
  border-radius: 22px;
  padding: 18px;
}

.post-card {
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.post-card-rail,
.post-card-foot,
.toolbar-card,
.toolbar-stats,
.pagination-actions {
  display: flex;
  gap: 12px;
}

.post-card-rail {
  align-items: flex-start;
  justify-content: space-between;
}

.post-card-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.post-card-foot {
  margin-top: 14px;
  justify-content: space-between;
  align-items: center;
}

.post-card-score {
  flex: 0 0 78px;
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 12px 10px;
  border-radius: 18px;
  background: rgba(24, 56, 60, 0.06);
  border: 1px solid rgba(24, 56, 60, 0.08);
}

.post-card-score strong {
  font-size: 1.45rem;
  line-height: 1;
}

.post-card-score span,
.post-open-hint {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.post-preview {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-card.active {
  background: rgba(24, 56, 60, 0.92);
  color: #fff;
  box-shadow: 0 24px 42px rgba(24, 56, 60, 0.18);
}

.post-card.active p,
.post-card.active .meta,
.post-card.active .post-open-hint,
.post-card.active .post-card-score span {
  color: rgba(255, 255, 255, 0.82);
}

.post-card.active .post-card-score {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.post-card h3,
.admin-report-card h3 {
  margin: 12px 0 10px;
  font-size: 1.16rem;
  line-height: 1.2;
}

.meta {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.badge {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.subtle {
  background: rgba(22, 18, 13, 0.06);
  color: var(--ink-soft);
}

.badge.hot {
  background: #fee2da;
  color: var(--hot);
}

.badge.mine {
  background: #dcecdf;
  color: var(--mine);
}

.badge.guest {
  background: #efe5d5;
  color: #7d633c;
}

.badge.muted {
  background: #ebe8e3;
  color: var(--muted);
}

.activity-stats {
  margin-top: 14px;
}

.stat-pill {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.thread-body {
  white-space: pre-wrap;
}

.thread-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.thread-stat {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 18, 13, 0.08);
}

.thread-stat span {
  font-size: 0.78rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  font-weight: 700;
}

.thread-stat strong {
  font-size: 1.3rem;
  line-height: 1.1;
}

.thread-body-wrap {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(22, 18, 13, 0.08);
}

.thread-body-wrap .thread-body {
  margin: 0;
}

.comment-box,
.manage-box,
.report-box {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(22, 18, 13, 0.08);
}

.report-box.compact {
  padding-top: 16px;
  margin-top: 14px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.comment-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(22, 18, 13, 0.08);
}

.comment-card p {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.credential-box {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.credential-box strong {
  word-break: break-word;
}

.activity-item {
  display: grid;
  gap: 6px;
}

.activity-item span {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.9rem;
}

.feature-row {
  margin: 14px 0 18px;
}

.auth-form {
  margin-top: 18px;
}

.stack > .primary,
.stack > .secondary,
.stack > .ghost,
.stack > .danger {
  width: 100%;
}

.hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.empty-card {
  margin-top: 18px;
  border-radius: 20px;
}

.toolbar-card {
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(22, 18, 13, 0.08);
}

.toolbar-copy {
  display: grid;
  gap: 4px;
}

.toolbar-copy strong {
  font-size: 1rem;
}

.toolbar-copy span {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.toolbar-stats {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-panel {
  margin-top: 20px;
}

.admin-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.admin-stat-card,
.backup-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(22, 18, 13, 0.08);
}

.admin-stat-card span,
.backup-card span,
.backup-card code,
.admin-stat-card small {
  display: block;
}

.admin-stat-card span,
.admin-stat-card small,
.backup-card span,
.backup-card code {
  color: var(--ink-soft);
}

.admin-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.admin-section-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(22, 18, 13, 0.08);
}

.compact-head p {
  max-width: 42ch;
}

.admin-filter-row {
  display: grid;
  grid-template-columns: 130px 160px minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 16px;
}

.admin-pagination {
  margin-top: 18px;
}

.backup-card {
  gap: 8px;
}

.backup-card strong {
  display: block;
}

.mobile-main-nav,
.mobile-panel-nav {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mobile-switch {
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.mobile-switch.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 16px 30px rgba(24, 56, 60, 0.16);
}

.mobile-switch:disabled {
  opacity: 0.42;
}

.mobile-panel-stage {
  margin-top: 14px;
}

.mobile-side-panels {
  margin-top: 18px;
}

.mobile-main-nav {
  margin-top: 16px;
}

.mobile-main-nav .mobile-switch {
  flex: 1 1 0;
}

.board-row,
.mobile-main-nav,
.mobile-panel-nav {
  scrollbar-width: none;
}

.board-row::-webkit-scrollbar,
.mobile-main-nav::-webkit-scrollbar,
.mobile-panel-nav::-webkit-scrollbar {
  display: none;
}

.backup-card code {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(22, 18, 13, 0.04);
  font-family: "Space Grotesk", monospace;
  font-size: 0.83rem;
  word-break: break-all;
}

@media (max-width: 1120px) {
  .hero,
  .content {
    grid-template-columns: 1fr;
  }

  .hero-mobile {
    gap: 16px;
  }

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

  .hero-top,
  .section-head {
    flex-direction: column;
  }

  .toolbar-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-stats {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .search-row,
  .admin-auth-row,
  .admin-filter-row {
    grid-template-columns: 1fr;
  }

  .board-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-top: 18px;
    padding-bottom: 4px;
  }

  .board-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .thread-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .thread-actions .primary,
  .thread-actions .tiny-action {
    width: 100%;
    justify-content: center;
  }

  .thread-actions .hint {
    width: 100%;
  }

  .detail-head-side {
    width: 100%;
    align-items: flex-start;
  }

  .post-card-rail,
  .post-card-foot {
    flex-direction: column;
  }

  .post-card-score {
    width: fit-content;
    min-width: 88px;
  }

  .thread-stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 16px 12px 28px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  h1 {
    max-width: none;
    font-size: clamp(2rem, 12vw, 3.3rem);
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 22px 20px;
  }

  .hero-chip {
    width: 100%;
    justify-content: center;
  }

  .mobile-main-nav {
    position: sticky;
    top: 8px;
    z-index: 4;
    padding: 10px;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(24, 56, 60, 0.1);
  }

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

  .mobile-switch {
    min-height: 44px;
  }

  .section-head p,
  .compact-head p {
    max-width: none;
  }

  .search-row {
    margin-top: 14px;
  }

  .toolbar-card {
    padding: 14px;
  }

  .post-card,
  .admin-report-card {
    border-radius: 20px;
    padding: 16px;
  }

  .thread-body-wrap,
  .thread-stat {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
