:root {
  --bg-app: #111111;
  --bg-header: #191919;
  --bg-bubble-other: #262626;
  --bg-bubble-me: #286a46;
  --bg-panel: #161616;
  --bg-btn: #242424;
  --bg-btn-hover: #2f2f2f;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --text-main: #e8e8e8;
  --text-muted: #888888;
  --text-dim: #555555;
  --accent-green: #07c160;
  --danger-red: #d94848;
  --warn-amber: #d99b26;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #060606;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

.phone-shell {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* 低电量暗角遮罩 */
.vignette-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 40;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.85) 100%);
  transition: opacity 1.2s ease;
}

.phone-shell.low-battery .vignette-overlay {
  opacity: 0.78;
}

.phone-shell.critical-battery .vignette-overlay {
  opacity: 1;
  background: radial-gradient(circle at center, transparent 30%, rgba(55, 0, 0, 0.5) 74%, rgba(0, 0, 0, 0.96) 100%);
  animation: coldPulse 3.5s infinite ease-in-out;
}

@keyframes coldPulse {
  0%, 100% { opacity: 0.92; }
  50% { opacity: 1; }
}

.phone-shell.glitch-flash {
  animation: glitchFlicker 0.32s steps(2, end);
}

.phone-shell.screen-shake {
  animation: screenShake 0.42s ease-in-out;
}

@keyframes glitchFlicker {
  0% { filter: none; transform: translateX(0); }
  25% { filter: invert(0.1) contrast(1.35); transform: translateX(-3px); }
  50% { filter: brightness(0.3); transform: translateX(3px); }
  75% { filter: hue-rotate(15deg) brightness(0.85); transform: translateX(-1px); }
  100% { filter: none; transform: translateX(0); }
}

@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -1px); }
  80% { transform: translate(3px, 1px); }
}

/* 顶部手机状态栏 */
.status-bar {
  height: 28px;
  padding: 0 14px;
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #dcdcdc;
  flex-shrink: 0;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-signal.no-service {
  color: var(--danger-red);
}

.battery-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.battery-text {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.battery-wrap.low .battery-text { color: var(--warn-amber); }
.battery-wrap.critical .battery-text {
  color: var(--danger-red);
  animation: pulseWarn 1.2s infinite;
}

.battery-body {
  width: 22px;
  height: 11px;
  border: 1.4px solid rgba(255, 255, 255, 0.75);
  border-radius: 2.5px;
  padding: 1px;
  display: flex;
  align-items: center;
}

.battery-fill {
  height: 100%;
  background: #e5e5e5;
  border-radius: 1px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.battery-wrap.low .battery-fill { background: var(--warn-amber); }
.battery-wrap.critical .battery-fill { background: var(--danger-red); }

.battery-cap {
  width: 2px;
  height: 5px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 0 1px 1px 0;
  margin-left: -3px;
}

@keyframes pulseWarn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* 微信顶栏 */
.chat-header {
  height: 44px;
  padding: 0 10px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-main);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.clue-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent-green);
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
}

.chat-title-wrap {
  flex: 1;
  text-align: center;
  overflow: hidden;
}

.chat-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.typing-indicator {
  font-size: 11px;
  color: #9a9a9a;
  margin-top: 1px;
}

.typing-indicator.creepy { color: #d95b5b; }

/* 群聊 / 私聊切换标签栏 */
.thread-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #151515;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
}

.thread-tabs::-webkit-scrollbar { display: none; }

.thread-tab {
  position: relative;
  background: #202020;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #9c9c9c;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.thread-tab.active {
  background: #2b2b2b;
  color: #ffffff;
  border-color: rgba(7, 193, 96, 0.45);
}

.creepy-tab-name { color: #df7474; }

.tab-dot {
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
  font-weight: 600;
  animation: pulseWarn 1.4s infinite;
}

/* 群公告条 */
.notice-banner {
  background: #1f1f1f;
  border-bottom: 1px solid var(--border-subtle);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.notice-tag {
  background: rgba(7, 193, 96, 0.16);
  color: var(--accent-green);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  flex-shrink: 0;
}

.notice-banner.corrupted .notice-tag {
  background: rgba(217, 72, 72, 0.2);
  color: #e06c6c;
}

.notice-preview {
  flex: 1;
  color: #b5b5b5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notice-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

/* 多频道聊天视口 */
.chat-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
}

.chat-list {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 12px 12px 20px;
  flex-direction: column;
  gap: 14px;
}

.chat-list.active {
  display: flex;
}

.chat-list::-webkit-scrollbar { width: 3px; }
.chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.dm-empty-tip {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 40px;
}

/* 私聊跳转横幅 */
.dm-jump-banner {
  background: rgba(229, 57, 53, 0.14);
  border: none;
  border-top: 1px solid rgba(229, 57, 53, 0.3);
  color: #f4a4a4;
  padding: 8px 12px;
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* 系统提示 & 时间戳 */
.msg-system {
  align-self: center;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 2px 10px;
  line-height: 1.5;
  max-width: 92%;
}

.msg-system.creepy-time { color: #c25e5e; }
.msg-system.pat-system { color: #a36b6b; font-style: italic; }

.recall-peek-btn {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  color: #a8c7fa;
  background: rgba(168, 199, 250, 0.1);
  border: 1px solid rgba(168, 199, 250, 0.25);
  border-radius: 4px;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

/* 聊天气泡行 */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: msgIn 0.22s ease-out;
}

.msg-row.me { flex-direction: row-reverse; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #222;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.msg-content-col {
  max-width: 74%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-row.me .msg-content-col { align-items: flex-end; }

.sender-name {
  font-size: 11.5px;
  color: var(--text-muted);
  padding-left: 2px;
}

.bubble {
  position: relative;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--bg-bubble-other);
  color: var(--text-main);
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
  user-select: text;
}

.msg-row.me .bubble {
  background: var(--bg-bubble-me);
  color: #f3fff7;
}

.bubble.creepy-msg {
  background: #23181a;
  border: 1px solid rgba(217, 72, 72, 0.25);
  color: #f0d5d5;
}

.bubble.mutated-msg { color: #e2c5c5; }

/* 推理卡片 */
.deduction-card {
  background: #1a1f24;
  border: 1px solid rgba(168, 199, 250, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #d7e4f8;
}

.deduction-card-title {
  font-size: 12px;
  color: #90b8f8;
  font-weight: 600;
  margin-bottom: 4px;
}

/* 语音气泡 */
.voice-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
  cursor: pointer;
}

.voice-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.voice-bar {
  width: 2.5px;
  background: #cfcfcf;
  border-radius: 2px;
  height: 6px;
}

.voice-bar:nth-child(2) { height: 11px; }
.voice-bar:nth-child(3) { height: 15px; }
.voice-bar:nth-child(4) { height: 9px; }

.voice-bubble.playing .voice-bar {
  animation: waveAnim 0.6s infinite alternate;
}
.voice-bubble.playing .voice-bar:nth-child(2) { animation-delay: 0.15s; }
.voice-bubble.playing .voice-bar:nth-child(3) { animation-delay: 0.3s; }
.voice-bubble.playing .voice-bar:nth-child(4) { animation-delay: 0.45s; }

@keyframes waveAnim {
  from { height: 4px; }
  to { height: 16px; }
}

.voice-duration {
  font-size: 13px;
  color: #c9c9c9;
  margin-left: auto;
}

.voice-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.voice-transcribe-btn {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #b8b8b8;
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.voice-transcribe-btn:hover { background: #282828; color: #fff; }

.voice-transcript {
  background: #1d1d1d;
  border-left: 2px solid #555;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: #d4d4d4;
}

.voice-transcript.creepy {
  border-left-color: var(--danger-red);
  color: #e6b8b8;
}

/* 图片气泡 */
.image-bubble {
  padding: 4px;
  background: #1d1d1d;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.image-bubble img {
  display: block;
  width: 210px;
  aspect-ratio: 4 / 3;
  max-height: 220px;
  object-fit: cover;
  border-radius: 4px;
  background: #141414;
}

.image-date-stamp {
  position: absolute;
  right: 10px;
  bottom: 28px;
  font-family: monospace;
  font-size: 10px;
  color: rgba(245, 180, 90, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.image-date-stamp.corrupt { color: rgba(235, 90, 90, 0.9); }

.image-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 4px 2px;
}

/* 去年旧群聊截图卡片（C4） */
.old-screenshot-card {
  background: #1c1c1e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 10px;
  width: 235px;
  cursor: pointer;
}

.old-ss-header {
  font-size: 11px;
  color: #9e9e9e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 5px;
  margin-bottom: 7px;
  display: flex;
  justify-content: space-between;
}

.old-ss-line {
  font-size: 12px;
  line-height: 1.5;
  color: #d6d6d6;
  margin-bottom: 5px;
}

.old-ss-line strong { color: #fff; }

/* 底部选项区 */
.bottom-panel {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.timed-bar-wrap { margin-bottom: 8px; }

.timed-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: #e06c6c;
  margin-bottom: 4px;
}

.timed-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.timed-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--danger-red);
  transition: width 0.2s linear;
}

.status-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

.choices-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.choice-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-btn);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.choice-btn:active {
  transform: scale(0.985);
  background: var(--bg-btn-hover);
}

.choice-cost {
  font-size: 11.5px;
  color: var(--warn-amber);
  flex-shrink: 0;
}

.choice-btn.danger-choice { border-color: rgba(217, 72, 72, 0.35); }
.choice-btn.deduct-choice { border-color: rgba(144, 184, 248, 0.35); }

/* 弹窗通用 */
.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.hidden { display: none !important; }

.start-card, .dialog-card {
  width: 100%;
  background: #1b1b1b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 20px 18px;
}

.start-tag, .ending-badge {
  display: inline-block;
  font-size: 11px;
  color: #e06c6c;
  background: rgba(217, 72, 72, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.ending-badge.good {
  color: var(--accent-green);
  background: rgba(7, 193, 96, 0.15);
}

.ending-badge.neutral {
  color: var(--warn-amber);
  background: rgba(217, 155, 38, 0.15);
}

.start-title, .ending-title {
  margin: 0 0 10px;
  font-size: 21px;
  letter-spacing: 0.5px;
}

.start-desc, .ending-body {
  font-size: 14px;
  line-height: 1.65;
  color: #cfcfcf;
  margin: 0 0 12px;
  white-space: pre-line;
}

.ending-stats {
  background: #131313;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #9e9e9e;
  margin-bottom: 14px;
}

.start-tips {
  background: #131313;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #9e9e9e;
  margin-bottom: 12px;
}

.ending-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.gallery-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #666;
}

.gallery-chip.unlocked {
  color: #8ee0a8;
  border-color: rgba(7, 193, 96, 0.35);
  background: rgba(7, 193, 96, 0.1);
}

.gallery-chip.unlocked.bad {
  color: #e68a8a;
  border-color: rgba(217, 72, 72, 0.35);
  background: rgba(217, 72, 72, 0.12);
}

.gallery-chip.unlocked.neutral {
  color: #e8c273;
  border-color: rgba(217, 155, 38, 0.35);
  background: rgba(217, 155, 38, 0.12);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent-green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  background: #262626;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d4d4d4;
  font-size: 14px;
  cursor: pointer;
}

.btn-danger-outline {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(217, 72, 72, 0.5);
  color: #e06c6c;
  font-size: 14px;
  cursor: pointer;
}

/* 底部抽屉 */
.sheet-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82%;
  background: #191919;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 16px;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sheet-header, .dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}

.sheet-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.member-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.member-name { font-size: 12px; color: #d5d5d5; text-align: center; }
.member-role { font-size: 10px; color: var(--text-muted); text-align: center; }
.member-item.creepy .member-name { color: #e06c6c; }

.sheet-section {
  border-bottom: 1px solid var(--border-subtle);
  padding: 4px 0;
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  font-size: 14px;
  cursor: pointer;
}

.sheet-row-sub, .sheet-row-val { font-size: 13px; color: var(--text-muted); }
.sheet-row-val.creepy { color: #e06c6c; }
.sheet-actions { margin-top: 16px; }

/* 公告正文 */
.notice-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.notice-body {
  font-size: 13.5px;
  line-height: 1.7;
  color: #dedede;
  margin-bottom: 16px;
  white-space: pre-line;
}

.notice-body .creepy-line { color: #e06c6c; font-size: 12.5px; }

/* 线索本 */
.clues-list { display: flex; flex-direction: column; gap: 10px; }

.clue-card {
  background: #222;
  border-left: 3px solid var(--accent-green);
  padding: 10px 12px;
  border-radius: 6px;
}

.clue-card.easter { border-left-color: #a8c7fa; }
.clue-title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.clue-desc { font-size: 12.5px; color: #bdbdbd; line-height: 1.5; }
.clues-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 26px 12px;
  font-size: 13.5px;
}

/* 大图预览 */
.image-viewer {
  background: rgba(0, 0, 0, 0.94);
  flex-direction: column;
  cursor: pointer;
}

.image-viewer-inner {
  width: 100%;
  max-width: 390px;
  text-align: center;
}

.image-viewer-inner img {
  width: 100%;
  max-height: 68dvh;
  object-fit: contain;
  border-radius: 6px;
}

.image-viewer-caption {
  margin-top: 12px;
  font-size: 13px;
  color: #b5b5b5;
  line-height: 1.5;
}

/* Toast（浮于顶部状态栏下方，不遮挡聊天消息） */
.toast {
  pointer-events: none;
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(28, 28, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f0f0f0;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 12px;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}
