/* =========================================================
   多语言：语言选择面板 + 英文/繁中排版微调
   ========================================================= */

html[lang="zh-TW"] {
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", Georgia, serif;
  --sans: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", sans-serif;
}
html[lang="en"] {
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.lang-overlay {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 12%, rgba(240, 207, 138, 0.16), transparent 32%),
    linear-gradient(150deg, rgba(7, 17, 30, 0.94), rgba(13, 33, 54, 0.88)),
    url("../assets/gen/scenes/campus.webp") center/cover no-repeat;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.lang-overlay.show { opacity: 1; }

.lang-card {
  position: relative;
  width: min(560px, 94vw);
  padding: 32px 34px 22px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 92% 0%, rgba(240, 207, 138, 0.28), transparent 34%),
    var(--paper);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 30px 90px rgba(3, 10, 20, 0.5);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.lang-overlay.show .lang-card { transform: translateY(0) scale(1); }
.lang-overlay.chosen .lang-card { transform: translateY(-4px) scale(1.01); }

.lang-logo {
  width: 52px;
  margin: 0 auto 10px;
  filter: drop-shadow(0 6px 16px rgba(18, 38, 63, 0.18));
}
.lang-kicker {
  text-align: center;
  font-family: var(--en);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.lang-title {
  margin-top: 12px;
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(26px, 5vw, 34px);
  letter-spacing: 0.12em;
  color: var(--navy);
}
.lang-subtitle {
  margin-top: 6px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.lang-options {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.lang-option:hover {
  transform: translateY(-1px);
  border-color: rgba(224, 166, 60, 0.7);
  box-shadow: 0 8px 22px rgba(18, 38, 63, 0.1);
}
.lang-option.selected {
  border-color: var(--gold);
  background: linear-gradient(100deg, rgba(240, 207, 138, 0.26), rgba(255, 255, 255, 0.85));
}
.lang-option.chosen {
  border-color: var(--teal);
  background: linear-gradient(100deg, rgba(122, 158, 126, 0.22), rgba(255, 255, 255, 0.9));
}
.lang-option:disabled { cursor: default; opacity: 0.82; }
.lang-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--teal-deep);
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.6);
}
.lang-option.selected .lang-mark {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--navy);
}
.lang-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lang-option-text b {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.lang-option-text small {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--en);
  letter-spacing: 0.04em;
}
.lang-arrow {
  margin-left: auto;
  color: var(--terracotta);
  font-size: 17px;
  opacity: 0.5;
  transition: transform 0.16s, opacity 0.16s;
}
.lang-option:hover .lang-arrow { transform: translateX(3px); opacity: 1; }

.lang-note {
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.85;
  color: var(--muted);
}
.lang-note-en {
  font-family: var(--en);
  font-size: 11px;
}
.lang-start {
  margin-top: 6px;
  text-align: center;
  font-family: var(--en);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--teal-deep);
  opacity: 0.7;
}
.lang-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(29, 42, 58, 0.06);
  font-size: 13px;
  transition: background 0.16s, color 0.16s;
}
.lang-close:hover { background: rgba(29, 42, 58, 0.12); color: var(--navy); }

.lang-overlay.error .lang-card { animation: langShake 0.45s ease; }
@keyframes langShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

/* 标题页语言入口 */
.title-lang {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
}
.title-lang .lang-flag { font-size: 13px; }

/* ---------- 英文排版微调 ---------- */
html[lang="en"] .title-h1 {
  font-size: clamp(46px, 6vw, 78px);
  letter-spacing: 0.02em;
}
html[lang="en"] .title-tagline {
  letter-spacing: 0.08em;
}
html[lang="en"] .title-lead {
  line-height: 1.75;
  max-width: 500px;
}
html[lang="en"] .title-mini-actions {
  flex-wrap: wrap;
  gap: 10px 16px;
}
html[lang="en"] .title-feature {
  font-size: 10.5px;
}
html[lang="en"] .title-actions .btn,
html[lang="en"] .btn-lg {
  letter-spacing: 0.01em;
}
html[lang="en"] .objective-title {
  font-size: 14px;
  line-height: 1.35;
}
html[lang="en"] .objective-sub {
  line-height: 1.55;
}
html[lang="en"] .station-hero-title {
  letter-spacing: 0.01em;
}
html[lang="en"] .modal-title {
  letter-spacing: 0.01em;
}
html[lang="en"] .dialogue-side-title,
html[lang="en"] .dialogue-side-note {
  letter-spacing: 0.01em;
}
html[lang="en"] .quiz-opt,
html[lang="en"] .election-option {
  line-height: 1.45;
}
html[lang="en"] .election-step-title {
  letter-spacing: 0.01em;
}
html[lang="en"] .speech-template {
  line-height: 1.4;
}
html[lang="en"] .ns-kcal small {
  margin-left: 0.22em;
}

/* 繁中字体提示 */
html[lang="zh-TW"] .title-tagline {
  letter-spacing: 0.14em;
}

@media (max-width: 560px) {
  .lang-card { padding: 26px 20px 18px; border-radius: 22px; }
  .lang-option { padding: 12px 12px; }
  .lang-option-text b { font-size: 16px; }
}
