:root {
  --v-primary: #2f7ee6;
  --v-primary-2: #5b9bf5;
  --v-primary-soft: #eaf2ff;
  --v-text: #1f2a44;
  --v-muted: #8b95a9;
  --v-line: #e7ecf5;
  --v-bg: #f5f8fd;
  --v-panel: #ffffff;
  --v-danger: #e5484d;
  --v-green: #22b573;
  --v-font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.theme-emerald { --v-primary: #1aa675; --v-primary-2: #4ac196; --v-primary-soft: #e6f7f1; }
body.theme-violet { --v-primary: #7a5af8; --v-primary-2: #9d84fb; --v-primary-soft: #f0ecff; }
body.theme-coral { --v-primary: #f07a4b; --v-primary-2: #f79b74; --v-primary-soft: #fff0e9; }
body.theme-gold { --v-primary: #c39430; --v-primary-2: #d9b15a; --v-primary-soft: #fbf3df; }
body.theme-rose { --v-primary: #e86a8e; --v-primary-2: #f08fa9; --v-primary-soft: #fdeef2; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--v-font);
  color: var(--v-text);
  background: #e9eef7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.visitor-body {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(800px 500px at 10% 0%, rgba(120, 163, 255, 0.22), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(120, 205, 255, 0.18), transparent 60%),
    #e9eef7;
}
.visitor-app {
  width: 100%;
  max-width: 760px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--v-bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(31, 52, 90, 0.12);
}
@media (min-width: 761px) {
  .visitor-body { padding: 0; }
  .visitor-app { height: 100dvh; }
}

/* loading */
.visitor-config-loading {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: rgba(245, 248, 253, 0.94); color: var(--v-muted); font-size: 13px;
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid #dbe6f7; border-top-color: var(--v-primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* header */
.service-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--v-panel);
  border-bottom: 1px solid var(--v-line);
  position: relative;
  z-index: 5;
  transition: 0.2s;
}
.service-banner.soft {
  background: linear-gradient(180deg, var(--v-primary-soft), #fff);
  border-bottom-color: transparent;
}
.service-banner.gradient {
  background: linear-gradient(135deg, var(--v-primary), var(--v-primary-2));
  border-bottom: none;
  color: #fff;
}
.banner-avatar {
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex: none;
  background: #eef4ff; border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 4px 12px rgba(31, 52, 90, 0.12);
}
.banner-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-copy { flex: 1; min-width: 0; }
.banner-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vip-badge {
  font-size: 9px; color: var(--v-primary); background: var(--v-primary-soft); border: 1px solid color-mix(in srgb, var(--v-primary) 35%, #fff);
  border-radius: 999px; padding: 2px 7px; white-space: nowrap;
}
.banner-name { font-size: 16px; letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-copy p { margin: 3px 0 0; color: var(--v-muted); font-size: 11px; }
.service-banner.gradient .banner-copy p { color: rgba(255, 255, 255, 0.8); }
.service-banner.gradient .vip-badge { color: #fff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.4); }
.notification-settings-button {
  border: 1px solid var(--v-line); background: rgba(255, 255, 255, 0.86); color: var(--v-text);
  border-radius: 999px; padding: 6px 10px; font-size: 10.5px; display: flex; align-items: center; gap: 4px; flex: none;
}
.service-banner.gradient .notification-settings-button { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.3); }

/* announcement */
.announcement {
  flex: none; display: flex; align-items: center; gap: 7px; padding: 9px 14px;
  background: #fff8e8; color: #8a6416; font-size: 11.5px; border-bottom: 1px solid #f4e3b7;
}
.announcement-icon { flex: none; }
.announcement #announcementText { flex: 1; line-height: 1.5; }
.announcement-label { font-size: 9px; background: rgba(138, 100, 22, 0.1); border-radius: 999px; padding: 1px 6px; flex: none; }
.announcement-close { border: none; background: transparent; color: #a98a45; font-size: 16px; padding: 0 2px; }

.visitor-connection-status {
  flex: none; font-size: 10.5px; color: #8a6416; background: #fff8e8; text-align: center; padding: 5px 10px; border-bottom: 1px solid #f4e3b7;
}

/* messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 18px;
  background:
    radial-gradient(600px 320px at 100% 0%, color-mix(in srgb, var(--v-primary) 8%, transparent), transparent 65%),
    var(--v-bg);
  display: flex;
  flex-direction: column;
  gap: 3px;
  -webkit-overflow-scrolling: touch;
}
.messages-empty { margin: auto; color: var(--v-muted); font-size: 12.5px; line-height: 1.8; text-align: center; }
.date-sep { align-self: center; font-size: 9.5px; color: #98a3b8; background: rgba(255, 255, 255, 0.88); border: 1px solid var(--v-line); padding: 3px 10px; border-radius: 999px; margin: 10px 0 8px; }
.msg-row { display: flex; align-items: flex-start; gap: 8px; max-width: 86%; margin: 5px 0; align-self: flex-start; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.system { align-self: center; max-width: 94%; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; overflow: hidden; background: #eef4ff; }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-row.mine .msg-avatar { display: none; }
.msg-body { min-width: 0; }
.msg-name { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--v-muted); margin: 0 0 3px 2px; }
.msg-name .tag { color: var(--v-primary); background: var(--v-primary-soft); border-radius: 999px; padding: 1px 5px; }
.msg-bubble {
  position: relative;
  background: #fff;
  border: 1px solid #eef1f7;
  border-radius: 3px 15px 15px 15px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 5px 14px rgba(31, 50, 84, 0.045);
}
.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, var(--v-primary), var(--v-primary-2));
  color: #fff;
  border: none;
  border-radius: 15px 3px 15px 15px;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--v-primary) 26%, transparent);
}
.msg-row.system .msg-bubble {
  background: #e9edf5; color: #7e889c; font-size: 11px; border: none; border-radius: 999px;
  padding: 5px 12px; box-shadow: none;
}
.msg-time { font-size: 9px; color: #a1aabd; margin-top: 4px; display: flex; gap: 5px; align-items: center; }
.msg-row.mine .msg-time { color: rgba(255, 255, 255, 0.72); justify-content: flex-end; }
.msg-time .auto { color: var(--v-primary); }
.msg-row.mine .msg-time .auto { color: rgba(255,255,255,0.85); }

.msg-image-grid { display: grid; gap: 3px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 300px; }
.msg-image-grid.single { grid-template-columns: 1fr; }
.msg-image-grid img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; display: block; cursor: pointer; border: 1px solid #e9eef7; }
.msg-row.mine .msg-image-grid img { border-color: rgba(255,255,255,0.25); }
.msg-video { max-width: 320px; }
.msg-video video { width: 100%; border-radius: 12px; display: block; max-height: 260px; background: #000; }
.msg-voice { min-width: 180px; }
.msg-voice audio { height: 30px; max-width: 230px; }
.msg-file { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 200px; }
.msg-file + .msg-file { margin-top: 8px; }
.msg-file .file-icon { width: 36px; height: 40px; border-radius: 8px; background: var(--v-primary-soft); color: var(--v-primary); display: grid; place-items: center; font-size: 9px; font-weight: 800; flex: none; }
.msg-row.mine .msg-file + .msg-file { margin-top: 8px; }
.msg-file .file-icon { background: rgba(255,255,255,0.2); color: #fff; }
.msg-file > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.msg-file .file-name { display: block; font-weight: 600; font-size: 12.5px; line-height: 1.4; word-break: break-all; }
.msg-file .file-size { display: block; font-size: 10px; color: var(--v-muted); margin-top: 2px; }
.msg-row.mine .msg-file .file-size { color: rgba(255,255,255,0.75); }
.msg-call { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.msg-call .call-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--v-primary-soft); color: var(--v-primary); display: grid; place-items: center; font-size: 15px; flex: none; }
.msg-call.missed .call-icon { background: #fdecec; color: var(--v-danger); }
.msg-call .call-title { font-weight: 600; font-size: 12px; }
.msg-call .call-sub { font-size: 10px; color: var(--v-muted); margin-top: 2px; }
.msg-row.mine .msg-call .call-sub { color: rgba(255,255,255,0.75); }
.msg-recalled { color: #98a2b5; font-style: italic; }
.msg-row.mine .msg-recalled { color: rgba(255,255,255,0.75); }

.typing-indicator { align-self: flex-start; display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 10px; color: var(--v-muted); }
.typing-dots { display: flex; gap: 3px; background: #fff; border: 1px solid var(--v-line); border-radius: 12px; padding: 8px 10px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: #b4bed1; animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.35; } 30% { opacity: 1; } }

.scroll-bottom {
  position: absolute; right: 16px; bottom: 118px; z-index: 8;
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.96); border: 1px solid var(--v-line);
  box-shadow: 0 6px 16px rgba(31, 52, 90, 0.12); color: var(--v-muted); font-size: 15px; display: grid; place-items: center;
}

/* composer */
.composer {
  flex: none; background: #fff; border-top: 1px solid var(--v-line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  position: relative; z-index: 4;
}
.typing { font-size: 10.5px; color: var(--v-muted); padding: 0 4px 5px; }
.tool-row { display: flex; align-items: center; gap: 2px; padding: 1px 2px 6px; }
.tool-btn {
  touch-action: none;
  border: none; background: transparent; color: #6e7a92; width: 38px; height: 34px; border-radius: 9px;
  font-size: 17px; display: grid; place-items: center; flex: none;
}
.tool-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn:hover { background: #f4f7fc; color: var(--v-primary); }
.tool-btn:active { background: var(--v-primary-soft); color: var(--v-primary); }
.brand-mark { margin-left: auto; display: flex; align-items: center; gap: 4px; color: var(--v-primary); font-size: 10px; font-weight: 700; }
.brand-mark img { height: 22px; max-width: 110px; object-fit: contain; display: block; }
.brand-text { white-space: nowrap; font-size: 10px; letter-spacing: 0.2px; }
.input-row { display: flex; align-items: flex-end; gap: 8px; }
.input-shell { flex: 1; background: #f7f9fd; border: 1px solid var(--v-line); border-radius: 13px; padding: 2px 6px; }
.input-shell:focus-within { background: #fff; border-color: color-mix(in srgb, var(--v-primary) 45%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--v-primary) 9%, transparent); }
#messageInput {
  width: 100%; border: none; background: transparent; outline: none; resize: none;
  min-height: 42px; max-height: 120px; padding: 10px 8px; font-size: 13.5px; line-height: 1.5;
}
.send-btn {
  border: none; color: #fff; font-weight: 700; border-radius: 12px; padding: 0 18px; height: 44px; flex: none;
  background: linear-gradient(135deg, var(--v-primary), var(--v-primary-2));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--v-primary) 26%, transparent);
}
.send-btn:disabled { opacity: 0.5; box-shadow: none; }
.upload-status { margin: 0 2px 7px; padding: 7px 10px; background: var(--v-primary-soft); border-radius: 9px; }
.upload-status-head { display: flex; justify-content: space-between; font-size: 10px; color: var(--v-muted); }
.upload-track { height: 3px; border-radius: 2px; background: #dfe9f8; margin-top: 5px; overflow: hidden; }
.upload-track span { display: block; height: 100%; width: 0; background: var(--v-primary); transition: width 0.2s; }

/* emoji */
.emoji-panel {
  position: absolute; left: 8px; right: 8px; bottom: 104px; z-index: 12;
  background: #fff; border: 1px solid var(--v-line); border-radius: 16px; box-shadow: 0 16px 44px rgba(31, 52, 90, 0.16);
  padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 230px; overflow-y: auto;
}
.emoji-panel button { border: none; background: transparent; font-size: 21px; padding: 5px 0; border-radius: 8px; }
.emoji-panel button:hover { background: #f4f7fc; }

/* voice */
.voice-hold { position: fixed; inset: 0; z-index: 60; background: rgba(18, 27, 45, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.voice-hold-card {
  width: min(100%, 760px); background: #fff; border-radius: 22px 22px 0 0; padding: 22px 24px calc(26px + env(safe-area-inset-bottom));
  display: flex; gap: 16px; align-items: center; box-shadow: 0 -10px 40px rgba(20, 32, 55, 0.18);
}
.voice-hold-mic { width: 58px; height: 58px; border-radius: 50%; background: var(--v-primary); color: #fff; display: grid; place-items: center; font-size: 22px; flex: none; animation: breathing 1.6s infinite; }
.voice-hold.cancel .voice-hold-mic { background: var(--v-danger); }
@keyframes breathing { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--v-primary) 12%, transparent); } }
.voice-hold-body { flex: 1; min-width: 0; }
.voice-hold-head { display: flex; justify-content: space-between; font-size: 13px; }
.voice-hold-head span { color: var(--v-muted); font-variant-numeric: tabular-nums; }
.voice-live-wave { display: flex; align-items: center; gap: 4px; height: 34px; margin: 8px 0 4px; }
.voice-live-wave i { width: 4px; border-radius: 2px; background: var(--v-primary); animation: wave 0.9s infinite ease-in-out; height: 30%; }
.voice-live-wave i:nth-child(2n) { animation-delay: 0.12s; }
.voice-live-wave i:nth-child(3n) { animation-delay: 0.24s; }
.voice-live-wave i:nth-child(4n) { animation-delay: 0.36s; }
.voice-hold.cancel .voice-live-wave i { background: var(--v-danger); }
@keyframes wave { 50% { height: 100%; } }
.voice-hold-tip { font-size: 10.5px; color: var(--v-muted); }
.voice-hold.cancel .voice-hold-tip { color: var(--v-danger); font-weight: 600; }

/* call */
.call-dialog { position: fixed; inset: 0; z-index: 80; background: rgba(12, 20, 36, 0.62); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 18px; }
.call-card {
  width: min(92vw, 400px); background: linear-gradient(170deg, #1f2c4a, #111a2e); color: #fff;
  border-radius: 26px; padding: 28px 22px 22px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,0.42);
  position: relative; overflow: hidden;
}
.call-avatar-wrap { width: 78px; height: 78px; margin: 0 auto 16px; position: relative; }
.call-avatar { width: 78px; height: 78px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18); display: grid; place-items: center; font-size: 28px; }
.call-live-dot { position: absolute; right: 2px; bottom: 2px; width: 13px; height: 13px; border-radius: 50%; background: #2ed184; border: 3px solid #18233c; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(46,209,132,0.12); } }
.call-kicker { font-size: 9px; letter-spacing: 2px; color: rgba(255,255,255,0.45); }
.call-card h2 { margin: 8px 0 4px; font-size: 20px; }
.call-card #callStatus { color: rgba(255,255,255,0.68); font-size: 12.5px; margin: 0 0 8px; min-height: 18px; }
.call-duration { font-size: 24px; font-weight: 300; letter-spacing: 2px; margin: 8px 0; font-variant-numeric: tabular-nums; }
.call-security { font-size: 10px; color: rgba(255,255,255,0.4); margin-bottom: 12px; }
.call-video-stage { position: relative; border-radius: 16px; overflow: hidden; background: #000; margin: 10px 0 16px; aspect-ratio: 3 / 4; }
.call-remote-video { width: 100%; height: 100%; object-fit: cover; }
.call-local-video { position: absolute; right: 10px; bottom: 10px; width: 82px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.35); background: #111; }
.call-incoming-actions { display: flex; justify-content: center; gap: 48px; margin-top: 18px; }
.call-round { border: none; background: transparent; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10px; }
.call-round span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; }
.call-round.call-reject span { background: var(--v-danger); }
.call-round.call-accept span { background: var(--v-green); }
.call-enable-media { display:block; width:100%; border:none; border-radius:12px; padding:10px 12px; margin:0 0 12px; color:#fff; background:linear-gradient(135deg,var(--v-primary,#2f7ee6),var(--v-primary-2,#5b9bf5)); font-size:11.5px; font-weight:700; box-shadow:0 8px 18px rgba(47,126,230,.25); }
.call-controls { display: flex; justify-content: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.call-control { border: none; background: transparent; color: rgba(255,255,255,0.85); display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 9px; }
.call-control span { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.1); display: grid; place-items: center; font-size: 17px; }
.call-control.danger span { background: var(--v-danger); }

/* image overlay */
.image-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(8, 14, 25, 0.94); display: flex; align-items: center; justify-content: center; padding: 24px; }
.image-overlay img, .image-overlay video { max-width: 94vw; max-height: 88vh; border-radius: 12px; }
.image-overlay video { display: none; }
.image-overlay.video img { display: none; }
.image-overlay.video video { display: block; }
.overlay-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; border: none; background: rgba(255,255,255,0.12); color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 22px; }

/* service state */
.service-state { position: fixed; inset: 0; z-index: 150; background: var(--v-bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.service-card { width: min(92vw, 380px); background: #fff; border: 1px solid var(--v-line); border-radius: 20px; padding: 28px 24px; text-align: center; box-shadow: 0 20px 60px rgba(31, 52, 90, 0.1); }
.service-card h2 { margin: 0 0 8px; font-size: 18px; }
.service-card p { margin: 0; color: var(--v-muted); font-size: 12.5px; line-height: 1.8; }

/* modal */
.modal-root { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) { .modal-root { align-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 30, 50, 0.42); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(100%, 760px); max-height: 86vh; overflow-y: auto; background: #fff;
  border-radius: 20px 20px 0 0; padding: 20px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 50px rgba(20, 32, 55, 0.18); animation: slideUp 0.2s ease;
}
@media (min-width: 600px) { .modal-card { width: min(92vw, 420px); border-radius: 20px; padding: 22px; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; gap: 10px; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head p { margin: 4px 0 0; color: var(--v-muted); font-size: 11.5px; line-height: 1.65; }
.modal-head .icon-btn { margin-left: auto; border: none; background: transparent; color: var(--v-muted); font-size: 20px; width: 32px; height: 32px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn {
  border: 1px solid var(--v-line); background: #fff; border-radius: 11px; padding: 9px 14px; font-size: 12.5px; font-weight: 600;
}
.btn.primary { border: none; color: #fff; background: linear-gradient(135deg, var(--v-primary), var(--v-primary-2)); }
.btn.danger { color: var(--v-danger); border-color: #f2c4c6; }
.btn.block { width: 100%; }
.btn.small { padding: 7px 11px; font-size: 11.5px; }
.notify-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed #eef1f7; }
.notify-row .nr-main { flex: 1; }
.notify-row b { font-size: 12.5px; display: block; }
.notify-row span { font-size: 10.5px; color: var(--v-muted); line-height: 1.5; display: block; margin-top: 2px; }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.switch span { position: absolute; inset: 0; background: #d8e0ee; border-radius: 999px; transition: 0.18s; pointer-events: none; }
.switch span:after { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: 0.18s; }
.switch input:checked + span { background: var(--v-primary); }
.switch input:checked + span:after { transform: translateX(17px); }
.notify-note { font-size: 10.5px; color: var(--v-muted); line-height: 1.7; margin: 12px 0 0; }
.notify-note b { color: var(--v-text); }
.pwa-install { margin-top: 14px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); z-index: 120;
  background: rgba(25, 36, 58, 0.94); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 12px;
  opacity: 0; pointer-events: none; transition: 0.2s; max-width: 82vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: rgba(190, 48, 55, 0.96); }

@media (max-width: 760px) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
}
@media (max-width: 420px) {
  .service-banner { padding: 11px 12px; }
  .banner-avatar { width: 42px; height: 42px; }
  .banner-name { font-size: 15px; }
  .notification-settings-button b { display: none; }
  .notification-settings-button { padding: 7px 9px; }
  .messages { padding: 13px 10px 16px; }
  .msg-row { max-width: 89%; }
  .tool-btn { width: 35px; font-size: 16px; }
  .brand-mark img { height: 19px; max-width: 84px; }
}
@media (max-height: 520px) {
  .service-banner { padding-top: 8px; padding-bottom: 8px; }
  .emoji-panel { max-height: 150px; }
}

/* 手机端通话窗口：限制高度，避免超出屏幕 */
@media (max-width: 640px), (max-height: 720px) {
  .call-dialog { padding: 8px; }
  .call-card {
    width: min(96vw, 380px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    padding: 18px 14px 16px;
    border-radius: 22px;
  }
  .call-avatar-wrap { width: 64px; height: 64px; margin: 0 auto 10px; }
  .call-avatar { width: 64px; height: 64px; font-size: 24px; }
  .call-kicker { font-size: 8px; letter-spacing: 1.5px; }
  .call-card h2 { font-size: 18px; margin: 5px 0 2px; }
  .call-status { font-size: 11.5px; margin-bottom: 4px; }
  .call-duration { font-size: 20px; margin: 4px 0; }
  .call-security { font-size: 9px; margin-bottom: 8px; }
  .call-video-stage { height: min(40dvh, 300px); aspect-ratio: auto; margin: 6px 0 10px; }
  .call-local-video { width: 62px; right: 6px; bottom: 6px; }
  .call-incoming-actions { gap: 38px; margin-top: 10px; }
  .call-round span { width: 48px; height: 48px; font-size: 19px; }
  .call-controls { gap: 10px; margin-top: 10px; }
  .call-control span { width: 40px; height: 40px; font-size: 16px; }
  .call-enable-media { margin-bottom: 8px; padding: 8px 10px; font-size: 10.5px; }
}

/* ===== 全屏通话：视频铺满、语音大屏，不超出手机屏幕 ===== */
.call-overlay, .call-dialog {
  padding: 0 !important;
  background: #0b1220 !important;
}
.call-overlay .call-card, .call-dialog .call-card {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(600px 480px at 50% 0%, rgba(74, 112, 180, 0.5), transparent 70%),
    linear-gradient(165deg, #223552, #0b1220 75%);
}
.call-overlay .call-card > *, .call-dialog .call-card > * { position: relative; z-index: 2; }
.call-overlay .call-card .call-avatar-wrap, .call-dialog .call-card .call-avatar-wrap {
  width: 96px; height: 96px; margin: auto auto 18px;
}
.call-overlay .call-card .call-avatar, .call-dialog .call-card .call-avatar {
  width: 96px; height: 96px; font-size: 34px; background: rgba(255,255,255,0.1);
}
.call-overlay .call-card h3, .call-dialog .call-card h2 { font-size: 24px; margin: 0 0 6px; color: #fff; }
.call-overlay .call-card .call-status, .call-dialog .call-card .call-status,
.call-dialog .call-card #callStatus { font-size: 13px; color: rgba(255,255,255,0.68); margin: 0 0 8px; }
.call-overlay .call-card .call-duration, .call-dialog .call-card .call-duration { font-size: 28px; color: #fff; margin: 4px 0 8px; }
.call-overlay .call-card .call-security, .call-dialog .call-card .call-security { font-size: 10px; color: rgba(255,255,255,0.4); margin-bottom: 10px; }
.call-overlay .call-card .call-controls, .call-dialog .call-card .call-controls {
  margin-top: auto; width: 100%; display: flex; justify-content: center; flex-wrap: wrap;
  gap: 18px; padding-top: 18px; z-index: 3;
}
.call-overlay .call-card .call-control, .call-dialog .call-card .call-control { color: #fff; }
.call-overlay .call-card .call-control span, .call-dialog .call-card .call-control span {
  width: 54px; height: 54px; background: rgba(255,255,255,0.13); font-size: 21px;
}
.call-overlay .call-card .call-control.danger span, .call-dialog .call-card .call-control.danger span { background: #e5484d; }
.call-overlay .call-card .call-incoming-actions, .call-dialog .call-card .call-incoming-actions {
  margin-top: auto; display: flex; justify-content: center; gap: 62px; width: 100%; padding: 24px 0 10px; z-index: 3;
}
.call-overlay .call-card .call-round span, .call-dialog .call-card .call-round span { width: 64px; height: 64px; font-size: 25px; }
.call-overlay .call-card .call-round b, .call-dialog .call-card .call-round b { font-size: 11px; color: #fff; }
.call-overlay .call-card .call-enable-media, .call-dialog .call-card .call-enable-media {
  display: block; width: auto; min-width: 220px; margin: 8px auto 0; padding: 9px 16px;
  font-size: 11.5px; z-index: 4; background: rgba(255,255,255,0.16); box-shadow: none;
  border: 1px solid rgba(255,255,255,0.22); color: #fff;
}
.call-overlay .call-card.audio-mode, .call-dialog .call-card.audio-mode { justify-content: flex-start; }
.call-overlay .call-card.audio-mode .call-avatar-wrap, .call-dialog .call-card.audio-mode .call-avatar-wrap { margin-top: auto; }
.call-overlay .call-card.audio-mode .call-controls, .call-dialog .call-card.audio-mode .call-controls { margin-top: auto; }
.call-overlay .call-card.audio-mode .call-incoming-actions, .call-dialog .call-card.audio-mode .call-incoming-actions { margin-top: auto; }

.call-overlay .call-card.video-mode, .call-dialog .call-card.video-mode {
  padding: 0;
  justify-content: flex-end;
  background: #000;
}
.call-overlay .call-card.video-mode::before, .call-dialog .call-card.video-mode::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 160px; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.7), rgba(0,0,0,0));
}
.call-overlay .call-card.video-mode::after, .call-dialog .call-card.video-mode::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 230px; z-index: 1;
  background: linear-gradient(0deg, rgba(0,0,0,0.75), rgba(0,0,0,0));
}
.call-overlay .call-card.video-mode .call-avatar-wrap,
.call-overlay .call-card.video-mode .call-kicker,
.call-overlay .call-card.video-mode .call-security,
.call-dialog .call-card.video-mode .call-avatar-wrap,
.call-dialog .call-card.video-mode .call-kicker,
.call-dialog .call-card.video-mode .call-security { display: none !important; }
.call-overlay .call-card.video-mode .call-video-stage, .call-dialog .call-card.video-mode .call-video-stage {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0; aspect-ratio: auto; z-index: 0;
}
.call-overlay .call-card.video-mode .call-remote-video, .call-dialog .call-card.video-mode .call-remote-video {
  width: 100%; height: 100%; object-fit: cover;
}
.call-overlay .call-card.video-mode .call-local-video, .call-dialog .call-card.video-mode .call-local-video {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; bottom: auto;
  width: 100px; height: 136px; border-radius: 12px; object-fit: cover; z-index: 4;
  border: 1px solid rgba(255,255,255,0.35); background: #111;
}
.call-overlay .call-card.video-mode h3, .call-dialog .call-card.video-mode h2 {
  position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 16px; right: 128px;
  margin: 0; font-size: 17px; text-align: left; color: #fff; z-index: 3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.call-overlay .call-card.video-mode .call-status, .call-dialog .call-card.video-mode .call-status,
.call-dialog .call-card.video-mode #callStatus {
  position: absolute; top: calc(46px + env(safe-area-inset-top)); left: 16px; right: 128px;
  margin: 0; font-size: 11.5px; text-align: left; color: rgba(255,255,255,0.75); z-index: 3;
}
.call-overlay .call-card.video-mode .call-duration, .call-dialog .call-card.video-mode .call-duration {
  position: absolute; top: calc(68px + env(safe-area-inset-top)); left: 16px; right: 128px;
  margin: 0; font-size: 20px; text-align: left; color: #fff; z-index: 3;
}
.call-overlay .call-card.video-mode .call-enable-media, .call-dialog .call-card.video-mode .call-enable-media {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(108px + env(safe-area-inset-bottom));
  margin: 0; z-index: 4; background: rgba(0,0,0,0.5);
}
.call-overlay .call-card.video-mode .call-controls, .call-dialog .call-card.video-mode .call-controls {
  position: relative; z-index: 3; padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); margin: 0;
}
.call-overlay .call-card.video-mode .call-incoming-actions, .call-dialog .call-card.video-mode .call-incoming-actions {
  position: relative; z-index: 3; padding: 20px 0 calc(22px + env(safe-area-inset-bottom)); margin: 0;
}
@media (min-width: 768px) {
  .call-overlay .call-card.video-mode .call-local-video, .call-dialog .call-card.video-mode .call-local-video {
    width: 140px; height: 190px; top: 22px; right: 22px;
  }
  .call-overlay .call-card.video-mode .call-controls, .call-dialog .call-card.video-mode .call-controls { gap: 26px; }
}
@media (max-width: 400px) {
  .call-overlay .call-card .call-avatar-wrap, .call-dialog .call-card .call-avatar-wrap { width: 82px; height: 82px; }
  .call-overlay .call-card .call-avatar, .call-dialog .call-card .call-avatar { width: 82px; height: 82px; font-size: 28px; }
  .call-overlay .call-card h3, .call-dialog .call-card h2 { font-size: 21px; }
  .call-overlay .call-card .call-controls, .call-dialog .call-card .call-controls { gap: 12px; }
  .call-overlay .call-card .call-control span, .call-dialog .call-card .call-control span { width: 48px; height: 48px; }
  .call-overlay .call-card .call-incoming-actions, .call-dialog .call-card .call-incoming-actions { gap: 48px; }
  .call-overlay .call-card .call-round span, .call-dialog .call-card .call-round span { width: 58px; height: 58px; }
}

/* ===== 通话最小化 ===== */
.call-minimize {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 14px;
  width: 38px; height: 38px; border-radius: 50%; z-index: 6;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.35);
  color: #fff; font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.call-card:not(.video-mode) .call-minimize { background: rgba(255,255,255,0.12); }
.call-overlay.minimized, .call-dialog.minimized { background: transparent !important; pointer-events: none !important; }
.call-overlay.minimized .call-card, .call-dialog.minimized .call-card { opacity: 0 !important; pointer-events: none !important; }
.call-mini-bar {
  position: fixed; right: 14px; bottom: calc(116px + env(safe-area-inset-bottom)); z-index: 75;
  display: flex; align-items: center; gap: 6px; padding: 6px 7px 6px 13px;
  background: rgba(20, 32, 52, 0.95); color: #fff; border-radius: 999px;
  box-shadow: 0 10px 28px rgba(15, 27, 48, 0.28); border: 1px solid rgba(255,255,255,0.12);
}
.call-mini-bar .mini-call-return {
  border: none; background: transparent; color: #fff; display: flex; align-items: center;
  gap: 7px; padding: 0; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.mini-call-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ed184; box-shadow: 0 0 0 4px rgba(46,209,132,0.12); }
.mini-call-hangup { border: none; background: #e5484d; color: #fff; border-radius: 999px; padding: 6px 10px; font-size: 10.5px; font-weight: 600; }
@media (min-width: 981px) {
  .call-mini-bar { bottom: 22px; right: 22px; }
}
@media (max-width: 400px) {
  .call-mini-bar { bottom: calc(110px + env(safe-area-inset-bottom)); right: 10px; }
  .call-mini-bar .mini-call-return { font-size: 11px; }
}

/* 视频模式标题避开左上角最小化按钮 */
.call-overlay .call-card.video-mode h3,
.call-dialog .call-card.video-mode h2,
.call-overlay .call-card.video-mode .call-status,
.call-dialog .call-card.video-mode .call-status,
.call-dialog .call-card.video-mode #callStatus,
.call-overlay .call-card.video-mode .call-duration,
.call-dialog .call-card.video-mode .call-duration { left: 62px; }

/* ===== 最小化：彻底移除遮罩模糊 + 右上角汉字按钮 ===== */
.call-overlay.minimized, .call-dialog.minimized {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none !important;
}
.call-overlay.minimized .call-card, .call-dialog.minimized .call-card {
  opacity: 0 !important;
  pointer-events: none !important;
}
.call-minimize {
  left: auto !important;
  right: 14px !important;
  top: calc(14px + env(safe-area-inset-top)) !important;
  width: auto !important;
  min-width: 68px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.call-card:not(.video-mode) .call-minimize {
  background: rgba(255, 255, 255, 0.14);
}
/* 视频小窗放到最小化按钮下方，避免重叠 */
.call-overlay .call-card.video-mode .call-local-video,
.call-dialog .call-card.video-mode .call-local-video {
  top: calc(56px + env(safe-area-inset-top));
  right: 14px;
}
@media (min-width: 768px) {
  .call-minimize { right: 22px !important; top: 22px !important; }
  .call-overlay .call-card.video-mode .call-local-video,
  .call-dialog .call-card.video-mode .call-local-video { top: 66px; right: 22px; }
}

/* 修复：全屏卡片直接子元素的 relative 规则覆盖了最小化按钮定位 */
.call-overlay .call-card > .call-minimize,
.call-dialog .call-card > .call-minimize {
  position: absolute !important;
  left: auto !important;
  right: 14px !important;
  top: calc(14px + env(safe-area-inset-top)) !important;
  z-index: 8 !important;
}
@media (min-width: 768px) {
  .call-overlay .call-card > .call-minimize,
  .call-dialog .call-card > .call-minimize { right: 22px !important; top: 22px !important; }
}
