* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0f1115;
  color: #e6e8ee;
  font: 15px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 560px;
  background: #171a21;
  border: 1px solid #262b36;
  border-radius: 14px;
  padding: 20px;
}

.hidden { display: none !important; }

h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: 2px; }

.hint, .notice {
  color: #7c8595;
  font-size: 12px;
  margin: 0 0 16px;
}

.notice { margin: 10px 0 0; }

label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: #9aa4b2;
}

input[type="text"], input[type="password"] {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid #2c323f;
  background: #0f1218;
  color: #e6e8ee;
  font-size: 15px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

input[type="text"]:focus, input[type="password"]:focus { border-color: #4b6cf5; }

button {
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid #2c323f;
  background: #232936;
  color: #e6e8ee;
  font-size: 14px;
  cursor: pointer;
}

button:hover { background: #2b3242; }

#login-btn { width: 100%; margin-top: 4px; background: #4b6cf5; border-color: #4b6cf5; color: #fff; }
#login-btn:hover { background: #3f5de0; }
#login-btn:disabled { opacity: .6; cursor: default; }

.error { color: #ff6b6b; font-size: 13px; min-height: 20px; margin: 10px 0 0; }

#chat-view { display: flex; flex-direction: column; height: min(84vh, 720px); }

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #262b36;
}

.who { font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sep { color: #5b6473; }

.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.status.online { color: #4ade80; background: rgba(74, 222, 128, .12); }
.status.offline { color: #94a3b8; background: rgba(148, 163, 184, .12); }

.actions { display: flex; gap: 8px; }
.actions button { padding: 7px 12px; font-size: 13px; }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}

/* 每条消息单独遮挡：按住气泡才显示内容 */
.bubble-cover { display: none; letter-spacing: 1px; opacity: .75; }
.bubble.masked .bubble-cover { display: inline; }
.bubble.masked .bubble-body { display: none; }
.bubble.masked { cursor: pointer; }

.bubble {
  max-width: 78%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: none;
  user-select: none;
}

.bubble.mine { align-self: flex-end; background: #3f5de0; color: #fff; border-bottom-right-radius: 4px; }
.bubble.peer { align-self: flex-start; background: #232936; border-bottom-left-radius: 4px; }

.row { display: flex; align-items: center; gap: 8px; max-width: 86%; }
.row.mine { align-self: flex-end; }
.row.peer { align-self: flex-start; }
.row .bubble { max-width: 100%; align-self: center; }

/* 圆圈显示按钮：点一下显示这条消息，再点一下遮住，手指不会挡住文字 */
.reveal-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #3a4254;
  background: #1a1f29;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .85;
}
.reveal-btn:active { background: #2c3446; }

.row.fading { opacity: 0; transition: opacity 1.2s ease; }

.meta { font-size: 11px; color: #7c8595; align-self: flex-start; }
.meta.center { align-self: center; }

.typing { font-size: 12px; color: #7c8595; margin: 0 0 8px; }

#send-form { display: flex; gap: 10px; padding-top: 12px; border-top: 1px solid #262b36; }
#send-form input { flex: 1; margin: 0; }
#send-btn { background: #4b6cf5; border-color: #4b6cf5; color: #fff; }
#dice-btn { padding: 8px 12px; font-size: 16px; line-height: 1; }
.bubble.dice .bubble-body { font-size: 20px; letter-spacing: 1px; }
#send-btn:hover { background: #3f5de0; }

/* 隐私遮罩：窗口失焦 / 触发截屏键时覆盖全屏，截到的只能是这层 */
#privacy-shield {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0d11;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

#privacy-shield .shield-inner {
  text-align: center;
  padding: 24px;
}

#privacy-shield .shield-icon { font-size: 40px; line-height: 1; margin-bottom: 14px; }

#privacy-shield h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 3px;
  color: #e6e8ee;
}

#privacy-shield p { margin: 0; font-size: 13px; color: #6b7482; }

/* 会话内容整体不可选中，避免被复制 */
#chat-view { -webkit-user-select: none; user-select: none; }
