/* Sound Match Picture – layout and game-specific styles (UA Kit provides topbar, bar, buttons, result card) */

.smp-app {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  box-sizing: border-box;
}
.smp-app > header,
.smp-app > .ua-screen,
.smp-app > section { width: 100%; max-width: 620px; }
.smp-app > section, .smp-app > .ua-screen { display: flex; flex-direction: column; gap: 16px; }

@media (min-width: 880px) {
  .smp-app { padding-top: 28px; }
  .smp-app > section, .smp-app > .ua-screen { max-width: 980px; gap: 22px; }
}

/* Start */
.smp-start { padding: 40px 22px; text-align: center; align-items: center; background: var(--ua-card); border: 1px solid var(--ua-line); border-radius: 22px; box-shadow: var(--ua-shadow); }
.smp-hero { font-size: 56px; line-height: 1; }
.smp-start h1 { margin: 0; font-size: 26px; color: var(--ua-text); }
.smp-lead { margin: 0; max-width: 340px; color: var(--ua-text); line-height: 1.5; }
.smp-muted { margin: 0; color: var(--ua-muted); }

/* Hearts in the top bar */
.smp-hearts { display: inline-flex; gap: 4px; align-items: center; padding: 0 4px; }
.smp-heart { font-size: 20px; line-height: 1; color: #ef4444; transition: transform .2s ease, color .2s ease; }
.smp-heart.is-broken { color: var(--ua-muted); opacity: .6; }
.smp-heart.is-breaking { animation: smp-crack .48s ease both; }
.smp-heart.is-full { animation: smp-beat 2.4s ease-in-out infinite; }
@keyframes smp-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.15); } 30% { transform: scale(1); } }
@keyframes smp-crack { 0% { transform: scale(1); } 40% { transform: scale(1.3) rotate(-8deg); } 100% { transform: scale(.8) translateY(4px); opacity: .6; } }

/* Listen panel */
.smp-listen {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; border-radius: 22px;
  background: var(--ua-card); border: 1px solid var(--ua-line); box-shadow: var(--ua-shadow);
}
.smp-play {
  position: relative; flex-shrink: 0; width: 64px; height: 64px; border: 0; border-radius: 50%;
  display: grid; place-items: center; color: #fff; cursor: pointer;
  background: linear-gradient(145deg, #8b5cf6, #6d28d9);
  box-shadow: 0 8px 22px rgba(109, 40, 217, .4);
  transition: transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.smp-play:hover { transform: scale(1.05); }
.smp-play:active { transform: scale(.94); }
.smp-play svg { pointer-events: none; }
.smp-play.playing::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid #8b5cf6; animation: smp-ring 1.2s ease-out infinite; pointer-events: none;
}
@keyframes smp-ring { from { transform: scale(.9); opacity: .8; } to { transform: scale(1.5); opacity: 0; } }
.smp-wave { display: none; }
.smp-listen-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.smp-listen-text strong { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ua-accent-2); }
.smp-feedback { font-size: 17px; font-weight: 700; color: var(--ua-text); line-height: 1.35; min-height: 1.35em; }
.smp-feedback.ok { color: #15803d; }
.smp-feedback.bad { color: #b91c1c; }
html[data-theme="dark"] .smp-feedback.ok { color: #4ade80; }
html[data-theme="dark"] .smp-feedback.bad { color: #f87171; }

/* Picture grid */
.smp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .smp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 880px) { .smp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }

.smp-card {
  position: relative; aspect-ratio: 1 / 1; padding: 10px; border-radius: 20px; cursor: pointer;
  background: var(--ua-card); border: 2px solid var(--ua-line); box-shadow: var(--ua-shadow);
  display: grid; place-items: center; overflow: hidden;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, opacity .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.smp-card img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.smp-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(109, 40, 217, .18); border-color: var(--ua-accent-2); }
.smp-card:active:not(:disabled) { transform: scale(.96); }
.smp-card:disabled { cursor: default; }
.smp-card.wrong { border-color: #ef4444; animation: smp-shake .45s ease; }
.smp-card.matched { border-color: #22c55e; opacity: .55; }
.smp-card.just-matched { opacity: 1; animation: smp-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes smp-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes smp-pop { 0% { transform: scale(.92); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Match burst */
.smp-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.smp-burst i {
  position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%;
  animation: smp-burst .8s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes smp-burst {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--tx), var(--ty)) scale(.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .smp-heart.is-full, .smp-play.playing::before, .smp-card.wrong, .smp-burst i { animation: none !important; }
}
