/* ========== 公共聊天室 — 浅色主题 ========== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e8eaed;
  --text: #1f2329;
  --sub: #8a9099;
  --blue: #2b7fff;
  --blue-soft: #eaf2ff;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 14px;
}

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; word-break: break-all; }

/* ================= 首页 ================= */
body.home {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px 18px;
}
.home-wrap { width: 100%; max-width: 460px; }

.home-title { text-align: center; margin-bottom: 30px; }
.home-title h1 { font-size: 30px; margin: 0 0 8px; font-weight: 700; letter-spacing: 1px; }
.home-title p  { margin: 0; color: var(--sub); font-size: 14px; }

.room-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card);
  border-radius: 18px;
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(20,30,60,.06);
  border: 1px solid var(--line);
  transition: transform .15s, box-shadow .15s;
  color: var(--text);
}
.room-card:active { transform: scale(.98); box-shadow: 0 1px 6px rgba(20,30,60,.1); }

.room-icon { font-size: 34px; line-height: 1; flex-shrink: 0; }
.room-text { flex: 1; min-width: 0; }
.room-text h2 { margin: 0 0 4px; font-size: 19px; font-weight: 650; }
.room-text p  { margin: 0; font-size: 13px; color: var(--sub); }
.room-arrow { font-size: 26px; color: #c8cdd4; flex-shrink: 0; }

.room-normal   { border-left: 4px solid var(--blue); }
.room-important{ border-left: 4px solid var(--amber); }

.home-foot {
  margin-top: 26px; display: flex; flex-direction: column; gap: 6px;
  text-align: center; font-size: 12px; color: var(--sub);
}

/* ================= 聊天页 ================= */
body.chat-page { padding-bottom: 140px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.back {
  font-size: 28px; line-height: 1; color: var(--text);
  width: 34px; text-align: center; flex-shrink: 0;
}
.topbar-mid { flex: 1; min-width: 0; text-align: center; }
.topbar-title { font-size: 16px; font-weight: 650; }
.topbar-sub { font-size: 11px; color: var(--sub); }
.refresh {
  background: none; border: none; font-size: 20px; color: var(--sub);
  width: 34px; flex-shrink: 0; cursor: pointer;
}

/* 空间条 */
.usage-bar { height: 3px; background: #eceef1; }
.usage-fill { height: 100%; width: 0; background: var(--green); transition: width .4s; }
.usage-fill.warn { background: var(--red); }
.usage-text { font-size: 11px; color: var(--sub); padding: 5px 14px 8px; }

/* 消息列表 */
.msg-list { padding: 4px 12px 12px; }

.msg {
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 13px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(20,30,60,.045);
}
.msg-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 5px;
}
.msg-nick { font-size: 13px; font-weight: 600; color: var(--blue); }
.msg-time { font-size: 11px; color: var(--sub); margin-left: auto; }
.del {
  background: none; border: none; font-size: 14px; cursor: pointer;
  opacity: .5; padding: 0 2px;
}
.del:active { opacity: 1; }

.msg-body { word-break: break-word; white-space: pre-wrap; }

/* 附件 */
.att-img img {
  max-width: 100%; max-height: 340px; border-radius: 10px; display: block;
  cursor: zoom-in;
}
.att-video { max-width: 100%; max-height: 340px; border-radius: 10px; display: block; }

.att-file {
  display: flex; align-items: center; gap: 10px;
  background: #f7f8fa; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; margin-top: 6px;
  color: var(--text);
}
.att-ico { font-size: 22px; flex-shrink: 0; }
.att-info { min-width: 0; display: flex; flex-direction: column; }
.att-info b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-info i { font-size: 11px; color: var(--sub); font-style: normal; }

.msg-body a { text-decoration: underline; }

/* 拖拽层 */
.drop-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(43,127,255,.10);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
.drop-overlay.show { display: flex; }
.drop-inner {
  background: #fff; border: 3px dashed var(--blue);
  border-radius: 20px; padding: 36px 52px;
  text-align: center; font-size: 16px; font-weight: 600; color: var(--blue);
  box-shadow: 0 8px 40px rgba(43,127,255,.2);
}
.drop-icon { font-size: 46px; margin-bottom: 10px; }

/* 输入区 */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.composer-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.nick {
  flex: 1; border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 11px; font-size: 13px; background: #fafbfc; outline: none;
  font-family: inherit;
}
.nick:focus { border-color: var(--blue); background: #fff; }

.attach {
  font-size: 21px; cursor: pointer; padding: 3px 7px;
  border: 1px solid var(--line); border-radius: 9px; background: #fafbfc;
  flex-shrink: 0; line-height: 1;
}

.composer-input { display: flex; gap: 8px; align-items: flex-end; }
#inputBox {
  flex: 1; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 13px; font-size: 15px; resize: none; outline: none;
  font-family: inherit; line-height: 1.45; max-height: 120px;
  background: #fafbfc;
}
#inputBox:focus { border-color: var(--blue); background: #fff; }

.send {
  background: var(--blue); color: #fff; border: none;
  border-radius: 12px; padding: 10px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; flex-shrink: 0; font-family: inherit;
}
.send:active { opacity: .85; }
.send:disabled { background: #c3d4ee; }

.preview { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.preview img { width: 52px; height: 52px; object-fit: cover; border-radius: 7px; }

/* 空状态 */
.empty-tip {
  text-align: center; color: var(--sub); font-size: 13px;
  padding: 60px 20px;
}

/* ================= 密码生成器 ================= */
body.pw { padding: 0; }
.pw-wrap { max-width: 560px; margin: 0 auto; padding: 16px 14px 40px; }

.pw-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 2px 16px;
}
.pw-head h1 { font-size: 20px; margin: 0; font-weight: 700; }
.pw-back {
  font-size: 26px; line-height: 1; color: var(--text);
  padding: 2px 10px 4px 0; font-weight: 300;
}

.pw-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
  border: 1px solid var(--line);
}

.pw-label {
  font-size: 13px; color: var(--sub); font-weight: 600;
  margin-bottom: 10px; letter-spacing: .3px;
}

.pw-opts { display: flex; flex-direction: column; gap: 10px; }
.pw-chk {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; cursor: pointer; padding: 4px 0;
}
.pw-chk input[type=checkbox] {
  width: 19px; height: 19px; accent-color: var(--blue);
  flex-shrink: 0; cursor: pointer;
}

.pw-gen {
  width: 100%; margin-top: 18px;
  background: var(--blue); color: #fff; border: none;
  border-radius: 12px; padding: 13px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.pw-gen:active { opacity: .85; }

/* 生成结果 */
.pw-result { border: 2px solid var(--blue); background: var(--blue-soft); }
.pw-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px; font-weight: 600; letter-spacing: 1px;
  background: #fff; border-radius: 10px; padding: 16px 14px;
  word-break: break-all; text-align: center; color: #1a56c4;
  border: 1px solid #d3e2fb;
}
.pw-actions { display: flex; gap: 10px; margin-top: 12px; }
.pw-btn {
  flex: 1; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 11px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; color: var(--text);
}
.pw-btn:active { opacity: .8; }
.pw-btn:disabled { opacity: .5; cursor: default; }
.pw-btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.pw-btn-danger { color: var(--red); border-color: #fbd5d5; background: #fff8f8; }

/* 历史 */
.pw-his-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.pw-his-head .pw-label { margin-bottom: 0; }
.pw-his-head .pw-btn { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; }

.pw-list { margin-top: 8px; }
.pw-empty { text-align: center; color: var(--sub); font-size: 13px; padding: 28px 0; }

.pw-item {
  border-top: 1px solid var(--line); padding: 12px 0;
}
.pw-item:first-child { border-top: none; }

.pw-item-top { display: flex; align-items: center; gap: 8px; }
.pw-item-pw {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 600; word-break: break-all; color: var(--text);
}
.pw-item-btns { display: flex; gap: 5px; flex-shrink: 0; }
.pw-mini {
  border: 1px solid var(--line); background: #fafbfc; color: var(--sub);
  border-radius: 7px; padding: 4px 9px; font-size: 12px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.pw-mini:active { opacity: .7; }
.pw-mini-blue { color: var(--blue); border-color: #d3e2fb; background: var(--blue-soft); }
.pw-mini-red  { color: var(--red); border-color: #fbd5d5; background: #fff8f8; }

.pw-item-note { font-size: 13px; color: var(--text); margin-top: 6px; }
.pw-item-note-empty { color: var(--sub); font-style: italic; }
.pw-item-time { font-size: 11px; color: var(--sub); margin-top: 3px; }

/* 首页第三个卡片配色 */
.room-password { border-left-color: #9b6bff; }
.room-password .room-icon { background: #f3edff; }
