:root {
  --bg: #f4f1e9;
  --panel: #fffdf8;
  --ink: #24221d;
  --muted: #8d8779;
  --line: #e7e1d3;
  --accent: #1f7a5a;
  --accent-deep: #155f45;
  --mine: linear-gradient(165deg, #2a8b65 0%, #1a6b4d 100%);
  --other: #ffffff;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 18px rgba(40, 30, 10, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea {
  font-family: var(--font);
  touch-action: manipulation;
}

.hidden { display: none !important; }

/* ---------------- 进入页 ---------------- */

.join {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(90% 60% at 18% 8%, #e6f1e9 0%, transparent 60%),
    radial-gradient(85% 60% at 92% 92%, #f3e6d6 0%, transparent 58%),
    #f7f4ed;
}

.join-card {
  width: 100%;
  max-width: 392px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 28px;
  padding: 30px 26px 24px;
  box-shadow: 0 24px 70px rgba(60, 45, 20, .16), 0 2px 6px rgba(60, 45, 20, .06);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.join-logo {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  background: linear-gradient(160deg, #2a8b65, #155f45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(31, 122, 90, .3);
}

.join h1 {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: -.01em;
}

.join-sub {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
}

.field { display: block; margin-bottom: 16px; }

.field span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 7px 4px;
}

.field input {
  width: 100%;
  height: 52px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 16px;
  font-size: 18px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  border-color: rgba(31, 122, 90, .5);
  box-shadow: 0 0 0 4px rgba(31, 122, 90, .08);
}

.primary-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(160deg, #2a8b65, #166349);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(31, 122, 90, .28);
}

.primary-btn:active { transform: scale(.985); }

.join-tip {
  text-align: center;
  margin: 16px 0 0;
  font-size: 12.5px;
  color: #a9a294;
}

.gate-tip.error {
  color: #b23a2e;
  font-weight: 600;
}

.primary-btn:disabled {
  opacity: .6;
  cursor: default;
}

/* ---------------- 主界面 ---------------- */

.app {
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100vh);
  min-height: 0;
  position: relative;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 11px) 16px 11px;
  background: rgba(250, 247, 240, .9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 3;
}

.topbar-main { flex: 1 1 auto; min-width: 0; }

.topbar h1 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c3bcae;
  flex: 0 0 7px;
  transition: background .2s;
}

.status.online::before {
  background: #37a06f;
  box-shadow: 0 0 0 3px rgba(55, 160, 111, .15);
}

.status.typing::before {
  background: #e0a33c;
  animation: pulse 1s infinite;
}

.status.bad::before { background: #d05a4a; }

@keyframes pulse { 50% { opacity: .3; } }

.top-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.top-btn:active { background: rgba(0, 0, 0, .06); }

.top-btn[hidden] { display: none; }

/* 消息提醒按钮：没开启时轻轻跳动，开启后变实心 */
.top-btn#pushBtn { position: relative; animation: bell 2.4s ease-in-out infinite; }
.top-btn#pushBtn.on { animation: none; background: rgba(47, 122, 95, .14); }
.top-btn#pushBtn.on::after {
  content: '';
  position: absolute;
  margin: -4px 0 0 -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f7a5f;
}

@keyframes bell {
  0%, 70%, 100% { transform: rotate(0); }
  74% { transform: rotate(-12deg); }
  78% { transform: rotate(12deg); }
  82% { transform: rotate(-8deg); }
  86% { transform: rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .top-btn#pushBtn { animation: none; }
}

.me-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(31, 122, 90, .25);
}

.me-btn:active { transform: scale(.94); }

/* ---------------- 消息区 ---------------- */

.chat-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(120% 60% at 12% 0%, rgba(31, 122, 90, .055), transparent 60%),
    radial-gradient(120% 60% at 100% 100%, rgba(176, 120, 60, .06), transparent 55%),
    var(--bg);
}

.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 3px;
}

.load-more {
  flex: 0 0 auto;
  align-self: center;
  margin: 2px 0 10px;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(120, 110, 90, .08);
  cursor: pointer;
}

.load-more[hidden] { display: none; }

.chip {
  align-self: center;
  margin: 14px 0 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(120, 110, 90, .09);
  letter-spacing: .03em;
}

.msg {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 9px;
  max-width: 100%;
  animation: rise .18s ease-out;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

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

.avatar {
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.stack {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 48px);
  min-width: 0;
}

.mine .stack { align-items: flex-end; }

.bubble {
  background: var(--other);
  padding: 11px 15px;
  border-radius: 18px;
  border-top-left-radius: 6px;
  font-size: 18px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
  box-shadow: var(--shadow);
}

.mine .bubble {
  background: var(--mine);
  color: #fff;
  border-radius: 18px;
  border-top-left-radius: 18px;
  border-top-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(26, 107, 77, .22);
}

.bubble.danmaku-bubble {
  background: linear-gradient(160deg, #8a5cf6, #c94f9b);
  color: #fff;
  border-radius: 18px;
  border-top-left-radius: 6px;
  box-shadow: 0 4px 14px rgba(138, 92, 246, .28);
}

.mine .bubble.danmaku-bubble {
  border-radius: 18px;
  border-top-right-radius: 6px;
  border-top-left-radius: 18px;
}

.bubble.effect-bubble {
  background: linear-gradient(160deg, #fdf0f4, #fbe4ec);
  color: #a83a5b;
  font-weight: 600;
  border-top-left-radius: 6px;
}

.mine .bubble.effect-bubble {
  background: linear-gradient(160deg, #f7dbe6, #f3c8d9);
  color: #8f2c4a;
}

.bubble-text { white-space: pre-wrap; word-break: break-word; }

/* 气泡里的引用块 */
.quote {
  border-left: 3px solid rgba(0, 0, 0, .18);
  padding: 2px 0 2px 8px;
  margin-bottom: 7px;
  font-size: 14.5px;
  line-height: 1.45;
  opacity: .85;
}

.mine .quote { border-left-color: rgba(255, 255, 255, .55); }

.quote .q-name {
  font-weight: 700;
  margin-right: 5px;
}

.quote .q-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
  opacity: .9;
}

/* 每条消息的时间 */
.time {
  margin: 3px 4px 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1;
  letter-spacing: .02em;
}

.read-mark {
  margin-left: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.read-mark.done { color: #37a06f; }

/* ---------------- 语音消息 ---------------- */

.voice {
  background: var(--other);
  padding: 10px 14px;
  border-radius: 18px;
  border-top-left-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 190px;
  max-width: min(72vw, 330px);
}

.mine .voice {
  background: var(--mine);
  color: #fff;
  border-radius: 18px;
  border-top-left-radius: 18px;
  border-top-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(26, 107, 77, .22);
}

.voice-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-play {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(31, 122, 90, .12);
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mine .voice-play {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.voice-wave {
  flex: 1 1 auto;
  height: 6px;
  min-width: 90px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .1);
  overflow: hidden;
}

.mine .voice-wave { background: rgba(255, 255, 255, .3); }

.voice-wave i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
  transition: width .15s linear;
}

.mine .voice-wave i { background: #fff; }

.voice-dur {
  flex: 0 0 auto;
  font-size: 13px;
  opacity: .75;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 位置消息 ---------------- */

.location {
  background: var(--other);
  padding: 10px 14px;
  border-radius: 18px;
  border-top-left-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 200px;
  max-width: min(72vw, 330px);
}

.mine .location {
  background: var(--mine);
  color: #fff;
  border-radius: 18px;
  border-top-left-radius: 18px;
  border-top-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(26, 107, 77, .22);
}

.loc-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.loc-icon { font-size: 18px; }
.loc-title { font-size: 15px; }

.loc-coord {
  margin-top: 6px;
  font-size: 13px;
  opacity: .8;
  font-variant-numeric: tabular-nums;
}

.loc-meta {
  margin-top: 2px;
  font-size: 12px;
  opacity: .65;
}

.loc-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.loc-btn {
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13.5px;
  cursor: pointer;
  background: rgba(31, 122, 90, .1);
  color: var(--accent);
}

.mine .loc-btn {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.loc-btn.primary { font-weight: 600; }

/* ---------------- 录音条 ---------------- */

.rec-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(201, 79, 155, .08);
  border-top: 1px solid rgba(201, 79, 155, .2);
}

.rec-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d33;
  animation: pulse 1s infinite;
}

.rec-time {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.rec-hint {
  flex: 1 1 auto;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec-btn {
  flex: 0 0 auto;
  border: none;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 15px;
  cursor: pointer;
}

.rec-btn.cancel {
  background: rgba(0, 0, 0, .07);
  color: var(--ink);
}

.rec-btn.send {
  background: var(--accent);
  color: #fff;
}

.sticker {
  font-size: 64px;
  line-height: 1.2;
  padding: 2px 4px;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .1));
}

.photo {
  max-width: min(66vw, 340px);
  max-height: 58vh;
  width: auto;
  height: auto;
  border-radius: 16px;
  display: block;
  cursor: zoom-in;
  background: rgba(0, 0, 0, .05);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .12);
}

/* ---------------- 弹幕 / 特效层 ---------------- */

.danmaku-layer,
.fx-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.danmaku-item {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 1px 3px rgba(255, 255, 255, .9), 0 0 12px rgba(255, 255, 255, .6);
  animation-name: danmaku-flow;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  will-change: transform;
}

@keyframes danmaku-flow {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100vw - 100%)); }
}

.drop {
  position: absolute;
  top: -12vh;
  line-height: 1;
  animation-name: drop-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  will-change: transform;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .08));
}

@keyframes drop-fall {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(125vh) rotate(240deg); }
}

/* ---------------- 表情面板 ---------------- */

.emoji-panel {
  flex: 0 0 auto;
  height: 0;
  overflow: hidden;
  background: var(--panel);
  border-top: 1px solid transparent;
  transition: height .22s ease;
}

.emoji-panel.open {
  height: min(300px, 38vh);
  height: min(300px, 38dvh);
  border-top-color: var(--line);
}

.emoji-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px 6px;
}

.tab {
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active {
  background: rgba(31, 122, 90, .1);
  color: var(--accent);
  font-weight: 600;
}

.emoji-scroll {
  height: calc(100% - 46px);
  overflow-y: auto;
  padding: 4px 10px 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 2px;
}

.emoji-item {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  padding: 8px 0;
  border-radius: 10px;
  cursor: pointer;
}

.emoji-item:active { background: rgba(0, 0, 0, .06); }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 4px;
}

.sticker-item {
  border: none;
  background: rgba(0, 0, 0, .03);
  border-radius: 14px;
  font-size: 36px;
  line-height: 1;
  padding: 9px 0;
  cursor: pointer;
}

.sticker-item:active { background: rgba(0, 0, 0, .08); }

/* ---------------- 特效条 / 引用条 ---------------- */

.fx-row {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.fx-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14.5px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.fx-btn.active {
  background: rgba(201, 79, 155, .12);
  border-color: rgba(201, 79, 155, .45);
  color: #a83a7b;
  font-weight: 600;
}

.quote-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(31, 122, 90, .07);
  border-top: 1px solid rgba(31, 122, 90, .16);
  font-size: 13.5px;
  color: var(--accent-deep);
}

.quote-bar-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-close {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
}

/* ---------------- 输入区 ---------------- */

.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(253, 251, 246, .96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 4;
}

.icon-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s, transform .1s;
}

.icon-btn:active { transform: scale(.92); }
.icon-btn.active { background: rgba(31, 122, 90, .1); }
.icon-btn:disabled { opacity: .45; }

#input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 132px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.4;
  resize: none;
  outline: none;
  overflow-y: auto;
  scrollbar-width: none;
  transition: border-color .15s, box-shadow .15s;
}

#input::-webkit-scrollbar { display: none; }

#input:focus {
  border-color: rgba(31, 122, 90, .45);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, .08);
}

#input.danmaku-mode {
  border-color: rgba(201, 79, 155, .55);
  box-shadow: 0 0 0 3px rgba(201, 79, 155, .1);
}

.send-btn {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 15px;
  border: none;
  border-radius: 20px;
  background: var(--mine);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(26, 107, 77, .25);
  transition: transform .1s, opacity .15s;
}

.send-btn:active { transform: scale(.96); }
.send-btn:disabled { opacity: .5; }

/* ---------------- 底部操作面板 ---------------- */

.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 18, 14, .42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .16s ease-out;
}

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

.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--panel);
  border-radius: 22px 22px 0 0;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .18);
  animation: sheet-up .2s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.sheet-preview {
  padding: 6px 10px 12px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
  max-height: 84px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sheet-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px 10px;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}

.sheet-actions button:active { background: rgba(0, 0, 0, .04); }

.sheet-cancel {
  width: 100%;
  margin-top: 8px;
  border: none;
  background: rgba(120, 110, 90, .08);
  border-radius: 14px;
  padding: 13px;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
}

.sheet-tall {
  height: min(72vh, 620px);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 12px;
  font-size: 17px;
  font-weight: 650;
  border-bottom: 1px solid var(--line);
}

.sheet-x {
  border: none;
  background: transparent;
  font-size: 17px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}

.fav-list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 2px 10px;
}

.fav-item {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.fav-item-main {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.fav-item-text {
  flex: 1 1 auto;
  font-size: 16px;
  line-height: 1.5;
  word-break: break-word;
}

.fav-item-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.fav-remove {
  border: none;
  background: transparent;
  color: #b23a2e;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.fav-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  padding: 40px 10px;
  line-height: 1.7;
}

/* ---------------- 第三人警告 ---------------- */

.alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(120, 18, 12, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: alert-in .2s ease-out;
}

@keyframes alert-in { from { opacity: 0; } to { opacity: 1; } }

.alert-card {
  width: 100%;
  max-width: 380px;
  background: #fffaf7;
  border-radius: 24px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
}

.alert-icon {
  font-size: 44px;
  line-height: 1;
  animation: pulse .9s infinite;
}

.alert-card h2 {
  margin: 12px 0 10px;
  font-size: 21px;
  color: #9a1b10;
}

.alert-card p {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.7;
  color: #6b5c53;
}

/* ---------------- 浮层 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  background: rgba(35, 33, 27, .88);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 95;
  max-width: 80vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 12, 10, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* ---------------- 深色模式 ---------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121310;
    --panel: #1b1d18;
    --ink: #eeeae1;
    --muted: #9e988b;
    --line: #2c2e27;
    --other: #23251f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }

  .join {
    background:
      radial-gradient(90% 60% at 18% 8%, rgba(31, 122, 90, .16) 0%, transparent 60%),
      radial-gradient(85% 60% at 92% 92%, rgba(176, 120, 60, .12) 0%, transparent 58%),
      #0f110e;
  }

  .join-card {
    background: rgba(28, 30, 24, .94);
    border-color: rgba(255, 255, 255, .06);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  }

  .field input,
  #input {
    background: #24261f;
    color: var(--ink);
  }

  .topbar { background: rgba(20, 22, 17, .9); }
  .composer { background: rgba(22, 24, 19, .96); }
  .emoji-panel { background: var(--panel); }
  .fx-row { background: var(--panel); }

  .messages {
    background:
      radial-gradient(120% 60% at 12% 0%, rgba(31, 122, 90, .1), transparent 60%),
      radial-gradient(120% 60% at 100% 100%, rgba(176, 120, 60, .07), transparent 55%),
      var(--bg);
  }

  .join-tip { color: #6f6a60; }

  .fx-btn,
  .sheet-actions button {
    background: #24261f;
    color: var(--ink);
  }

  .sheet { background: #1b1d18; }

  .alert-card {
    background: #241d1a;
  }

  .alert-card h2 { color: #ff8f80; }
  .alert-card p { color: #c9bdb4; }

  .danmaku-item {
    text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .7);
  }

  .rec-bar { background: rgba(201, 79, 155, .12); }
  .rec-btn.cancel { background: rgba(255, 255, 255, .1); color: var(--ink); }
}
