/* ============================================================
   FONTS
   ============================================================ */
@font-face {
  font-family: "Santral";
  src:
    url("fonts/Santral-Black.woff2") format("woff2"),
    url("fonts/Santral-Black.woff") format("woff");
  font-weight: 900;
  font-style: normal;
}
@font-face {
  font-family: "Santral";
  src:
    url("fonts/Santral-Bold.woff2") format("woff2"),
    url("fonts/Santral-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
}

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --navy: #18185c;
  --magenta: #cf337b;
  --white: #ffffff;
  --font: "Santral", sans-serif;
  --circle-size: min(279px, 62vw);
}

/* ============================================================
   RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  width: 100%;
  min-height: 100%;
}
body {
  font-family: var(--font);
  overflow-x: hidden;
  background: linear-gradient(
    135deg,
    #7b5ea7 0%,
    #5b7fd4 35%,
    #6a5bbf 60%,
    #d45b9e 100%
  );
  background-size: 300% 300%;
  animation: gradient-shift 8s ease infinite;
}

/* ============================================================
   VIEWS
   ============================================================ */
.view {
  display: block;
  min-height: 100vh;
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition:
    opacity 300ms ease,
    visibility 300ms ease;
  pointer-events: none;
}
.view.active {
  opacity: 1;
  visibility: visible;
  position: relative;
  pointer-events: auto;
}

/* ============================================================
   ANIMATED GRADIENT BACKGROUND
   ============================================================ */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.card {
  background: transparent;
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 50px;
  gap: 22px;
}

/* ============================================================
   SPARKLES
   ============================================================ */
@keyframes sparkle-blink {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.7);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.sparkle {
  position: absolute;
  animation: sparkle-blink ease-in-out infinite;
}
.sparkle.sp1 {
  width: 46px;
  top: 7%;
  left: 5%;
  animation-duration: 3.1s;
  animation-delay: 0s;
}
.sparkle.sp2 {
  width: 28px;
  top: 12%;
  right: 7%;
  animation-duration: 2.7s;
  animation-delay: 0.8s;
}
.sparkle.sp3 {
  width: 18px;
  top: 34%;
  right: 5%;
  animation-duration: 3.5s;
  animation-delay: 1.4s;
}
.sparkle.sp4 {
  width: 62px;
  bottom: 19%;
  left: 5%;
  animation-duration: 2.4s;
  animation-delay: 0.5s;
}
.sparkle.sp5 {
  width: 38px;
  bottom: 15%;
  right: 8%;
  animation-duration: 3.8s;
  animation-delay: 1.9s;
}
.sparkle.sp6 {
  width: 22px;
  top: 52%;
  left: 9%;
  animation-duration: 3.2s;
  animation-delay: 2.3s;
}
.sparkle.sp7 {
  width: 15px;
  top: 3%;
  left: 38%;
  animation-duration: 4.1s;
  animation-delay: 0.3s;
}

/* ============================================================
   TEXT
   ============================================================ */
.text-holder {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--navy);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 743px;
  width: 100%;
  padding: 10px;
}
h1 {
  font-weight: 900;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.2;
}
.text-holder p {
  font-weight: 700;
  font-size: clamp(16px, 2.3vw, 22px);
  line-height: 1.5;
}

/* ============================================================
   PROFILE CIRCLE
   ============================================================ */
.profile-circle {
  position: relative;
  z-index: 1;
  width: var(--circle-size);
  height: var(--circle-size);
  flex-shrink: 0;
}
.circle-outer {
  position: absolute;
  top: 2.69%; /* 7.5/279 — centers circle at 50% despite off-center SVG */
  left: 1.58%; /* 4.4/279 */
  width: 96.85%; /* 270.2/279 — natural SVG aspect, not stretched to square */
  height: 97.17%; /* 271.1/279 */
}
.editor-active .circle-outer {
  display: none;
} /* ring drawn on canvas instead */
.circle-inner {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
}
.avatar-placeholder {
  position: absolute;
  top: 4%;
  left: 4%;
  width: 92%;
  height: 92%;
  object-fit: contain;
  clip-path: circle(59% at 50% 44.5%);
}
.logo-fixed {
  position: absolute;
  top: 66.7%;
  left: 22.94%;
  width: 55.59%;
  transform: rotate(-1.98deg);
  pointer-events: none;
}

/* ============================================================
   VIDEO (camera view)
   ============================================================ */
.camera-active video {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
  object-fit: cover;
  border-radius: 50%;
  transform: scaleX(-1);
}

/* ============================================================
   CANVAS (editor view)
   ============================================================ */
.editor-active #preview-canvas {
  position: absolute;
  inset: 2.5%;
  width: 95%;
  height: 95%;
  z-index: 1;
  touch-action: none;
  cursor: grab;
}
.editor-active #preview-canvas:active {
  cursor: grabbing;
}

/* ============================================================
   HINT TEXT
   ============================================================ */
.hint-text {
  position: relative;
  z-index: 1;
  color: var(--white);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.button-holder {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
button {
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  color: var(--white);
  background: var(--magenta);
  border: none;
  border-radius: 44px;
  height: 46px;
  padding: 2px 24px 0;
  min-width: 163px;
  cursor: pointer;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.1);
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
button:hover {
  opacity: 0.88;
}
button:active {
  opacity: 0.75;
}
.btn-icon {
  display: inline-block;
  transform: translateY(1.5px);
}
.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: none;
}
.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.9);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 520px;
  width: 92%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-content h2 {
  font-weight: 900;
  color: var(--navy);
  font-size: 24px;
}
.modal-instruction {
  font-size: 14px;
  color: #555;
}
.share-hint {
  font-size: 12px;
  color: #888;
  margin-top: 12px;
  line-height: 1.4;
}
#share-text {
  font-family: var(--font);
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  width: 100%;
}
.modal-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.modal-buttons button {
  min-width: 120px;
  flex: 1;
  font-size: 14px;
}
.share-mobile {
  display: none;
}
.share-desktop {
  display: contents;
}
.share-actions {
  gap: 12px;
}
.share-actions button {
  flex: 1 1 100%;
}
.modal-close {
  background: transparent;
  color: #999;
  font-size: 14px;
  min-width: unset;
  align-self: center;
  box-shadow: none;
}
.modal-close:hover {
  color: #333;
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .card {
    padding: 24px 16px 36px;
    gap: 16px;
  }
  .button-holder {
    gap: 12px;
  }
  button {
    min-width: 140px;
    height: 42px;
    font-size: 15px;
  }
  .modal-content {
    padding: 24px 20px;
  }
  .share-mobile {
    display: block;
  }
  .share-desktop {
    display: none;
  }
}
