/* 語言切換 — 地球按鈕旁下拉（非全屏彈窗） */
.lang-switcher {
  position: relative;
  flex-shrink: 0;
  z-index: 30;
}

.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--gramo-accent-rgb), 0.35);
  background: rgba(28, 35, 56, 0.75);
  color: var(--gramo-accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
}

.lang-switcher-btn:hover,
.lang-switcher-btn[aria-expanded="true"] {
  background: rgba(28, 35, 56, 0.95);
  color: var(--gramo-text);
  border-color: rgba(var(--gramo-accent-rgb), 0.5);
}

.lang-switcher-btn svg {
  flex-shrink: 0;
}

.lang-switcher-btn .lang-chevron {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.lang-switcher-btn[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  max-height: min(320px, 70vh);
  overflow: hidden;
  display: none;
  flex-direction: column;
  border-radius: 14px;
  background: var(--gramo-card);
  border: 1px solid var(--line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: 6px;
}

.lang-menu.open {
  display: flex;
}

.lang-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  max-height: min(300px, 68vh);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--gramo-text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.35;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--gramo-text);
}

.lang-option.selected {
  color: var(--gramo-text);
  font-weight: 600;
  background: rgba(var(--gramo-accent-rgb), 0.1);
}

.lang-option .mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gramo-text-secondary);
  flex-shrink: 0;
}

.lang-option.selected .mark {
  background: rgba(var(--gramo-accent-rgb), 0.18);
  color: var(--gramo-accent);
}

.lang-option .label {
  flex: 1;
  min-width: 0;
}

.lang-option .check {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--gramo-accent);
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 私隱頁頂欄 */
.top-bar #gramo-lang-anchor {
  position: relative;
}

@media (max-width: 920px) {
  .nav-links { display: none; }
}
