/* Language Switcher Styles */

html.i18n-pending [data-i18n] {
  visibility: hidden;
}

.language-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.language-btn.nav-language-btn {
  gap: 4px;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted, #d1d5db);
  width: 100%;
  min-height: 100%;
  min-width: 0;
}

.language-btn.nav-language-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.86);
  transform: translateY(-2px);
}

.language-btn__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.language-btn__icon svg {
  width: 22px;
  height: 22px;
  color: currentColor;
}

.language-btn__text {
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Full-screen language page */
.language-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden;
  background:
    radial-gradient(75% 55% at 50% -10%, rgba(250, 204, 21, 0.12), transparent 72%),
    radial-gradient(100% 120% at 50% 0%, #232f66 0%, #0b1431 47%, #050913 100%);
}

.language-screen--open {
  opacity: 1;
  pointer-events: all;
}

.language-screen__layout {
  position: relative;
  width: min(92vw, 500px);
  margin: 3.5vh auto 0;
  animation: languageCardIn 0.45s ease;
  will-change: transform, opacity;
}

.language-screen__aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.75;
  animation: languageAurora 18s ease-in-out infinite;
}

.language-screen__aurora--a {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.42), transparent 68%);
  top: -120px;
  left: -120px;
}

.language-screen__aurora--b {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.38), transparent 70%);
  right: -180px;
  bottom: -160px;
  animation-delay: -6s;
}

.language-screen__aurora--c {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.28), transparent 68%);
  left: 50%;
  top: 18%;
  transform: translate(-50%, -50%);
  animation-delay: -3s;
}

.language-screen__stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 180px 120px, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(2px 2px at 320px 260px, rgba(255, 255, 255, 0.28), transparent),
    radial-gradient(1px 1px at 460px 90px, rgba(255, 255, 255, 0.4), transparent);
  background-size: 520px 320px;
  opacity: 0.4;
  animation: languageTwinkle 6s linear infinite;
}

.language-screen__card {
  position: relative;
  max-height: min(58vh, 560px);
  margin-top: -20px;
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(18, 26, 52, 0.92), rgba(15, 18, 35, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 32px 80px rgba(7, 10, 20, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.language-screen__close {
  position: absolute;
  top: 8px;
  right: 0;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.language-screen__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.language-screen__close svg {
  width: 18px;
  height: 18px;
}

.language-screen__shine {
  position: absolute;
  inset: -60% -30% auto;
  height: 280px;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.2) 42%, transparent 68%);
  transform: rotate(8deg);
  animation: languageShine 7.5s ease-in-out infinite;
  pointer-events: none;
}

.language-screen__hero {
  position: relative;
  border-radius: 0;
  overflow: visible;
  border: none;
  margin-bottom: 0;
  box-shadow: none;
  isolation: isolate;
}

.language-screen__hero-wrap {
  position: relative;
  padding-top: 12px;
  padding-bottom: 8px;
  display: flex;
  justify-content: center;
}

.language-screen__hero img {
  width: min(86vw, 430px);
  max-height: 245px;
  object-fit: contain;
  display: block;
  animation: languageFloat 5.8s ease-in-out infinite;
  filter: drop-shadow(0 18px 34px rgba(35, 83, 194, 0.5));
  will-change: transform;
}

.language-screen__orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  pointer-events: none;
}

.language-screen__orbit--a {
  width: 82%;
  height: 88%;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: languageOrbit 12s linear infinite;
}

.language-screen__orbit--b {
  width: 64%;
  height: 70%;
  transform: translate(-50%, -50%) rotate(22deg);
  border-color: rgba(125, 211, 252, 0.34);
  animation: languageOrbitReverse 10s linear infinite;
}

.language-screen__orb {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  filter: blur(0.2px);
  pointer-events: none;
}

.language-screen__orb--a {
  left: 18%;
  top: 20%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.95), rgba(250, 204, 21, 0));
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.85);
  animation: languageOrbA 6.2s ease-in-out infinite;
}

.language-screen__orb--b {
  right: 14%;
  bottom: 24%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.95), rgba(34, 211, 238, 0));
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.82);
  animation: languageOrbB 5.3s ease-in-out infinite;
}

.language-screen__title-wrap {
  margin-bottom: 10px;
  animation: languageFadeUp 0.5s ease 0.07s both;
}

.language-screen__title {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.language-screen__subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  margin-bottom: 0;
}

.language-screen__list {
  max-height: min(36vh, 350px);
  overflow: auto;
  padding-right: 4px;
  display: grid;
  gap: 8px;
  animation: languageFadeUp 0.6s ease 0.14s both;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.language-screen__list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.language-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  color: #fff;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  overflow: hidden;
}

.language-item:hover {
  transform: translateX(3px);
  border-color: rgba(125, 211, 252, 0.42);
  box-shadow: 0 12px 20px rgba(16, 42, 89, 0.28);
}

.language-item--active {
  border-color: rgba(125, 211, 252, 0.52);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(168, 85, 247, 0.19));
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.28), 0 14px 24px rgba(21, 55, 123, 0.33);
}

.language-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.15) 45%, transparent 68%);
  transform: translateX(-120%);
  transition: transform 0.45s ease;
  pointer-events: none;
}

.language-item:hover::after {
  transform: translateX(120%);
}

.language-item__flag {
  width: 34px;
  height: 24px;
  border-radius: 0;
  overflow: visible;
  border: none;
  flex: 0 0 34px;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.language-item__flag img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  filter: drop-shadow(0 4px 8px rgba(14, 22, 55, 0.5));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.language-item:hover .language-item__flag img {
  transform: translateY(-1px) scale(1.07);
  filter: drop-shadow(0 6px 12px rgba(72, 150, 255, 0.5));
}

.language-item--active .language-item__flag img {
  animation: languageFlagPulse 2.8s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.6)) drop-shadow(0 4px 10px rgba(43, 102, 212, 0.45));
}

.language-item__name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

.language-item__check {
  width: 20px;
  height: 20px;
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.language-item__check svg {
  width: 16px;
  height: 16px;
}

.language-screen__back {
  margin-top: 12px;
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #2dd4bf 0%, #3b82f6 42%, #7c3aed 100%);
  color: #f8fbff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  animation: languageFadeUp 0.65s ease 0.22s both;
}

.language-screen__back:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 16px 30px rgba(76, 120, 255, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.language-screen__back:active {
  transform: translateY(1px) scale(0.996);
}

.language-screen__confirm-glow {
  position: absolute;
  inset: -40% -20%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.34), transparent 42%);
  animation: languageBtnGlow 3.2s linear infinite;
  pointer-events: none;
}

.language-screen__confirm-text {
  position: relative;
  z-index: 1;
}

@keyframes languageCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes languageAurora {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(10px, -18px) scale(1.08);
  }
}

@keyframes languageTwinkle {
  0% { opacity: 0.3; }
  50% { opacity: 0.55; }
  100% { opacity: 0.3; }
}

@keyframes languageShine {
  0%, 100% {
    transform: translateX(-20%) rotate(8deg);
    opacity: 0.35;
  }
  50% {
    transform: translateX(20%) rotate(8deg);
    opacity: 0.7;
  }
}

@keyframes languageOrbit {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes languageOrbitReverse {
  from { transform: translate(-50%, -50%) rotate(360deg); }
  to { transform: translate(-50%, -50%) rotate(0deg); }
}

@keyframes languageOrbA {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.9; }
  50% { transform: translate(8px, -10px) scale(1.15); opacity: 1; }
}

@keyframes languageOrbB {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.85; }
  50% { transform: translate(-10px, 10px) scale(1.18); opacity: 1; }
}

@keyframes languageFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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

@keyframes languageBtnGlow {
  from { transform: translateX(-14%); }
  to { transform: translateX(14%); }
}

@keyframes languageFlagPulse {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1px) scale(1.05);
  }
}

@media (max-width: 520px) {
  .language-screen__layout {
    width: min(94vw, 94vw);
    margin-top: 2.5vh;
  }

  .language-screen__card {
    margin-top: -10px;
    padding: 14px;
    border-radius: 22px;
  }

  .language-screen__title {
    font-size: 20px;
  }

  .language-screen__hero img {
    max-height: 200px;
  }

  .language-screen__orbit--a {
    width: 90%;
    height: 94%;
  }

  .language-screen__orbit--b {
    width: 72%;
    height: 78%;
  }
}

@media (max-width: 420px) {
  .language-btn.nav-language-btn {
    padding: 8px 2px;
    gap: 3px;
  }

  .language-btn__icon {
    width: 20px;
    height: 20px;
  }

  .language-btn__icon svg {
    width: 20px;
    height: 20px;
  }

  .language-btn__text {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .language-screen *,
  .language-screen *::before,
  .language-screen *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .language-item:hover,
  .language-screen__back:hover,
  .language-btn.nav-language-btn:hover {
    transform: none;
  }
}
