:root {
  color-scheme: dark;
  --wechat-header: #111111;
  --wechat-panel: #191919;
  --wechat-assistant: #2b2c30;
  --wechat-green: #3eb573;
}

.voice-settings-form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.voice-settings-form label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  color: var(--text);
  font-size: 14px;
}

.voice-settings-form output {
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

.voice-settings-form input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--red);
}

.voice-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.voice-settings-actions .primary,
.voice-settings-actions .secondary-button {
  width: auto;
  min-width: 92px;
  margin-top: 0;
  border-radius: 9px;
  padding: 11px 18px;
}

.sidebar-connection {
  margin: -27px 0 28px 55px;
}

.sidebar-action b {
  font-weight: 400;
}

.mobile-menu-float {
  position: fixed;
  z-index: 3;
  top: calc(10px + env(safe-area-inset-top));
  left: 10px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: #ddd;
  background: rgba(24, 24, 24, .72);
  backdrop-filter: blur(8px);
}

.mobile-menu-float svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
}

.character-calendar {
  margin-top: 20px;
}

.calendar-navigation {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-navigation strong {
  text-align: center;
  font-size: 15px;
  font-weight: 500;
}

.calendar-navigation button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #d7c5ca;
  background: #ffffff08;
  font-size: 26px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-weekday {
  padding: 5px 0 8px;
  text-align: center;
  color: #806f78;
  font-size: 10px;
}

.calendar-grid button {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #cfc5c8;
  font-size: 12px;
}

.calendar-grid button:not(:disabled)::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #a86270;
  transform: translateX(-50%);
}

.calendar-grid button.selected {
  color: #fff;
  background: #8c4352;
}

.calendar-grid button.today {
  box-shadow: inset 0 0 0 1px #c08a95;
}

.calendar-grid button:disabled {
  color: #51494d;
}

.character-calendar h3 {
  margin: 24px 0 14px;
  color: #d9c6c8;
  font-size: 14px;
  font-weight: 500;
}

.schedule-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.schedule-list li {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid #ffffff0a;
}

.schedule-list time {
  padding-top: 1px;
  color: #a56d78;
  font: 11px ui-monospace, monospace;
}

.schedule-list strong,
.schedule-list span {
  display: block;
}

.schedule-list strong {
  margin-bottom: 5px;
  color: #e4d9db;
  font-size: 12px;
  font-weight: 500;
}

.schedule-list span {
  color: #94878c;
  font-size: 11px;
  line-height: 1.7;
}

.schedule-status {
  display: inline-flex;
  width: max-content;
  margin-top: 7px;
  padding: 2px 7px;
  border: 1px solid rgba(188, 115, 127, .3);
  border-radius: 999px;
  color: rgba(240, 236, 234, .58);
  font-size: 10px;
}

.schedule-status.done {
  color: #d9b3b9;
  border-color: rgba(188, 115, 127, .48);
}

.schedule-list li:has(.schedule-status.planned) {
  opacity: .66;
}

html,
body {
  background: #111;
}

main {
  background: #111;
}

.chat-header {
  height: 72px;
  position: relative;
  justify-content: center;
  padding: 0 22px;
  gap: 8px;
  border-color: #ffffff0a;
  background: var(--wechat-header);
}

.header-person {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.header-person h1 {
  margin: 0;
  color: #ededed;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
}

.connection {
  width: 1px;
  height: 1px;
  position: absolute;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
}

.chat-header .call-button {
  margin-left: auto;
}

.chat-header .icon-button {
  color: #e5e5e5;
  border-radius: 6px;
}

.chat-header .icon-button:hover {
  background: #ffffff0b;
}

.chat-header .export-button svg circle {
  fill: currentColor;
  stroke: none;
}

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 32px;
  background-image:
    linear-gradient(rgba(8, 8, 8, .48), rgba(5, 5, 5, .62)),
    var(--chat-background-image, url('/chat-background-opt.jpg'));
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  scroll-behavior: auto;
}

.chat-settings-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.chat-settings-form label {
  display: grid;
  gap: 8px;
  color: #bdb3b7;
  font-size: 12px;
}

.chat-settings-form input[type="text"],
.chat-settings-form input[type="file"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ffffff14;
  border-radius: 8px;
  color: #eee;
  background: #19191b;
}

.background-preview {
  height: 130px;
  border: 1px solid #ffffff12;
  border-radius: 10px;
  background-image: linear-gradient(#0005, #0005), var(--preview-image, url('/chat-background-opt.jpg'));
  background-size: cover;
  background-position: center;
}

.chat-settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chat-settings-actions button {
  margin: 0;
}

.messages {
  width: 100%;
  max-width: 900px;
  margin: auto auto 0;
  padding: 30px 0 0;
}

.load-older-row {
  display: flex;
  justify-content: center;
  padding: 8px 0 22px;
}

.load-older-row button {
  padding: 7px 13px;
  border-radius: 15px;
  color: #b9b3b6;
  background: #1111119c;
  font-size: 11px;
}

.date-divider {
  width: max-content;
  max-width: 80%;
  margin: 9px auto 26px;
  padding: 4px 9px;
  border-radius: 4px;
  color: #d3d3d3;
  background: #11111173;
  font-size: 10px;
  letter-spacing: 0;
  backdrop-filter: blur(8px);
}

.message {
  gap: 11px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.message:last-child {
  margin-bottom: 20px;
}

.message.message-reveal {
  animation: message-reveal .22s ease-out both;
  animation-delay: var(--message-delay, 0ms);
}

@keyframes message-reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.assistant,
.message.user {
  padding: 0;
}

.message .avatar.chat-avatar {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0;
  flex: 0 0 42px;
  border: 0;
  border-radius: 5px;
  object-fit: cover;
  background: #222;
}

.message .user-chat-avatar {
  padding: 0;
  object-fit: cover;
  background: #2b2c30;
}

.bubble-wrap {
  max-width: min(72%, 620px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message.user .bubble-wrap {
  align-items: flex-end;
}

.bubble {
  min-height: 42px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 9px 13px;
  border: 0;
  border-radius: 14px;
  color: #f1f1f1;
  background: var(--wechat-assistant);
  font-size: 16px;
  line-height: 1.55;
  box-shadow: 0 1px 2px #0002;
}

.message-text {
  display: block;
}

.quoted-message {
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 6px 9px;
  border: 0;
  border-radius: 4px;
  color: #a9a9a9;
  background: #29292b;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px #0002;
}

.message-translation {
  width: 100%;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid #ffffff16;
  color: #bab3b7;
  font-size: 12px;
  line-height: 1.55;
}

.quote-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 47px 9px;
  padding: 3px 4px 7px;
  border-bottom: 1px solid #ffffff16;
  background: transparent;
}

.quote-preview span {
  display: block;
  min-width: 0;
  flex: 1;
  color: #aaa3a7;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-preview button {
  width: 28px;
  height: 28px;
  color: #aaa3a7;
  font-size: 21px;
}

.message-popover {
  position: fixed;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 9px 8px;
  border: 1px solid #ffffff12;
  border-radius: 10px;
  background: #3a3a3c;
  box-shadow: 0 8px 30px #0008;
}

.message-popover::after {
  content: '';
  position: absolute;
  left: var(--arrow-x);
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #3a3a3c;
  transform: translateX(-50%) rotate(45deg);
}

.message-popover.below::after {
  top: -7px;
  bottom: auto;
}

.message-popover button {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 6px 3px;
  color: #eee;
}

.message-popover button + button {
  border-left: 1px solid #ffffff0d;
}

.message-popover svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 4px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-popover span {
  display: block;
  font-size: 11px;
  white-space: nowrap;
}

.selection-toolbar {
  min-height: 50px;
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 8px;
}

.selection-toolbar span {
  text-align: center;
  color: #b9b0b4;
  font-size: 13px;
}

.selection-toolbar button {
  height: 38px;
  border-radius: 9px;
  color: #ddd5d8;
  background: #ffffff0a;
}

.selection-toolbar .selection-delete {
  color: #f1c8ce;
  background: #7d3541;
}

.selection-mode .message {
  position: relative;
}

.selection-mode .message::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 11px;
  width: 19px;
  height: 19px;
  border: 1px solid #8c8589;
  border-radius: 50%;
  background: #19191b;
  z-index: 3;
}

.selection-mode .message.selected::before {
  border-color: #a45161;
  background: radial-gradient(circle, #fff 0 3px, #9a4858 4px 100%);
}

.assistant .bubble::before,
.user .bubble::after {
  content: none;
}

.assistant .bubble::before {
  left: -7px;
  border-right: 8px solid var(--wechat-assistant);
}

.assistant .bubble {
  border-top-left-radius: 5px;
}

.user .bubble {
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  forced-color-adjust: none;
  color-scheme: only light;
  text-shadow: none;
  filter: none;
  mix-blend-mode: normal;
  background: var(--wechat-green);
  border-top-right-radius: 5px;
}

.user .bubble .message-text {
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  forced-color-adjust: none;
}

.user .bubble::after {
  right: -7px;
  border-left: 8px solid var(--wechat-green);
}

.message time {
  display: none;
}

.message-error {
  margin: 5px 2px 0;
  padding: 4px 7px;
  border-radius: 4px;
  color: #ffd1ce;
  background: #4f2020b8;
}

.pending-dots {
  padding: 6px 2px;
}

.pending-dots i {
  background: #bcbcbc;
}

.bubble.voice-bubble {
  min-height: 42px;
}

.bubble.image-bubble {
  min-height: 0;
  max-width: min(310px, 62vw);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.assistant .bubble.image-bubble::before,
.user .bubble.image-bubble::after {
  content: none;
}

.chat-image {
  display: block;
  width: min(240px, 60vw);
  height: auto;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  cursor: zoom-in;
}

.image-viewer {
  position: fixed;
  z-index: 50;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  border-radius: 0;
  background: #000e;
  cursor: zoom-out;
}

.image-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.voice-play {
  height: 42px;
  margin: -9px -13px;
  color: #07140c;
}

.composer-area {
  max-width: none;
  flex-shrink: 0;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #ffffff0a;
  background: var(--wechat-panel);
}

.typing {
  height: 19px;
  padding-left: 48px;
  color: #9b9b9b;
}

.typing:empty {
  display: none;
}

.composer {
  min-height: 50px;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.composer:focus-within {
  border: 0;
}

.composer textarea {
  min-height: 42px;
  max-height: 120px;
  padding: 9px 12px;
  border-radius: 6px;
  color: #ededed;
  background: #29292b;
  font-size: 16px;
  line-height: 1.5;
  overflow-y: auto;
  scrollbar-width: none;
}

.composer textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.composer textarea::placeholder {
  color: #737373;
}

.composer button,
.composer .voice-input {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #e7e7e7;
  background: transparent;
}

.composer button:hover,
.composer .voice-input:hover {
  background: #ffffff0b;
}

.composer #send {
  width: auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 5px;
  color: white;
  background: #07c160;
  font-size: 13px;
}

.composer #send:hover {
  background: #12b85d;
}

.composer .attachment-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
}

.composer .attachment-toggle svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.5;
}

.attachment-panel {
  display: flex;
  min-height: 112px;
  margin: 8px -18px -14px;
  padding: 16px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #ffffff0a;
  background: #202022;
}

.attachment-item {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #bdbdbd;
  font-size: 12px;
}

.attachment-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #dedede;
  background: #303033;
}

.attachment-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer .voice-hold {
  height: 42px;
  border-radius: 6px;
  color: #ededed;
  background: #29292b;
  border-color: #ffffff08;
}

.composer .voice-hold:hover {
  background: #313133;
}

.composer .voice-hold.recording {
  background: #3a3a3d;
}

.composer-footnote {
  display: none;
}

.welcome {
  color: #f0f0f0;
  text-shadow: 0 2px 16px #000;
}

.welcome p,
.welcome-kicker {
  color: #c3c3c3;
}

.suggestions button {
  color: #e5e5e5;
  border-color: #ffffff20;
  background: #16161699;
  backdrop-filter: blur(8px);
}

.sidebar,
dialog,
.pair-screen {
  color-scheme: dark;
}

.access-screen {
  z-index: 11;
}

@media (max-width: 600px), (pointer: coarse) and (max-width: 1200px) {
  .date-divider,
  .mobile-menu-float {
    backdrop-filter: none;
  }
  .chat-header {
    height: calc(60px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
  }

  .chat-header .icon-button {
    width: 36px;
    height: 36px;
  }

  .header-person h1 {
    font-size: 18px;
  }

  .timeline {
    padding: 0 12px;
    background-position: center top;
  }

  .messages {
    padding: 23px 0 0;
  }

  .message {
    gap: 9px;
    margin-bottom: 17px;
  }

  .message:last-child {
    margin-bottom: 17px;
  }

  .message .avatar.chat-avatar {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .bubble-wrap {
    max-width: calc(100% - 98px);
  }

  .bubble {
    min-height: 46px;
    padding: 10px 14px;
    font-size: 18px;
  }

  .quoted-message {
    font-size: 14px;
  }

  .message-translation {
    font-size: 13px;
  }

  .quote-preview span,
  .message-popover span {
    font-size: 12px;
  }

  .assistant .bubble::before,
  .user .bubble::after {
    top: 12px;
  }

  .composer-area {
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  }

  .typing {
    height: 17px;
    padding-left: 45px;
  }

  .composer textarea {
    min-height: 46px;
    font-size: 18px;
  }

  .attachment-panel {
    min-height: 108px;
    margin: 6px -10px calc(-6px - env(safe-area-inset-bottom));
    padding: 15px 17px calc(10px + env(safe-area-inset-bottom));
  }

  .bubble.image-bubble {
    max-width: min(280px, 64vw);
  }

  .chat-image {
    max-height: 310px;
  }
}
