/* ===================== Language switcher (FAB, light) ===================== */
.lang-fab{
  --fab-size: 58px;
  --fab-z: 1000;
  --fab-ring: rgba(14,107,74,.22);
  --fab-shadow: 0 12px 32px -10px rgba(14,107,74,.30), 0 4px 14px -6px rgba(0,0,0,.10);
  --fab-glow: 0 0 26px rgba(52,211,153,.32), 0 0 14px rgba(14,107,74,.20);
  --fab-surface: linear-gradient(180deg, #ffffff 0%, #fbfcfb 100%);
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: var(--fab-size); height: var(--fab-size);
  z-index: var(--fab-z);
  font-family: var(--f);
  isolation: isolate;
}
.lang-fab--rtl{ right: auto; left: calc(20px + env(safe-area-inset-left)); }

.lang-fab-btn{
  position: relative; width: var(--fab-size); height: var(--fab-size);
  border-radius: 50%; border: 1px solid var(--fab-ring);
  padding: 0; cursor: pointer; color: #fff;
  background: #fff;
  box-shadow: var(--fab-shadow), inset 0 0 0 1px rgba(255,255,255,.6);
  transition: transform .35s cubic-bezier(.2,.85,.2,1.25), box-shadow .25s ease, border-color .25s ease;
  overflow: hidden;
}
.lang-fab-btn:hover{
  transform: translateY(-2px);
  border-color: rgba(14,107,74,.4);
  box-shadow: 0 18px 42px -12px rgba(14,107,74,.45), var(--fab-glow);
}
.lang-fab-btn:active{ transform: translateY(0) scale(.96); }
.lang-fab-btn:focus-visible{ outline: 2px solid rgba(14,107,74,.7); outline-offset: 3px; }

.lang-fab-aurora{
  position: absolute; inset: -30%;
  background: conic-gradient(
    from 0deg,
    rgba(14,107,74,0)    0deg,
    rgba(14,107,74,.42)  40deg,
    rgba(52,211,153,.45) 140deg,
    rgba(10,138,74,.40)  240deg,
    rgba(14,107,74,0)    360deg
  );
  filter: blur(12px); opacity: .55;
  animation: langFabAurora 14s linear infinite;
  z-index: 0; pointer-events: none;
}
.lang-fab-btn:hover .lang-fab-aurora{ opacity: .9; animation-duration: 8s; }
@keyframes langFabAurora{ to{ transform: rotate(360deg); } }

.lang-fab-pulse{
  position: absolute; inset: 0; border-radius: 50%;
  pointer-events: none; z-index: 0;
  box-shadow: 0 0 0 0 rgba(52,211,153,.55);
  animation: langFabPulse 3.2s ease-out infinite;
}
@keyframes langFabPulse{
  0%   { box-shadow: 0 0 0 0   rgba(52,211,153,.45); }
  70%  { box-shadow: 0 0 0 14px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0   rgba(52,211,153,0); }
}

.lang-fab-globe{
  position: absolute; inset: 4px;
  border-radius: 50%; overflow: hidden;
  z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(14,107,74,.18), inset 0 -8px 12px -8px rgba(0,0,0,.25);
  background: #f0f5f3;
  transition: transform .45s cubic-bezier(.2,.85,.2,1.2);
}
.lang-fab-btn:hover .lang-fab-globe{ transform: rotate(-8deg) scale(1.02); }
.lang-fab-flag{ position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; filter: saturate(1.08); }
.lang-fab-grid{ position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: overlay; opacity: .8; }
.lang-fab-gloss{
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(40% 40% at 30% 22%, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 60%),
    radial-gradient(120% 120% at 50% 120%, rgba(0,0,0,.18) 0%, rgba(0,0,0,0) 55%);
  pointer-events: none;
}
.lang-fab[data-open="true"] .lang-fab-globe{ transform: rotate(-22deg) scale(.92); }
.lang-fab[data-open="true"] .lang-fab-pulse{ animation: none; opacity: 0; }
.lang-fab[data-open="true"] .lang-fab-aurora{ opacity: 1; animation-duration: 6s; }

.lang-fab-dim{
  position: fixed; inset: 0;
  background: rgba(14,27,20,0);
  backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0);
  transition: background .35s ease, backdrop-filter .35s ease;
  z-index: calc(var(--fab-z) - 1); pointer-events: none;
}
.lang-fab[data-open="true"] .lang-fab-dim{
  background: rgba(14,27,20,.35);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  pointer-events: auto;
}

.lang-fab-panel{
  position: absolute;
  right: calc(var(--fab-size) * 0.5);
  bottom: calc(var(--fab-size) * 0.5);
  width: 300px; max-height: min(540px, calc(100vh - 140px));
  padding: 14px 12px;
  border-radius: 24px; border: 1px solid var(--bd2);
  background: var(--fab-surface);
  backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 24px 56px -14px rgba(10,10,10,.18), inset 0 0 0 1px rgba(255,255,255,.6);
  opacity: 0;
  transform-origin: bottom right;
  transform: translate(calc(var(--fab-size) * 0.5), calc(var(--fab-size) * 0.5)) scale(.2);
  transition: opacity .28s ease, transform .45s cubic-bezier(.2,.85,.2,1.2);
  overflow: hidden;
  z-index: calc(var(--fab-z) + 1); isolation: isolate;
}
.lang-fab--rtl .lang-fab-panel{
  right: auto; left: calc(var(--fab-size) * 0.5);
  transform-origin: bottom left;
  transform: translate(calc(var(--fab-size) * -0.5), calc(var(--fab-size) * 0.5)) scale(.2);
}
.lang-fab[data-open="true"] .lang-fab-panel{ opacity: 1; transform: translate(0,0) scale(1); }
.lang-fab-panel-aurora{
  position: absolute; right: -40px; bottom: -40px;
  width: 240px; height: 240px;
  background: conic-gradient(
    from 180deg,
    rgba(14,107,74,.32)  0deg,
    rgba(52,211,153,.32) 100deg,
    rgba(10,138,74,.30)  220deg,
    rgba(14,107,74,.26)  360deg
  );
  filter: blur(36px); opacity: .5;
  pointer-events: none; z-index: 0;
  animation: langFabAurora 18s linear infinite reverse;
}
.lang-fab--rtl .lang-fab-panel-aurora{ right: auto; left: -40px; }

.lang-fab-sheet-head{ display: none; align-items: center; justify-content: space-between; padding: 4px 8px 12px; position: relative; z-index: 1; }
.lang-fab-sheet-handle{ position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 44px; height: 4px; border-radius: 4px; background: rgba(0,0,0,.18); }
.lang-fab-sheet-title{ font-size: 16px; font-weight: 700; color: var(--tx); font-family: var(--fd); letter-spacing: -.01em; }
.lang-fab-sheet-close{
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--bd2); background: var(--bg2);
  color: var(--tx2); cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.lang-fab-sheet-close:hover{ background: var(--bg3); border-color: var(--bd); color: var(--tx); }

.lang-fab-list{
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 2px;
  max-height: 480px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(14,107,74,.25) transparent;
  position: relative; z-index: 1;
}
.lang-fab-list::-webkit-scrollbar{ width: 6px; }
.lang-fab-list::-webkit-scrollbar-thumb{ background: rgba(14,107,74,.25); border-radius: 6px; }

.lang-fab-item{ opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .42s cubic-bezier(.2,.85,.25,1.1); transition-delay: calc(var(--lang-i, 0) * 22ms + 90ms); }
.lang-fab[data-open="true"] .lang-fab-item{ opacity: 1; transform: translateY(0); }

.lang-fab-opt{
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 12px;
  text-decoration: none; color: var(--tx); background: transparent;
  border: 1px solid transparent;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
  position: relative;
}
.lang-fab-opt:hover, .lang-fab-opt:focus-visible{
  background: var(--bg2); border-color: var(--bd2); outline: none; transform: translateX(1px);
}
.lang-fab-opt:focus-visible{ box-shadow: 0 0 0 2px rgba(14,107,74,.4); }
.lang-fab-opt.is-active{
  background: linear-gradient(120deg, var(--ac-bg) 0%, rgba(234,246,239,.6) 100%);
  border-color: rgba(14,107,74,.35);
  box-shadow: inset 0 0 0 1px rgba(14,107,74,.10);
}

.lang-fab-opt-flag{
  position: relative; flex: 0 0 30px; width: 30px; height: 30px;
  border-radius: 50%; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.10);
}
.lang-fab-opt-flag img{ width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 50%; }
.lang-fab-opt.is-active .lang-fab-opt-flag{
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45), 0 0 0 2px var(--ac), 0 3px 12px rgba(14,107,74,.30);
}
.lang-fab-opt-text{ display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.lang-fab-opt-name{ font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; color: var(--tx); line-height: 1.2; font-family: var(--fd); }
.lang-fab-opt-code{ font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; color: var(--tx3); letter-spacing: .12em; margin-top: 3px; }
.lang-fab-opt-check{ flex: 0 0 16px; color: var(--ac); }

.lang-fab--rtl .lang-fab-opt{ flex-direction: row-reverse; text-align: right; }
.lang-fab--rtl .lang-fab-opt-text{ align-items: flex-end; }
.lang-fab--rtl .lang-fab-opt:hover, .lang-fab--rtl .lang-fab-opt:focus-visible{ transform: translateX(-1px); }
html.lang-fab-lock{ overflow: hidden; }

@media (max-width: 640px){
  .lang-fab{ --fab-size: 54px; right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); }
  .lang-fab--rtl{ right: auto; left: calc(14px + env(safe-area-inset-left)); }
  .lang-fab-panel{
    position: fixed; inset: auto 0 0 0; right: 0 !important; left: 0 !important; bottom: 0;
    width: auto; max-height: 82vh;
    padding: 18px 14px max(16px, env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    transform-origin: bottom center;
    transform: translateY(100%) scale(1);
  }
  .lang-fab[data-open="true"] .lang-fab-panel{ transform: translateY(0) scale(1); }
  .lang-fab-sheet-head{ display: flex; }
  .lang-fab-list{ max-height: calc(82vh - 70px); }
  .lang-fab-opt{ padding: 11px 12px; min-height: 52px; }
  .lang-fab-opt-name{ font-size: 15.5px; }
  .lang-fab-panel-aurora{ right: -80px; bottom: -120px; width: 320px; height: 320px; }
}
@media (prefers-reduced-motion: reduce){
  .lang-fab-aurora, .lang-fab-panel-aurora, .lang-fab-pulse{ animation: none; }
  .lang-fab-btn, .lang-fab-panel, .lang-fab-item, .lang-fab-globe, .lang-fab-dim{ transition: none !important; }
  .lang-fab-item{ transition-delay: 0ms !important; }
}
html[dir="rtl"] body{ text-align: right; }
