:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #647067;
  --line: #d9e0d9;
  --panel: #ffffff;
  --soft: #eef5f0;
  --accent: #21735b;
  --accent-dark: #145341;
  --gold: #b98b2d;
  --bg: #f7f8f5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 0 32px;
  background: rgba(247, 248, 245, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand, .site-header nav, .hero-actions, .composer, .check {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { font-weight: 700; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: white;
  background: var(--accent);
  border-radius: 6px;
}
.site-header nav a, .site-header nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.site-header form { margin: 0; }
.nav-cta { color: var(--accent-dark) !important; font-weight: 700; }
.hero {
  min-height: 560px;
  display: grid;
  align-items: center;
  padding: 72px 32px 64px;
  background:
    linear-gradient(120deg, rgba(23,32,28,.88), rgba(33,115,91,.64)),
    url("https://images.unsplash.com/photo-1518005020951-eccb494ad742?auto=format&fit=crop&w=1800&q=80") center/cover;
  color: white;
  text-align: center;
}
.hero > div { width: min(1760px, 100%); margin: 0 auto; }
.section { width: min(1080px, 100%); margin: 0 auto; }
.hero h1 {
  max-width: 1580px;
  margin: 12px auto 26px;
  font-size: clamp(54px, 8.4vw, 132px);
  line-height: 1.02;
  letter-spacing: 0;
}
.hero-copy {
  max-width: 1120px;
  min-height: 120px;
  margin: 0 auto;
  color: rgba(255,255,255,.9);
  font-size: 26px;
  line-height: 1.9;
  font-weight: 700;
  white-space: pre-wrap;
}
.hero-actions {
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}
.eyebrow { margin: 0; color: var(--gold); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.danger { background: #fff4f1; border-color: #e3a89b; color: #9d2d18; }
.section { padding: 58px 32px; }
.section-heading { margin-bottom: 18px; }
.section h2, .auth-card h1, .chat-side h1, .admin-sidebar h1 { margin: 6px 0 0; font-size: 30px; }
.announcement-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.notice, .auth-card, .chat-side, .chat-panel, .admin-sidebar, .announcement-admin {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.notice { padding: 20px; }
.notice h3 { margin: 8px 0; }
.notice p { color: var(--muted); line-height: 1.7; white-space: pre-wrap; }
.notice time, .muted, .thread-button small { color: var(--muted); }
.pin { color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.auth-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(420px, 100%); padding: 28px; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
  background: white;
}
textarea { resize: vertical; }
.auth-card, .stack-form { display: grid; gap: 16px; }
.compact-form { gap: 10px; }
.error { padding: 10px 12px; border-radius: 6px; background: #fff0ee; color: #9b2d20; }
.form-link { color: var(--muted); }
.form-link a { color: var(--accent-dark); font-weight: 800; }
.chat-layout, .admin-grid {
  min-height: calc(100vh - 68px);
  display: grid;
  gap: 18px;
  padding: 24px;
}
.chat-layout { grid-template-columns: 320px minmax(0, 1fr); }
.admin-grid { grid-template-columns: 260px minmax(0, 1fr) 340px; }
.chat-side, .admin-sidebar, .announcement-admin { padding: 22px; }
.chat-side p, .mini-list p { color: var(--muted); line-height: 1.7; }
.status { margin-top: 16px; padding: 12px; background: var(--soft); border-radius: 6px; color: var(--accent-dark); font-weight: 700; }
.status.error { background: #fde8e2; color: #9d2d18; }
.status.success { background: #e6f3ea; color: #23633b; }
.chat-panel { min-height: 520px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.admin-chat-head { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.messages { padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.message { max-width: min(660px, 86%); padding: 12px 14px; border-radius: 8px; background: var(--soft); line-height: 1.6; }
.message.me { align-self: flex-end; background: #dff0e9; }
.message strong { display: block; margin-bottom: 4px; font-size: 13px; }
.message time { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.composer { padding: 16px; border-top: 1px solid var(--line); align-items: end; }
.thread-list { display: grid; gap: 8px; margin-top: 14px; }
.thread-button {
  width: 100%;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}
.thread-button.active { border-color: var(--accent); background: var(--soft); }
.thread-button span, .thread-button small { display: block; }
.button:disabled { cursor: not-allowed; opacity: 0.58; }
.mini-list { display: grid; gap: 10px; }
.mini-list article { border-top: 1px solid var(--line); padding-top: 12px; }
.account-list article { display: grid; gap: 10px; }
.announcement-admin {
  max-height: calc(100vh - 116px);
  overflow: auto;
  display: grid;
  gap: 12px;
}
.admin-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.admin-section:first-child {
  border-top: 0;
  padding-top: 0;
}
.admin-section summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  list-style-position: outside;
}
.admin-section[open] summary {
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .site-header { padding: 0 16px; align-items: flex-start; flex-direction: column; justify-content: center; }
  .site-header nav { flex-wrap: wrap; padding-bottom: 12px; }
  .hero { min-height: 540px; padding: 58px 20px 48px; }
  .hero h1 { font-size: clamp(42px, 15vw, 72px); }
  .hero-copy { min-height: 150px; font-size: 20px; line-height: 1.85; }
  .chat-layout, .admin-grid { grid-template-columns: 1fr; padding: 14px; }
  .message { max-width: 96%; }
  .composer { flex-direction: column; align-items: stretch; }
}
