:root {
  --bg: #dff0ef;
  --ink: #5f4a3f;
  --accent: #df7983;
  --accent-soft: #f4d3d6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vmin 5vmin;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 620px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  animation: rise 1s ease forwards;
}

.art-wrap {
  position: relative;
  display: inline-block;
  filter: drop-shadow(0 22px 45px rgba(91, 81, 72, 0.18));
}

.card.no-image .art-wrap { display: none; }

.art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.art-wrap:empty,
.art:not([src]) { display: none; }

.content {
  margin-bottom: clamp(1.75rem, 6vw, 2.75rem);
}

.card.no-image .content {
  margin-bottom: 0;
}

.name {
  font-family: "Caveat", cursive;
  font-weight: 700;
  font-size: clamp(2.8rem, 12vw, 4.5rem);
  line-height: 1;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.name:empty { display: none; }

.message {
  margin-top: 1rem;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  white-space: pre-line;
  color: var(--ink);
}

.message:empty { display: none; }

.meta {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 60%, transparent);
}

.meta:empty { display: none; }

/* Play button — sits on the bottom edge of the card */
.play {
  position: absolute;
  bottom: 0;
  left: 50%;
  --shift: translate(-50%, 50%);
  transform: var(--shift);
  width: 84px;
  height: 84px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 12px 28px rgba(232, 134, 154, 0.45), 0 0 0 6px var(--bg);
}

.play:hover { transform: var(--shift) scale(1.06); }
.play:active { transform: var(--shift) scale(0.97); }
.play:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 4px; }

/* Fallback position when there is no card image */
.card.no-image .play {
  position: static;
  --shift: translateY(0);
  margin-top: clamp(1.75rem, 6vw, 2.75rem);
  box-shadow: 0 12px 28px rgba(232, 134, 154, 0.45);
}

.play__icon {
  width: 34px;
  height: 34px;
  fill: currentColor;
  grid-area: 1 / 1;
}

.play__icon--play { margin-left: 4px; }
.play__icon--pause { display: none; }

.play.is-playing .play__icon--play { display: none; }
.play.is-playing .play__icon--pause { display: block; }

.play__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}

.play.is-playing .play__ring {
  animation: pulse 2.4s ease-out infinite;
}
.play.is-playing .play__ring--2 {
  animation-delay: 1.2s;  
}

.play__label {
  display: block;
  margin-top: clamp(3.5rem, 9vw, 4.25rem);
  font-size: clamp(1.5rem, 3.4vw, 1.25rem);
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--ink) 78%, transparent);
}

.card.no-image .play__label {
  margin-top: 0.85rem;
}

.play__label:empty { display: none; }

.play.is-error {
  background: #c9beb4;
  box-shadow: none;
  cursor: not-allowed;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.9); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; opacity: 1; transform: none; }
  .play.is-playing .play__ring { animation: none; }
}
