:root {
  --bg: #11160f;
  --card: #1c2418;
  --text: #f3efe4;
  --muted: #b7b09a;
  --accent: #c9a227;
  --err: #e07070;
  --ok: #7dca8e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #2a331f 0%, var(--bg) 50%);
  color: var(--text);
  min-height: 100vh;
}
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #2f3928;
}
.bar a { color: var(--muted); }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
.card {
  background: var(--card);
  border: 1px solid #33402c;
  border-radius: 16px;
  padding: 24px;
  margin: 24px auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login { max-width: 420px; margin-top: 12vh; }
h1, h2 { margin: 0 0 12px; }
.muted { color: var(--muted); }
.error { color: var(--err); }
.ok { color: var(--ok); }
label { display: block; margin: 16px 0; }
.nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.skins { display: flex; gap: 6px; flex-wrap: wrap; }
.skins button {
  margin-top: 0;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
}
.skins button.on { box-shadow: 0 0 0 2px currentColor; }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid #44553a;
  margin-left: 8px;
}
.chat-page { max-width: 980px; }
.chat-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 16px;
  min-height: 70vh;
}
.chat-side { border-right: 1px solid #33402c; padding-right: 12px; }
.user-list, .chat-side { display: flex; flex-direction: column; gap: 6px; }
.room {
  margin-top: 0;
  background: #12180f;
  color: var(--text);
  border-radius: 10px;
  text-align: left;
  font-weight: 600;
  width: 100%;
}
.room.on { background: var(--accent); color: #1a1404; }
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
button.ghost-sm {
  margin-top: 0;
  background: #24301f;
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
}
button.ghost-sm.on {
  background: var(--ok);
  color: #102214;
}
button.danger {
  margin-top: 0;
  background: #8a3a32;
  color: #fff8f4;
  font-size: 13px;
  padding: 8px 12px;
}
.msgs {
  height: 52vh;
  overflow: auto;
  background: #12180f;
  border: 1px solid #33402c;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 80%;
  background: #24301f;
  border-radius: 12px;
  padding: 8px 12px;
}
.bubble.mine { align-self: flex-end; background: #3a4a2c; }
.bubble .who { display: block; font-size: 12px; color: var(--accent); }
.bubble .txt { white-space: pre-wrap; word-break: break-word; }
.bubble .when { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.send { display: flex; gap: 8px; align-items: center; }
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.tools .tool {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.tools .tool input { display: none; }
.tools .tool {
  display: inline-block;
  padding: 8px 12px;
  background: var(--accent);
  color: #1a1404;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}
.sticker-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #33402c;
  border-radius: 12px;
  background: #12180f;
}
.emoji-row, .sticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.emoji, .sticker-btn {
  margin-top: 0;
  padding: 4px;
  min-width: 40px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}
.sticker-btn img { width: 44px; height: 44px; display: block; }
.chat-img {
  display: block;
  max-width: min(260px, 70vw);
  max-height: 240px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: zoom-in;
  -webkit-touch-callout: default;
  -webkit-user-select: none;
  user-select: none;
}
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(10, 8, 12, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 10px;
}
.img-lightbox[hidden] { display: none !important; }
.img-lightbox img {
  max-width: min(96vw, 920px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
  -webkit-touch-callout: default;
  -webkit-user-select: none;
  user-select: none;
}
.img-lightbox-hint {
  margin: 0;
  color: #ddd;
  font-size: 13px;
}
.img-lightbox-open {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.chat-sticker { width: 72px; height: 72px; display: block; margin-top: 6px; }
.voice-hold {
  min-width: 118px;
  font-weight: 700;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.voice-hold.rec {
  background: #8a2b2b;
  border-color: #c45;
  color: #fff;
}
.voice-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  min-width: 148px;
  max-width: min(260px, 72vw);
  padding: 8px 12px;
  border-radius: 18px;
  background: #2a3524;
  border: 1px solid #44553a;
  cursor: pointer;
  user-select: none;
}
.bubble.mine .voice-bubble { background: #3a4a2c; }
.voice-bubble.playing { outline: 1px solid var(--accent); }
.voice-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #1a1608;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  pointer-events: none;
}
.voice-bars {
  flex: 1;
  height: 18px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.voice-bars i {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: #9aaa7a;
  transform-origin: center;
}
.voice-bubble.playing .voice-bars i {
  animation: vbar 0.7s ease-in-out infinite alternate;
}
.voice-bars i:nth-child(2) { animation-delay: .08s; height: 10px; }
.voice-bars i:nth-child(3) { animation-delay: .16s; height: 14px; }
.voice-bars i:nth-child(4) { animation-delay: .04s; height: 8px; }
.voice-bars i:nth-child(5) { animation-delay: .2s; height: 16px; }
.voice-bars i:nth-child(6) { animation-delay: .12s; height: 9px; }
.voice-dur { font-size: 12px; color: var(--muted); min-width: 2.4em; text-align: right; }
@keyframes vbar {
  from { transform: scaleY(0.55); }
  to { transform: scaleY(1.35); }
}
.rec-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 10, 8, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.rec-mask[hidden] { display: none !important; }
.rec-mask.cancel .rec-card { background: #4a2222; }
.rec-card {
  min-width: 180px;
  padding: 22px 28px;
  border-radius: 16px;
  background: #1c2418;
  border: 1px solid #44553a;
  text-align: center;
}
.rec-wave {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #e07070 0%, #8a2b2b 70%);
  animation: recpulse 1s ease-in-out infinite;
}
@keyframes recpulse {
  0%, 100% { transform: scale(0.92); opacity: .85; }
  50% { transform: scale(1.08); opacity: 1; }
}
.rec-time { margin: 0; font-size: 28px; font-variant-numeric: tabular-nums; }
.rec-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.send input[type=text] { flex: 1; margin-top: 12px; }
@media (max-width: 640px) {
  .chat-shell { grid-template-columns: 1fr; }
  .chat-side { border-right: 0; border-bottom: 1px solid #33402c; padding-bottom: 12px; }
}
input[type=password], input[type=text], textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #44553a;
  background: #12180f;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 120px; word-break: break-all; }
button, .btn {
  display: inline-block;
  margin-top: 12px;
  padding: 12px 18px;
  background: var(--accent);
  color: #1a1404;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.split {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: start;
}
.qr {
  width: 180px;
  height: 180px;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
}
ol { color: var(--muted); padding-left: 20px; }
.hp {
  position: absolute;
  left: -9999px;
  height: 0;
  width: 0;
  opacity: 0;
}
.sr { display: block; margin: 20px 0 8px; color: var(--muted); font-size: 13px; }
.public {
  background: #f4efe6;
  color: #2b261c;
}
.public .wrap { max-width: 560px; margin: 18vh auto; padding: 0 20px; }
.public h1 { font-weight: 500; letter-spacing: 0.04em; }
.public .mark { letter-spacing: 0.28em; text-transform: uppercase; font-size: 12px; color: #8a8170; }
.public .lede { color: #6d6456; line-height: 1.6; }
.public .note, .public .foot { color: #8a8170; font-size: 14px; }
.public input[type=text] {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #d5ccbb;
  background: #fffdf8;
  color: #2b261c;
  border-radius: 4px;
}
.public button {
  background: #2b261c;
  color: #f4efe6;
  border-radius: 4px;
}
.public .row-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}
.public .row-actions button { margin-top: 12px; }
.public .side-link {
  display: inline-block;
  margin-top: 12px;
  padding: 12px 18px;
  background: #2b261c;
  color: #f4efe6;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
}
@media (max-width: 640px) {
  .split { grid-template-columns: 1fr; }
}
.mail-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.mail-row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: #12180f;
  border: 1px solid #33402c;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.mail-row.unseen { border-color: var(--accent); }
.mail-from, .mail-sub, .mail-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.mail-sub { color: var(--muted); }
.mail-body {
  white-space: pre-wrap;
  word-break: break-word;
  background: #12180f;
  border: 1px solid #33402c;
  border-radius: 12px;
  padding: 16px;
  min-height: 200px;
  max-height: 70vh;
  overflow: auto;
}
.mail-frame {
  display: block;
  width: 100%;
  min-height: 70vh;
  border: 1px solid #33402c;
  border-radius: 12px;
  background: #fff;
}
@media (max-width: 640px) {
  .mail-row { grid-template-columns: 1fr; }
}

body.lounge.theme-pink {
  --bg: #f7c6d8;
  --card: #ffe6f0;
  --text: #6b2d45;
  --muted: #c47a96;
  --accent: #ff8fb5;
  --err: #e0567a;
  --ok: #f48fb1;
  background:
    radial-gradient(900px 500px at 12% -8%, #ffd6e8 0%, transparent 55%),
    radial-gradient(800px 480px at 100% 10%, #ffc1d8 0%, transparent 50%),
    linear-gradient(180deg, #f9c2d6 0%, #f4a9c4 45%, #ee9bb8 100%);
  color: var(--text);
}
body.lounge.theme-pink .bar {
  border-bottom-color: #f3b3c9;
  background: rgba(255, 232, 242, 0.72);
}
body.lounge.theme-pink .bar a { color: #c45d82; }
body.lounge.theme-pink .card {
  background: var(--card);
  border-color: #f5bdd0;
  box-shadow: 0 12px 36px rgba(214, 96, 138, 0.18);
}
body.lounge.theme-pink input[type=password],
body.lounge.theme-pink input[type=text],
body.lounge.theme-pink textarea {
  background: #fff7fb;
  border-color: #f0b6cc;
  color: var(--text);
}
body.lounge.theme-pink button,
body.lounge.theme-pink .btn {
  background: #ff8fb5;
  color: #5a1f36;
}
body.lounge.theme-pink button.ghost {
  background: transparent;
  color: var(--text);
  border-color: #f0b6cc;
}
body.lounge.theme-pink .chat-side { border-right-color: #f5bdd0; }
body.lounge.theme-pink .room {
  background: #fff7fb;
  color: var(--text);
}
body.lounge.theme-pink .room.on {
  background: #ff8fb5;
  color: #5a1f36;
}
body.lounge.theme-pink button.ghost-sm {
  background: #ffd0e1;
  color: #6b2d45;
}
body.lounge.theme-pink button.ghost-sm.on {
  background: #ff8fb5;
  color: #5a1f36;
}
body.lounge.theme-pink .msgs {
  background: #fff7fb;
  border-color: #f5bdd0;
}
body.lounge.theme-pink .bubble { background: #ffd6e6; }
body.lounge.theme-pink .bubble.mine { background: #ffb3cc; }
body.lounge.theme-pink .bubble .who { color: #e85a8c; }
@media (max-width: 640px) {
  body.lounge.theme-pink .chat-side { border-bottom-color: #f5bdd0; }
}

body.lounge.theme-hermes {
  --bg: #c65a1e;
  --card: #fff1e4;
  --text: #4a2a16;
  --muted: #b56a3c;
  --accent: #f37021;
  --err: #c0392b;
  --ok: #e67a2e;
  background:
    radial-gradient(900px 520px at 8% -10%, #ffb077 0%, transparent 50%),
    linear-gradient(180deg, #f37021 0%, #d45c18 42%, #b84a12 100%);
  color: var(--text);
}
body.lounge.theme-hermes .bar {
  border-bottom-color: #e8a06a;
  background: rgba(255, 241, 228, 0.82);
}
body.lounge.theme-hermes .bar a { color: #a44a18; }
body.lounge.theme-hermes .card {
  background: var(--card);
  border-color: #f0c19a;
  box-shadow: 0 12px 36px rgba(140, 56, 12, 0.22);
}
body.lounge.theme-hermes input[type=password],
body.lounge.theme-hermes input[type=text],
body.lounge.theme-hermes textarea {
  background: #fffaf4;
  border-color: #efc09a;
  color: var(--text);
}
body.lounge.theme-hermes button,
body.lounge.theme-hermes .btn {
  background: #f37021;
  color: #2b1408;
}
body.lounge.theme-hermes button.ghost {
  background: transparent;
  color: var(--text);
  border-color: #efc09a;
}
body.lounge.theme-hermes .chat-side { border-right-color: #f0c19a; }
body.lounge.theme-hermes .room {
  background: #fffaf4;
  color: var(--text);
}
body.lounge.theme-hermes .room.on {
  background: #f37021;
  color: #2b1408;
}
body.lounge.theme-hermes button.ghost-sm {
  background: #ffd7b8;
  color: #4a2a16;
}
body.lounge.theme-hermes button.ghost-sm.on {
  background: #f37021;
  color: #2b1408;
}
body.lounge.theme-hermes .msgs {
  background: #fffaf4;
  border-color: #f0c19a;
}
body.lounge.theme-hermes .bubble { background: #ffd8b6; }
body.lounge.theme-hermes .bubble.mine { background: #f7a35c; }
body.lounge.theme-hermes .bubble .who { color: #d35400; }
@media (max-width: 640px) {
  body.lounge.theme-hermes .chat-side { border-bottom-color: #f0c19a; }
}

body.lounge.theme-ashare {
  --bg: #3a0508;
  --card: #4a0c10;
  --text: #ffe8e8;
  --muted: #e08a8a;
  --accent: #ee2e24;
  --err: #ff6b6b;
  --ok: #ff4d4f;
  background:
    radial-gradient(900px 500px at 10% -12%, #8a1218 0%, transparent 52%),
    linear-gradient(180deg, #5a0a0e 0%, #2b0306 55%, #1a0103 100%);
  color: var(--text);
}
body.lounge.theme-ashare .bar {
  border-bottom-color: #8a1c22;
  background: rgba(74, 12, 16, 0.92);
}
body.lounge.theme-ashare .bar a { color: #ffb3b3; }
body.lounge.theme-ashare .card {
  background: var(--card);
  border-color: #a31d24;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}
body.lounge.theme-ashare input[type=password],
body.lounge.theme-ashare input[type=text],
body.lounge.theme-ashare textarea {
  background: #2a0508;
  border-color: #a31d24;
  color: var(--text);
}
body.lounge.theme-ashare button,
body.lounge.theme-ashare .btn {
  background: #ee2e24;
  color: #fff5f5;
}
body.lounge.theme-ashare button.ghost {
  background: transparent;
  color: var(--text);
  border-color: #a31d24;
}
body.lounge.theme-ashare .chat-side { border-right-color: #a31d24; }
body.lounge.theme-ashare .room {
  background: #2a0508;
  color: var(--text);
}
body.lounge.theme-ashare .room.on {
  background: #ee2e24;
  color: #fff5f5;
}
body.lounge.theme-ashare button.ghost-sm {
  background: #6b1218;
  color: #ffe8e8;
}
body.lounge.theme-ashare button.ghost-sm.on {
  background: #ee2e24;
  color: #fff5f5;
}
body.lounge.theme-ashare button.danger {
  background: #7a1016;
  color: #ffd0d0;
}
body.lounge.theme-ashare .msgs {
  background: #2a0508;
  border-color: #a31d24;
}
body.lounge.theme-ashare .bubble { background: #6b141a; }
body.lounge.theme-ashare .bubble.mine { background: #c41e24; }
body.lounge.theme-ashare .bubble .who { color: #ffb4a8; }
@media (max-width: 640px) {
  body.lounge.theme-ashare .chat-side { border-bottom-color: #a31d24; }
}
