:root {
  --peach: #ff9d8a;
  --blush: #ffc4c7;
  --apricot: #f39f51;
  --coral: #de5445;
  --wine: #780e0e;
  --cream: #fff8f6;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(120, 14, 14, 0.1);
  --shadow: 0 16px 36px rgba(222, 84, 69, 0.12);
  color: var(--wine);
  font-family: "M PLUS Rounded 1c", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 196, 199, 0.95), transparent 32%),
    radial-gradient(circle at 100% 8%, rgba(255, 157, 138, 0.55), transparent 28%),
    radial-gradient(circle at 80% 100%, rgba(243, 159, 81, 0.28), transparent 30%),
    var(--cream);
  color: var(--wine);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, .card, .option, .tile, .token, .station { transition: transform .22s ease, box-shadow .22s ease, background .22s ease, border-color .22s ease; }
button:active:not(:disabled) { transform: scale(0.97); }

#app {
  width: min(480px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
}

h1, h2, .brand, .score, .prompt {
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
}
h1 { font-size: 34px; line-height: 1.05; }
h2 { margin: 18px 0 8px; font-size: 24px; }
.muted, .kicker, .sub { color: rgba(120, 14, 14, 0.62); }
.kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lede { margin: 8px 0 0; line-height: 1.45; }

.top, .brand-row, .stats, .sentence, .token-row, .pair-line {
  display: flex;
  gap: 10px;
  align-items: center;
}
.top, .brand-row { justify-content: space-between; }
.actions { display: flex; align-items: center; gap: 8px; }
.admin-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 14px;
}
.admin-btn.on { background: var(--wine); color: white; }
.ear {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: white;
  color: var(--wine);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  flex: none;
}
.note {
  margin-top: 12px;
  padding: 16px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.word-card {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 22px;
  background: white;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
}
.word-card b { font-size: 18px; }
.brand-row { justify-content: flex-start; }
.brand { font-size: 28px; line-height: 1; }

.momo { width: 92px; height: 86px; flex: none; filter: drop-shadow(0 8px 10px rgba(222, 84, 69, 0.18)); }
.momo.float { animation: float 3.2s ease-in-out infinite; }
.momo.sm { width: 64px; height: 60px; }
.momo.lg { width: 140px; height: 130px; }

.chip, .ghost, .primary, .option, .station, .card, .field input, .mic, .tile, .token {
  border-radius: 22px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: white;
  color: var(--wine);
  padding: 8px 12px;
  box-shadow: var(--shadow);
}
.icon { width: 18px; height: 18px; display: block; }
.icon.lg { width: 28px; height: 28px; }

.hero, .card, .option, .station, .stat, .feedback, .tile, .token {
  box-shadow: var(--shadow);
}
.hero {
  margin-top: 16px;
  padding: 18px;
  border-radius: 32px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.5), transparent 42%),
    linear-gradient(145deg, var(--blush), var(--peach) 70%, var(--apricot));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
}
.hero h1 { font-size: 36px; }
.hero .primary { grid-column: 1 / -1; }

.primary, .ghost {
  display: block;
  width: 100%;
  border: 0;
  text-align: center;
}
.primary {
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #ff8d78, var(--coral));
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(222, 84, 69, 0.32);
}
.primary:disabled { opacity: 0.45; box-shadow: none; }
.ghost {
  margin-top: 8px;
  padding: 12px;
  background: transparent;
  color: var(--wine);
}

.stats { margin-top: 14px; }
.stat {
  flex: 1;
  background: var(--card);
  border-radius: 22px;
  padding: 12px;
  backdrop-filter: blur(8px);
}
.stat b { display: block; font-size: 22px; }
.stat span { color: rgba(120, 14, 14, 0.62); font-size: 12px; }

.path { margin-top: 8px; display: grid; gap: 10px; }
.station {
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--card);
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.station.current { outline: 2px solid var(--coral); }
.station.lock { opacity: 0.55; }
.num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blush);
  font-weight: 800;
}
.bar {
  height: 7px;
  margin-top: 8px;
  border-radius: 99px;
  background: rgba(120, 14, 14, 0.08);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--apricot), var(--coral));
  transition: width .6s ease;
}

.progress { display: flex; gap: 5px; margin: 14px 0; }
.progress i {
  height: 7px;
  flex: 1;
  border-radius: 99px;
  background: rgba(120, 14, 14, 0.1);
  transform-origin: left;
}
.progress i.on {
  background: linear-gradient(90deg, var(--apricot), var(--coral));
  animation: fill .35s ease;
}

.prompt { font-size: 40px; line-height: 1.05; margin: 8px 0; }
.options, .stack, .cards { display: grid; gap: 8px; }
.option, .tile, .token, .card {
  border: 1px solid transparent;
  background: white;
  padding: 15px 16px;
  text-align: left;
}
.option.good, .feedback.good {
  background: #fff4ec;
  animation: glow-good .7s ease;
}
.option.bad, .feedback.bad {
  background: #fff0ee;
  animation: glow-bad .7s ease;
}
.feedback {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 16px;
  border-radius: 22px;
  background: white;
}
.feedback-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.feedback-head strong { font-size: 22px; line-height: 1; }
.feedback-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.mark { font-size: 20px; font-weight: 800; }
.xp {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 700;
}
.feedback-note {
  margin: 0;
  line-height: 1.45;
}
.feedback-line {
  display: grid;
  gap: 2px;
  margin: 0;
  line-height: 1.35;
}
.feedback-line span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.62;
}
.feedback > * { animation: feedback-in .45s ease both; }
.feedback > :nth-child(2) { animation-delay: .16s; }
.feedback > :nth-child(3) { animation-delay: .32s; }
.feedback > :nth-child(4) { animation-delay: .48s; }
.feedback-next { animation: feedback-in .45s ease .62s both; }
.feedback.almost { animation: glow-soft .7s ease; background: #fff6ea; }
.wait {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--wine);
  font-weight: 700;
}
.wait .icon { animation: spin 1.1s linear infinite; }
.sentence {
  flex-wrap: wrap;
  align-items: baseline;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.45;
}
.blank {
  min-width: 72px;
  border-bottom: 3px solid var(--coral);
  padding: 0 6px;
}
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile.picked { outline: 2px solid var(--wine); transform: translateY(-2px); }
.token-row {
  flex-wrap: wrap;
  min-height: 58px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
}
.mic {
  width: 108px;
  height: 108px;
  border: 0;
  border-radius: 50%;
  margin: 8px auto;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--peach), var(--coral));
  color: white;
  box-shadow: 0 12px 24px rgba(222, 84, 69, 0.28);
}
.mic.live { animation: pulse 1s ease-in-out infinite; }
.center { text-align: center; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  padding: 16px;
  outline: none;
  border-radius: 22px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { box-shadow: 0 0 0 4px rgba(255, 157, 138, 0.45); }
.card { width: 100%; }
.card.on {
  border-color: var(--coral);
  background: #fff1ec;
  box-shadow: 0 0 0 4px rgba(255, 157, 138, 0.35);
}
.card small { display: block; margin-top: 4px; color: rgba(120, 14, 14, 0.62); font-weight: 500; }
.score { font-size: 72px; line-height: 0.9; }
.words { display: grid; margin-top: 8px; }
.words div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.prompt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.error {
  background: #fff0ee;
  color: var(--wine);
  padding: 10px 12px;
  border-radius: 16px;
  margin-bottom: 10px;
}
.lesson, .panel {
  animation: rise .38s ease;
}
.glow-good { animation: card-good .8s ease; }
.glow-bad { animation: card-bad .8s ease; }

.screen-enter-active, .screen-leave-active { transition: opacity .32s ease, transform .32s ease; }
.screen-enter-from { opacity: 0; transform: translateY(12px) scale(0.98); }
.screen-leave-to { opacity: 0; transform: translateY(-8px) scale(0.99); }
.pop-enter-active, .pop-leave-active { transition: opacity .28s ease, transform .28s ease; }
.pop-enter-from { opacity: 0; transform: translateX(16px); }
.pop-leave-to { opacity: 0; transform: translateX(-16px); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes feedback-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fill { from { transform: scaleX(0.2); } to { transform: scaleX(1); } }
@keyframes pulse {
  50% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(255, 157, 138, 0.28); }
}
@keyframes glow-good {
  0% { box-shadow: 0 0 0 0 rgba(243, 159, 81, 0.15); }
  45% { box-shadow: 0 0 0 8px rgba(255, 157, 138, 0.45), 0 0 32px 6px rgba(243, 159, 81, 0.55); }
  100% { box-shadow: 0 0 22px 2px rgba(255, 196, 199, 0.95); }
}
@keyframes glow-bad {
  0% { box-shadow: 0 0 0 0 rgba(222, 84, 69, 0.15); }
  45% { box-shadow: 0 0 0 8px rgba(222, 84, 69, 0.28), 0 0 28px 4px rgba(120, 14, 14, 0.35); }
  100% { box-shadow: 0 0 18px 2px rgba(222, 84, 69, 0.28); }
}
@keyframes glow-soft {
  50% { box-shadow: 0 0 0 8px rgba(243, 159, 81, 0.28), 0 0 24px rgba(255, 196, 199, 0.8); }
}
@keyframes card-good {
  40% { box-shadow: 0 0 42px 10px rgba(255, 157, 138, 0.55); }
}
@keyframes card-bad {
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); box-shadow: 0 0 36px 8px rgba(222, 84, 69, 0.35); }
  60% { transform: translateX(0); }
}

.chat {
  margin-top: 14px;
  display: grid;
  gap: 10px;
  max-height: 42vh;
  overflow: auto;
  padding-right: 2px;
}
.bubble {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 22px;
  background: white;
  box-shadow: var(--shadow);
  line-height: 1.4;
}
.bubble.user {
  background: linear-gradient(160deg, var(--blush), #ffe1d8);
  margin-left: 28px;
}
.bubble.assistant { margin-right: 28px; }
.bubble .ear { flex: none; margin-top: 1px; }
.lang-switch { display: flex; gap: 8px; }
.lang-switch .chip.on { background: var(--wine); color: white; }

.award-entry { margin-top: 14px; }
.home-links { margin-top: 12px; display: grid; gap: 10px; }
.home-links .award-entry { margin-top: 0; }
.plan-card {
  margin-top: 12px;
  padding: 16px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.plan-card.owned {
  outline: 2px solid rgba(222, 84, 69, 0.18);
}
.plan-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.plan-price {
  font-weight: 800;
  white-space: nowrap;
}
.badge-grid { display: grid; gap: 10px; }
.badge {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: white;
  box-shadow: var(--shadow);
  animation: crawl .5s cubic-bezier(.16, 1.2, .4, 1) both;
}
.badge.lock { opacity: .48; }
.award-pop {
  position: fixed;
  z-index: 40;
  top: calc(14px + env(safe-area-inset-top));
  right: max(12px, calc((100vw - 480px) / 2 + 12px));
  width: min(420px, calc(100vw - 24px));
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 24px;
  background: white;
  color: var(--wine);
  box-shadow: 0 18px 40px rgba(222, 84, 69, .28);
  animation: crawl .55s cubic-bezier(.16, 1.35, .32, 1);
}
.award-pop.out { animation: crawl-out .4s ease forwards; }
.award-medal {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--blush), var(--peach));
  flex: none;
}
@keyframes crawl {
  0% { transform: translateX(120%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes crawl-out {
  to { transform: translateX(130%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
