.language-prompt {
  position: fixed;
  z-index: 10000;
  right: clamp(16px, 2vw, 28px);
  bottom: clamp(16px, 2vw, 28px);
  isolation: isolate;
  width: min(244px, calc(100vw - 32px));
  padding: 13px;
  overflow: hidden;
  border: 1px solid rgba(245, 245, 240, 0.14);
  border-radius: 16px;
  color: #f5f5f0;
  background: rgba(15, 14, 25, 0.94);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(245, 245, 240, 0.05);
  font-family: "Figtree", Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.98);
  transition: opacity 240ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.language-prompt::before {
  position: absolute;
  z-index: 0;
  right: 18px;
  bottom: -18px;
  width: 150px;
  height: 70px;
  border-radius: 50%;
  background: rgba(120, 152, 255, 0.18);
  filter: blur(30px);
  content: "";
  pointer-events: none;
}

.language-prompt.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.language-prompt > :not(.language-prompt-particles) {
  position: relative;
  z-index: 2;
}

.language-prompt-particles {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.language-prompt-particle {
  position: absolute;
  top: var(--particle-y);
  left: var(--particle-x);
  width: var(--particle-size);
  height: var(--particle-size);
  border-radius: 50%;
  background: rgba(245, 245, 240, 0.76);
  box-shadow: 0 0 8px rgba(245, 245, 240, 0.28);
  opacity: var(--particle-opacity);
  animation: language-particle-twinkle var(--particle-duration) ease-in-out var(--particle-delay) infinite alternate;
}

.language-prompt-particle:nth-child(3n) {
  background: #91a8f7;
  box-shadow: 0 0 10px rgba(145, 168, 247, 0.52);
}

@keyframes language-particle-twinkle {
  from { opacity: 0.08; transform: translateY(2px) scale(0.8); }
  to { opacity: var(--particle-opacity); transform: translateY(-2px) scale(1.1); }
}

.language-prompt-close {
  position: absolute !important;
  top: 9px;
  right: 9px;
  display: grid;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: rgba(245, 245, 240, 0.58);
  background: transparent;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.language-prompt-close:hover,
.language-prompt-close:focus-visible {
  color: #f5f5f0;
  background: rgba(245, 245, 240, 0.08);
  outline: none;
}

.language-prompt-title {
  margin: 0 25px 0 0;
  color: #f5f5f0;
  font-family: "Alan Sans", "Figtree", Arial, sans-serif;
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

.language-prompt-actions {
  display: flex;
  margin-top: 17px;
  flex-direction: row;
  gap: 7px;
}

.language-prompt-button {
  display: inline-flex;
  width: auto;
  min-height: 35px;
  padding: 0 9px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(245, 245, 240, 0.13);
  border-radius: 10px;
  color: rgba(245, 245, 240, 0.72);
  background: rgba(245, 245, 240, 0.035);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.language-prompt-button:hover,
.language-prompt-button:focus-visible {
  color: #f5f5f0;
  border-color: rgba(145, 168, 247, 0.38);
  background: rgba(245, 245, 240, 0.07);
  outline: none;
  transform: translateY(-1px);
}

.language-prompt-button-primary {
  flex: 1;
  color: #f5f5f0;
  border-color: rgba(120, 152, 255, 0.4);
  background: rgba(120, 152, 255, 0.14);
}

.language-prompt-button-secondary { flex: 1; }

html[data-theme="light"] .language-prompt {
  color: #0b0a12;
  border-color: rgba(11, 10, 18, 0.12);
  background: rgba(248, 248, 245, 0.95);
  box-shadow: 0 22px 70px rgba(22, 24, 35, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .language-prompt-title { color: #0b0a12; }
html[data-theme="light"] .language-prompt-close { color: rgba(11, 10, 18, 0.52); }
html[data-theme="light"] .language-prompt-close:hover,
html[data-theme="light"] .language-prompt-close:focus-visible {
  color: #0b0a12;
  background: rgba(11, 10, 18, 0.06);
}
html[data-theme="light"] .language-prompt-button {
  color: rgba(11, 10, 18, 0.68);
  border-color: rgba(11, 10, 18, 0.12);
  background: rgba(11, 10, 18, 0.025);
}
html[data-theme="light"] .language-prompt-button:hover,
html[data-theme="light"] .language-prompt-button:focus-visible {
  color: #0b0a12;
  border-color: rgba(70, 102, 205, 0.3);
  background: rgba(70, 102, 205, 0.07);
}
html[data-theme="light"] .language-prompt-button-primary {
  color: #18224a;
  border-color: rgba(70, 102, 205, 0.28);
  background: rgba(120, 152, 255, 0.16);
}

@media (max-width: 700px) {
  .language-prompt {
    right: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    width: min(244px, calc(100vw - 24px));
    padding: 12px;
    border-radius: 15px;
    transform: translate(50%, 14px) scale(0.98);
  }

  .language-prompt.is-visible { transform: translate(50%, 0) scale(1); }
  .language-prompt-title { font-size: 15.5px; }
  .language-prompt-actions { align-items: stretch; }
  .language-prompt-button { min-height: 36px; padding: 0 8px; font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .language-prompt,
  .language-prompt-button { transition-duration: 0.01ms !important; }
  .language-prompt-particle { animation: none !important; }
}
