/* ===========================================
   来自 1998 · 90 年代风格
   配色：午夜深紫 + 霓虹粉 + 琥珀路灯 + 老 LCD 绿
   =========================================== */

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

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: #0a0814;
  color: #f5e8d0;
  font-family: "Courier New", "Songti SC", "STSong", "宋体", monospace;
  overflow: hidden;
  letter-spacing: 0.02em;
}

/* 老式纸纹 + 噪点 + 暗角 */
body::before {
  content: ""; position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at center, #1a1530 0%, #0a0814 70%, #000 100%);
  z-index: -2;
}
body::after {
  content: ""; position: fixed; inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.012) 0px,
      rgba(255,255,255,0.012) 1px,
      transparent 1px, transparent 3px
    );
  pointer-events: none;
  z-index: -1;
}

.hidden { display: none !important; }

/* CRT 扫描线 */
.scanlines {
  position: fixed; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.18) 0px,
    rgba(0,0,0,0.18) 1px,
    transparent 1px, transparent 3px
  );
  mix-blend-mode: multiply;
  z-index: 9998;
}
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 200px 60px rgba(0,0,0,0.7);
  z-index: 9997;
}

/* ============ 启动 ============ */
.boot-screen {
  position: fixed; inset: 0;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  z-index: 99999;
  transition: opacity 0.6s;
}
.boot-screen.gone { opacity: 0; pointer-events: none; }
.boot-inner {
  color: #9bff7a;
  font-family: "Courier New", monospace;
  font-size: 14px;
  text-shadow: 0 0 6px #00ff66;
  line-height: 1.9;
  padding: 24px;
  letter-spacing: 0.05em;
}
.boot-line { opacity: 0; animation: boot-in 0.4s forwards; }
.boot-line:nth-child(1) { animation-delay: 0.0s; }
.boot-line:nth-child(2) { animation-delay: 0.5s; }
.boot-line:nth-child(3) { animation-delay: 1.0s; }
.boot-line:nth-child(4) { animation-delay: 1.6s; }
.boot-line .hot { color: #ff5577; text-shadow: 0 0 6px #ff5577; }
@keyframes boot-in { to { opacity: 1; } }

/* ============ 屏幕容器 ============ */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}

/* CRT 弯曲外壳 */
.crt {
  width: 100%; max-width: 420px;
  height: 100%;
  max-height: 820px;
  position: relative;
}

/* ============ 手机外壳（仿 90 年代直板机）============ */
.phone-frame {
  width: 100%; height: 100%;
  background:
    linear-gradient(180deg, #2c2740 0%, #1a162a 100%);
  border-radius: 28px;
  border: 2px solid #4a3f6a;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.08),
    inset 0 -2px 0 rgba(0,0,0,0.6),
    0 0 30px rgba(180, 80, 200, 0.15),
    0 18px 40px rgba(0,0,0,0.6);
  padding: 14px 12px 10px;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 顶部听筒 */
.phone-frame::before {
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 5px;
  background: #0a0814;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

.phone-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px 6px;
  font-size: 11px;
  color: #c8b88a;
  letter-spacing: 0.1em;
}
.signal-bar {
  display: inline-flex; align-items: flex-end; gap: 2px; height: 12px;
}
.signal-bar span {
  display: inline-block;
  width: 3px;
  background: #ffb84a;
  box-shadow: 0 0 4px #ffb84a;
}
.signal-bar span:nth-child(1) { height: 4px; }
.signal-bar span:nth-child(2) { height: 7px; }
.signal-bar span:nth-child(3) { height: 10px; }
.signal-bar span:nth-child(4) { height: 12px; }
.signal-bar span.off { background: #443a55; box-shadow: none; }
.clock {
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: #ffb84a;
  text-shadow: 0 0 3px #ffb84a;
}
.battery {
  width: 22px; height: 10px;
  border: 1px solid #c8b88a;
  border-radius: 2px;
  position: relative;
  padding: 1px;
}
.battery::after {
  content: ""; position: absolute;
  right: -3px; top: 2px; width: 2px; height: 4px;
  background: #c8b88a;
}
.battery i {
  display: block; height: 100%;
  width: 75%;
  background: #ffb84a;
  box-shadow: 0 0 3px #ffb84a;
}

/* 屏幕区 */
.phone-screen {
  flex: 1;
  background:
    radial-gradient(ellipse at top, #2a1f4a 0%, #1a1530 60%, #100a1f 100%);
  border-radius: 6px;
  border: 1px solid #5a4a7a;
  padding: 16px 14px;
  margin-top: 4px;
  overflow-y: auto;
  position: relative;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
}

.phone-bottom {
  display: flex; justify-content: center; align-items: center; gap: 14px;
  padding-top: 10px;
}
.hw-btn {
  background: linear-gradient(180deg, #3a3050 0%, #1c1730 100%);
  border: 1px solid #5a4a7a;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.5);
}
.hw-btn.round { width: 28px; height: 28px; border-radius: 50%; }
.hw-btn.long { width: 90px; height: 20px; border-radius: 10px; }

/* ============ 登录页内容 ============ */
.title-block {
  text-align: center;
  padding: 12px 0 18px;
}
.title-zh {
  font-family: "STSong", "宋体", serif;
  font-size: 26px;
  color: #ffd9a8;
  letter-spacing: 0.4em;
  text-shadow: 0 0 8px rgba(255, 180, 100, 0.4);
  margin-bottom: 4px;
}
.title-en {
  font-size: 9px;
  color: #c8b8e8;
  letter-spacing: 0.3em;
  margin-bottom: 8px;
}
.title-dash {
  color: #6a5a8a;
  font-size: 10px;
  letter-spacing: 0.2em;
}
.title-sub {
  margin-top: 10px;
  font-size: 11px;
  color: #b8a8d8;
  line-height: 1.7;
  letter-spacing: 0.15em;
  font-family: "STSong", "宋体", serif;
}

.tab-row {
  display: flex;
  margin: 8px 0 14px;
  border-bottom: 1px dashed #5a4a7a;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: #8a7aaa;
  padding: 8px 4px;
  font-size: 13px;
  letter-spacing: 0.3em;
  font-family: inherit;
  cursor: pointer;
}
.tab-btn.active {
  color: #ffd9a8;
  text-shadow: 0 0 6px rgba(255, 180, 100, 0.5);
  border-bottom: 2px solid #ffb84a;
  margin-bottom: -1px;
}

.form-block {
  display: flex; flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
}
.form-block label {
  font-size: 10px;
  color: #b8a8d8;
  letter-spacing: 0.25em;
  margin-top: 6px;
  margin-bottom: 2px;
}
.form-block input,
.settings-panel input,
.settings-panel textarea,
.input-row textarea {
  background: #0a0814;
  border: 1px solid #5a4a7a;
  color: #ffd9a8;
  padding: 8px 10px;
  font-family: "Courier New", "宋体", monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
  outline: none;
  -webkit-appearance: none;
}
.form-block input:focus,
.settings-panel input:focus,
.settings-panel textarea:focus,
.input-row textarea:focus {
  border-color: #ffb84a;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.6),
    0 0 6px rgba(255, 180, 100, 0.3);
}

.btn-primary, .btn-secondary, .btn-danger, .btn-send {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.3em;
  padding: 10px 14px;
  border: 1px solid;
  border-radius: 2px;
  cursor: pointer;
  margin-top: 14px;
}
.btn-primary {
  background: linear-gradient(180deg, #ff7a9a 0%, #c83a6a 100%);
  border-color: #ff8aa8;
  color: #fff;
  text-shadow: 0 0 4px rgba(255,255,255,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 0 8px rgba(255, 100, 140, 0.4);
}
.btn-primary:active { transform: translateY(1px); }
.btn-secondary {
  background: #2a2240;
  border-color: #5a4a7a;
  color: #c8b8e8;
}
.btn-danger {
  background: #3a1020;
  border-color: #aa3050;
  color: #ff9aaa;
}

.form-msg {
  margin-top: 8px;
  font-size: 11px;
  color: #ff7a9a;
  min-height: 14px;
  letter-spacing: 0.1em;
  text-align: center;
}

.footer-tip {
  text-align: center;
  margin-top: 20px;
  font-size: 10px;
  color: #8a7aaa;
  letter-spacing: 0.2em;
  line-height: 1.8;
}
.footer-tip .dim { color: #5a4a7a; }
.footer-link {
  display: inline-block;
  margin-top: 4px;
  color: #ffb84a;
  text-decoration: none;
  letter-spacing: 0.2em;
  font-size: 10px;
  border-bottom: 1px dashed #5a4a7a;
  padding-bottom: 1px;
}
.footer-link:hover { color: #ffd9a8; }

/* 赞赏弹窗 */
.sponsor-img {
  max-width: 86vw;
  max-height: 80vh;
  border: 2px solid #ffb84a;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(255, 184, 74, 0.4);
}

/* ============ 聊天界面 ============ */
.chat-frame .phone-top {
  background: #0a0814;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 4px;
}
.convo-name {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: #ffd9a8;
  letter-spacing: 0.2em;
  text-shadow: 0 0 4px rgba(255, 180, 100, 0.4);
}
.convo-name .from {
  color: #8a7aaa;
  font-size: 10px;
  margin-right: 4px;
}
.convo-name .online {
  color: #66ff99;
  font-size: 8px;
  margin-left: 6px;
  animation: blink-soft 2s infinite;
  text-shadow: 0 0 4px #66ff99;
}
@keyframes blink-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.icon-btn {
  background: none;
  border: 1px solid #5a4a7a;
  color: #c8b8e8;
  width: 28px; height: 24px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.msg-list {
  flex: 1;
  background:
    radial-gradient(ellipse at top, #1f1838 0%, #100a1f 80%);
  border-radius: 4px;
  border: 1px solid #4a3f6a;
  margin: 4px 0;
  padding: 14px 12px;
  overflow-y: auto;
  scroll-behavior: smooth;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
.msg-list::-webkit-scrollbar { width: 6px; }
.msg-list::-webkit-scrollbar-thumb { background: #4a3f6a; border-radius: 3px; }
.msg-list::-webkit-scrollbar-track { background: transparent; }

.msg-day {
  text-align: center;
  font-size: 10px;
  color: #6a5a8a;
  margin: 12px 0 8px;
  letter-spacing: 0.3em;
}

.msg-item {
  margin: 8px 0;
  max-width: 80%;
  display: flex;
  flex-direction: column;
  animation: msg-in 0.3s ease-out;
}
.msg-item.user { margin-left: auto; align-items: flex-end; }
.msg-item.assistant { margin-right: auto; align-items: flex-start; }

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

.msg-bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
  font-family: "STSong", "宋体", "Songti SC", serif;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  letter-spacing: 0.04em;
}
.msg-item.user .msg-bubble {
  background: linear-gradient(180deg, #ff85a5 0%, #d04a72 100%);
  color: #fff;
  border-bottom-right-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 2px 6px rgba(200, 60, 100, 0.3);
}
.msg-item.assistant .msg-bubble {
  background: #f3e5c3;
  color: #2a1a0a;
  border-bottom-left-radius: 3px;
  border: 1px solid #d4be8a;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 2px 6px rgba(0,0,0,0.3);
  font-family: "STKaiti", "Kaiti SC", "楷体", "STSong", serif;
}

.msg-time {
  font-size: 9px;
  color: #8a7aaa;
  margin-top: 3px;
  letter-spacing: 0.15em;
  padding: 0 4px;
}

/* 打字中 */
.msg-typing .msg-bubble {
  background: #f3e5c3;
  color: #6a5a4a;
  font-style: italic;
}
.msg-typing .dots span {
  display: inline-block;
  animation: dot 1.2s infinite;
}
.msg-typing .dots span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.msg-empty {
  text-align: center;
  color: #8a7aaa;
  font-size: 12px;
  padding: 40px 20px;
  line-height: 2;
  letter-spacing: 0.15em;
  font-family: "STSong", "宋体", serif;
}
.msg-empty .big {
  font-size: 16px;
  color: #ffd9a8;
  display: block;
  margin-bottom: 8px;
  text-shadow: 0 0 6px rgba(255,180,100,0.4);
}

/* 输入区 */
.input-row {
  display: flex;
  gap: 6px;
  padding: 4px 0 0;
  align-items: flex-end;
}
.input-row textarea {
  flex: 1;
  resize: none;
  font-family: "STSong", "宋体", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  max-height: 100px;
  padding: 8px 10px;
}
.btn-send {
  flex-shrink: 0;
  margin-top: 0;
  padding: 8px 14px;
  background: linear-gradient(180deg, #ff7a9a 0%, #c83a6a 100%);
  border-color: #ff8aa8;
  color: #fff;
  letter-spacing: 0.2em;
  font-size: 12px;
  min-width: 56px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 0 8px rgba(255, 100, 140, 0.4);
}
.btn-send:disabled {
  opacity: 0.5; cursor: not-allowed;
  background: #3a2a4a;
  border-color: #5a4a7a;
}

/* ============ 设置抽屉 ============ */
.mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 99;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.settings-panel {
  background: linear-gradient(180deg, #1f1838 0%, #14102a 100%);
  border: 2px solid #5a4a7a;
  border-radius: 6px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 16px;
  color: #c8b8e8;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 10px 40px rgba(0,0,0,0.6);
}
.settings-title {
  text-align: center;
  font-size: 16px;
  color: #ffd9a8;
  letter-spacing: 0.4em;
  padding-bottom: 12px;
  border-bottom: 1px dashed #5a4a7a;
  margin-bottom: 14px;
  text-shadow: 0 0 6px rgba(255,180,100,0.4);
}
.settings-block {
  margin-bottom: 12px;
}
.block-label {
  font-size: 11px;
  color: #b8a8d8;
  letter-spacing: 0.2em;
  margin-bottom: 4px;
}
.block-value {
  background: #0a0814;
  border: 1px solid #5a4a7a;
  padding: 8px 10px;
  border-radius: 2px;
  color: #ffd9a8;
  font-size: 13px;
}
.settings-panel input,
.settings-panel textarea {
  width: 100%;
  font-size: 12px;
}
.hint {
  font-size: 10px;
  color: #8a7aaa;
  letter-spacing: 0.1em;
  margin-top: 4px;
  line-height: 1.6;
}

.settings-actions {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.settings-actions button { margin-top: 0; }
.settings-close { margin-top: 16px; }
.settings-close button { width: 100%; }

/* ============ 移动端适配 ============ */
@media (max-width: 480px) {
  .screen { padding: 0; }
  .crt { max-width: 100%; max-height: 100%; }
  .phone-frame {
    border-radius: 0;
    border: none;
    /* 底部安全区：避免被浏览器导航栏遮住 */
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 12px)) 8px;
  }
  .phone-frame::before { display: none; }
  .phone-bottom { display: none; }
  .title-zh { font-size: 22px; }

  /* 防 iOS 输入时自动缩放（font-size < 16px 时会触发） */
  .form-block input,
  .input-row textarea,
  .settings-panel input {
    font-size: 16px;
  }

  /* 加大触控区域 */
  .tab-btn { padding: 12px 4px; font-size: 14px; }
  .btn-primary { padding: 14px 14px; font-size: 14px; }
  .icon-btn { width: 38px; height: 34px; font-size: 18px; }

  /* 输入行加高，发送按钮更容易点 */
  .input-row { gap: 8px; padding: 6px 0 0; }
  .input-row textarea { font-size: 16px; padding: 10px 12px; }
  .btn-send {
    padding: 10px 16px;
    font-size: 14px;
    min-width: 64px;
    min-height: 44px;
  }
}

@media (max-height: 700px) {
  .title-block { padding: 6px 0 10px; }
  .footer-tip { margin-top: 10px; }
}

/* 支持动态视口高度（解决移动端地址栏显示/隐藏导致页面跳动） */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

/* ============ 信号选择面板 ============ */
.signal-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
}
.signal-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #15102a;
  border: 1px solid #3a3050;
  color: #6a5a8a;
  padding: 12px 14px;
  border-radius: 4px;
  font-family: inherit;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.25s;
  text-align: left;
  font-size: 13px;
}
.signal-btn .sig-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #3a3050;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: all 0.25s;
  flex-shrink: 0;
}
.signal-btn .sig-num {
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: #6a5a8a;
  transition: color 0.25s;
}
.signal-btn .sig-label {
  color: #6a5a8a;
  transition: color 0.25s;
  flex: 1;
}
.signal-btn .sig-desc {
  font-size: 10px;
  color: #4a3f6a;
  letter-spacing: 0.1em;
  transition: color 0.25s;
}
/* 已激活 / 已点过：变亮 */
.signal-btn.active {
  background: #1a1530;
  border-color: var(--sig-color, #ffb84a);
  box-shadow:
    inset 0 0 0 1px var(--sig-color, #ffb84a),
    0 0 12px color-mix(in srgb, var(--sig-color, #ffb84a) 35%, transparent);
  color: #ffd9a8;
}
.signal-btn.active .sig-dot {
  background: var(--sig-color, #ffb84a);
  box-shadow: 0 0 8px var(--sig-color, #ffb84a);
  animation: sig-blink 2s infinite;
}
.signal-btn.active .sig-num,
.signal-btn.active .sig-label {
  color: #ffd9a8;
  text-shadow: 0 0 6px color-mix(in srgb, var(--sig-color, #ffb84a) 50%, transparent);
}
.signal-btn.active .sig-desc {
  color: #b8a8d8;
}
.signal-btn:active { transform: scale(0.98); }

/* 锁定：永远不可点 */
.signal-btn.locked {
  background: #0a0814;
  border-color: #2a2040;
  cursor: not-allowed;
  opacity: 0.4;
}
.signal-btn.locked .sig-dot {
  background: #2a2040;
  box-shadow: none;
  animation: none;
}
.signal-btn.locked .sig-label::after {
  content: " · 信号已切断";
  font-size: 10px;
  color: #aa3050;
  letter-spacing: 0.1em;
}

/* 04 错误信号 · 噪点闪烁 */
.signal-btn.glitch .sig-num,
.signal-btn.glitch .sig-label {
  animation: glitch-text 3s infinite;
}
@keyframes sig-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@keyframes glitch-text {
  0%, 90%, 100% { opacity: 1; transform: translateX(0); }
  92% { opacity: 0.6; transform: translateX(-1px); }
  94% { opacity: 1; transform: translateX(1px); }
  96% { opacity: 0.5; transform: translateX(0); }
}

.form-hint {
  text-align: center;
  font-size: 11px;
  color: #b8a8d8;
  letter-spacing: 0.15em;
  margin-top: 10px;
  margin-bottom: 0;
}

.logged-in-banner {
  background: #15102a;
  border: 1px dashed #5a4a7a;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 11px;
  color: #b8a8d8;
  letter-spacing: 0.1em;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.link-btn {
  background: none;
  border: none;
  color: #ffb84a;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.1em;
  padding: 0;
}

/* ============ 聊天顶栏 · 多信号 ============ */
.chat-top { gap: 6px; }
#btn-back { font-size: 22px; line-height: 1; padding-bottom: 4px; }
.convo-name .from {
  font-family: "Courier New", monospace;
  font-size: 9px;
}
#chat-channel-num {
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: var(--cur-color, #ffb84a);
  text-shadow: 0 0 6px var(--cur-color, #ffb84a);
}
#chat-channel-name { color: var(--cur-color, #ffd9a8); }

/* ============ 00 配额条（统一占位头像 + 三项配额）============ */
.avatar-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #15102a;
  border: 1px solid #3a3050;
  border-radius: 4px;
  padding: 8px 12px;
  margin: 4px 0 0;
}
.avatar-thumb {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #5a4a7a;
  flex-shrink: 0;
  object-fit: cover;
  background: #2a2040;
}
.avatar-meta {
  flex: 1; min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quota-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  letter-spacing: 0.15em;
}
.quota-line .ql-key {
  color: #8a7aaa;
}
.quota-line .ql-val {
  color: #ffd9a8;
  font-family: "Courier New", monospace;
}

/* 一次性照片弹窗 */
#popup-photo-mask { flex-direction: column; }
.popup-photo-img {
  max-width: 92vw;
  max-height: 70vh;
  border: 2px solid #ff9a7a;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(255, 154, 122, 0.55);
}
.popup-photo-tip {
  margin-top: 14px;
  color: #ff9a7a;
  font-size: 11px;
  letter-spacing: 0.25em;
}
.avatar-close {
  margin-top: 18px;
  background: #2a2240;
  border: 1px solid #5a4a7a;
  color: #c8b8e8;
  padding: 10px 28px;
  font-family: inherit;
  letter-spacing: 0.3em;
  border-radius: 3px;
  cursor: pointer;
}

/* ============ 系统消息（04 / 拦截 / 03 farewell）============ */
.msg-item.system {
  margin: 12px auto;
  max-width: 90%;
  align-items: center;
}
.msg-item.system .msg-bubble {
  background: transparent;
  border: 1px dashed #5a4a7a;
  color: #8a7aaa;
  font-family: "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 8px 14px;
  font-style: normal;
}

/* 附件渲染 */
.msg-attachment {
  margin-top: 6px;
  max-width: 200px;
}
.msg-attachment img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid #d4be8a;
  display: block;
}
.msg-attachment audio {
  width: 200px;
  height: 36px;
}

/* ============ 03 坐标按钮 ============ */
.coord-btn-wrap {
  margin: 6px 0;
  padding: 10px;
  border: 1px solid #cc4a5a;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(204,74,90,0.08), rgba(204,74,90,0.02));
  text-align: center;
}
.coord-btn {
  background: linear-gradient(180deg, #d63a4a 0%, #8a1525 100%);
  border: 1px solid #ff5a6a;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.3em;
  padding: 12px 20px;
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
  text-shadow: 0 0 6px rgba(255,255,255,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 0 20px rgba(214, 58, 74, 0.6);
  animation: red-pulse 2.4s infinite;
}
.coord-btn:active { transform: scale(0.98); }
.coord-hint {
  font-size: 10px;
  color: #cc4a5a;
  margin-top: 6px;
  letter-spacing: 0.15em;
}
@keyframes red-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 14px rgba(214,58,74,0.4); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 28px rgba(214,58,74,0.8); }
}

.coord-warn {
  text-align: center;
  color: #ff9aaa;
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 0.1em;
  margin: 16px 0;
}

/* ============ 锁定提示 ============ */
.locked-bar {
  background: #1a0a14;
  border: 1px dashed #aa3050;
  color: #ff9aaa;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.3em;
  margin: 6px 0;
  border-radius: 3px;
}

/* ============ 媒体按钮 ============ */
.media-btns {
  display: flex;
  gap: 4px;
  align-self: flex-end;
}
.media-btn {
  background: #2a2240;
  border: 1px solid #5a4a7a;
  color: #ffd9a8;
  width: 36px; height: 36px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ 语音录制面板 ============ */
.voice-panel {
  background: linear-gradient(180deg, #1f1838 0%, #14102a 100%);
  border: 2px solid #ff9a7a;
  border-radius: 6px;
  width: 100%;
  max-width: 320px;
  padding: 20px;
  color: #c8b8e8;
  text-align: center;
}
.voice-title {
  font-size: 14px;
  color: #ffd9a8;
  letter-spacing: 0.3em;
  margin-bottom: 16px;
}
.voice-timer {
  font-family: "Courier New", monospace;
  font-size: 28px;
  color: #ff9a7a;
  text-shadow: 0 0 8px rgba(255,154,122,0.5);
  margin: 14px 0;
}
.voice-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.voice-actions button { margin-top: 0; }
.voice-hint {
  margin-top: 10px;
  font-size: 11px;
  color: #ff9aaa;
  letter-spacing: 0.1em;
  min-height: 14px;
}

/* ============ 语音消息气泡 ============ */
.msg-attachment {
  margin-top: 4px;
}
.msg-attachment audio {
  width: 220px;
  max-width: 100%;
  height: 36px;
  border-radius: 18px;
  outline: none;
  filter: sepia(0.2) saturate(0.85) hue-rotate(-10deg);
}
.msg-attachment audio::-webkit-media-controls-panel {
  background: linear-gradient(180deg, #ffd1b0 0%, #ffae8a 100%);
}
.msg-item.assistant .msg-attachment audio {
  background: #f3e5c3;
}
.msg-item.user .msg-attachment audio {
  background: #ff85a5;
}
.msg-attachment img {
  max-width: 200px;
  border-radius: 8px;
  display: block;
}

/* ============ 02 通话界面 ============ */
#call {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at top, #1c2a4a 0%, #0a0d20 80%, #000 100%);
  z-index: 50;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.call-bg {
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 4px);
  pointer-events: none;
}
.call-inner {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 40px 20px 30px;
  color: #c8d4e8;
}
.call-top {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}
.call-warn {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #ff9080;
  background: rgba(180, 60, 60, 0.12);
  border: 1px solid rgba(255, 120, 100, 0.35);
  padding: 6px 14px;
  border-radius: 14px;
  text-shadow: 0 0 4px rgba(255, 120, 100, 0.5);
  animation: warn-pulse 2.6s infinite;
}
@keyframes warn-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.call-avatar {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a4a7a 0%, #1a2040 100%);
  border: 2px solid #7aaaff;
  box-shadow:
    0 0 30px rgba(122, 170, 255, 0.4),
    inset 0 0 20px rgba(122, 170, 255, 0.15);
  margin-top: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: avatar-pulse 3s infinite;
}
.call-avatar img {
  width: 70%; height: 70%; opacity: 0.7;
}
@keyframes avatar-pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(122, 170, 255, 0.4), inset 0 0 20px rgba(122, 170, 255, 0.15); }
  50% { box-shadow: 0 0 50px rgba(122, 170, 255, 0.7), inset 0 0 28px rgba(122, 170, 255, 0.3); }
}
.call-name {
  font-family: "STSong", "宋体", serif;
  font-size: 22px;
  letter-spacing: 0.4em;
  color: #d4e0ff;
  text-shadow: 0 0 8px rgba(122, 170, 255, 0.5);
  margin-top: 6px;
}
.call-status {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: #8aa0c8;
  min-height: 16px;
}
.call-timer {
  font-family: "Courier New", monospace;
  font-size: 18px;
  color: #7aaaff;
  letter-spacing: 0.2em;
  text-shadow: 0 0 6px rgba(122, 170, 255, 0.4);
  margin-top: 4px;
}

.call-transcript {
  flex: 1;
  width: 100%;
  max-width: 380px;
  margin: 18px auto 0;
  padding: 14px 16px;
  overflow-y: auto;
  font-size: 12px;
  color: #8aa0c8;
  letter-spacing: 0.1em;
  line-height: 1.85;
  font-family: "STSong", serif;
  scrollbar-width: thin;
}
.call-transcript::-webkit-scrollbar { width: 4px; }
.call-transcript::-webkit-scrollbar-thumb { background: #3a4a6a; border-radius: 2px; }
.call-transcript .tx-line {
  margin-bottom: 8px;
  opacity: 0;
  animation: tx-in 0.4s forwards;
}
.call-transcript .tx-me { text-align: right; color: #aaccff; }
.call-transcript .tx-her { text-align: left; color: #ffd9a8; }
.call-transcript .tx-sys { text-align: center; color: #ff9080; font-size: 10px; letter-spacing: 0.3em; }
@keyframes tx-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.call-bottom {
  width: 100%;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 24px;
}
.call-record-btn {
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9aaa 0%, #c83a6a 70%, #5a1030 100%);
  border: 3px solid #ff9080;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.3em;
  cursor: pointer;
  box-shadow:
    0 0 30px rgba(200, 60, 100, 0.5),
    inset 0 4px 12px rgba(255,255,255,0.2),
    inset 0 -6px 12px rgba(0,0,0,0.4);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  transition: transform 0.1s, box-shadow 0.15s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.call-record-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.call-record-btn.recording {
  transform: scale(1.08);
  box-shadow:
    0 0 50px rgba(255, 100, 130, 0.8),
    inset 0 4px 12px rgba(255,255,255,0.3),
    inset 0 -6px 12px rgba(0,0,0,0.5);
  animation: rec-pulse 0.8s infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 50px rgba(255, 100, 130, 0.8), inset 0 4px 12px rgba(255,255,255,0.3), inset 0 -6px 12px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 0 70px rgba(255, 150, 180, 1.0), inset 0 4px 12px rgba(255,255,255,0.4), inset 0 -6px 12px rgba(0,0,0,0.5); }
}
.rec-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.8);
}
.recording .rec-dot { background: #ff0040; box-shadow: 0 0 12px #ff0040; }
.rec-label { font-size: 13px; }

.call-hangup-btn {
  width: 100%; max-width: 240px;
  padding: 12px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.4em;
  background: #2a1020;
  color: #ff7a9a;
  border: 1px solid #aa3050;
  border-radius: 24px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .call-record-btn { width: 110px; height: 110px; }
}

/* ============ 微信接入按钮 + 弹窗 ============ */
.icon-btn.icon-wx {
  font-family: "STSong", "宋体", serif;
  color: #66ff99;
  border-color: #2a7050;
  background: rgba(40, 90, 60, 0.18);
  text-shadow: 0 0 6px rgba(102, 255, 153, 0.4);
  margin-right: 4px;
}
.icon-btn.icon-wx:hover {
  background: rgba(40, 90, 60, 0.35);
}
.wx-panel { max-width: 380px; }
.wx-stage { text-align: center; }
.wx-tip {
  font-size: 13px;
  color: #c8b8e8;
  letter-spacing: 0.1em;
  line-height: 1.7;
  margin: 8px 0;
}
.wx-tip.ok { color: #9bff7a; text-shadow: 0 0 6px rgba(155, 255, 122, 0.4); }
.wx-tip.err { color: #ff7a9a; }
.wx-tip-dim {
  font-size: 11px;
  color: #8a7aaa;
  letter-spacing: 0.1em;
  line-height: 1.7;
  margin: 6px 0;
}
.wx-qr-wrap {
  margin: 18px auto;
  padding: 12px;
  background: #fff;
  border-radius: 6px;
  display: inline-block;
  box-shadow: 0 0 20px rgba(102, 255, 153, 0.25);
}
.wx-qr-wrap img {
  display: block;
  width: 220px; height: 220px;
}

/* ============ Toast 提示 ============ */
.toast {
  position: fixed;
  left: 50%; bottom: 80px;
  transform: translateX(-50%);
  background: rgba(20, 10, 30, 0.92);
  border: 1px solid #aa3050;
  color: #ff9aaa;
  padding: 10px 18px;
  font-size: 12px;
  letter-spacing: 0.2em;
  border-radius: 4px;
  z-index: 99999;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(170, 48, 80, 0.4);
}

/* 移动端：信号面板 / 头像 调整 */
@media (max-width: 480px) {
  .signal-btn { padding: 14px 12px; font-size: 14px; }
  .signal-btn .sig-num { font-size: 14px; }
  .signal-btn .sig-desc { font-size: 11px; }
  .avatar-thumb { width: 40px; height: 40px; }
  .avatar-name { font-size: 14px; }
  .avatar-sub, .avatar-quota { font-size: 10px; }
  .media-btn { width: 40px; height: 40px; font-size: 18px; }
}

/* =========================================================
   明亮模式（默认）· body.light 覆盖
   暖纸色调，保留 90 年代复古感但整体明亮
   ========================================================= */
body.light { background: #e8e0d0; color: #3a2f25; }
body.light body::before, body.light::before {
  background: radial-gradient(ellipse at center, #f5efe2 0%, #e3d8c4 70%, #d4c8b0 100%);
}
/* 暗场效果在明亮模式下减弱 */
body.light .scanlines { opacity: 0.25; mix-blend-mode: multiply; }
body.light .vignette { box-shadow: inset 0 0 200px 40px rgba(120,100,70,0.15); }

/* 手机外壳：浅金属灰 */
body.light .phone-frame {
  background: linear-gradient(180deg, #fdfaf3 0%, #e8e0cf 100%);
  border-color: #c8b894;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.7),
    inset 0 -2px 0 rgba(0,0,0,0.08),
    0 0 30px rgba(180,150,100,0.15),
    0 18px 40px rgba(120,100,70,0.25);
}
body.light .phone-frame::before { background: #c8b894; }
body.light .phone-top { color: #7a6a4a; }
body.light .clock { color: #b8742a; text-shadow: none; }
body.light .battery { border-color: #7a6a4a; }
body.light .battery i { background: #b8742a; box-shadow: none; }
body.light .signal-bar span { background: #b8742a; box-shadow: none; }
body.light .signal-bar span.off { background: #c8bca0; }

/* 屏幕区 */
body.light .phone-screen {
  background: radial-gradient(ellipse at top, #fffdf6 0%, #f2ead8 60%, #e8dfc8 100%);
  border-color: #d0c0a0;
  box-shadow: inset 0 0 30px rgba(150,120,80,0.1);
}
body.light .hw-btn {
  background: linear-gradient(180deg, #f0e8d6 0%, #d8ccb0 100%);
  border-color: #c0b090;
}

/* 标题 / 文字 */
body.light .title-zh { color: #9a5a1a; text-shadow: 0 0 8px rgba(200,150,80,0.25); }
body.light .title-en { color: #8a7a9a; }
body.light .title-dash { color: #b0a088; }
body.light .title-sub { color: #6a5a4a; }
body.light .footer-tip { color: #8a7a5a; }
body.light .footer-tip .dim { color: #b0a088; }
body.light .footer-link { color: #b8742a; border-bottom-color: #c8b894; }

/* tab */
body.light .tab-row { border-bottom-color: #c8b894; }
body.light .tab-btn { color: #9a8a6a; }
body.light .tab-btn.active { color: #9a5a1a; border-bottom-color: #b8742a; text-shadow: none; }

/* 输入框 */
body.light .form-block input,
body.light .settings-panel input,
body.light .settings-panel textarea,
body.light .input-row textarea {
  background: #fffdf6; border-color: #c8b894; color: #3a2f25;
  box-shadow: inset 0 1px 3px rgba(120,100,70,0.12);
}
body.light .form-block label { color: #7a6a4a; }
body.light .form-hint { color: #9a8a6a; }
body.light .form-block input:focus,
body.light .settings-panel input:focus,
body.light .settings-panel textarea:focus,
body.light .input-row textarea:focus {
  border-color: #b8742a; box-shadow: inset 0 1px 3px rgba(120,100,70,0.1), 0 0 6px rgba(184,116,42,0.25);
}

/* 聊天头部 */
body.light .chat-frame .phone-top { background: #f2ead8; }
body.light .convo-name { color: #9a5a1a; text-shadow: none; }
body.light .convo-name .from { color: #9a8a6a; }
body.light .icon-btn { border-color: #c8b894; color: #7a6a4a; }
body.light .icon-btn.icon-wx { color: #2a8a4a; border-color: #8ac8a0; background: rgba(120,200,150,0.15); text-shadow: none; }

/* 消息列表 */
body.light .msg-list {
  background: radial-gradient(ellipse at top, #fffdf6 0%, #f2ebd9 80%);
  border-color: #d0c0a0;
  box-shadow: inset 0 0 20px rgba(150,120,80,0.08);
}
body.light .msg-list::-webkit-scrollbar-thumb { background: #c8b894; }
body.light .msg-day { color: #a09070; }
body.light .msg-time { color: #a09070; }
body.light .msg-empty { color: #8a7a5a; }
body.light .msg-empty .big { color: #9a5a1a; text-shadow: none; }

/* 用户气泡：暖橘粉 */
body.light .msg-item.user .msg-bubble {
  background: linear-gradient(180deg, #ff9a7a 0%, #e8704a 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 2px 6px rgba(200,100,60,0.25);
}
/* AI 气泡：纸白 */
body.light .msg-item.assistant .msg-bubble {
  background: #fffdf3;
  color: #3a2f25;
  border-color: #e0d4ba;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 6px rgba(150,120,80,0.15);
}
body.light .msg-item.system .msg-bubble { background: #f0e8d6; color: #7a6a4a; }
body.light .msg-typing .msg-bubble { background: #f5eede; color: #8a7a5a; }

/* 发送按钮 */
body.light .btn-send {
  background: linear-gradient(180deg, #ff9a7a 0%, #e8704a 100%);
  border-color: #ffaa8a; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 0 8px rgba(200,100,60,0.25);
}
body.light .btn-send:disabled { background: #d8ccb0; border-color: #c8b894; }
body.light .btn-primary {
  background: linear-gradient(180deg, #ff9a7a 0%, #d8603a 100%);
  border-color: #ffaa8a; color: #fff;
}

/* 信号选择按钮 */
body.light .signal-btn {
  background: linear-gradient(180deg, #fffdf6 0%, #f0e8d6 100%);
  border-color: #d0c0a0;
}
body.light .signal-btn .sig-num { color: #9a8a6a; }
body.light .signal-btn .sig-label { color: #5a4a3a; }
body.light .signal-btn .sig-desc { color: #9a8a6a; }
body.light .signal-btn .sig-dot { background: #c8b894; }
body.light .signal-btn.active { border-color: var(--sig-color, #b8742a); }
body.light .signal-btn.active .sig-num,
body.light .signal-btn.active .sig-label { color: #9a5a1a; }

/* 设置面板 / 弹窗 */
body.light .mask { background: rgba(120,100,70,0.4); }
body.light .settings-panel {
  background: linear-gradient(180deg, #fffdf6 0%, #f2ead8 100%);
  border-color: #c8b894; color: #5a4a3a;
}
body.light .settings-title { color: #9a5a1a; text-shadow: none; border-bottom-color: #c8b894; }
body.light .block-label { color: #7a6a4a; }
body.light .block-value { background: #fffdf6; border-color: #c8b894; color: #3a2f25; }
body.light .btn-secondary { background: #f0e8d6; border-color: #c8b894; color: #6a5a4a; }

/* 00 头像条 */
body.light .avatar-bar { background: #f2ead8; border-color: #d0c0a0; }
body.light .quota-line .ql-key { color: #9a8a6a; }
body.light .quota-line .ql-val { color: #9a5a1a; }
body.light .media-btn { background: #f0e8d6; border-color: #c8b894; color: #7a6a4a; }

/* 主题切换按钮 */
.theme-toggle {
  background: none;
  border: 1px solid #5a4a7a;
  color: #c8b8e8;
  width: 28px; height: 24px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  margin-right: 4px;
}
body.light .theme-toggle { border-color: #c8b894; color: #7a6a4a; }
