/* ============================================================
   《最后一个 QQ 群》 —— 旧聊天软件质感
   主色：灰蓝 / 米白 / 浅蓝旧边框 / 暖黄提示 / 少量红
   ============================================================ */

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

:root {
  --blue-dark: #3f6293;
  --blue-mid: #6a8cb8;
  --blue-pale: #b8cbe0;
  --paper: #f2efe4;
  --paper-dark: #e3e0d4;
  --chat-bg: #fbfaf4;
  --old-bg: #f6efd7;
  --warn: #9a6b1a;
  --warn-bg: #fdf3d1;
  --red: #b0433a;
  --ink: #2c2c2c;
  --grey: #8a8a82;
  --nick-other: #1f5fa9;
  --nick-me: #2a7d2a;
  --nick-bot: #3d7a74;
}

html, body {
  height: 100%;
  background: #232b36;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 35%, #2e3a48 0%, #1c222b 100%);
  font-family: "SimSun", "NSimSun", "Songti SC", serif;
  font-size: 12px;
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: none;
}

.hidden { display: none !important; }

/* ---------------- CRT 覆盖层 ---------------- */
#crt {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 9999;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.07) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
#crt::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(10,14,20,.38) 100%);
}

/* ---------------- 窗口通用 ---------------- */
.win {
  background: var(--paper);
  border: 1px solid #4a5a70;
  box-shadow:
    inset 1px 1px 0 #ffffff,
    inset -1px -1px 0 #b8b4a4,
    3px 4px 0 rgba(0,0,0,.35);
}

.titlebar {
  display: flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 6px;
  background: linear-gradient(180deg, var(--blue-mid) 0%, var(--blue-dark) 100%);
  color: #fff;
  user-select: none;
}
.tb-title { flex: 1; font-weight: bold; letter-spacing: 1px; overflow: hidden; white-space: nowrap; }
.tb-sub { font-weight: normal; opacity: .75; margin-left: 6px; letter-spacing: 0; }
.tb-clock { opacity: .85; margin-right: 4px; font-family: "Courier New", monospace; font-size: 11px; }
.tb-btns { display: flex; gap: 3px; }
.tb-btn {
  width: 18px; height: 16px; font-style: normal; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-dark); color: #333;
  border: 1px solid #fff; border-right-color: #888; border-bottom-color: #888;
  cursor: pointer;
}
.tb-btn:active { border-color: #888; border-right-color: #fff; border-bottom-color: #fff; }
.tb-icon {
  width: 18px; height: 18px; flex: none;
  image-rendering: pixelated;
  display: inline-block;
}
.tb-icon svg, .avatar svg { display: block; width: 100%; height: 100%; }

/* ---------------- 按钮 ---------------- */
.btn {
  font-family: inherit; font-size: 12px;
  padding: 3px 14px;
  background: var(--paper-dark); color: var(--ink);
  border: 1px solid #fff; border-right-color: #7a7a70; border-bottom-color: #7a7a70;
  outline: 1px solid #55637a;
  cursor: pointer;
}
.btn:hover { background: #ece9dc; }
.btn:active { border-color: #7a7a70; border-right-color: #fff; border-bottom-color: #fff; }
.btn:disabled { color: #999; cursor: default; }

/* ============================================================
   登录界面
   ============================================================ */
#login-screen {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
}
.login-win { width: 320px; }
.login-body { display: flex; gap: 16px; padding: 22px 20px 14px; }
.login-avatar {
  width: 48px; height: 48px; flex: none;
  border: 1px solid #9aa4b4;
  background: #dfe6ee;
  image-rendering: pixelated;
}
.login-avatar svg { width: 100%; height: 100%; display: block; }
.login-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.login-fields label { display: flex; align-items: center; gap: 4px; }
.login-fields input[type="text"], .login-fields input:not([type]) , .login-fields input[type="password"] {
  flex: 1; width: 100%;
  font-family: inherit; font-size: 12px;
  padding: 3px 4px;
  border: 1px solid #7a8ba0; border-top-color: #5a6b80;
  background: #fff;
}
.login-fields input:disabled { background: #eee; color: #999; }
.login-chk { display: flex; gap: 12px; color: #666; }
#login-btn { margin-top: 4px; align-self: flex-end; width: 90px; }
#login-status {
  min-height: 52px; padding: 6px 10px 10px;
  color: var(--warn);
  border-top: 1px dotted #c8c4b4;
  line-height: 1.7;
  font-size: 12px;
}
.login-foot { color: #5f6d80; letter-spacing: 1px; font-size: 11px; }

/* ============================================================
   主界面
   ============================================================ */
#main-screen {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.main-win {
  width: 900px; height: 620px;
  max-width: 98vw; max-height: 96vh;
  display: flex; flex-direction: column;
}

/* 工具栏 */
.toolbar {
  display: flex; gap: 4px;
  padding: 4px 6px;
  background: var(--paper-dark);
  border-bottom: 1px solid #b8b4a4;
}
.tool-btn {
  position: relative;
  font-family: inherit; font-size: 12px;
  padding: 3px 12px;
  background: transparent; color: var(--ink);
  border: 1px solid transparent;
  cursor: pointer;
}
.tool-btn:hover {
  background: #ece9dc;
  border: 1px solid #fff; border-right-color: #999; border-bottom-color: #999;
}
.badge {
  position: absolute; top: 1px; right: 2px;
  width: 6px; height: 6px;
  background: var(--red);
  border-radius: 0;
}

/* 目标栏 */
#goal-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid #e2d5a8;
}
.goal-label {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--warn);
  font-size: 11px;
}

/* 主体两栏 */
.main-body { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* 聊天区 */
#chat {
  flex: 1; overflow-y: auto;
  background: var(--chat-bg);
  padding: 10px 14px 16px;
  line-height: 1.65;
}
.msg { margin-top: 9px; display: flex; gap: 7px; }
.msg .avatar {
  width: 26px; height: 26px; flex: none; margin-top: 2px;
  border: 1px solid #c4c0b0;
  image-rendering: pixelated;
  background: #eee;
}
.msg.offline-av .avatar { filter: grayscale(1) opacity(.6); }
.msg .m-main { min-width: 0; }
.msg .m-head { color: var(--nick-other); }
.msg .m-head .m-time { color: #9a9a90; margin-left: 6px; font-size: 11px; }
.msg.me .m-head { color: var(--nick-me); }
.msg.bot .m-head { color: var(--nick-bot); }
.msg .m-body {
  margin-top: 1px;
  white-space: pre-wrap;
  word-break: break-word;
}
/* 恢复出的旧记录：泛黄 */
.msg.old {
  background: var(--old-bg);
  border-left: 3px solid #e0c878;
  padding: 3px 8px 4px 6px;
  margin-left: -6px;
}
.msg.old .avatar { filter: sepia(.3) opacity(.85); }
.msg.old.offline-av .avatar { filter: grayscale(.7) sepia(.4) opacity(.7); }

/* 系统消息 / 分割线 */
.sysmsg {
  margin-top: 10px;
  text-align: center;
  color: var(--grey);
  font-size: 11px;
}
.sysmsg.red { color: var(--red); }
.divider {
  margin: 14px 0 4px;
  display: flex; align-items: center; gap: 8px;
  color: #b09a4f; font-size: 11px;
  user-select: none;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 0;
  border-top: 1px dashed #d4c48a;
}
.divider.red { color: var(--red); }
.divider.red::before, .divider.red::after { border-top-color: #d4a09a; }

/* 报表块（结局统计） */
.report {
  margin: 12px auto 4px;
  max-width: 340px;
  border: 1px solid #b8b4a4;
  background: #f4f2e8;
  padding: 8px 14px;
  color: #555;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.report .r-red { color: var(--red); }

/* 表情 chips */
.emo {
  color: #c07818;
  background: #fdf0d2;
  border: 1px solid #ecd8a0;
  padding: 0 2px;
  font-size: 11px;
}

/* 输入区 */
#typing {
  position: absolute; bottom: 34px; left: 12px;
  color: var(--grey); font-size: 11px;
  animation: blink 1.2s step-end infinite;
}
@keyframes blink { 50% { opacity: .3; } }
#toast {
  position: absolute; bottom: 38px; left: 50%;
  transform: translateX(-50%);
  max-width: 85%;
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid #e0c878;
  padding: 4px 12px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.15);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  z-index: 5;
}
#quick-replies {
  position: absolute; bottom: 36px; left: 0; right: 0;
  display: flex; gap: 8px; justify-content: center;
  padding: 6px;
  z-index: 5;
}
.input-bar {
  display: flex; gap: 6px;
  padding: 6px;
  background: var(--paper-dark);
  border-top: 1px solid #b8b4a4;
}
#chat-input {
  flex: 1;
  font-family: inherit; font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #7a8ba0; border-top-color: #5a6b80;
  background: #fff;
}
#chat-input:disabled { background: #eee; color: #999; }

/* 成员列表 */
.member-col {
  width: 190px; flex: none;
  border-left: 1px solid #b8b4a4;
  background: #eef1f5;
  display: flex; flex-direction: column;
}
.member-head {
  padding: 5px 8px;
  background: linear-gradient(180deg, #dfe6ee, #c9d4e2);
  border-bottom: 1px solid #b0bcc9;
  color: #40546e; font-weight: bold;
}
#member-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.member-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.member-row:hover { background: #dde6f0; }
.member-row .avatar {
  width: 22px; height: 22px; flex: none;
  border: 1px solid #b8c0cc;
  image-rendering: pixelated;
}
.member-row.off .avatar { filter: grayscale(1) opacity(.55); }
.member-row .m-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.member-row.off .m-name { color: #8a94a0; }
.member-row .m-level { color: #c9a227; font-size: 10px; flex: none; }
.member-row .dot {
  width: 6px; height: 6px; flex: none;
  background: #4fae4f;
  box-shadow: 0 0 3px #4fae4f;
}
.member-more {
  padding: 6px 8px; text-align: center;
  color: #8a94a0; cursor: pointer; font-size: 11px;
}
.member-more:hover { color: #55637a; }
.member-sep {
  padding: 3px 8px; color: #8a94a0; font-size: 11px;
  border-top: 1px dotted #c4ccd6; margin-top: 3px;
}

/* 状态栏 */
.statusbar {
  display: flex; justify-content: space-between;
  padding: 3px 10px;
  background: var(--paper-dark);
  border-top: 1px solid #b8b4a4;
  color: #6a6a60; font-size: 11px;
}

/* ============================================================
   子窗口（面板）
   ============================================================ */
#panel-mask, #confirm-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 26, 34, .35);
  display: flex; align-items: center; justify-content: center;
}
.panel-win {
  width: 520px; max-width: 92vw;
  max-height: 80vh;
  display: flex; flex-direction: column;
}
#panel-body {
  overflow-y: auto;
  padding: 12px 14px;
  line-height: 1.7;
}

/* 公告 */
.notice-item {
  border: 1px solid #d4d0c0;
  background: #faf8f0;
  margin-bottom: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.notice-item:hover { background: #fdfbf4; }
.notice-item .n-title { font-weight: bold; color: #40546e; }
.notice-item .n-title .n-pin {
  color: var(--red); border: 1px solid var(--red);
  font-size: 10px; padding: 0 3px; margin-right: 5px; font-weight: normal;
}
.notice-item .n-meta { color: var(--grey); font-size: 11px; margin-top: 2px; }
.notice-item .n-meta .n-edited { color: var(--red); margin-left: 8px; }
.notice-item .n-body {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dotted #d4d0c0;
  white-space: pre-wrap;
}
.notice-item .n-body .kw {
  color: var(--red);
  border-bottom: 1px dashed var(--red);
  cursor: pointer;
}
.notice-item.collapsed .n-body { display: none; }
.notice-item .n-unread {
  float: right; color: var(--red); font-size: 10px;
}

/* 文件 */
.file-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 6px;
  border-bottom: 1px dotted #d4d0c0;
  cursor: pointer;
}
.file-row:hover { background: #faf8f0; }
.file-icon {
  width: 22px; height: 26px; flex: none;
  image-rendering: pixelated;
}
.file-main { flex: 1; min-width: 0; }
.file-name { color: #2c4a6e; }
.file-row.expired .file-name { color: #9a9a90; text-decoration: line-through solid #c8c8c0 1px; }
.file-row.locked .file-name { color: #9a9a90; }
.file-meta { color: var(--grey); font-size: 11px; }
.file-state { flex: none; font-size: 11px; }
.file-state.ok { color: #3a7a3a; }
.file-state.expired { color: #a0a098; }
.file-state.locked { color: var(--red); }
.file-note { color: #8a7a50; font-size: 11px; margin-top: 1px; }

/* 文件查看器 */
.viewer {
  font-family: "Courier New", monospace;
  font-size: 12px;
  background: #fdfcf6;
  border: 1px solid #d4d0c0;
  padding: 12px 14px;
  white-space: pre-wrap;
  line-height: 1.8;
  color: #3a3a34;
}
.viewer .v-red { color: var(--red); }

/* 相册 */
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.photo-card {
  border: 1px solid #d4d0c0;
  background: #faf8f0;
  padding: 6px;
  cursor: pointer;
  position: relative;
}
.photo-card:hover { background: #fdfbf4; }
.photo-card .p-art {
  width: 100%; aspect-ratio: 10 / 8;
  border: 1px solid #c4c0b0;
  image-rendering: pixelated;
  background: #ddd;
}
.photo-card .p-art svg { width: 100%; height: 100%; display: block; }
.photo-card .p-title { margin-top: 5px; color: #40546e; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.photo-card .p-meta { color: var(--grey); font-size: 11px; }
.photo-card .p-new {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff;
  font-size: 10px; padding: 0 3px;
}
.photo-detail .pd-art {
  width: 260px; margin: 0 auto;
  aspect-ratio: 10 / 8;
  border: 1px solid #c4c0b0;
  image-rendering: pixelated;
}
.photo-detail .pd-art svg { width: 100%; height: 100%; display: block; }
.photo-detail .pd-title { text-align: center; font-weight: bold; margin-top: 8px; color: #40546e; }
.photo-detail .pd-meta { text-align: center; color: var(--grey); font-size: 11px; margin-top: 2px; }
.photo-detail .pd-desc {
  margin-top: 10px; padding: 8px 10px;
  background: #faf8f0; border: 1px solid #d4d0c0;
  white-space: pre-wrap;
}
.photo-detail .pd-desc .pd-late { color: var(--red); }
.photo-detail .pd-desc .pd-end { color: #9a6b1a; }
.photo-detail .pd-back { margin-top: 10px; text-align: center; }

/* 搜索 */
.search-bar { display: flex; gap: 6px; margin-bottom: 10px; }
.search-bar input {
  flex: 1;
  font-family: inherit; font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #7a8ba0; border-top-color: #5a6b80;
}
#search-result { min-height: 60px; color: #555; white-space: pre-wrap; line-height: 1.8; }
#search-result .sr-hit { color: #3a7a3a; }
#search-result .sr-miss { color: var(--grey); }
#search-result .sr-red { color: var(--red); }
.search-tip { color: var(--grey); font-size: 11px; margin-top: 10px; border-top: 1px dotted #d4d0c0; padding-top: 8px; }

/* 线索 */
.clue-item {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 4px;
  border-bottom: 1px dotted #d4d0c0;
}
.clue-item .c-label { color: #40546e; font-weight: bold; flex: none; }
.clue-item .c-label.final { color: var(--red); }
.clue-item .c-hint { color: #777; flex: 1; }
.clue-item .c-go { flex: none; }
.clue-empty { color: var(--grey); text-align: center; padding: 20px 0; }

/* 成员名片 */
.card-top { display: flex; gap: 12px; align-items: center; }
.card-avatar {
  width: 48px; height: 48px; flex: none;
  border: 1px solid #b8c0cc;
  image-rendering: pixelated;
}
.card-avatar.off { filter: grayscale(1) opacity(.55); }
.card-avatar svg { width: 100%; height: 100%; display: block; }
.card-name { font-weight: bold; font-size: 14px; color: #2c4a6e; }
.card-role { color: var(--grey); font-size: 11px; }
.card-sig { margin-top: 4px; color: #777; }
.card-fields { margin-top: 12px; border-top: 1px dotted #d4d0c0; }
.card-fields .cf-row {
  display: flex; padding: 5px 2px;
  border-bottom: 1px dotted #e4e0d0;
}
.card-fields .cf-k { width: 90px; flex: none; color: var(--grey); }
.card-fields .cf-v.odd { color: var(--red); }
.card-fields .cf-v .cf-mark { color: var(--red); font-size: 11px; margin-left: 6px; }

/* ============================================================
   设置菜单 / 确认框
   ============================================================ */
#settings-menu {
  position: fixed; z-index: 200;
  background: var(--paper);
  border: 1px solid #4a5a70;
  box-shadow: 2px 3px 0 rgba(0,0,0,.3);
  min-width: 110px;
}
.menu-item { padding: 6px 16px; cursor: pointer; }
.menu-item:hover { background: var(--blue-pale); }

.confirm-win { width: 300px; }
.confirm-body { padding: 18px 16px; line-height: 1.8; white-space: pre-wrap; }
.confirm-btns {
  display: flex; justify-content: center; gap: 14px;
  padding: 0 0 14px;
}

/* ============================================================
   结局界面
   ============================================================ */
#ending-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: #10141b;
  display: flex; align-items: center; justify-content: center;
  animation: fadein 2.4s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#ending-inner {
  text-align: center;
  color: #b8c4d4;
  line-height: 2.4;
  letter-spacing: 2px;
}
#ending-inner .e-line { opacity: 0; animation: lineIn 1.6s ease forwards; }
@keyframes lineIn { to { opacity: 1; } }
#ending-inner .e-quote { font-size: 15px; }
#ending-inner .e-title { font-size: 21px; color: #e8e2d0; margin-top: 28px; letter-spacing: 6px; }
#ending-inner .e-sub { color: #5f6d80; font-size: 12px; }
#ending-inner .e-stats { color: #7a8ba0; font-size: 12px; margin-top: 20px; }
#ending-inner .e-btns { margin-top: 26px; display: flex; gap: 14px; justify-content: center; }
#ending-inner .btn { background: #232b36; color: #b8c4d4; border-color: #4a5a70; outline-color: #10141b; }
#ending-inner .btn:hover { background: #2e3a48; }

/* 滚动条（旧样式） */
::-webkit-scrollbar { width: 13px; }
::-webkit-scrollbar-track { background: var(--paper-dark); border-left: 1px solid #c4c0b0; }
::-webkit-scrollbar-thumb {
  background: #c9d4e2;
  border: 1px solid #8a9ab0;
  box-shadow: inset 1px 1px 0 #fff;
}
::-webkit-scrollbar-thumb:hover { background: #b8cbe0; }
