:root {
  color-scheme: dark;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: #edf0fa;
  background: #141722;
  --muted: #a7afc4;
  --border: #343a4e;
  --surface: #1c2030;
  --blue: #afc3ff;
  --orange: #ffba91;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button {
  border: 1px solid var(--border); border-radius: 9px; background: #23283a;
  padding: .62rem .85rem; font-weight: 650;
}
button:hover:enabled { background: #353e59; }
button:disabled, textarea:disabled, select:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #b9c9ff; outline-offset: 3px; }
h1, h2, p { margin: 0; }
#app { display: grid; grid-template-columns: 242px minmax(0, 1fr); height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; gap: 20px; padding: 23px 15px 15px;
  background: #10131d; border-right: 1px solid #282d3d; min-height: 0;
}
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; margin: 0 6px; }
.brand-mark, .empty-mark {
  display: grid; place-items: center; color: #dbe4ff; background: #263454;
  border: 1px solid #425681; border-radius: 10px; width: 36px; height: 36px;
}
.new { text-align: left; color: var(--blue); }
#threads { display: grid; gap: 5px; overflow-y: auto; align-content: start; flex: 1; }
#threads button {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
  text-align: left; background: none; color: var(--muted); border-color: transparent; font-size: .91rem;
}
#threads button:hover, #threads button[aria-current="true"] {
  background: #262d43; color: #f4f6ff; border-color: #343e5b;
}
.quiet { align-self: flex-start; background: transparent; color: var(--muted); }
main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; }
.topbar {
  padding: 18px clamp(16px, 4vw, 42px); display: flex; justify-content: space-between;
  align-items: center; gap: 14px; border-bottom: 1px solid #2b3041;
}
h1 { font-size: 1.15rem; overflow-wrap: anywhere; }
.participants { display: flex; gap: 8px; font-size: .8rem; white-space: nowrap; }
.participants span {
  display: flex; align-items: center; gap: 6px; padding: 5px 9px;
  border: 1px solid var(--border); border-radius: 20px; color: var(--blue);
}
.participants span + span { color: var(--orange); }
.participants i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.timeline { overflow-y: auto; padding: 28px 20px 14px; }
.column { max-width: 790px; margin: auto; }
#empty { padding: clamp(26px, 12vh, 110px) 0 26px; text-align: center; }
.empty-mark { width: 62px; height: 62px; margin: 0 auto 20px; font-size: 1.9rem; border-radius: 16px; }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); margin-bottom: 12px; }
#empty p, #status, #login-status { color: var(--muted); line-height: 1.6; }
#messages { display: grid; gap: 13px; }
article { padding: 15px 19px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
article.user { background: #242b40; }
article strong { display: block; margin-bottom: 8px; font-size: .83rem; color: var(--blue); }
article.claude strong { color: var(--orange); }
article.user strong { color: #d8def3; }
article p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.bottom { padding: 0 20px 20px; background: #141722; }
.status-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 3px 0 7px; }
.status-row p { flex: 1; font-size: .83rem; }
.status-row button { padding: 4px 8px; font-size: .78rem; }
#composer { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px; }
textarea { resize: vertical; max-height: 30vh; display: block; width: 100%; border: 0; padding: 8px; background: transparent; }
textarea::placeholder { color: var(--muted); }
.options { display: flex; flex-wrap: wrap; gap: 9px 14px; align-items: center; padding: 7px 2px 0; }
.options label { color: var(--muted); font-size: .83rem; }
select { background: #23283a; border: 1px solid var(--border); border-radius: 7px; padding: .36rem .45rem; }
.primary { background: #becbff; color: #171f37; border: 1px solid transparent; }
.primary:hover:enabled { background: #dae2ff; }
#send { margin-left: auto; white-space: nowrap; }
#gate { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
#login {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: min(100%, 370px); padding: 30px; display: grid; gap: 13px;
}
#password { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #121523; padding: 10px; }
#login-status:empty { display: none; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 680px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px;
    padding: 10px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { margin: 0; font-size: .9rem; }
  .brand-mark { width: 27px; height: 27px; }
  #threads { grid-row: 2; grid-column: 1 / -1; display: flex; overflow-x: auto; }
  #threads button { width: auto; max-width: 230px; padding: 5px 8px; }
  #threads:empty { display: none; }
  .new, .quiet { padding: 6px; font-size: .79rem; align-self: auto; }
  .topbar, .timeline, .bottom { padding-left: 12px; padding-right: 12px; }
  .topbar { align-items: flex-start; }
  h1 { font-size: .95rem; }
  .participants { font-size: .68rem; gap: 3px; }
  .participants span { padding: 3px 5px; gap: 4px; }
}
