:root {
  --paper: #f4efe7;
  --ink: #171412;
  --ink-2: #312b25;
  --muted: #786e62;
  --line: #d8cfc2;
  --line-dark: #3a332d;
  --red: #bd3f2d;
  --red-dark: #8f2e22;
  --surface: #fffaf1;
  --surface-2: #ebe1d2;
  --admin-bg: #161412;
  --admin-panel: #211d19;
  --admin-soft: #2b2621;
  --admin-text: #f6efe4;
  --admin-muted: #b7aa9a;
  --shadow: 0 24px 80px rgba(54, 39, 26, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.site-page {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 20, 18, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 72px 100%;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 18px;
  background: var(--paper);
  color: var(--ink);
  transition: opacity 520ms ease, visibility 520ms ease;
}

.page-loader p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.loader-mark {
  position: relative;
  display: grid;
  width: min(240px, 58vw);
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 12px;
}

.loader-mark span {
  height: 32px;
  border: 1px solid var(--ink);
  animation: loader-breathe 1100ms ease-in-out infinite alternate;
}

.loader-mark span:last-child {
  animation-delay: 180ms;
}

.loader-mark i {
  position: relative;
  height: 1px;
  overflow: hidden;
  background: rgba(23, 20, 18, 0.24);
}

.is-loaded .page-loader {
  visibility: hidden;
  opacity: 0;
}

@keyframes loader-breathe {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
  background: rgba(244, 239, 231, 0.88);
  border-bottom: 1px solid rgba(216, 207, 194, 0.72);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 760;
  text-decoration: none;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.brand-symbol svg {
  color: currentColor;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.site-nav a {
  position: relative;
  text-decoration: none;
}

.site-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 220ms ease;
}

.site-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.landing {
  display: grid;
  width: min(1180px, calc(100% - 32px));
  min-height: 62svh;
  margin: 0 auto;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  padding: 54px 0 68px;
}

.landing-copy {
  max-width: 960px;
}

.avatar-pair {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.avatar-frame {
  position: relative;
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: rgba(255, 250, 241, 0.56);
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-frame span {
  padding: 8px;
  font-size: 15px;
  font-weight: 720;
  text-align: center;
}

.avatar-link {
  width: clamp(54px, 12vw, 150px);
  height: 1px;
  background: var(--red);
}

.landing h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(56px, 10vw, 124px);
  line-height: 0.92;
  font-weight: 520;
  letter-spacing: -0.02em;
}

.name-join {
  color: var(--red);
}

.lead {
  max-width: 520px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

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

.action.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

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

.action.danger {
  border-color: var(--red);
  color: var(--red);
}

.admin-page .action.primary {
  border-color: var(--red);
  background: var(--red);
  color: var(--admin-text);
}

.admin-page .action.secondary {
  color: var(--admin-muted);
}

.status-strip {
  display: grid;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chat-empty {
  margin: 0;
  color: var(--muted);
}

.chat-page .chat-empty {
  color: var(--admin-muted);
}

.status-strip article {
  padding: 22px 18px;
  border-right: 1px solid var(--line);
}

.status-strip article:last-child {
  border-right: 0;
}

.status-strip span {
  display: block;
  font-size: clamp(22px, 4vw, 42px);
  font-weight: 620;
}

.status-strip p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.note-line,
.split-section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.note-line {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.note-line span,
.section-heading p,
.view-head p {
  margin: 0;
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-line p {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(26px, 5vw, 56px);
  line-height: 1.08;
}

.split-section {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  position: sticky;
  top: 88px;
  align-self: start;
}

.section-heading h2 {
  margin: 10px 0 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 0.98;
  font-weight: 520;
}

.record-list {
  display: grid;
}

.record-item {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  transition: padding-left 220ms ease, border-color 220ms ease;
}

.record-item:hover {
  padding-left: 12px;
  border-color: rgba(189, 63, 45, 0.42);
}

.record-item:first-child {
  border-top: 0;
}

.record-item time {
  color: var(--muted);
  font-size: 14px;
}

.record-item h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.12;
  font-weight: 620;
}

.record-item p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
}

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

.media-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--surface-2);
}

.media-item img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 500ms ease;
}

.media-item:hover img {
  transform: scale(1.035);
}

.media-item figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 42px 14px 14px;
  color: #fffaf1;
  background: linear-gradient(transparent, rgba(23, 20, 18, 0.72));
  font-size: 13px;
  font-weight: 650;
}

.empty-state {
  padding: 48px 0;
  border-top: 1px solid var(--line);
}

.media-grid .empty-state {
  grid-column: 1 / -1;
}

.empty-state strong {
  display: block;
  font-size: 22px;
  font-weight: 620;
}

.empty-state p {
  max-width: 420px;
  margin: 10px 0 0;
  color: var(--muted);
}

.admin-page {
  color: var(--admin-text);
  background: var(--admin-bg);
}

.chat-page {
  min-height: 100svh;
  color: var(--admin-text);
  background:
    linear-gradient(90deg, rgba(246, 239, 228, 0.04) 1px, transparent 1px),
    var(--admin-bg);
  background-size: 64px 100%;
}

.chat-app {
  min-height: 100svh;
}

.identity-gate {
  display: grid;
  min-height: 100svh;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  align-content: center;
  gap: 36px;
  padding: 48px 0;
}

.chat-brand {
  position: absolute;
  top: 24px;
  color: var(--admin-text);
}

.identity-gate h1,
.chat-room-head h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(52px, 10vw, 112px);
  line-height: 0.92;
  font-weight: 520;
}

.identity-gate p,
.chat-room-head p {
  max-width: 520px;
  margin: 18px 0 0;
  color: var(--admin-muted);
}

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

.identity-choice {
  display: grid;
  min-height: 230px;
  align-content: end;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line-dark);
  background: var(--admin-panel);
  color: var(--admin-text);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
}

.identity-choice:hover {
  transform: translateY(-3px);
  border-color: var(--red);
}

.choice-avatar {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--admin-muted);
}

.choice-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.choice-avatar b {
  font-size: 18px;
}

.identity-choice strong {
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
  font-weight: 520;
}

.chat-room {
  display: grid;
  height: 100svh;
  grid-template-rows: auto 1fr auto;
}

.chat-room-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line-dark);
  background: rgba(22, 20, 18, 0.9);
  backdrop-filter: blur(16px);
}

.chat-room-head h1 {
  font-size: clamp(34px, 6vw, 72px);
}

.return-link-inline {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--admin-muted);
  font-size: 14px;
  text-decoration: none;
}

.room-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 24px clamp(16px, 4vw, 42px);
}

.room-message {
  max-width: min(680px, 82%);
  padding: 14px 16px;
  border: 1px solid var(--line-dark);
  background: var(--admin-panel);
}

.room-message.is-mine {
  align-self: flex-end;
  border-color: rgba(189, 63, 45, 0.62);
  background: #2a1814;
}

.room-message div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--admin-muted);
  font-size: 12px;
}

.room-message p {
  margin: 8px 0 0;
  font-size: clamp(16px, 2.4vw, 22px);
  line-height: 1.42;
}

.room-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 42px);
  border-top: 1px solid var(--line-dark);
  background: rgba(22, 20, 18, 0.92);
}

.room-compose input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-dark);
  background: var(--admin-panel);
  color: var(--admin-text);
}

.room-compose input:focus {
  outline: none;
  border-color: var(--red);
}

.console-shell {
  display: grid;
  min-height: 100svh;
  grid-template-columns: 280px 1fr;
}

.console-side {
  position: sticky;
  top: 0;
  height: 100svh;
  padding: 28px;
  border-right: 1px solid var(--line-dark);
  background: #171411;
}

.admin-brand {
  color: var(--admin-text);
}

.console-tabs {
  display: grid;
  gap: 6px;
  margin-top: 44px;
}

.tab {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--admin-muted);
  text-align: left;
  font-size: 14px;
  font-weight: 680;
  cursor: pointer;
}

.tab.is-active {
  background: var(--admin-soft);
  color: var(--admin-text);
}

.return-link {
  position: absolute;
  bottom: 28px;
  color: var(--admin-muted);
  font-size: 14px;
  text-decoration: none;
}

.console-main {
  min-width: 0;
  padding: clamp(22px, 5vw, 64px);
}

.login-panel,
.console-panel {
  width: min(980px, 100%);
}

.login-panel {
  display: grid;
  max-width: 460px;
  gap: 18px;
}

.login-panel h1,
.view-head h1 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.95;
  font-weight: 520;
}

.login-panel p {
  margin: 12px 0 0;
  color: var(--admin-muted);
}

label {
  display: grid;
  gap: 8px;
  color: inherit;
  font-size: 13px;
  font-weight: 680;
}

.admin-page input,
.admin-page textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  outline: none;
  background: #171411;
  color: var(--admin-text);
}

.admin-page textarea {
  resize: vertical;
}

.admin-page input:focus,
.admin-page textarea:focus {
  border-color: var(--red);
}

.console-view {
  display: none;
}

.console-view.is-active {
  display: block;
}

.view-head {
  margin-bottom: 32px;
}

.field-grid,
.editor-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line-dark);
  background: var(--admin-panel);
}

.wide {
  grid-column: 1 / -1;
}

.wide-button {
  margin-top: 18px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 10px;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.admin-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-dark);
}

.admin-entry strong {
  display: block;
  font-size: 16px;
}

.admin-entry p {
  margin: 6px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-entry-actions {
  display: flex;
  gap: 8px;
}

.small-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: transparent;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
}

.data-box {
  margin-top: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.form-message {
  min-height: 20px;
  color: var(--admin-muted);
  font-size: 13px;
}

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

@media (max-width: 860px) {
  .site-header {
    width: calc(100% - 28px);
  }

  .site-nav {
    gap: 12px;
  }

  .landing {
    width: calc(100% - 28px);
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 42px 0 46px;
  }

  .landing h1 {
    font-size: clamp(48px, 18vw, 78px);
  }

  .avatar-frame {
    width: 68px;
    height: 68px;
  }

  .status-strip {
    width: calc(100% - 28px);
    grid-template-columns: repeat(2, 1fr);
  }

  .status-strip article:nth-child(2) {
    border-right: 0;
  }

  .status-strip article:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .note-line,
  .split-section {
    width: calc(100% - 28px);
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 46px 0;
  }

  .section-heading {
    position: static;
  }

  .record-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

  .identity-gate {
    width: calc(100% - 28px);
    gap: 28px;
  }

  .identity-choices {
    grid-template-columns: 1fr;
  }

  .identity-choice {
    min-height: 160px;
  }

  .chat-room-head {
    display: grid;
    padding: 18px 14px;
  }

  .room-messages {
    padding: 16px 14px;
  }

  .room-message {
    max-width: 92%;
  }

  .room-compose {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .console-shell {
    grid-template-columns: 1fr;
  }

  .console-side {
    position: static;
    height: auto;
    padding: 18px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .console-tabs {
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-top: 18px;
    overflow-x: auto;
  }

  .tab {
    min-width: 86px;
    text-align: center;
  }

  .return-link {
    display: none;
  }

  .console-main {
    padding: 28px 14px 48px;
  }

  .field-grid,
  .editor-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}

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