/* ---------- motion ---------- */
@keyframes screen-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes screen-back {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes wave {
  from { transform: scaleY(.55); opacity: .55; }
  to { transform: scaleY(1.05); opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
@keyframes boot-line {
  from { transform: translateX(-100%); }
  to { transform: translateX(310%); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop-in {
  0% { opacity: 0; transform: scale(.86); }
  60% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes ring-in {
  from { opacity: 0; transform: rotate(-30deg) scale(.9); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .app-root *, .app-root *::before, .app-root *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
.app-root.reduce-motion *,
.app-root.reduce-motion *::before,
.app-root.reduce-motion *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}


.od-icon { shape-rendering: geometricPrecision; }
.badge-sheet-medal { position: relative; }

.badge-sheet-medal .medal { animation: medal-reveal var(--motion-honor) var(--ease-out) both; }

@keyframes medal-reveal {
  0% { opacity: 0; transform: scale(.6) rotate(-10deg); }
  58% { opacity: 1; transform: scale(1.06) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}


/* ---------- Motion layer ---------- */
.audio-play, .mini-toggle { position: relative; }
.audio-play .icon-play, .audio-play .icon-pause,
.mini-toggle .icon-play, .mini-toggle .icon-pause {
  position: absolute;
  inset: 0;
  display: grid !important;
  place-items: center;
  transition: opacity var(--motion-press) var(--ease-out), transform var(--motion-base) var(--ease-spring);
}
.audio-play .icon-pause, .mini-toggle .icon-pause { opacity: 0; transform: scale(.55) rotate(-24deg); }
.audio-play.is-playing .icon-play, .mini-toggle.is-playing .icon-play { opacity: 0; transform: scale(.7) rotate(24deg); }
.audio-play.is-playing .icon-pause, .mini-toggle.is-playing .icon-pause { opacity: 1; transform: none; }

.mini-action.is-on .od-icon, .detail-action-btn.is-on .od-icon, .fav-remove:active .od-icon {
  animation: heart-pop var(--motion-base) var(--ease-spring);
}
@keyframes heart-pop {
  0% { transform: scale(.78); }
  55% { transform: scale(1.24); }
  100% { transform: scale(1); }
}

.signin-stamp {
  position: absolute;
  z-index: 2;
  top: -4px;
  right: 2px;
  width: 76px; height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-light);
  transform: rotate(-9deg);
  opacity: .92;
  animation: stamp-in var(--motion-stamp) var(--ease-spring) both;
}
.signin-stamp::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(198, 161, 107, .5); border-radius: 50%; }
.signin-stamp span { font-family: var(--serif); font-size: 0.9375rem; letter-spacing: .08em; }

@keyframes stamp-in {
  0% { opacity: 0; transform: scale(1.18) rotate(-12deg); }
  55% { opacity: 1; transform: scale(.92) rotate(-7deg); }
  100% { opacity: .92; transform: scale(1) rotate(-9deg); }
}

.quiz-feedback.is-correct { animation: feedback-correct var(--motion-slow) var(--ease-out) both; }
.quiz-feedback.is-wrong { animation: feedback-wrong var(--motion-slow) var(--ease-out) both; }
@keyframes feedback-correct {
  0% { opacity: 0; transform: translateY(8px); }
  55% { opacity: 1; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes feedback-wrong {
  0% { opacity: 0; transform: translateX(0); }
  28% { opacity: 1; transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  72% { transform: translateX(-2px); }
  100% { opacity: 1; transform: translateX(0); }
}
.result-score strong { animation: score-reveal var(--motion-slow) var(--ease-out) both; }
@keyframes score-reveal {
  0% { opacity: 0; transform: translateY(10px) scale(.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.success-ticket { animation: ticket-unfold var(--motion-ticket) var(--ease-out) both; transform-origin: 50% 0; }
.ticket { animation: ticket-unfold var(--motion-ticket) var(--ease-out) both; transform-origin: 50% 0; }
@keyframes ticket-unfold {
  0% { opacity: 0; transform: perspective(900px) rotateX(-18deg) scaleY(.76); }
  58% { opacity: 1; transform: perspective(900px) rotateX(2deg) scaleY(1.015); }
  100% { opacity: 1; transform: perspective(900px) rotateX(0) scaleY(1); }
}



/* Real Web Audio amplitude overrides CSS fallback */
.waveform.is-metered i { animation: none !important; }

/* V1.3 small-state fixes */
.app-root .medal { background: none; box-shadow: none; border-radius: 0; }
.app-root .medal-art { width: 100%; height: 100%; display: block; }
.app-root .medal-lock { background: var(--bg-2); border-color: var(--line); color: var(--muted); }
.app-root .badge-sheet-medal .medal { animation: medal-reveal var(--motion-honor) var(--ease-out) both; }
.app-root .success-ticket,
.app-root .ticket { animation: ticket-unfold var(--motion-ticket) var(--ease-out) both; }
.app-root .signin-stamp { animation: stamp-in var(--motion-stamp) var(--ease-out) both; }
.app-root .app-main.is-entering { animation: screen-in var(--motion-page) var(--ease-out) both; }
.app-root .app-main.is-back { animation: screen-back var(--motion-page) var(--ease-out) both; }
.app-root .tab-item.is-active .tab-icon .od-icon { animation: tab-icon-in var(--motion-tab) var(--ease-out) both; }
.app-root .audio-play .icon-play,
.app-root .audio-play .icon-pause,
.app-root .mini-toggle .icon-play,
.app-root .mini-toggle .icon-pause { transition-duration: var(--motion-save); }
.app-root .mini-action.is-on .od-icon,
.app-root .detail-action-btn.is-on .od-icon { animation: heart-pop var(--motion-save) var(--ease-spring); }

@media (prefers-reduced-motion: reduce) {
  .app-root *, .app-root *::before, .app-root *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
