:root {
  --plg-ink: #0b1424;
  --plg-muted: #5b6b82;
  --plg-primary: #2563eb;
  --plg-primary-2: #38bdf8;
  --plg-primary-3: #6366f1;
  --plg-grad: linear-gradient(135deg, #2563eb, #38bdf8);
}

.plg-gateway,
.plg-gateway * { box-sizing: border-box; }

.plg-gateway {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Backdrop ---------- */
.plg-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(58% 48% at 10% 0%, rgba(56, 189, 248, 0.22), transparent 62%),
    radial-gradient(52% 44% at 100% 100%, rgba(99, 102, 241, 0.20), transparent 62%),
    radial-gradient(36% 36% at 82% 8%, rgba(236, 72, 153, 0.10), transparent 56%),
    linear-gradient(145deg, rgba(5, 11, 26, 0.93), rgba(13, 24, 46, 0.90));
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  animation: plg-backdrop-in .5s ease both;
}

.plg-backdrop::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(620px 620px at 30% 28%, rgba(56, 189, 248, 0.28), transparent 62%);
  animation: plg-drift 16s ease-in-out infinite alternate;
}

.plg-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(2, 6, 18, 0.55));
}

/* ---------- Modal ---------- */
.plg-modal {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 30px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(245, 250, 255, 0.86)) padding-box,
    linear-gradient(145deg, rgba(255, 255, 255, 0.70), rgba(203, 213, 225, 0.10) 38%, rgba(56, 189, 248, 0.55), rgba(255, 255, 255, 0.45)) border-box;
  box-shadow:
    0 44px 110px rgba(2, 8, 28, 0.48),
    0 12px 32px rgba(2, 8, 28, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(44px) saturate(165%);
  -webkit-backdrop-filter: blur(44px) saturate(165%);
  color: var(--plg-ink);
  animation: plg-pop .5s cubic-bezier(.22, 1, .36, 1) both;
}

.plg-modal::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42%;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.55) 50%, transparent);
  transform: translateX(-140%) skewX(-9deg);
  animation: plg-sheen 7.5s cubic-bezier(.5, 0, .5, 1) 1.2s infinite;
}

.plg-glow {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(34px);
}

.plg-glow-one {
  width: 340px;
  height: 340px;
  top: -190px;
  right: -140px;
  background: radial-gradient(circle at 32% 32%, rgba(56, 189, 248, 0.55), rgba(56, 189, 248, 0) 70%);
  animation: plg-float-a 16s ease-in-out infinite alternate;
}

.plg-glow-two {
  width: 280px;
  height: 280px;
  left: -160px;
  bottom: -180px;
  background: radial-gradient(circle at 58% 60%, rgba(99, 102, 241, 0.50), rgba(99, 102, 241, 0) 70%);
  animation: plg-float-b 18s ease-in-out infinite alternate;
}

.plg-header,
.plg-content,
.plg-footer { position: relative; z-index: 1; }

/* ---------- Header / Brand ---------- */
.plg-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 28px 10px;
  text-align: center;
}

.plg-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  color: inherit !important;
  text-decoration: none !important;
}

.plg-logo-wrap,
.plg-logo-fallback {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  min-width: 112px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.55));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  overflow: hidden;
}

.plg-logo {
  display: block;
  width: auto;
  height: 80px;
  max-width: min(260px, 62vw);
  object-fit: contain;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  background: transparent !important;
}

.plg-logo-fallback .dashicons {
  font-size: 40px;
  width: 40px;
  height: 40px;
  color: var(--plg-primary);
}

.plg-brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Close ---------- */
.plg-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 6;
  appearance: none;
  width: 40px;
  height: 40px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.30) !important;
  outline: 0 !important;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #64748b;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform .22s ease, background .22s ease, color .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.plg-close:hover {
  transform: rotate(90deg) scale(1.05);
  background: rgba(255, 255, 255, 0.92);
  color: var(--plg-ink);
  border-color: rgba(148, 163, 184, 0.55) !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.plg-close:focus-visible { box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.35); }
.plg-close .dashicons { font-size: 19px; width: 19px; height: 19px; }

/* ---------- Content ---------- */
.plg-content {
  padding: 22px 30px 24px;
  text-align: center;
}

.plg-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 15px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.09), rgba(56, 189, 248, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 4px 12px rgba(37, 99, 235, 0.07);
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.plg-kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--plg-grad);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.plg-content h2 {
  margin: 16px 0 10px;
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.05em;
  background: linear-gradient(135deg, #0f172a, #2563eb 78%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.plg-subtext {
  max-width: 520px;
  margin: 0 auto 26px;
  color: var(--plg-muted);
  font-size: 14.5px;
  line-height: 1.65;
}

/* ---------- Language grid ---------- */
.plg-language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  width: min(520px, 100%);
  margin: 0 auto;
}

.plg-language-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.55)) padding-box,
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(203, 213, 225, 0.45)) border-box;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  color: var(--plg-ink) !important;
  text-decoration: none !important;
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
  opacity: 0;
  animation: plg-card-in .55s cubic-bezier(.2, .8, .2, 1) forwards;
}

.plg-language-card::after {
  content: "";
  position: absolute;
  inset: auto 6% -45%;
  height: 65%;
  z-index: -1;
  background: radial-gradient(52% 52% at 50% 50%, rgba(56, 189, 248, 0.38), transparent 70%);
  filter: blur(8px);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.plg-language-card:hover {
  transform: translateY(-4px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.72)) padding-box,
    linear-gradient(145deg, #93c5fd, #38bdf8) border-box;
  box-shadow: 0 22px 44px rgba(37, 99, 235, 0.20), inset 0 1px 0 #fff;
}

.plg-language-card:hover::after { opacity: 1; }

.plg-language-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 15px;
  background: linear-gradient(145deg, #eef4ff, #ffffff);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.12);
  box-shadow: inset 0 1px 0 #fff, 0 6px 16px rgba(37, 99, 235, 0.10);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .07em;
}

.plg-mark-has-flag {
  background: linear-gradient(145deg, #f6f9ff, #ffffff);
  box-shadow: inset 0 1px 0 #fff, 0 8px 18px rgba(15, 23, 42, 0.08);
}

.plg-flag {
  font-size: 27px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.20));
}

.plg-flag img {
  display: block;
  width: 34px;
  height: 23px;
  max-width: none;
  border-radius: 3px;
}

.plg-language-labels { position: relative; z-index: 1; min-width: 0; flex: 1; }
.plg-language-labels strong { display: block; font-size: 15.5px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
.plg-language-labels small { display: block; margin-top: 5px; font-size: 11px; font-weight: 600; color: #8492a6; }

.plg-arrow {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  font-size: 15px;
  color: #8ea2bf;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.10);
  transition: transform .22s ease, color .22s ease, background .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.plg-language-card:hover .plg-arrow {
  transform: translate(2px, -2px);
  color: #fff;
  background: var(--plg-grad);
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.38);
}

/* ---------- Footer ---------- */
.plg-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 26px 22px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #9aa7bb;
  text-align: center;
}

.plg-footer-dot { width: 4px; height: 4px; border-radius: 50%; background: linear-gradient(135deg, #2563eb, #38bdf8); }

/* ---------- Animations ---------- */
@keyframes plg-pop {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes plg-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes plg-drift {
  from { transform: translate3d(-34px, -22px, 0) rotate(.02deg); }
  to { transform: translate3d(42px, 30px, 0) rotate(.02deg); }
}

@keyframes plg-float-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-46px, 30px) scale(1.12); }
}

@keyframes plg-float-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, -34px) scale(1.10); }
}

@keyframes plg-sheen {
  0%, 55% { transform: translateX(-140%) skewX(-9deg); }
  78%     { transform: translateX(340%) skewX(-9deg); }
  100%    { transform: translateX(340%) skewX(-9deg); }
}

@keyframes plg-card-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.plg-kicker,
.plg-content h2,
.plg-subtext,
.plg-footer {
  opacity: 0;
  animation: plg-rise .6s cubic-bezier(.2, .8, .2, 1) forwards;
}

@keyframes plg-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.plg-kicker { animation-delay: .12s; }
.plg-content h2 { animation-delay: .20s; }
.plg-subtext { animation-delay: .30s; }
.plg-language-grid { animation-delay: .40s; }
.plg-footer { animation-delay: .72s; }

.plg-language-card:nth-child(1) { animation-delay: .40s; }
.plg-language-card:nth-child(2) { animation-delay: .48s; }
.plg-language-card:nth-child(3) { animation-delay: .56s; }
.plg-language-card:nth-child(4) { animation-delay: .64s; }
.plg-language-card:nth-child(5) { animation-delay: .72s; }
.plg-language-card:nth-child(6) { animation-delay: .80s; }
.plg-language-card:nth-child(7) { animation-delay: .88s; }
.plg-language-card:nth-child(8) { animation-delay: .96s; }

/* ---------- Close state ---------- */
body.plg-lock-scroll { overflow: hidden !important; }

.plg-gateway.plg-is-closing .plg-modal {
  animation: none;
  opacity: 0;
  transform: translateY(10px) scale(.97);
  transition: opacity .18s ease, transform .18s ease;
}

.plg-gateway.plg-is-closing .plg-backdrop {
  opacity: 0;
  transition: opacity .18s ease;
}

.plg-gateway.plg-is-closing .plg-backdrop::before { animation: none; }

/* ---------- Focus ---------- */
.plg-close:focus-visible,
.plg-language-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.35);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .plg-gateway { padding: 12px; }
  .plg-modal { width: min(520px, 100%); max-height: calc(100vh - 24px); border-radius: 26px; }
  .plg-header { padding: 22px 56px 6px; }
  .plg-close { top: 15px; right: 15px; width: 36px; height: 36px; }
  .plg-logo-wrap, .plg-logo-fallback { width: 88px; height: 88px; min-width: 88px; border-radius: 22px; }
  .plg-logo { height: 62px; max-width: min(210px, 66vw); }
  .plg-brand-name { font-size: 18px; }
  .plg-content { padding: 20px 15px 20px; }
  .plg-content h2 { font-size: 29px; }
  .plg-subtext { margin-bottom: 19px; font-size: 13.5px; }
  .plg-language-grid { grid-template-columns: 1fr; width: min(420px, 100%); gap: 10px; }
  .plg-language-card { min-height: 72px; }
  .plg-footer { padding-bottom: 17px; }
}

@media (max-width: 390px) {
  .plg-content h2 { font-size: 26px; }
  .plg-language-card { min-height: 68px; padding: 12px 13px; }
  .plg-language-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .plg-flag { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .plg-modal,
  .plg-backdrop,
  .plg-backdrop::before,
  .plg-glow,
  .plg-glow-one,
  .plg-glow-two,
  .plg-kicker,
  .plg-content h2,
  .plg-subtext,
  .plg-language-grid,
  .plg-footer,
  .plg-language-card,
  .plg-close,
  .plg-arrow { animation: none !important; transition: none !important; }
  .plg-kicker, .plg-content h2, .plg-subtext, .plg-language-grid, .plg-footer, .plg-language-card { opacity: 1; }
}