:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  background: #050912;
  overflow-x: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  min-height: 100vh;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #eef1f6;
  position: relative;
}

/* ---------- Aurora background ---------- */

.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #0b1526 0%, #050912 55%, #030509 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  will-change: transform, opacity;
}

.orb-blue {
  width: 60vmax;
  height: 60vmax;
  top: -20vmax;
  left: -15vmax;
  background: #1f4f8f;
  animation: drift-a 26s ease-in-out infinite;
}

.orb-teal {
  width: 50vmax;
  height: 50vmax;
  bottom: -18vmax;
  right: -12vmax;
  background: #1f7a6f;
  animation: drift-b 32s ease-in-out infinite;
}

.orb-violet {
  width: 45vmax;
  height: 45vmax;
  top: 30%;
  right: -20vmax;
  background: #4d3a7a;
  animation: drift-c 38s ease-in-out infinite;
}

.orb-green {
  width: 35vmax;
  height: 35vmax;
  bottom: 10%;
  left: -15vmax;
  background: #2f6b4f;
  opacity: 0.22;
  animation: drift-a 30s ease-in-out infinite reverse;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vmax, 3vmax) scale(1.08); }
}

@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vmax, -3vmax) scale(1.06); }
}

@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-3vmax, 4vmax) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
}

/* ---------- Layout ---------- */

.memorial {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Player ---------- */

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 60px -15px rgba(0, 0, 0, 0.7),
    0 0 80px -20px rgba(80, 140, 220, 0.25);
}

#memorial-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.tap-button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(5, 9, 18, 0.38);
  backdrop-filter: blur(1px);
  border: none;
  cursor: pointer;
  color: #f4f6fa;
  transition: background 0.25s ease, opacity 0.35s ease;
}

.tap-button:active {
  background: rgba(5, 9, 18, 0.52);
}

.tap-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 22px;
  padding-left: 4px;
  box-shadow: 0 0 30px rgba(120, 170, 255, 0.35);
}

.tap-button--replay .tap-icon {
  padding-left: 0;
  font-size: 26px;
}

.tap-label {
  font-size: 16px;
  letter-spacing: 0.04em;
  font-weight: 500;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.hidden {
  display: none !important;
}

.error-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(5, 9, 18, 0.85);
  text-align: center;
  padding: 24px;
}

.error-message p {
  margin: 0;
  font-size: 15px;
  color: #d8dee8;
}

.retry-button {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f6fa;
  font-size: 14px;
  cursor: pointer;
}

.loading-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Dedication ---------- */

.dedication {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: #aab4c6;
  text-align: center;
  margin: 4px 0 0;
  opacity: 0.85;
}

@media (max-height: 700px) {
  .memorial { padding-top: 14px; gap: 12px; }
  .dedication { font-size: 13px; }
}
