:root {
  --bg: #0f1220;
  --card: #1a1f35;
  --card2: #222946;
  --text: #eef1fb;
  --muted: #9aa3c0;
  --accent: #6c8cff;
  --accent2: #4f6df5;
  --gold: #ffd166;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #26305c 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 14px 20px;
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 18, 32, .8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .5px; }
.mode-switch {
  display: flex; background: var(--card); border-radius: 999px; padding: 4px;
}
.mode-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-size: .95rem; transition: all .25s;
}
.mode-btn.active { background: var(--accent2); color: #fff; box-shadow: 0 4px 14px rgba(79, 109, 245, .45); }

#app { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.view[hidden] { display: none; }

.controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.select {
  background: var(--card); color: var(--text);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  padding: 10px 12px; font-size: .95rem; max-width: 100%;
}
.counter { color: var(--muted); font-size: .9rem; }

.card-wrap { display: flex; align-items: stretch; gap: 10px; }
.nav-arrow {
  border: none; background: var(--card); color: var(--muted);
  border-radius: var(--radius); width: 46px; font-size: 1.8rem; cursor: pointer;
  transition: all .2s; flex: 0 0 auto;
}
.nav-arrow:hover { background: var(--card2); color: #fff; }
.card {
  flex: 1; background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 26px 22px; min-height: 320px;
  display: flex; flex-direction: column; gap: 16px;
  animation: cardIn .35s ease;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.card-tag {
  align-self: flex-start; font-size: .78rem; color: var(--gold);
  background: rgba(255, 209, 102, .12); border: 1px solid rgba(255, 209, 102, .3);
  padding: 4px 12px; border-radius: 999px;
}
.fr-text { font-size: 1.35rem; line-height: 1.55; font-weight: 600; }
.zh-text { font-size: 1.05rem; line-height: 1.6; color: var(--gold); }
.hiddenzh { display: none; }
.reveal-btn, .link-btn {
  border: 1px dashed rgba(255, 255, 255, .25); background: transparent;
  color: var(--muted); padding: 8px 16px; border-radius: 10px;
  cursor: pointer; transition: all .2s; font-size: .9rem;
}
.reveal-btn:hover, .link-btn:hover { color: #fff; border-color: var(--accent); }
.link-btn { border-style: solid; }

.speakers { display: flex; flex-wrap: wrap; gap: 8px; }
.spk-btn {
  border: 1px solid rgba(255, 255, 255, .15); background: var(--card);
  color: var(--text); padding: 8px 14px; border-radius: 999px;
  cursor: pointer; font-size: .9rem; transition: all .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.spk-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.spk-btn.playing {
  background: var(--accent2); border-color: var(--accent2); color: #fff;
  box-shadow: 0 0 0 4px rgba(79, 109, 245, .25);
  animation: pulse 1s ease infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 8px rgba(79, 109, 245, .12); }
}
.no-audio { color: var(--muted); font-size: .88rem; font-style: italic; }

.variants summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.variants ul { margin: 10px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.7; font-size: .95rem; }

.mobile-nav { display: flex; gap: 10px; margin-top: 14px; }
.big-btn {
  flex: 1; border: 1px solid rgba(255, 255, 255, .15); background: var(--card);
  color: var(--text); padding: 13px 16px; border-radius: 12px;
  cursor: pointer; font-size: 1rem; transition: all .2s;
}
.big-btn:hover { background: var(--card2); }
.big-btn.primary {
  background: var(--accent2); border-color: var(--accent2); color: #fff;
  box-shadow: 0 6px 18px rgba(79, 109, 245, .4);
}
.big-btn.primary:hover { background: var(--accent); }
.big-btn.ghost { background: transparent; }

/* test setup */
.setup-card {
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
}
.setup-card h2 { margin: 0; }
.hint { color: var(--muted); margin: 0; font-size: .92rem; }
.lbl { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.speaker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.speaker-grid .spk-btn { justify-content: center; }
.spk-btn.selected { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.chk { color: var(--muted); font-size: .92rem; display: flex; gap: 8px; align-items: center; }

/* test view */
.progress { height: 6px; background: var(--card); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--gold)); transition: width .4s; border-radius: 999px; }
.test-card { align-items: center; text-align: center; justify-content: center; }
.ear { font-size: 3.2rem; animation: pulse2 1.6s ease infinite; }
@keyframes pulse2 { 50% { transform: scale(1.15); opacity: .7; } }
.test-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; width: 100%; }
.test-actions .big-btn { flex: 1 1 130px; max-width: 200px; }

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 14px; }

@media (max-width: 640px) {
  .nav-arrow { display: none; }
  .card { padding: 20px 18px; min-height: 280px; }
  .fr-text { font-size: 1.15rem; }
  .speaker-grid { grid-template-columns: repeat(2, 1fr); }
  .test-actions .big-btn { flex: 1 1 45%; max-width: none; }
}
@media (min-width: 641px) { .mobile-nav { display: none; } }
