:root {
  color-scheme: light;
  --ink: #111114;
  --muted: rgba(17, 17, 20, 0.58);
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --glass: rgba(255, 255, 255, 0.42);
  --glass-strong: rgba(255, 255, 255, 0.64);
  --line: rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 9%, rgba(255, 255, 255, 0.96), transparent 20%),
    radial-gradient(circle at 18% 30%, rgba(0, 122, 255, 0.22), transparent 32%),
    radial-gradient(circle at 78% 24%, rgba(175, 82, 222, 0.16), transparent 28%),
    radial-gradient(circle at 84% 78%, rgba(52, 199, 89, 0.2), transparent 34%),
    linear-gradient(135deg, #f7f8fc 0%, #eceef5 46%, #fbfbfd 100%);
  background-size: 120% 120%;
  animation: ambientShift 12s ease-in-out infinite alternate;
}

button {
  font: inherit;
  text-align: center;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.stage {
  width: min(780px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.22));
  box-shadow: 0 28px 80px rgba(45, 54, 73, 0.16);
  backdrop-filter: blur(34px) saturate(1.45);
  animation: stageIn 0.72s cubic-bezier(0.2, 1, 0.22, 1) both;
}

.speech {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 14px 30px rgba(0, 0, 0, 0.08);
  line-height: 1.35;
  font-size: 0.92rem;
  font-weight: 680;
  color: rgba(17, 17, 20, 0.72);
  text-align: center;
  backdrop-filter: blur(24px) saturate(1.65);
  animation: floatIn 0.62s ease 0.08s both;
}

.quiz-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: min(760px, calc(100vh - 48px));
  padding: 28px;
}

.creator {
  align-self: center;
  margin: 0 0 12px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: rgba(17, 17, 20, 0.62);
  font-size: 0.82rem;
  font-weight: 780;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 10px 22px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(22px) saturate(1.5);
  animation: floatIn 0.56s ease both;
}

.topbar,
.meter-row,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 14px 34px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(28px) saturate(1.55);
  animation: floatIn 0.62s ease 0.04s both;
}

.topbar > div:first-child {
  min-width: 0;
  padding-left: 12px;
}

.kicker {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.04;
  font-weight: 850;
  text-align: left;
}

.title-en {
  margin: 6px 0 0;
  color: rgba(17, 17, 20, 0.5);
  font-size: clamp(0.82rem, 1.8vw, 1rem);
  font-weight: 760;
  letter-spacing: 0.02em;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.lang-toggle,
.icon-button,
.ghost-button,
.primary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  color: #111;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(22px) saturate(1.65);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.lang-toggle:hover,
.icon-button:hover,
.ghost-button:hover,
.primary-button:hover,
.apple-person-button:hover,
.mode-option:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 18px 36px rgba(0, 122, 255, 0.14);
}

.lang-toggle:active,
.icon-button:active,
.ghost-button:active,
.primary-button:active,
.apple-person-button:active,
.mode-option:active {
  transform: scale(0.975);
}

.icon-button {
  width: 48px;
  flex: 0 0 48px;
}

.lang-toggle {
  min-width: 54px;
  padding: 0 14px;
  font-weight: 850;
  color: var(--blue);
}

.ghost-button {
  padding: 0 18px;
  font-weight: 740;
}

.primary-button {
  min-width: 132px;
  padding: 0 30px;
  font-weight: 780;
}

.primary-button::after {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-left: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}

.voice-glyph,
.fx-glyph {
  position: relative;
  display: inline-block;
  width: 19px;
  height: 18px;
}

.voice-glyph {
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: translateX(-2px);
}

.voice-glyph::before,
.voice-glyph::after {
  content: "";
  position: absolute;
  top: 50%;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 99px 99px 0;
  transform: translateY(-50%);
}

.voice-glyph::before {
  left: 5px;
  width: 7px;
  height: 11px;
}

.voice-glyph::after {
  left: 9px;
  width: 11px;
  height: 17px;
}

.fx-glyph {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.fx-glyph::before,
.fx-glyph::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.fx-glyph::before {
  top: 4px;
  box-shadow: -5px 5px 0 currentColor, 5px 5px 0 currentColor;
}

.fx-glyph::after {
  bottom: 4px;
  width: 9px;
  height: 2px;
}

.icon-button.muted .voice-glyph::before,
.icon-button.muted .voice-glyph::after,
.icon-button.muted .fx-glyph::before,
.icon-button.muted .fx-glyph::after {
  display: none;
}

.icon-button.muted .voice-glyph,
.icon-button.muted .fx-glyph {
  opacity: 0.55;
}

.start-view,
.final-intro,
.result-view {
  margin: auto 0 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 16px 42px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px) saturate(1.55);
}

.start-view {
  display: grid;
  gap: 16px;
  justify-items: stretch;
  animation: floatIn 0.56s ease 0.12s both;
}

.final-intro {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  animation: finalReveal 0.58s cubic-bezier(0.2, 1, 0.22, 1) both;
}

.final-intro h2 {
  font-size: clamp(1.65rem, 5vw, 2.6rem);
  line-height: 1.08;
  font-weight: 850;
}

.final-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  font-weight: 760;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mode-option {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  color: rgba(17, 17, 20, 0.72);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 10px 22px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(18px) saturate(1.45);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.mode-option.active {
  color: #fff;
  background: rgba(0, 122, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 14px 30px rgba(0, 122, 255, 0.26);
}

.apple-person-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(52, 199, 89, 0.34);
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.15);
  color: rgba(17, 17, 20, 0.82);
  font-weight: 850;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 14px 30px rgba(52, 199, 89, 0.14);
  backdrop-filter: blur(18px) saturate(1.45);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.result-view p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  text-align: center;
}

.achievement-card {
  display: grid;
  gap: 8px;
  margin: 20px 0 6px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.14), rgba(52, 199, 89, 0.16));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 16px 34px rgba(0, 122, 255, 0.12);
  text-align: center;
  animation: finalReveal 0.52s cubic-bezier(0.2, 1, 0.22, 1) both;
}

.achievement-card span {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 850;
}

.achievement-card strong {
  font-size: 1.08rem;
  line-height: 1.45;
}

.result-summary,
.result-report {
  display: block;
}

.result-report {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  color: var(--ink);
}

.result-report b {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.result-report span {
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.34);
  font-weight: 850;
}

.result-view {
  animation: finalReveal 0.52s cubic-bezier(0.2, 1, 0.22, 1) both;
}

.quiz-view {
  margin-top: 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: floatIn 0.46s ease both;
}

.meter-row {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
}

.meter {
  height: 8px;
  margin: 12px 0 16px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(17, 17, 20, 0.08);
}

.meter div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.28s ease;
}

.question-card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 16px 42px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(26px) saturate(1.6);
}

.question-card.question-enter {
  animation: questionSlide 0.34s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

#questionText {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  font-size: 1.25rem;
  line-height: 1.45;
  font-weight: 820;
  text-align: center;
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.option {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  backdrop-filter: blur(18px) saturate(1.45);
  animation: optionIn 0.34s ease both;
}

.option:nth-child(2) {
  animation-delay: 0.04s;
}

.option:nth-child(3) {
  animation-delay: 0.08s;
}

.option:nth-child(4) {
  animation-delay: 0.12s;
}

.option span:last-child {
  align-self: center;
  line-height: 1.35;
}

.option:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 26px rgba(0, 122, 255, 0.12);
}

.option .label {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  color: var(--blue);
  font-weight: 900;
}

.option.correct {
  background: rgba(52, 199, 89, 0.22);
  box-shadow: 0 12px 30px rgba(52, 199, 89, 0.15);
}

.option.wrong {
  background: rgba(255, 59, 48, 0.18);
  animation: wrongShake 0.32s ease both;
}

.option.selected {
  transform: scale(0.992);
}

.option:disabled {
  cursor: default;
}

.action-row {
  margin-top: auto;
  padding-top: 18px;
  justify-content: center;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.result-grid div {
  display: grid;
  place-items: center;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.36);
}

.result-grid strong {
  display: block;
  font-size: 2.4rem;
  text-align: center;
}

.result-grid span {
  color: var(--muted);
  font-weight: 740;
  text-align: center;
}

.hidden {
  display: none;
}

.achievement-toast {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 50;
  width: min(430px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 20px 48px rgba(0, 122, 255, 0.18);
  backdrop-filter: blur(28px) saturate(1.7);
  transform: translate(-50%, -24px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.2, 1, 0.22, 1), opacity 0.32s ease;
}

.achievement-toast.show {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.achievement-toast b,
.achievement-toast span {
  display: block;
  text-align: center;
}

.achievement-toast b {
  color: var(--blue);
  font-size: 0.78rem;
}

.achievement-toast span {
  margin-top: 4px;
  font-weight: 820;
}

.secret-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(240, 242, 247, 0.42);
  backdrop-filter: blur(20px);
}

.secret-modal.hidden {
  display: none;
}

.secret-card {
  width: min(480px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 28px 80px rgba(17, 17, 20, 0.18);
  backdrop-filter: blur(34px) saturate(1.65);
  animation: finalReveal 0.42s cubic-bezier(0.2, 1, 0.22, 1) both;
}

.secret-card h2 {
  text-align: center;
}

.secret-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.secret-grid button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  font-weight: 820;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 24px rgba(0, 0, 0, 0.08);
}

.secret-grid button:last-child {
  grid-column: 1 / -1;
  color: #fff;
  background: rgba(0, 122, 255, 0.78);
}

.pay-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.pay-overlay.hidden {
  display: none;
}

.pay-card {
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 38px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 24px 56px rgba(0, 122, 255, 0.2),
    0 8px 18px rgba(17, 17, 20, 0.1);
  backdrop-filter: blur(30px) saturate(1.75);
  transform: scale(0.78);
  opacity: 0;
}

.pay-overlay.play .pay-card {
  animation: payPop 0.82s cubic-bezier(0.2, 1.35, 0.28, 1) forwards;
}

.checkmark {
  width: 82px;
  height: 82px;
}

.checkmark circle,
.checkmark path {
  fill: none;
  stroke: var(--green);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.checkmark circle {
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
}

.checkmark path {
  stroke-dasharray: 58;
  stroke-dashoffset: 58;
}

.pay-overlay.play .checkmark circle {
  animation: drawRing 0.42s ease-out 0.06s forwards;
}

.pay-overlay.play .checkmark path {
  animation: drawCheck 0.34s ease-out 0.34s forwards;
}

@keyframes payPop {
  0% {
    opacity: 0;
    transform: scale(0.72) translateY(18px);
  }
  42% {
    opacity: 1;
    transform: scale(1.08) translateY(0);
  }
  72% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.98) translateY(-8px);
  }
}

@keyframes drawRing {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes ambientShift {
  from {
    background-position: 0% 0%;
  }
  to {
    background-position: 100% 100%;
  }
}

@keyframes stageIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes finalReveal {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes questionSlide {
  from {
    opacity: 0;
    transform: translateX(18px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes optionIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wrongShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-2px);
  }
}

@media (max-width: 820px) {
  .shell {
    padding: 12px;
  }

  .stage {
    min-height: auto;
  }

  .speech {
    min-height: 46px;
    font-size: 0.92rem;
  }

  .quiz-panel {
    padding: 16px;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 14px;
    padding: 16px;
    text-align: center;
  }

  .topbar > div:first-child {
    padding-left: 0;
  }

  h1 {
    text-align: center;
    font-size: clamp(1.7rem, 9vw, 2.45rem);
  }

  .title-en {
    text-align: center;
  }

  .controls {
    justify-content: center;
  }

  .mode-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option {
    grid-template-columns: 32px 1fr;
    padding: 12px;
  }
}
