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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: #0f1115;
  color: #e6e6e6;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden { display: none !important; }

/* 登录 */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1b2030, #0f1115);
}
.login-box {
  width: 320px;
  padding: 32px;
  background: #181b22;
  border: 1px solid #2a2f3a;
  border-radius: 14px;
  text-align: center;
}
.login-box h1 { font-size: 28px; letter-spacing: 2px; margin-bottom: 6px; }
.login-box .sub { color: #8a90a0; font-size: 13px; margin-bottom: 22px; }
.login-box input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: #0f1115;
  color: #e6e6e6;
  font-size: 15px;
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 2px;
}
.login-box button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #4f7cff;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.login-box button:hover { background: #3f6af0; }
.err { color: #ff6b6b; font-size: 13px; margin-top: 12px; min-height: 16px; }

/* 聊天 */
.chat {
  width: 100%;
  max-width: 640px;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #14171d;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #232834;
  font-weight: 600;
}
.status { font-size: 12px; font-weight: 400; padding: 3px 10px; border-radius: 20px; }
.status.on { background: #1d3a23; color: #6ee79b; }
.status.off { background: #3a1d1d; color: #ff8a8a; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { display: flex; flex-direction: column; gap: 4px; }
.msg .time { font-size: 11px; color: #6b7280; }
.msg .body {
  background: #1f2430;
  padding: 10px 14px;
  border-radius: 10px;
  width: fit-content;
  max-width: 80%;
  word-break: break-word;
  line-height: 1.5;
}
.msg .img-msg { max-width: 280px; border-radius: 8px; display: block; cursor: zoom-in; }
.file-link {
  color: #4f7cff;
  text-decoration: none;
  border: 1px solid #2a3550;
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-block;
}
.file-link:hover { background: #1c2740; }

.composer {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid #232834;
}
.composer input[type=text] {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: #0f1115;
  color: #e6e6e6;
  font-size: 15px;
}
.file-btn {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: #1f2430;
  color: #c7ccd8;
  font-size: 14px;
  cursor: pointer;
}
.composer button {
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  background: #4f7cff;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.composer button:hover { background: #3f6af0; }

/* 图片放大查看 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.lightbox.hidden { display: none; }
.lb-img {
  max-width: 90vw;
  max-height: 85vh;
  transform-origin: center center;
  cursor: grab;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  user-select: none;
}
.lb-img:active { cursor: grabbing; }
.lb-controls {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #181b22;
  padding: 8px 14px;
  border-radius: 24px;
  border: 1px solid #2a2f3a;
}
.lb-controls button {
  border: none;
  background: #2a3550;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.lb-controls button:hover { background: #3a4a6e; }
.lb-controls #lbClose {
  width: auto;
  padding: 0 16px;
  border-radius: 18px;
  font-size: 14px;
}
.lb-controls #zoomLevel {
  color: #c7ccd8;
  font-size: 13px;
  min-width: 44px;
  text-align: center;
}
