:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #667085;
  --line: rgba(31, 45, 61, 0.14);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --leaf: #3b7d67;
  --leaf-dark: #225c4e;
  --rose: #b65a73;
  --gold: #c18a3d;
  --sky: #4d7ea8;
  --shadow: 0 20px 60px rgba(26, 35, 49, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(120deg, rgba(247, 251, 244, 0.90), rgba(246, 240, 234, 0.78)),
    url("/assets/treehole-bg.png") center / cover fixed;
}

button,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--leaf-dark);
  padding: 0.8rem 1.05rem;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button:hover {
  background: #18483f;
  box-shadow: 0 10px 22px rgba(34, 92, 78, 0.24);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
  box-shadow: none;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  outline: none;
}

textarea {
  display: block;
  resize: vertical;
  min-height: 7rem;
  padding: 0.95rem 1rem;
  line-height: 1.65;
}

textarea:focus,
select:focus {
  border-color: rgba(59, 125, 103, 0.72);
  box-shadow: 0 0 0 4px rgba(59, 125, 103, 0.12);
}

label {
  display: grid;
  gap: 0.45rem;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand small {
  margin-top: 0.14rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 8px;
  background:
    radial-gradient(circle at 55% 35%, #f7dca1 0 13%, transparent 14%),
    linear-gradient(145deg, var(--leaf), #1f4f48 64%, #26394d);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.18);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.ghost-button {
  min-height: 2rem;
  padding: 0.34rem 0.72rem;
  color: var(--leaf-dark);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 800;
}

.ghost-button:hover {
  color: #fff;
}

.server-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.34rem 0.72rem;
  color: var(--leaf-dark);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.server-pill.offline {
  color: #9f3a52;
}

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

.agreement-start {
  min-height: calc(100vh - 4.5rem);
  display: grid;
  align-items: center;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.48));
}

.agreement-copy {
  width: min(920px, 100%);
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--rose);
  font-size: 0.88rem;
  font-weight: 900;
}

.agreement-copy h1 {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.agreement-lead,
.agreement-footnote {
  max-width: 760px;
  color: #344054;
  font-size: 1.02rem;
  line-height: 1.8;
}

.agreement-lead {
  margin: 1rem 0 1.6rem;
}

.agreement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 1.5rem;
  margin: 1.4rem 0;
}

.agreement-section {
  border-top: 1px solid rgba(31, 45, 61, 0.18);
  padding-top: 0.85rem;
}

.agreement-section h2 {
  margin: 0 0 0.45rem;
  color: var(--leaf-dark);
  font-size: 1.05rem;
}

.agreement-section p {
  margin: 0;
  color: #344054;
  line-height: 1.78;
}

.agreement-footnote {
  margin: 1.2rem 0 1.25rem;
}

.accept-button {
  min-width: 10rem;
  background: linear-gradient(135deg, var(--leaf-dark), #264b65);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(340px, 0.76fr);
  gap: clamp(1rem, 3vw, 2rem);
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.6rem) 0 2.5rem;
}

.board-pane,
.chat-pane {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.board-pane {
  padding: clamp(1rem, 3vw, 1.45rem);
}

.chat-pane {
  display: grid;
  grid-template-rows: auto auto minmax(20rem, 1fr) auto;
  max-height: calc(100vh - 7rem);
  overflow: hidden;
}

.pane-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chat-heading {
  margin: 0;
  padding: clamp(1rem, 3vw, 1.35rem) clamp(1rem, 3vw, 1.35rem) 0;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  line-height: 1.12;
  letter-spacing: 0;
}

#boardTitle {
  font-size: clamp(2rem, 5vw, 4.1rem);
}

#chatTitle {
  font-size: 1.45rem;
}

.pane-heading p {
  margin-top: 0.38rem;
  color: var(--muted);
  line-height: 1.55;
}

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

.confession-form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.8rem;
}

.select-wrap {
  grid-template-columns: auto minmax(9rem, 1fr);
  align-items: center;
}

select {
  min-height: 2.85rem;
  padding: 0 0.8rem;
}

.confession-list {
  display: grid;
  gap: 0.75rem;
}

.note-card {
  display: grid;
  gap: 0.55rem;
  border: 1px solid rgba(31, 45, 61, 0.11);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.76);
}

.note-card:nth-child(3n + 1) {
  border-left-color: var(--leaf);
}

.note-card:nth-child(3n + 2) {
  border-left-color: var(--rose);
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.note-mood {
  color: var(--leaf-dark);
  font-weight: 800;
}

.note-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.72;
}

.safety-note {
  margin: 0.85rem clamp(1rem, 3vw, 1.35rem) 0;
  border: 1px solid rgba(182, 90, 115, 0.18);
  border-radius: 8px;
  padding: 0.72rem 0.85rem;
  color: #7b3045;
  background: rgba(255, 245, 247, 0.74);
  font-size: 0.9rem;
  line-height: 1.55;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  padding: 1rem clamp(1rem, 3vw, 1.35rem);
}

.message {
  width: min(90%, 34rem);
  border: 1px solid rgba(31, 45, 61, 0.10);
  border-radius: 8px;
  padding: 0.82rem 0.92rem;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.82);
}

.message.assistant {
  align-self: flex-start;
  border-left: 4px solid var(--leaf);
}

.message.user {
  align-self: flex-end;
  color: #fff;
  border-color: rgba(34, 92, 78, 0.28);
  background: linear-gradient(145deg, #2e6f5e, #23485d);
}

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

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  border-top: 1px solid rgba(31, 45, 61, 0.10);
  padding: 0.95rem clamp(1rem, 3vw, 1.35rem);
  background: rgba(255, 255, 255, 0.68);
}

.chat-composer textarea {
  min-height: 3.3rem;
  max-height: 10rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .agreement-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .chat-pane {
    max-height: none;
    min-height: 36rem;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand small {
    display: none;
  }

  .topbar-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .agreement-start {
    align-items: start;
    padding-top: 1.6rem;
  }

  .workspace {
    width: min(100% - 1rem, 1180px);
    padding-top: 0.7rem;
  }

  .pane-heading,
  .form-row,
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .pane-heading {
    display: grid;
  }

  button {
    width: 100%;
  }

  .message {
    width: 100%;
  }
}