:root {
  color-scheme: light;
  --ink: #17201e;
  --muted: #71807b;
  --paper: #f7f5ef;
  --forest: #10221f;
  --accent: #24a486;
  --accent-dark: #19755f;
  --line: #d9ddd7;
  --danger: #a53b35;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    var(--forest);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 80px rgba(0,0,0,.22);
}
.login-view {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  padding: 48px clamp(24px, 8vw, 84px);
  position: relative;
  overflow: hidden;
}
.login-view::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 48px, var(--forest) 48px 96px, #dfb657 96px 144px);
}
.mark { display: flex; gap: 6px; margin-bottom: 42px; }
.mark span { width: 7px; height: 28px; background: var(--forest); }
.mark span:nth-child(2) { height: 20px; background: var(--accent); }
.mark span:nth-child(3) { height: 12px; background: #dfb657; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}
h1 {
  margin: 0;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(38px, 8vw, 58px);
  font-weight: 700;
  letter-spacing: 0;
}
.login-copy { margin: 14px 0 50px; color: var(--muted); font-size: 15px; }
.login-form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.password-row { display: grid; grid-template-columns: 1fr auto; border-bottom: 2px solid var(--ink); }
.password-row:focus-within { border-color: var(--accent-dark); }
.password-row input { min-width: 0; border: 0; outline: 0; background: transparent; padding: 13px 0; font-size: 18px; }
.password-row button { border: 0; background: transparent; color: var(--accent-dark); padding: 0 4px 0 22px; font-weight: 700; }
.form-error, .board-error { min-height: 22px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.board-view { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 24px clamp(18px, 5vw, 40px) 18px; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 28px; }
.topbar .eyebrow { font-size: 10px; margin-bottom: 3px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.sync-state { color: var(--muted); font-size: 12px; white-space: nowrap; }
.sync-state i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); }
.sync-state.offline i { background: #cc7b40; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; }
.icon-button svg, .composer button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.messages { min-height: 0; overflow-y: auto; padding: 24px clamp(18px, 5vw, 40px) 10px; }
.empty-state { height: 100%; min-height: 280px; display: grid; place-content: center; justify-items: center; color: var(--muted); font-size: 13px; }
.empty-line { width: 58px; height: 1px; background: var(--line); }
.message { max-width: 88%; margin: 0 0 22px auto; animation: arrive .24s ease both; }
.message-body { margin: 0; padding: 13px 16px; background: #e4f0eb; border-left: 3px solid var(--accent); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 15px; }
.message-time { margin: 6px 2px 0; color: var(--muted); font-family: Consolas, monospace; font-size: 10px; text-align: right; }
.composer { display: grid; grid-template-columns: 1fr 48px; align-items: end; gap: 10px; margin: 10px clamp(14px, 4vw, 34px) max(12px, env(safe-area-inset-bottom)); padding: 10px 10px 10px 16px; background: white; border: 1px solid var(--line); box-shadow: 0 10px 32px rgba(16,34,31,.1); }
.composer textarea { width: 100%; max-height: 140px; resize: none; border: 0; outline: 0; padding: 11px 0 8px; background: transparent; line-height: 1.5; }
.composer button { width: 48px; height: 48px; border: 0; color: white; background: var(--forest); display: grid; place-items: center; }
.composer button:disabled { opacity: .55; cursor: wait; }
.board-error { margin: -6px 34px 8px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) {
  .shell { width: 100%; }
  .login-view { align-content: end; padding-bottom: 18vh; }
  .topbar { padding-top: max(18px, env(safe-area-inset-top)); }
  .sync-state { font-size: 0; }
  .sync-state i { margin: 0; }
  .message { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
