.intro-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999;
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: opacity 0.5s ease;
}
.intro-overlay.intro-hide {
  opacity: 0;
  pointer-events: none;
}
.intro-puffin-wrap {
  width: 220px;
  animation: fly-across 3.6s ease-in-out forwards;
}
.intro-puffin-frames {
  position: relative;
  width: 220px;
  height: 234px;
  animation: bob 0.6s ease-in-out infinite;
}
.intro-puffin {
  position: absolute;
  width: 220px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.15));
}
/* 两张图的喙(头部)在各自图片里的像素位置不同,
   这里用具体偏移量把两张图的头部对齐到同一个点,
   这样切换时看起来身体没动,只有翅膀在扇 */
.intro-puffin.frame-a {
  left: -45px;
  top: 124px;
  animation: flap-a 0.5s ease-in-out infinite;
}
.intro-puffin.frame-b {
  left: 0;
  top: 0;
  animation: flap-b 0.5s ease-in-out infinite;
}
@keyframes flap-a {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes flap-b {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}
@keyframes fly-across {
  0%   { transform: translateX(-45vw) translateY(20px)  scale(0.7)  rotate(-3deg); }
  25%  { transform: translateX(-10vw) translateY(-15px) scale(0.85) rotate(2deg); }
  50%  { transform: translateX(35vw)  translateY(10px)  scale(1)    rotate(-2deg); }
  75%  { transform: translateX(80vw)  translateY(-10px) scale(0.95) rotate(2deg); }
  100% { transform: translateX(135vw) translateY(15px)  scale(0.85) rotate(-3deg); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-8px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .intro-puffin-wrap { animation: none; }
  .intro-puffin-frames { animation: none; }
  .intro-puffin.frame-a, .intro-puffin.frame-b { animation: none; opacity: 1; }
}

/* 庆祝特效 */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(246, 243, 237, 0.88);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  overflow: hidden;
}
.celebrate-overlay.show { opacity: 1; }
.celebrate-text {
  position: relative;
  z-index: 2;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
  background: white;
  padding: 18px 26px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  text-align: center;
  max-width: 80%;
}
.confetti-field {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(115vh) rotate(540deg); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti-piece { display: none; }
}

:root {
  --bg: #F6F3ED;
  --card: #FFFFFF;
  --ink: #2E2A24;
  --ink-soft: #6B655C;
  --primary: #2C5F63;
  --primary-dark: #204548;
  --gold: #C99A3D;
  --rose: #C97B84;
  --sage: #5B8266;
  --border: #E6E1D6;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 18px 16px;
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  font-size: 22px;
  margin: 0;
  flex: 1;
  text-align: center;
}
.spacer { width: 64px; }
.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 17px;
  padding: 8px;
  cursor: pointer;
}

main { padding: 20px 16px 60px; max-width: 640px; margin: 0 auto; }

.screen { display: none; }
.screen.active { display: block; }

.lead {
  color: var(--ink-soft);
  font-size: 18px;
  margin-bottom: 18px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.scenario-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.scenario-card:active { transform: scale(0.96); }
.scenario-emoji { font-size: 34px; display: block; margin-bottom: 10px; }
.scenario-name { font-size: 18px; font-weight: 600; }

.example-box {
  background: #FBF8F1;
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.example-label { font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.example-text { margin-bottom: 8px; }
.example-cn { font-size: 20px; font-weight: 600; }
.example-en { font-size: 15px; color: var(--ink-soft); font-style: italic; margin-top: 3px; }
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 15px;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
}

.conversation { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }

.bubble {
  border-radius: var(--radius);
  padding: 14px 16px;
  max-width: 90%;
}
.bubble.me {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble.ai {
  background: var(--card);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble .cn { font-size: 16px; opacity: 0.85; margin-bottom: 4px; }
.bubble .note-line {
  font-size: 14px;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 4px;
}
.bubble .en { font-size: 19px; font-weight: 600; }
.bubble .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.bubble .small-btn {
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  background: rgba(0,0,0,0.06);
  color: inherit;
}
.bubble.me .small-btn { background: rgba(255,255,255,0.2); color: white; }

.score-line { margin-top: 8px; font-size: 15px; }
.word-ok { color: var(--sage); font-weight: 700; }
.word-bad { color: var(--rose); font-weight: 700; text-decoration: underline wavy; }

.turn-prompt {
  font-size: 16px;
  color: var(--primary-dark);
  background: #EAF2F1;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.turn-choice {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.turn-choice[hidden],
.turn-prompt[hidden],
.confirm-panel[hidden] {
  display: none;
}
.lang-btn {
  flex: 1;
  padding: 14px 8px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.lang-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #EAF2F1;
}

.confirm-panel {
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.confirm-raw {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.confirm-question {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.confirm-en {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 4px;
}
.confirm-cn {
  font-size: 16px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.confirm-actions .small-btn {
  padding: 12px;
  font-size: 16px;
  border-radius: 12px;
  background: rgba(0,0,0,0.06);
}
.confirm-actions .confirm-yes {
  background: var(--sage);
  color: white;
  font-weight: 700;
}

.record-panel {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 18px 0 10px;
  text-align: center;
}
.status-text { font-size: 16px; color: var(--ink-soft); margin-bottom: 14px; min-height: 22px; }
.mic-btn {
  position: relative;
  overflow: hidden;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 34px;
  box-shadow: 0 6px 18px rgba(44, 95, 99, 0.35);
  cursor: pointer;
}
.mic-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 78px;
  line-height: 1;
  opacity: 0.5;
  pointer-events: none;
}
.mic-btn.lang-zh::before { content: "🇨🇳"; }
.mic-btn.lang-en::before { content: "🇬🇧"; }
.mic-icon {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
}
.mic-btn.listening {
  animation: pulse 1.1s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(201,123,132,0.5); }
  70% { box-shadow: 0 0 0 22px rgba(201,123,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,123,132,0); }
}
.mic-hint { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }

.warn-box {
  background: var(--card);
  border: 1px solid var(--rose);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 17px;
}

@media (prefers-reduced-motion: reduce) {
  .mic-btn.listening { animation: none; }
}
