* {
  box-sizing: border-box;
}

:root {
  --bg: #f7ead1;
  --paper: rgba(255, 252, 241, 0.92);
  --paper-solid: #fffaf0;
  --ink: #3f2a18;
  --muted: #8a6b4d;
  --line: rgba(132, 86, 43, 0.22);
  --gold: #b9853b;
  --gold-dark: #8f5f24;
  --red: #a33b2f;
  --green: #5f7f4a;
  --shadow: rgba(105, 63, 25, 0.16);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "STKaiti",
    "KaiTi",
    "Noto Serif SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.72), transparent 28%),
    radial-gradient(circle at 86% 8%, rgba(238, 198, 124, 0.25), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(177, 110, 43, 0.12), transparent 36%),
    linear-gradient(135deg, #fff7e6 0%, #f4dfba 45%, #f9ecd4 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(132, 86, 43, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 86, 43, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
}

body::after {
  content: "云笺";
  position: fixed;
  right: -24px;
  bottom: 24px;
  z-index: -1;
  color: rgba(132, 86, 43, 0.06);
  font-size: min(30vw, 220px);
  font-weight: 900;
  letter-spacing: 12px;
  writing-mode: vertical-rl;
}

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

button,
.admin-button,
.nav-link,
.nav-logo,
.footer a {
  border: 0;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease,
    background 0.16s ease;
}

button {
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff9ed, #f3dfbd);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(132, 86, 43, 0.08);
}

button:hover,
.admin-button:hover,
.nav-link:hover,
.footer a:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 12px 24px rgba(132, 86, 43, 0.14);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(132, 86, 43, 0.24);
  border-radius: 18px;
  outline: none;
  padding: 14px 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 248, 232, 0.95));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 8px 20px rgba(132, 86, 43, 0.06);
}

textarea {
  min-height: 172px;
  resize: vertical;
  line-height: 1.75;
}

input::placeholder,
textarea::placeholder {
  color: rgba(138, 107, 77, 0.72);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(185, 133, 59, 0.82);
  box-shadow:
    0 0 0 4px rgba(185, 133, 59, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.page {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 28px;
}

.hero {
  margin-bottom: 18px;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(132, 86, 43, 0.16);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.72);
  box-shadow: 0 18px 44px rgba(132, 86, 43, 0.10);
  backdrop-filter: blur(12px);
}

.nav-logo {
  color: var(--gold-dark);
  font-weight: 900;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 999px;
}

.nav-link.active {
  color: var(--ink);
  background: rgba(185, 133, 59, 0.13);
}

.admin-entry {
  color: #fff;
  background: linear-gradient(135deg, #bd8a42, #8f5f24);
  box-shadow: 0 10px 22px rgba(143, 95, 36, 0.18);
}

.hero-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(30px, 5vw, 58px) 20px;
  border: 1px solid rgba(132, 86, 43, 0.18);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 252, 241, 0.94), rgba(252, 238, 207, 0.90)),
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.8), transparent 28%);
  box-shadow:
    0 28px 90px rgba(132, 86, 43, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(185, 133, 59, 0.18);
  border-radius: 50%;
}

.hero-card::before {
  left: -90px;
  top: -80px;
}

.hero-card::after {
  right: -80px;
  bottom: -90px;
}

.brand {
  display: inline-flex;
  position: relative;
  z-index: 1;
  padding: 8px 16px;
  border: 1px solid rgba(185, 133, 59, 0.28);
  border-radius: 999px;
  color: var(--gold-dark);
  background: rgba(255, 248, 232, 0.86);
  font-size: 14px;
  font-weight: 700;
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 16px 0 10px;
  color: var(--ink);
  font-size: clamp(38px, 7vw, 72px);
  letter-spacing: 6px;
  font-weight: 900;
  text-shadow: 0 4px 0 rgba(185, 133, 59, 0.08);
}

.hero p {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.8;
}

.hero-tags {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-tags span {
  padding: 7px 12px;
  border: 1px solid rgba(132, 86, 43, 0.16);
  border-radius: 999px;
  color: #765332;
  background: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.top-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.top-actions button,
.admin-button {
  min-width: 132px;
  font-weight: 800;
}

.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, #a33b2f, #7d2b22);
  border: 1px solid rgba(125, 43, 34, 0.28);
  box-shadow: 0 12px 26px rgba(125, 43, 34, 0.16);
}

.panel {
  position: relative;
  margin-top: 18px;
  padding: 24px;
  border: 1px solid rgba(132, 86, 43, 0.18);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(255, 247, 229, 0.92));
  box-shadow:
    0 24px 70px rgba(132, 86, 43, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(185, 133, 59, 0.09);
  border-radius: 24px;
}

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

.panel-title h2,
.message-toolbar h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 26px;
  letter-spacing: 1px;
}

.panel-title p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.label {
  display: block;
  margin: 14px 0 8px;
  color: #68492b;
  font-size: 15px;
  font-weight: 800;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  line-height: 1.6;
}

.check input {
  width: auto;
  box-shadow: none;
}

.primary {
  width: 100%;
  margin-top: 10px;
  color: #fff;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #c99645, #8f5f24);
  border: 1px solid rgba(143, 95, 36, 0.32);
  box-shadow: 0 14px 32px rgba(143, 95, 36, 0.2);
}

.danger {
  color: #fff;
  background: linear-gradient(135deg, #b84a3f, #8f2f27);
  border-color: rgba(143, 47, 39, 0.28);
}

.hidden {
  display: none !important;
}

.room-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.room-code {
  margin-top: 6px;
  color: var(--gold-dark);
  font-size: clamp(42px, 9vw, 76px);
  font-weight: 900;
  letter-spacing: 10px;
  line-height: 1.05;
}

.qr-card {
  display: grid;
  gap: 9px;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(132, 86, 43, 0.22);
  border-radius: 22px;
  background:
    linear-gradient(180deg, #fffdf6, #f7e8c9);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 18px 38px rgba(132, 86, 43, 0.12);
}

.qr-image {
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  border: 8px solid #fff;
}

.notice {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid rgba(95, 127, 74, 0.22);
  border-radius: 18px;
  background: rgba(95, 127, 74, 0.10);
  color: #526d3e;
  line-height: 1.7;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.composer {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-top: 18px;
}

.composer-box,
.message-card,
.empty {
  border: 1px solid rgba(132, 86, 43, 0.16);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.9), rgba(249, 235, 205, 0.72));
  padding: 18px;
  box-shadow: 0 14px 32px rgba(132, 86, 43, 0.08);
}

.message-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.message-toolbar > div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.messages {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  margin-bottom: 12px;
}

.message-top span,
.muted,
.file-meta,
.footer {
  color: var(--muted);
  font-size: 13px;
}

.text-message {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(132, 86, 43, 0.14);
  border-radius: 18px;
  background: rgba(255, 252, 241, 0.78);
  color: var(--ink);
  line-height: 1.75;
}

.message-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.file-name {
  margin-bottom: 6px;
  font-weight: 900;
  word-break: break-all;
}

.preview img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin-top: 14px;
  border-radius: 18px;
  object-fit: contain;
  background: rgba(255, 252, 241, 0.9);
  border: 1px solid rgba(132, 86, 43, 0.16);
}

.error {
  color: var(--red);
  font-weight: 800;
}

.empty {
  text-align: center;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  text-align: center;
}

.footer a {
  color: var(--gold-dark);
  font-weight: 900;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.62);
  border: 1px solid rgba(132, 86, 43, 0.14);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 100;
  padding: 12px 18px;
  border: 1px solid rgba(132, 86, 43, 0.22);
  border-radius: 999px;
  background: rgba(72, 45, 22, 0.94);
  color: #fffaf0;
  box-shadow: 0 18px 50px rgba(72, 45, 22, 0.25);
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 20px, 1080px);
    padding-top: 14px;
  }

  .site-nav {
    align-items: stretch;
    flex-direction: column;
    border-radius: 24px;
  }

  .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .nav-link {
    width: 100%;
  }

  .hero-card {
    border-radius: 26px;
    padding: 30px 16px;
  }

  .hero h1 {
    letter-spacing: 3px;
  }

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

  .grid.two,
  .room-head,
  .share-row,
  .composer {
    grid-template-columns: 1fr;
  }

  .qr-card {
    justify-self: center;
  }

  .room-code {
    letter-spacing: 6px;
  }

  .message-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .message-toolbar > div,
  .top-actions,
  .message-actions {
    flex-direction: column;
  }

  .top-actions button,
  .top-actions a,
  .message-toolbar button,
  .message-actions button,
  .share-row button {
    width: 100%;
  }

  .footer {
    flex-direction: column;
  }
}
