/* 茶水间 - 样式 */
:root {
  --paper: #f5f0e6;
  --card: #fffdf7;
  --ink: #2c2721;
  --ink-2: #6b6257;
  --ink-3: #9c9184;
  --line: #e4dbca;
  --accent: #b8442e;
  --accent-deep: #93331f;
  --accent-soft: #f7e9e3;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

h1 {
  font-family: Georgia, "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 2px;
}

.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.screen[hidden] { display: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(60, 45, 25, .08);
  padding: 36px 40px 32px;
  width: 100%;
  max-width: 400px;
}

.card-head { margin-bottom: 22px; }
.card-head .sub { color: var(--ink-2); margin-top: 6px; font-size: 14px; }
.card-head .who { color: var(--accent); font-weight: 600; }

/* ---------- 选项卡 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--paper);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-2);
  font-family: inherit;
}
.tab.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
label input:focus { border-color: var(--accent); }

.cap-row { display: flex; gap: 10px; align-items: flex-end; }
.cap-row label { flex: 1; margin-bottom: 14px; }
.cap-img {
  width: 130px; height: 44px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.cap-img svg { display: block; }
.cap-img:active { opacity: .7; }

.err { color: var(--accent); font-size: 13px; margin-bottom: 12px; }
.hint { color: var(--ink-3); font-size: 12.5px; margin-top: 14px; text-align: center; }
.hint a { color: var(--ink-2); }

/* ---------- 按钮 ---------- */
.btn {
  border: 0;
  border-radius: 9px;
  padding: 11px 22px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.btn.primary { background: var(--accent); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn.small { padding: 6px 14px; font-size: 13px; width: auto; }

/* ---------- 聊天室 ---------- */
#screen-chat { padding: 0; align-items: stretch; }
.chat-wrap { display: flex; width: 100%; height: 100vh; }

.side {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
}
.brand { margin-bottom: 26px; }
.brand-name {
  display: block;
  font-family: Georgia, "Noto Serif SC", "SimSun", serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
}
.brand-sub { color: var(--ink-3); font-size: 12px; }

.side-block h3 {
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
#online-list { list-style: none; }
#online-list li {
  font-size: 14px;
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#online-list li::before { content: "·"; color: #7ba05b; margin-right: 8px; font-weight: 700; }

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.me-name { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.msgs { flex: 1; overflow-y: auto; padding: 26px 30px 10px; }
.empty { color: var(--ink-3); text-align: center; margin-top: 18vh; font-size: 14px; }

.msg { max-width: 62%; margin-bottom: 14px; display: flex; flex-direction: column; }
.msg .meta { font-size: 12px; color: var(--ink-3); margin: 0 4px 4px; }
.msg .bubble {
  padding: 9px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.them { align-self: flex-start; align-items: flex-start; }
.msg.them .bubble { background: var(--card); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble { background: var(--accent-soft); border: 1px solid #ecd2c7; border-top-right-radius: 4px; }
.msg.sys { align-self: center; max-width: 100%; }
.msg.sys .meta { text-align: center; }

.typing {
  padding: 0 30px 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-style: italic;
}

.send-bar {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.send-bar input {
  flex: 1;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
}
.send-bar input:focus { border-color: var(--accent); }
.send-bar .btn { width: auto; padding: 11px 26px; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .side { display: none; }
  .msgs { padding: 20px 16px 8px; }
  .msg { max-width: 80%; }
  .card { padding: 28px 24px 26px; }
  .cap-img { width: 110px; }
}
