:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --chip-bg: #eef1f5;
  --chip-on: #2563eb;
  --chip-on-fg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --panel: #161b22;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #21262d;
    --accent: #4493f8;
    --accent-fg: #0b0f14;
    --chip-bg: #21262d;
    --chip-on: #4493f8;
    --chip-on-fg: #0b0f14;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button {
  font: inherit;
  color: var(--text);
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.ghost { background: transparent; border: 1px solid var(--line); }

/* 登录页 */
.screen#login {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
}
.login-box h1 { margin: 0 0 4px; font-size: 24px; }
.login-box .sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-box input {
  width: 100%;
  padding: 12px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
}
.login-box #loginBtn {
  width: 100%;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  font-weight: 600;
}
.err { color: #e5484d; font-size: 13px; min-height: 18px; margin: 8px 0 0; }

/* 主界面 */
.screen#main {
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header .title { font-weight: 700; font-size: 18px; }
.head-actions { display: flex; gap: 8px; }

.toolbar { padding: 8px 16px 0; }
.toolbar .full { width: 100%; color: var(--muted); font-size: 13px; padding: 8px; }

.stream {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.card-head .who { font-weight: 600; font-size: 14px; }
.card-head .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.card .body {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  color: var(--text);
}

/* 输入区 */
.compose {
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font-size: 14px; padding: 7px 12px; }
.chip.on { background: var(--chip-on); color: var(--chip-on-fg); border-color: var(--chip-on); }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea {
  flex: 1;
  resize: none;
  font: inherit;
  line-height: 1.4;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  max-height: 140px;
}
.compose-row #send {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  font-weight: 600;
  padding: 11px 18px;
}
