@font-face {
  font-family: "Lexend Deca";
  src: url("../resources/fonts/LexendDeca-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
}

@font-face {
  font-family: "Questrial";
  src: url("../resources/fonts/Questrial-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Roboto";
  src: url("../resources/fonts/Roboto-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Special Gothic Expanded One";
  src: url("../resources/fonts/SpecialGothicExpandedOne-Regular.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: 100;
  src: url("../resources/icons/MaterialIconsRound-Regular.otf")
    format("opentype");
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: 100;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 1, "wght" 100, "GRAD" 100, "opsz" 40;
}

:root {
  --safe-area-inset-bottom: env(safe-area-inset-bottom);
  --primary: #fc918c;
  --primary-dark: #e4746f;
  --card: #ffffff;
  --border: #e2e8f0;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --accent: #fde8e7;
  --shadow: 0 0px 5px rgba(0, 0, 0, 0.055);
  --message-user: #ffd1cf;
  --border-radius: 20px;
  --mgs-input: #fafafa;
  --mgs-input-textcolor: #000;
  --call-accept-btn: #333333;
  --powered-by: #555;
  --error: #e74c3c;
  --light-bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cdefs%3E%3Cpattern id='bgPattern' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Crect width='40' height='40' fill='%23f0f2f5'/%3E%3Cpath d='M0 0 L40 40 M40 0 L0 40' stroke='%23e2e8f0' stroke-width='1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23bgPattern)'/%3E%3C/svg%3E");
}

[data-theme="dark"] {
  --primary: #fc918c;
  --primary-dark: #e4746f;
  --card: #282828;
  --border: #3f3f3f;
  --text-dark: #d2d2d2;
  --text-light: #a0a0a0;
  --accent: #4a4a4a;
  --shadow: 0 0px 5px rgba(82, 82, 82, 0.055);
  --message-user: #4a4a4a;
  --mgs-input: #333333;
  --mgs-input-textcolor: #fff;
  --call-accept-btn: #fafafa;
  --powered-by: #bebebe;
  --error: #e74c3c;
  --dark-bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cdefs%3E%3Cpattern id='bgPattern' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Crect width='40' height='40' fill='%231f1f1f'/%3E%3Cpath d='M0 0 L40 40 M40 0 L0 40' stroke='%232b2b2b' stroke-width='1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23bgPattern)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100dvh;
}

body {
  font-family: "Roboto", sans-serif;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-dark);
  overflow: hidden;
  padding: 0 5px;
  background-image: var(--light-bg-pattern);
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body[data-theme="dark"] {
  background-image: var(--dark-bg-pattern);
}

#anonymous-login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100dvh;
  width: 100%;
  padding: 20px;
}

.login-container {
  background-color: var(--card);
  padding: 0 2rem 2rem 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-container__logo {
  position: relative;
  top: -27px;
  width: 77px;
  height: 77px;
}

.form-group {
  margin-bottom: 0.7rem;
  text-align: left;
}

.form-group__label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-light);
  font-size: 0.6rem;
}

.form-group__input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  border-top-left-radius: 0px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  background: var(--mgs-input);
  color: var(--mgs-input-textcolor);
}

.form-group__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(252, 145, 140, 0.15);
}

.form-group__input[type="date"] {
  color: var(--text-light);
}

.form-group__input[type="date"]:focus,
.form-group__input[type="date"]:valid {
  background: var(--mgs-input);
  color: var(--mgs-input-textcolor);
}

#loginButton {
  background-color: var(--primary);
  color: white;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  transition: background-color 0.2s ease, transform 0.2s;
  box-shadow: var(--shadow);
  width: 100%;
  font-weight: 500;
  margin-top: 0.6rem;
  height: 45px;
}

#loginButton:hover {
  background-color: var(--primary-dark);
}

#loginButton:disabled {
  background-color: var(--border);
  color: var(--text-light);
  cursor: not-allowed;
}

#loginButton:active {
  transform: scale(0.98);
}

.previous-user {
  margin-top: 1rem;
  color: var(--text-light);
  font-size: 0.7rem;
  text-align: center;
}

.previous-user__link {
  color: var(--primary);
  text-decoration: none;
}

.previous-user__link:hover {
  text-decoration: underline;
}

#chat-screen,
#about-screen {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
}

#about-screen {
  display: visible;
}

header {
  background: var(--card);
  color: var(--text-light);
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--border-radius);
  position: relative;
  width: 100%;
  margin: 6px auto;
}

header i {
  color: white;
  font-size: 1.25rem;
}

header img {
  width: 36px;
  height: 36px;
}

#header-title {
  font-weight: bold;
  color: var(--text-dark);
}

.theme-button {
  position: absolute;
  right: 0.9rem;
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
  box-shadow: var(--shadow);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  text-decoration: none;
}

.theme-button:hover {
  background-color: var(--primary-dark);
}

#inbox-button {
  right: 3.5rem;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message {
  max-width: 80%;
  padding: 0.8rem 1.2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  animation: fadeInUp 0.2s ease-out;
  font-size: 0.95rem;
  word-break: break-word;
  line-height: 1.4;
  position: relative;
}

.message-header {
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 0.85em;
}

.message-content {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
}

.message-received {
  background: var(--accent);
  align-self: flex-start;
  border-bottom-left-radius: 0;
}

.message-sent {
  background: var(--message-user);
  align-self: flex-end;
  border-bottom-right-radius: 0;
}

.message-system {
  align-self: center;
  background-color: var(--border);
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--border-radius);
  text-align: center;
  max-width: 90%;
}

.message-ai {
  background: var(--accent);
  align-self: flex-start;
  border-bottom-left-radius: 0;
  border: 1px dashed var(--primary);
}

.official-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  z-index: 1;
}
.official-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

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

.input-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 auto 0.5rem auto;
  padding: 0 1rem;
  border-radius: var(--border-radius);
}

.input-area {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  z-index: 10;
  position: relative;
  width: 100%;
  border-radius: var(--border-radius);
}

input[type="text"] {
  min-width: 45px;
}

#message-form {
  border-radius: var(--border-radius);
}

#reply-preview-area + #message-form {
  border-top: none;
}

.actions-container {
  position: relative;
}
.actions-popup {
  position: absolute;
  bottom: 59px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 9px;
  z-index: 13;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  border: 1px solid var(--border);
}
.actions-popup.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.action-btn {
  background: var(--accent);
  color: var(--text-dark);
  border: none;
  border-radius: 10px;
  padding: 9px;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  white-space: nowrap;
  transition: background-color 0.2s;
}
.action-btn:hover {
  background-color: var(--border);
}
#add-button {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.5rem;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#add-button.active {
  transform: rotate(45deg);
  color: var(--primary);
}
#add-button:hover {
  color: var(--text-dark);
}

#message-input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  background: var(--mgs-input);
  color: var(--mgs-input-textcolor);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.4;
}

#message-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#send-btn {
  border: none;
  background: var(--primary);
  color: white;
  padding: 0.7rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color 0.2s ease;
  box-shadow: var(--shadow);
}

#send-btn:hover {
  background-color: var(--primary-dark);
}

#messages::-webkit-scrollbar,
#favoritesPanel::-webkit-scrollbar,
#inbox-panel::-webkit-scrollbar,
#gifContent::-webkit-scrollbar {
  width: 0px;
}
#messages::-webkit-scrollbar-track,
#favoritesPanel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}
#messages::-webkit-scrollbar-thumb,
#favoritesPanel::-webkit-scrollbar-thumb,
#inbox-panel::-webkit-scrollbar-thumb,
#gifContent::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
#messages::-webkit-scrollbar-thumb:hover,
#favoritesPanel::-webkit-scrollbar-thumb:hover,
#inbox-panel::-webkit-scrollbar-thumb:hover,
#gifContent::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

#favoritesPanel,
#inbox-panel,
#gifPanel {
  position: absolute;
  bottom: calc(var(--input-height, 0px) + env(safe-area-inset-bottom) + 17px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  z-index: 11;
  width: calc(100% - 10px);
  max-width: 500px;
  height: auto;
  max-height: 40vh;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  display: flex;
  flex-direction: column;
}

#favoritesPanel.active,
#inbox-panel.active,
#gifPanel.active {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.6rem;
  width: 100%;
}

.favorite-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background-color: var(--mgs-input);
}

.favorite-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.favorite-item:hover img {
  transform: scale(1.1);
}

.favorites-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100px;
  color: var(--text-light);
  font-size: 0.9rem;
}

.favorites-empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.favorite-star-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.3);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
  z-index: 2;
}
.message-image-container:hover .favorite-star-btn {
  opacity: 1;
}
.favorite-star-btn.is-favorite {
  background-color: #ffc107;
}

.inline-emoji-merge {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin: 0 2px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
#modalTitle {
  margin-bottom: 9px;
}
.modal-content {
  background-color: var(--card);
  color: var(--text-dark);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 90%;
  width: 400px;
}
.modal-content p {
  word-break: break-all;
}
.modal-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}
.modal-buttons button.confirm {
  background-color: var(--primary);
  color: white;
}
.modal-buttons button.confirm:hover {
  background-color: var(--primary-dark);
}
.modal-buttons button.cancel {
  background-color: var(--border);
  color: var(--text-light);
}
.modal-buttons button.cancel:hover {
  background-color: #d1d5db;
}
.modal-buttons button.disabled {
  background-color: var(--border);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.7;
}

.modal-warning-text {
  word-break: normal;
}

#modalCheckboxContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 15px;
  gap: 8px;
}
#modalCheckbox {
  width: 18px;
  height: 18px;
}

.message-image-container {
  margin-bottom: 8px;
  max-width: 250px;
  overflow: hidden;
  position: relative;
}
.message-image {
  max-width: 100%;
  display: block;
  height: auto;
  cursor: default;
  border-radius: 15px;
}

.message-file-container {
  display: flex;
  align-items: center;
  background-color: transparent;
  padding: 10px;
  border-radius: 10px;
  margin-top: 5px;
  max-width: 280px;
}
.message-file-icon {
  font-size: 2rem;
  margin-right: 12px;
  color: var(--text-light);
}
.message-file-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.message-file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-file-download-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 4px 17px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 4px;
  transition: background-color 0.2s;
  align-self: flex-start;
}
.message-file-download-btn:hover {
  background-color: var(--primary-dark);
}

.audio-jukehost-lg {
  position: relative;
  top: -33px;
  text-align: center;
  width: auto;
  font-size: 11px;
  opacity: 0.3;
}

.custom-audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  margin-top: 8px;
  padding: 8px 12px;
}

.play-pause-btn {
  background: var(--primary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.2s;
}
.play-pause-btn:hover {
  background-color: var(--primary-dark);
}
.audio-progress-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  margin-top: auto;
}
.seek-slider {
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 5px;
  position: relative;
  width: 100%;
  height: 5px;
  outline: none;
}
.seek-slider:focus {
  outline: none;
}
.seek-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 3px;
}
.seek-slider::before {
  content: "";
  height: 5px;
  width: var(--seek-before-width, 0%);
  background-color: var(--primary);
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  cursor: pointer;
}
.seek-slider::-moz-range-progress {
  background-color: var(--primary);
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  height: 5px;
}
.seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 15px;
  width: 15px;
  background: var(--primary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  margin-top: -4.7px;
}
.seek-slider::-moz-range-thumb {
  height: 15px;
  width: 15px;
  background: var(--primary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 3;
  box-sizing: border-box;
}
.audio-time-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
  padding: 0 2px;
  margin-top: 7px;
}

a.social-link {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 5px;
  transition: background-color 0.2s;
}
a.social-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
body[data-theme="dark"] a.social-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

a.social-link i {
  margin-right: 1px;
  font-size: 1.1em;
}

.subtle-note {
  font-size: 0.85em;
  font-weight: normal;
  color: var(--primary-dark);
  opacity: 0.65;
  margin-left: 0.3em;
}

#context-menu {
  position: absolute;
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  background: var(--card);
  box-shadow: var(--shadow);
  z-index: 9995;
  padding: 7px;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  gap: 3px;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  border: 1px solid var(--border);
  overflow: visible;
  box-sizing: border-box;
  visibility: hidden;
}

#context-menu button {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  margin: 1.5px;
  background: var(--accent);
  color: var(--text-dark);
  border: none;
  border-radius: 15px;
  padding: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s;
  min-width: 40px;
  max-width: 40px;
  max-height: 40px;
  min-height: 40px;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.call-notification-panel {
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background-color: var(--card);
  padding: 12px 16px;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  width: 79dvw;
  max-width: 600px;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.7s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s,
    visibility 0s 0.4s, top 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.call-notification-panel.visible {
  top: 20px;
  opacity: 1;
  visibility: visible;
  transition: transform 0.7s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s,
    visibility 0s, top 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.caller-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
.caller-info i {
  font-size: 40px;
}

.caller-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.caller-name {
  font-weight: 500;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-timer {
  font-size: 0.85em;
  color: var(--text-light);
  margin-top: 2px;
  display: none;
}
.call-actions {
  display: flex;
  gap: 10px;
}
.call-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  margin: 1.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--call-accept-btn);
  font-size: 1.1rem;
  transition: opacity 0.3s;
}
.call-action-btn:active {
  transform: scale(0.9);
}
.accept-btn {
  background-color: transparent;
}
.decline-btn {
  background-color: var(--primary);
}
.decline-btn:hover {
  background-color: var(--primary-dark);
}
.call-notification-panel.in-call .call-timer {
  display: block;
}
.call-notification-panel.in-call .accept-btn {
  opacity: 0;
  padding: 0;
  margin-right: -10px;
  pointer-events: none;
  transition: opacity 0.3s;
}

#declineCallBtn {
  color: #fafafa;
}

#reply-preview-area {
  display: none;
  padding: 8px 12px;
  background-color: var(--accent);
  border-radius: 12px 12px 0 0;
  margin: 0 auto;
  width: calc(100% - 32px);
  border: 2.3px solid var(--card);
  border-bottom: 0px;
  position: relative;
  font-size: 0.85rem;
}

#reply-preview-content {
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 25px;
}

#reply-preview-content strong {
  color: var(--primary);
}

#cancel-reply-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.2rem;
}

.message-reply-container {
  background-color: rgba(0, 0, 0, 0.04);
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  border-left: 3px solid var(--primary);
  font-size: 0.9em;
  opacity: 0.85;
}

body[data-theme="dark"] .message-reply-container {
  background-color: rgba(255, 255, 255, 0.06);
}

.message-reply-sender {
  font-weight: 700;
  color: var(--primary);
  display: block;
  margin-bottom: 2px;
}

.message-reply-content {
  color: var(--text-light);
  word-break: break-word;
}
.message-reply-container i.fa-reply {
  margin-right: 6px;
  font-size: 0.9em;
}

#inbox-button.has-notification::after {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 15px;
  height: 15px;
  background-color: #ff2115e9;
  border-radius: 50%;
  animation: fadeInOut 1.7s ease-in-out infinite;
}

@keyframes fadeInOut {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}

.inbox-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.inbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}
.inbox-item:last-child {
  border-bottom: none;
}

.inbox-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  margin-right: 10px;
}

.inbox-item-sender {
  font-weight: 500;
  color: var(--text-dark);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-item-file {
  font-size: 0.85rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-item-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.inbox-accept-btn,
.inbox-decline-btn {
  background-color: var(--accent);
  border: 1px solid var(--border);
  color: var(--text-dark);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.inbox-accept-btn:hover {
  background-color: #4caf50;
  color: white;
  border-color: #4caf50;
}
.inbox-decline-btn:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.custom-video-container {
  position: relative;
  width: 100%;
  max-width: 280px;
  border-radius: 15px;
  overflow: hidden;
  margin-top: 8px;
  background-color: #000;
  border: 2.7px solid var(--primary);
}

.custom-video-container video {
  width: 100%;
  display: block;
  border-radius: 15px;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.custom-video-container:hover .video-controls {
  opacity: 1;
}

.video-controls.visible {
  opacity: 1;
}

.video-progress-bar {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  border-radius: 2px;
}

.video-progress-filled {
  width: 0;
  height: 100%;
  background-color: var(--primary);
  border-radius: 2px;
}

.video-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.video-left-controls,
.video-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-play-pause-btn,
.video-fullscreen-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.video-time-display {
  color: white;
  font-size: 0.75rem;
  font-family: "Roboto Mono", monospace;
}

.birthday-countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
}

.birthday-countdown-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#countdown-number {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
  font-size: 45vmin;
  animation: scale-in 0.8s ease-out forwards;
}

@keyframes scale-in {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

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

.message-deleting {
  animation: fadeOut 0.23s ease-out forwards;
}

.message-system-group {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  user-select: none;
}

.message-system-group.is-grouped .system-group-icon {
  display: inline-block;
}

.system-group-content {
  flex-grow: 1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-group-counter {
  margin-left: 5px;
  font-size: 0.8em;
  color: var(--text-light);
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: bold;
  display: none;
}

.message-system-group.is-grouped .system-group-counter {
  display: inline-block;
}

.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
  cursor: grab;
}
.image-preview-overlay.zoomed {
  cursor: zoom-out;
}
.image-preview-overlay.panning {
  cursor: grabbing;
}
.image-preview-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.image-preview-content {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  transform: scale(0.8);
  transition: transform 0.3s ease;
  transform-origin: center center;
  will-change: transform;
}

.image-preview-overlay.visible .image-preview-content {
  transform: scale(1);
}

.image-preview-actions {
  position: absolute;
  top: 15px;
  z-index: 1301;
  display: flex;
  gap: 10px;
  width: 100%;
}

.image-preview-button {
  position: absolute;
  color: white;
  z-index: 9998;
  font-weight: bold;
  cursor: pointer;
  background-color: transparent;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0;
}

#image-preview-favorite .fa-solid.fa-star {
  color: #f1c40f;
}

#image-preview-close {
  font-size: 26px;
  right: 15px;
}

#image-preview-favorite {
  font-size: 23px;
  left: 15px;
}

#gifPanel {
  padding: 0;
}

#gifPanelHeader {
  padding: 0.8rem;
  flex-shrink: 0;
}

#gifSearchInput {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--mgs-input);
  color: var(--mgs-input-textcolor);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#gifSearchInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(252, 145, 140, 0.15);
}

#gifContent {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0 0.8rem 0.8rem 0.8rem;
}

#gifContent .favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.6rem;
  width: 100%;
}

#gifContent .favorite-item {
  background-color: var(--border);
}

.gif-powered-by {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100px;
  color: var(--text-light);
  opacity: 0.7;
}
.gif-powered-by svg {
  width: clamp(5rem, 6vw, 7rem);
  height: auto;
}

.gif-powered-by svg,
.gif-powered-by path,
.gif-powered-by text {
  fill: currentColor;
}

.settings-menu-back {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 1rem;
}

.settings-menu-back.visible {
  opacity: 1;
  visibility: visible;
}

.settings-menu-content {
  background-color: var(--card);
  color: var(--text-dark);
  padding: 1.5rem 2rem;
  border-radius: var(--border-radius);
  position: relative;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.settings-menu-back.visible .settings-menu-content {
  transform: scale(1);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.settings-header h2 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 500;
  color: var(--text-dark);
}

.settings-close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
  transition: color 0.2s ease, transform 0.2s ease;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-item.vertical {
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.settings-item label {
  font-size: 0.95rem;
  color: var(--text-dark);
}

.setting-options-group {
  display: flex;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--mgs-input);
}

.option-btn {
  flex: 1;
  padding: 0.6rem 0.5rem;
  background-color: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.option-btn:last-child {
  border-right: none;
}

.option-btn:hover {
  background-color: var(--accent);
  color: var(--text-dark);
}

.option-btn.active {
  background-color: var(--primary);
  color: white;
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus-visible + .slider {
  box-shadow: 0 0 0 3px var(--accent);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.settings-action-button {
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

.settings-action-button:hover {
  background-color: var(--primary-dark);
}

.settings-icon-buttons-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

.settings-icon-button {
  background-color: var(--primary);
  color: white;
  border-radius: 25px;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease;
}

.settings-icon-button:hover {
  background-color: var(--primary-dark);
}

#settings-copyright {
  font-size: 13px;
  opacity: 0.7;
  width: 100%;
  text-align: center;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1.5rem;
  flex-shrink: 0;
}

.message-image-container.loading {
  width: 150px;
  height: 150px;
  background-color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  overflow: hidden;
  flex-shrink: 0;
}

.message-image-container.loading .message-image {
  display: none;
}

.image-loader {
  width: 2.5rem;
  height: 2.5rem;
  border: 4px solid var(--text-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.image-loader .fa-triangle-exclamation {
  color: var(--error);
  font-size: 1.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.history-item-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 5px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.history-item-list::-webkit-scrollbar {
  display: none;
}

.history-item {
  padding: 15px 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 1rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-item i {
  margin-left: 5px;
}
.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background-color: var(--accent);
}

.settings-footer {
  padding: 10px 15px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.clear-history-button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
  transition: background-color 0.2s ease;
}

.clear-history-button:hover {
  background-color: var(--primary-dark);
}

@media (min-width: 768px) {
  #favoritesPanel,
  #inbox-panel,
  #gifPanel {
    width: 50vw;
    max-width: 600px;
    height: 50vh;
    max-height: 300px;
    bottom: 85px;
    transform: translateX(-50%) translateY(10px);
  }

  #favoritesPanel.active,
  #inbox-panel.active,
  #gifPanel.active {
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 768px) {
  .modal-content {
    max-width: 80%;
  }
  header {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  header i {
    font-size: 1.2rem;
  }
  .theme-button {
    font-size: 0.9rem;
    width: 30px;
    height: 30px;
  }
  #messages {
    padding: 0.75rem;
  }
  .message {
    max-width: 90%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .message-system {
    font-size: 0.65rem;
    padding: 0.6rem 0.8rem;
  }
  .input-area {
    padding: 0.5rem 0.75rem;
  }
  #message-input {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }
  #send-btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
  }
  #favoritesPanel,
  #inbox-panel,
  #gifPanel {
    bottom: 85px;
  }

  .header-button {
    font-size: 0.9rem;
    width: 30px;
    height: 30px;
  }
  #inbox-button {
    right: 3.1rem;
  }

  #inbox-panel {
    bottom: 85px;
  }
  .actions-popup {
    bottom: 52px;
  }

  .settings-menu-content {
    padding: 1.2rem 1.5rem;
    max-height: 85dvh;
  }

  .settings-menu-back.visible .settings-menu-content {
    transform: scale(1);
  }

  .settings-header {
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
  }

  .settings-body {
    gap: 1rem;
  }

  #settings-copyright {
    color: var(--text-light);
  }

  .history-item-list {
    max-height: 200px;
  }
  .history-item {
    font-size: 0.9rem;
    padding: 8px 0;
  }
}

@media (max-width: 600px) {
  #countdown-number {
    font-size: 60vmin;
  }
}

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  overflow: hidden;
  background-color: #181818;
  background-image: url("../resources/xmeroriginals-loader-background.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.loader-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.loader-logo svg {
  width: clamp(130px, 20vmin, 200px);
  height: auto;
}

.loader-bottom {
  position: absolute;
  bottom: clamp(15px, 3vh, 35px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2vh, 20px);
}

.line-loader {
  width: 100%;
  height: 14px;
  background: repeating-linear-gradient(-45deg, #fff 0 15px, #0000 0 20px)
    left/200% 100%;
  animation: l3 2s infinite linear;
}

@keyframes l3 {
  100% {
    background-position: right;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-XF {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.loader-From {
  font-family: "Lexend Deca", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: clamp(1.1rem, 3vmin, 1.3rem);
  color: #fff;
  opacity: 0.3;
  margin-left: auto;
}
.loader-Xmer {
  font-family: "Special Gothic Expanded One", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: clamp(1.3rem, 4vmin, 1.7rem);
  color: #fff;
  margin-right: auto;
  opacity: 0.5;
}
.loader-Alt {
  font-family: "Lexend Deca", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: clamp(0.5rem, 1vmin, 1.2rem);
  color: #fff;
  white-space: nowrap;
  position: relative;
  bottom: 4px;
  opacity: 0.3;
}
