@import url('https://fonts.googleapis.com/css?family=Indie+Flower');
@import url('https://fonts.googleapis.com/css?family=Amatic+SC');

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  background: #bbcbe9 !important;
  overflow: hidden;
}

/* --- Анимированный фон с текстом песни --- */
.bday-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

.bday-bg .bg-row {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-family: 'Indie Flower', cursive;
  font-size: 44px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 3px;
  padding: 4px 0;
  animation: marquee-left 60s linear infinite;
  will-change: transform;
}

.bday-bg .bg-row:nth-child(even) {
  animation-name: marquee-right;
}

/* Разные скорости у рядов — для живости */
.bday-bg .bg-row:nth-child(3n)   { animation-duration: 75s; }
.bday-bg .bg-row:nth-child(4n)   { animation-duration: 45s; }
.bday-bg .bg-row:nth-child(5n+2) { animation-duration: 90s; }

.bday-bg .bg-row span {
  display: inline-block;
  padding-right: 60px;
}

@keyframes marquee-left {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

@keyframes marquee-right {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* --- Сцена с открыткой поверх фона --- */
.bday-scene {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 520px;
  perspective: 2500px;
}

/* --- Контейнер карточки --- */
.bday-card {
  position: relative;
  width: 377px;
  height: 500px;
  transform-style: preserve-3d;
  transform: rotate(0deg) scale(1);
  transition: transform 1.2s cubic-bezier(.23, 1, .32, 1);
  cursor: pointer;
  border-radius: 4px;
  will-change: transform;
}

.bday-card:hover,
.bday-card:focus-within {
  transform: rotate(10deg) scale(1.1);
}

/* Внутренняя страница */
.bday-card .details {
  position: absolute;
  inset: 0;
  z-index: 1;
  box-sizing: border-box;
  padding: 26px 22px;
  background: #dfdcdf;
  border-radius: 4px;
  box-shadow: inset 12px 0 30px rgba(0,0,0,.12),
              inset -2px 0 4px rgba(0,0,0,.06),
              6px 6px 20px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  font-family: 'Indie Flower', cursive !important;
  color: #013243;
  overflow: hidden;
}

.bday-card .details::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 14px;
  background: linear-gradient(to right,
              rgba(0,0,0,.14), rgba(0,0,0,0) 100%);
  pointer-events: none;
}

.bday-card .details h4 {
  font-size: 24px;
  line-height: 1.1;
  margin: 4px 0;
  font-family: 'Amatic SC', cursive !important;
}

.bday-card .details p {
  font-size: 14px;
  line-height: 1.45;
  margin: 3px 0;
  padding: 0 6px;
  text-align: left;
}

.bday-card .details p.signature {
  text-align: right;
  margin-top: 8px;
  padding-right: 12px;
}

.bday-card .details p.empty-message {
  font-size: 14px;
  color: #000;
  text-align: center;
}

.bday-card .details .stage-link {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 18px;
  background: #ff9800;
  color: #fff !important;
  font-family: system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  transition: background .2s, transform .2s;
  align-self: center;
}

.bday-card .details .stage-link:hover {
  background: #e68900;
  transform: scale(1.05);
}

/* Обложка */
.bday-card .cover {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(.23, 1, .32, 1);
  z-index: 2;
  will-change: transform;
}

.bday-card:hover .cover,
.bday-card:focus-within .cover {
  transform: rotateY(-180deg);
}

.bday-card .cover-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 8px 8px 26px rgba(0,0,0,.25);
}

.bday-card .cover-face.front {
  background: #e0e1dc;
}

.bday-card .cover-face.front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bday-card .cover-face.back {
  transform: rotateY(180deg);
  background: #dfdcdf;
  box-shadow: inset -12px 0 30px rgba(0,0,0,.12);
}

.color1 { color: #1BBC9B; }
.color2 { color: #C0392B; }

@media (max-width: 720px) {
  .bday-scene {
    padding: 30px 16px;
    min-height: auto;
  }
  .bday-card { width: 260px; height: 360px; }
  .bday-card .details h4 { font-size: 21px; }
  .bday-card .details p { font-size: 13px; }

  .bday-card:hover,
  .bday-card:focus-within {
    transform: rotate(5deg) scale(1.04);
  }

  .bday-bg .bg-row { font-size: 28px; }
}

/* --- Плавающая пластинка (переключатель музыки) --- */
.vinyl {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 9999;
  transition: transform .2s ease;
}

.vinyl:hover {
  transform: scale(1.08);
}

.vinyl:active {
  transform: scale(0.96);
}

.vinyl-disc {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  /* Винил: чёрный с бороздками + светлый центр */
  background:
    radial-gradient(circle at 50% 50%,
        #ffd54f 0 16%,
        #1a1a1a 16% 20%,
        #2b2b2b 20% 24%,
        #111 24% 28%,
        #2b2b2b 28% 32%,
        #111 32% 36%,
        #2b2b2b 36% 40%,
        #111 40% 100%);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, .35),
    inset 0 0 0 1px rgba(255, 255, 255, .05);
  animation: vinyl-spin 4s linear infinite;
  animation-play-state: paused;
  will-change: transform;
}

/* Центральное отверстие */
.vinyl-disc::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Лёгкий блик — как от лампы в комнате */
.vinyl-disc::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, .18) 0%,
      rgba(255, 255, 255, 0) 45%,
      rgba(255, 255, 255, 0) 60%,
      rgba(255, 255, 255, .08) 100%);
  pointer-events: none;
}

.vinyl.playing .vinyl-disc {
  animation-play-state: running;
}

@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .vinyl {
    width: 52px;
    height: 52px;
    right: 14px;
    bottom: 14px;
  }
}