:root {
  --coal: #221913;
  --coal-2: #31231b;
  --paper: #fffaf0;
  --surface: #f5ead3;
  --line: #d7bc8b;
  --accent: #f5a43a;
  --accent-2: #ffdd63;
  --grass: #469146;
  --dirt: #8b5a37;
  --text: #201713;
  --muted: #756956;
  --danger: #c74332;
  --shadow: 0 22px 60px rgba(19, 12, 8, 0.24);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--paper);
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  min-height: 76px;
  padding: 14px clamp(18px, 5vw, 70px);
  color: #f7ead2;
  background: rgba(34, 25, 19, 0.96);
  border-bottom: 1px solid rgba(245, 164, 58, 0.35);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 950;
}

.brand-mark,
.feature-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  background:
    linear-gradient(90deg, transparent 50%, rgba(0, 0, 0, 0.12) 50%) 0 0 / 14px 14px,
    linear-gradient(var(--grass) 0 45%, var(--dirt) 45%);
  border: 2px solid #120d09;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.2);
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 28px;
  color: #d7cbb8;
  font-size: 14px;
  font-weight: 900;
}

.top-nav a {
  padding: 9px 0;
  text-transform: uppercase;
}

.top-nav a.active,
.top-nav a:hover {
  color: var(--accent-2);
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 180px;
  color: #d7cbb8;
  font-size: 14px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  object-fit: cover;
  image-rendering: pixelated;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: #2a2a34;
}

.user-chip {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 2px solid #1b120d;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #24150c;
  background: var(--accent);
  box-shadow: 0 5px 0 #9c5c1d;
}

.button.ghost {
  color: #24150c;
  background: #fff5dc;
  box-shadow: 0 5px 0 #c7a56a;
}

.button.danger {
  color: #fffaf0;
  background: var(--danger);
  box-shadow: 0 5px 0 #7f281e;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

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

.hero {
  position: relative;
  overflow: hidden;
  min-height: min(820px, calc(100vh - 76px));
  display: grid;
  align-items: center;
  padding: clamp(58px, 8vw, 106px) clamp(18px, 5vw, 72px);
}

.photo-hero {
  color: #fff7e8;
  text-align: center;
  background: #251811;
}

.hero-bg {
  position: absolute;
  inset: -28px;
  background:
    linear-gradient(rgba(34, 20, 12, 0.58), rgba(34, 20, 12, 0.74)),
    url("/assets/group-photo.png") center / cover;
  filter: blur(7px);
  transform: scale(1.05);
}

.photo-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 96px;
  background: linear-gradient(180deg, transparent, var(--coal));
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
}

.hero h1,
.page-hero h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 112px);
  line-height: 0.95;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.42);
}

.hero p,
.page-hero p {
  max-width: 720px;
  margin: 24px auto 0;
  color: #fff0c2;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.6;
  font-weight: 750;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 34px;
}

.server-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 44px auto 0;
  max-width: 760px;
  border: 2px solid rgba(255, 232, 178, 0.5);
  background: rgba(34, 25, 19, 0.62);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.server-item {
  padding: 18px;
  border-right: 2px solid rgba(255, 232, 178, 0.35);
}

.server-item:last-child {
  border-right: 0;
}

.server-address-copy {
  text-align: left;
  color: inherit;
  background: transparent;
  box-shadow: none;
}

.server-address-copy:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.06);
}

.server-panel dt {
  color: #e8cf9e;
  font-size: 12px;
  font-weight: 950;
}

.server-panel dd {
  margin: 6px 0 0;
  color: #fffaf0;
  font-size: 17px;
  font-weight: 950;
}

.feature-band,
.content-grid,
.admin-shell,
.admin-locked,
.forum-controls {
  padding: 78px clamp(18px, 5vw, 72px);
}

.feature-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  background: var(--coal);
}

.feature-band article,
.post-card,
.editor-card,
.admin-panel,
.stat-card,
.admin-locked,
.profile-card,
.forum-main,
.compose-dialog {
  background: #fff4dd;
  border: 2px solid var(--line);
  box-shadow: 0 7px 0 rgba(106, 69, 35, 0.2);
}

.feature-band article {
  padding: 28px;
}

.feature-icon {
  display: inline-block;
  margin-bottom: 20px;
}

.feature-icon.redstone {
  background: linear-gradient(#d85a48 0 45%, #6f2d2a 45%);
}

.feature-icon.book {
  background: linear-gradient(90deg, #f8d979 0 46%, #7350a4 46% 54%, #f6f1dc 54%);
}

.feature-band h2,
.section-title h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  font-weight: 950;
}

.feature-band p,
.section-title p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-weight: 700;
}

.announcement-stage {
  position: relative;
  overflow: hidden;
  background: #2a1d16;
}

.solid-announcement-stage {
  background: linear-gradient(180deg, #2d2018, #3a291f);
}

.solid-announcement-stage::before {
  content: none;
}

.announcement-stage > * {
  position: relative;
  z-index: 1;
}

.announcement-stage .section-title h2,
.announcement-stage .section-title p {
  color: #fff7e8;
}

.forum-controls {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  background: #f7ecd7;
}

.profile-card {
  position: sticky;
  top: 100px;
  min-height: 470px;
  padding: 24px;
  overflow: hidden;
  text-align: center;
}

.profile-card h2 {
  margin: 0 0 16px;
  font-size: 28px;
}

.skin-stage {
  position: relative;
  height: 250px;
  display: grid;
  place-items: end center;
  margin: 0 auto -18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.08)),
    linear-gradient(45deg, #4a4e5c 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(-45deg, #4a4e5c 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(45deg, transparent 75%, #4a4e5c 75%) 0 0 / 28px 28px,
    linear-gradient(-45deg, transparent 75%, #4a4e5c 75%) 0 0 / 28px 28px,
    #353947;
  border: 2px solid #1b120d;
}

.skin-stage img {
  height: 238px;
  width: auto;
  image-rendering: pixelated;
  transform: translateY(18px);
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.34));
}

.profile-name {
  position: relative;
  z-index: 1;
  padding: 16px 12px;
  color: #fffaf0;
  background: #2a1d16;
  border: 2px solid #1b120d;
}

.profile-name strong,
.profile-name span {
  display: block;
}

.profile-name strong {
  font-size: 22px;
}

.profile-name span {
  margin-top: 5px;
  color: #e5cf9a;
  font-size: 13px;
  font-weight: 800;
}

.profile-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.forum-main {
  padding: 24px;
}

.forum-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.section-title.compact h2 {
  font-size: clamp(24px, 3vw, 36px);
}

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

.post-card {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
}

.forum-card {
  min-height: 300px;
  padding-top: 120px;
}

.skin-figure {
  position: absolute;
  top: -44px;
  right: 10px;
  height: 172px;
  max-width: 132px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.26));
  pointer-events: none;
}

.post-card h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.post-card p {
  color: #594b3a;
  line-height: 1.65;
  flex: 1;
}

.forum-section {
  background: #fffaf0;
}

.page-hero {
  padding: clamp(74px, 12vw, 140px) clamp(18px, 5vw, 72px);
  color: #fffaf0;
  text-align: center;
  background:
    linear-gradient(rgba(28, 19, 14, 0.72), rgba(28, 19, 14, 0.78)),
    url("/assets/group-photo.png") center / cover;
}

.forum-hero {
  background-position: center 62%;
}

.admin-hero {
  background: linear-gradient(135deg, #2b1d16, #493120 55%, #1d1713);
}

.admin-shell {
  display: grid;
  gap: 26px;
  background: #f7ecd7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 22px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.admin-panel,
.editor-card,
.admin-locked {
  padding: 24px;
}

.admin-table {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  background: #fffaf0;
  border: 2px solid #ead4a6;
}

.table-row strong,
.table-row span {
  display: block;
}

.table-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.row-actions,
.footer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

label {
  color: #463525;
  font-size: 13px;
  font-weight: 950;
}

input,
select {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  color: var(--text);
  background: #fffdf6;
  border: 2px solid var(--line);
  border-radius: 4px;
  outline: none;
}

input:focus,
select:focus,
.rich-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 164, 58, 0.22);
}

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

.toolbar button,
.toolbar-select {
  min-width: 42px;
  height: 36px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: #fffdf6;
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
}

.editor-toolbar-shell {
  position: relative;
}

.toolbar-more {
  position: relative;
}

.toolbar-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 4;
  display: grid;
  gap: 6px;
  min-width: 124px;
  padding: 8px;
  background: #fff7e8;
  border: 2px solid var(--line);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.toolbar-more-menu button {
  justify-content: flex-start;
  min-width: 0;
}

.rich-editor {
  min-height: 320px;
  padding: 18px;
  overflow: auto;
  background: #fffdf6;
  border: 2px solid var(--line);
  border-radius: 4px;
  line-height: 1.75;
  outline: none;
}

.rich-editor:empty::before {
  content: "在这里输入正文。";
  color: #9a927b;
}

.rich-editor img.inline-image,
.reader-body img.inline-image {
  max-width: 100%;
  border-radius: 6px;
}

.rich-editor table,
.reader-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
}

.rich-editor th,
.rich-editor td,
.reader-body th,
.reader-body td {
  padding: 8px 10px;
  border: 1px solid #d0b989;
}

.spoiler-inline {
  padding: 0 6px;
  color: transparent;
  background: #1d1a19;
  border-radius: 4px;
}

.spoiler-inline:hover {
  color: #fff4dd;
}

.inline-rule {
  border: 0;
  border-top: 2px solid #d0b989;
  margin: 18px 0;
}

.inline-details {
  padding: 10px 12px;
  background: #fff7e8;
  border: 2px solid #e0c99b;
}

.inline-code {
  padding: 14px;
  overflow: auto;
  color: #fff7e8;
  background: #2a2320;
  border-radius: 6px;
}

.rich-editor iframe,
.reader-body iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 4px;
  background: #111;
}

.split-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  border: 2px solid #2b1b12;
  background: #fffaf0;
  box-shadow: var(--shadow);
}

.auth-dialog,
.compose-dialog {
  width: min(900px, calc(100vw - 28px));
  padding: 28px;
}

.auth-dialog {
  width: min(420px, calc(100vw - 28px));
}

.auth-dialog h2,
.compose-dialog h2 {
  margin: 0 0 18px;
  font-size: 28px;
}

.auth-dialog form,
.compose-dialog form {
  display: grid;
  gap: 12px;
}

dialog::backdrop {
  background: rgba(24, 16, 12, 0.62);
}

.dialog-close {
  position: sticky;
  top: 12px;
  float: right;
  width: 40px;
  height: 40px;
  margin: 12px;
  border: 2px solid #2b1b12;
  border-radius: 4px;
  background: var(--accent);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.auth-dialog .dialog-close,
.compose-dialog .dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
}

#readerContent {
  padding: 44px;
}

#readerContent h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
}

.reader-body {
  margin-top: 24px;
  line-height: 1.78;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  color: #fffaf0;
  background: #2c1f17;
  border: 2px solid #fffaf0;
  border-radius: 4px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  grid-column: 1 / -1;
  padding: 34px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.86);
  border: 2px dashed var(--line);
  text-align: center;
  font-weight: 850;
}

.admin-locked {
  max-width: 720px;
  margin: 70px auto;
  text-align: center;
}

.admin-locked h2 {
  margin: 0;
  font-size: 36px;
}

.admin-locked p,
.profile-card p {
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .auth-actions {
    justify-content: flex-start;
  }

  .feature-band,
  .list,
  .stats-grid,
  .forum-controls {
    grid-template-columns: 1fr;
  }

  .profile-card {
    position: static;
  }

  .forum-toolbar,
  .table-row,
  .inline-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .site-header {
    grid-template-columns: auto auto;
    gap: 12px;
    align-items: center;
  }

  .brand {
    font-size: 15px;
  }

  .top-nav {
    grid-column: 1 / -1;
    order: 3;
    gap: 14px;
    font-size: 12px;
  }

  .auth-actions {
    min-width: 0;
    justify-content: flex-end;
  }

  .user-chip {
    display: none;
  }

  .hero h1,
  .page-hero h1 {
    font-size: 44px;
  }

  .server-panel {
    grid-template-columns: 1fr;
  }

  .server-item {
    border-right: 0;
    border-bottom: 2px solid rgba(255, 232, 178, 0.35);
  }

  .server-item:last-child {
    border-bottom: 0;
  }

  .section-title {
    display: block;
  }

  #readerContent {
    padding: 28px 18px;
  }
}
