:root {
  --flag-red: #d92832;
  --flag-blue: #2455a4;
  --flag-green: #14804a;
  --flag-yellow: #f4c542;
  --flag-saffron: #f39a3d;
  --flag-white: #f4f6f8;
  --flag-black: #20252a;
}

.language-picker { position: relative; z-index: 30; display: flex; flex: 0 0 auto; align-items: center; color: var(--muted); font-size: 10px; white-space: nowrap; direction: ltr; }
.language-picker-label { display: none; }
.language-trigger { width: 104px; min-width: 104px; min-height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; overflow: hidden; padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: var(--surface-2); cursor: pointer; font: inherit; }
.language-trigger #languageCurrentName { min-width: 0; max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.language-trigger:hover, .language-trigger:focus-visible { border-color: var(--yellow); outline: none; }
.language-trigger[aria-busy="true"] { cursor: wait; opacity: .72; }
.language-trigger-chevron { color: var(--muted); font-size: 14px; line-height: 1; }
.language-popover { position: absolute; top: calc(100% + 12px); right: 0; z-index: 50; width: 256px; max-width: min(256px, calc(100vw - 14px)); box-sizing: border-box; padding: 8px; border: 1px solid var(--line); border-radius: 24px; background: var(--overlay); box-shadow: 0 16px 34px var(--shadow); }
.language-popover-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 8px; }
.language-popover-head strong { color: var(--text); font-size: 11px; }
.language-popover-head span { color: var(--muted); font-size: 9px; }
.language-wheel-frame { height: 270px; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: radial-gradient(ellipse at center, var(--surface-3), var(--surface) 72%); box-shadow: inset 0 1px 0 var(--surface-3), inset 0 -8px 22px var(--shadow); }
.language-wheel { height: 270px; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: none; scroll-behavior: auto; scrollbar-width: none; scroll-padding: 116px 0; cursor: ns-resize; contain: strict; perspective: 520px; }
.language-wheel::-webkit-scrollbar { display: none; }
.language-wheel-spacer { height: 116px; flex: 0 0 116px; pointer-events: none; }
.language-wheel-item { width: 100%; height: 38px; display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 58px); align-items: center; gap: 6px; padding: 0 10px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; scroll-snap-align: start; cursor: pointer; text-align: left; opacity: .48; transform-origin: center center; will-change: transform, opacity; transition: color .12s, background-color .12s, opacity .12s; }
.language-wheel-item:hover { background: var(--surface-3); opacity: .9; }
.language-wheel-item:focus-visible { outline: 1px solid var(--yellow); outline-offset: -2px; }
.language-wheel-item.active { color: var(--text); background: var(--surface-3); opacity: 1; font-weight: 700; box-shadow: 0 2px 8px var(--shadow), 0 0 0 1px var(--yellow); }
.language-wheel-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.language-wheel-item small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--subtle); font-size: 7px; text-align: right; }
.language-wheel-item.active small { color: var(--muted); }
.language-flag { position: relative; width: 26px; height: 18px; display: inline-block; flex: 0 0 26px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background-color: var(--flag-white); box-shadow: 0 1px 2px var(--shadow); }
.flag-us { background: repeating-linear-gradient(to bottom, var(--flag-red) 0 7.69%, var(--flag-white) 7.69% 15.38%); }
.flag-us::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 43%; height: 54%; background: var(--flag-blue); }
.flag-es { background: linear-gradient(to bottom, var(--flag-red) 0 25%, var(--flag-yellow) 25% 75%, var(--flag-red) 75%); }
.flag-es::after { content: ""; position: absolute; left: 7px; top: 6px; width: 3px; height: 6px; background: var(--flag-red); box-shadow: 2px 1px 0 var(--flag-yellow); }
.flag-br { background: var(--flag-green); }
.flag-br::before { content: ""; position: absolute; left: 50%; top: 50%; width: 13px; height: 13px; background: var(--flag-yellow); transform: translate(-50%, -50%) rotate(45deg); }
.flag-br::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--flag-blue); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--flag-white); }
.flag-cn { background: var(--flag-red); }
.flag-cn::after, .flag-vn::after { content: ""; position: absolute; left: 5px; top: 4px; width: 8px; height: 8px; background: var(--flag-yellow); clip-path: polygon(50% 0, 61% 35%, 100% 35%, 69% 57%, 81% 100%, 50% 73%, 19% 100%, 31% 57%, 0 35%, 39% 35%); }
.flag-ru { background: linear-gradient(to bottom, var(--flag-white) 0 33%, var(--flag-blue) 33% 66%, var(--flag-red) 66%); }
.flag-fr { background: linear-gradient(90deg, var(--flag-blue) 0 33%, var(--flag-white) 33% 66%, var(--flag-red) 66%); }
.flag-de { background: linear-gradient(to bottom, var(--flag-black) 0 33%, var(--flag-red) 33% 66%, var(--flag-yellow) 66%); }
.flag-sa { background: var(--flag-green); }
.flag-sa::before { content: ""; position: absolute; left: 3px; right: 3px; top: 8px; height: 1px; background: var(--flag-white); transform: rotate(-4deg); }
.flag-sa::after { content: ""; position: absolute; left: 7px; top: 4px; width: 8px; height: 1px; background: var(--flag-white); box-shadow: 0 2px 0 var(--flag-white); }
.flag-in { background: linear-gradient(to bottom, var(--flag-saffron) 0 33%, var(--flag-white) 33% 66%, var(--flag-green) 66%); }
.flag-in::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border: 1px solid var(--flag-blue); border-radius: 50%; transform: translate(-50%, -50%); }
.flag-id { background: linear-gradient(to bottom, var(--flag-red) 0 50%, var(--flag-white) 50%); }
.flag-tr { background: var(--flag-red); }
.flag-tr::before { content: ""; position: absolute; left: 5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--flag-white); }
.flag-tr::after { content: ""; position: absolute; left: 8px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--flag-red); box-shadow: 5px 1px 0 -2px var(--flag-white); }
.flag-jp { background: var(--flag-white); }
.flag-jp::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--flag-red); transform: translate(-50%, -50%); }
.flag-it { background: linear-gradient(90deg, var(--flag-green) 0 33%, var(--flag-white) 33% 66%, var(--flag-red) 66%); }
.flag-pl { background: linear-gradient(to bottom, var(--flag-white) 0 50%, var(--flag-red) 50%); }
.flag-vn { background: var(--flag-red); }
.flag-th { background: linear-gradient(to bottom, var(--flag-red) 0 20%, var(--flag-white) 20% 35%, var(--flag-blue) 35% 65%, var(--flag-white) 65% 80%, var(--flag-red) 80%); }
.flag-kh { background: linear-gradient(to bottom, var(--flag-blue) 0 25%, var(--flag-red) 25% 75%, var(--flag-blue) 75%); }
.flag-kh::after { content: ""; position: absolute; left: 7px; bottom: 3px; width: 12px; height: 6px; background: var(--flag-white); clip-path: polygon(0 100%, 0 45%, 50% 0, 100% 45%, 100% 100%); }
.language-wheel-selection { position: absolute; z-index: 2; left: 6px; right: 6px; top: 116px; height: 38px; border: 1px solid var(--yellow); border-radius: 999px; background: var(--yellow); opacity: .12; pointer-events: none; }
.language-wheel-fade { position: absolute; z-index: 3; left: 0; right: 0; height: 54px; pointer-events: none; }
.language-wheel-fade-top { top: 0; background: linear-gradient(var(--surface), transparent); }
.language-wheel-fade-bottom { bottom: 0; background: linear-gradient(transparent, var(--surface)); }

@media (prefers-reduced-motion: reduce) {
  .language-wheel-item { transition: none; }
}
