:root {
  --ink: #2a1a2e;
  --cream: #fff6ef;
  --rose: #ff6b8b;
  --rose-deep: #e2456a;
  --gold: #ffd28a;
  --gold-deep: #f0b45f;
  --teal: #38c6b4;
  --green: #3ad07f;
  --green-deep: #22a862;
  --glass: rgba(255, 255, 255, 0.16);
  --glass-strong: rgba(255, 255, 255, 0.3);
  --shadow: 0 24px 70px rgba(40, 15, 40, 0.42);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  color: var(--cream);
  background: #1c1020 url("https://assets.friendortrend.dedyn.io/createbg.avif") center / cover no-repeat fixed;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background-image 0.9s ease-in-out;
}

body.logged-in {
  background-image: url("https://assets.friendortrend.dedyn.io/createbg.jpg");
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, rgba(28, 16, 32, 0.6), rgba(28, 16, 32, 0.84));
  z-index: 0;
}

/* Soft golden aura behind the card for a premium glow */
body::after {
  content: "";
  position: fixed;
  top: -20%;
  left: 50%;
  width: 720px;
  height: 720px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 210, 138, 0.16), transparent 60%);
  z-index: 0;
  pointer-events: none;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(94vw, 560px);
  text-align: center;
}

.logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
  animation: floaty 4s ease-in-out infinite;
}

.logo-sm {
  width: 56px;
  height: 56px;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.5rem;
  font-weight: 800;
  margin: 16px 0 6px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  letter-spacing: -0.5px;
}

.tagline {
  opacity: 0.85;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 0.72rem;
  margin-bottom: 30px;
}

.card {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-strong);
  border-radius: 28px;
  padding: 32px 26px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.6s ease both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 210, 138, 0.55), rgba(255, 255, 255, 0.05) 40%, rgba(255, 107, 139, 0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.lead {
  margin-bottom: 24px;
  opacity: 0.92;
  line-height: 1.6;
}

.fineprint {
  margin-top: 16px;
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.6;
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 15px 22px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--rose), var(--rose-deep));
  color: #fff;
  box-shadow: 0 14px 34px rgba(226, 69, 106, 0.5);
}

/* Subtle sheen sweep on primary buttons */
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  animation: sheen 3.6s ease-in-out infinite;
}

@keyframes sheen {
  0%,
  60% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: var(--cream);
  border: 1px solid var(--glass-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.24);
}

.btn-sign {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  display: block;
}

/* Home options */
.options {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  width: 100%;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-strong);
  color: var(--cream);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.option:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(40, 15, 40, 0.4);
}

.option-featured {
  background: linear-gradient(150deg, rgba(255, 210, 138, 0.2), rgba(255, 107, 139, 0.14));
  border-color: rgba(255, 210, 138, 0.6);
}

.option-featured:hover {
  border-color: var(--gold);
  box-shadow: 0 20px 46px rgba(240, 180, 95, 0.35);
}

.ribbon {
  position: absolute;
  top: 12px;
  right: -34px;
  transform: rotate(35deg);
  background: linear-gradient(120deg, var(--gold), var(--gold-deep));
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 40px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.opt-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--gold-deep));
  box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.4), 0 8px 18px rgba(226, 69, 106, 0.35);
  flex: none;
}

.opt-icon-alt {
  background: linear-gradient(135deg, var(--teal), #2f8fbf);
  box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.4), 0 8px 18px rgba(47, 143, 191, 0.35);
}

.opt-body {
  flex: 1;
}

.opt-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.opt-head h3 {
  font-size: 1.18rem;
  font-weight: 600;
}

.opt-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
}

.opt-badge-soft {
  background: rgba(56, 198, 180, 0.3);
  color: var(--cream);
}

.opt-body p {
  font-size: 0.84rem;
  opacity: 0.85;
  line-height: 1.5;
}

.opt-arrow {
  font-size: 1.3rem;
  opacity: 0.6;
  flex: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.option:hover .opt-arrow {
  transform: translateX(5px);
  opacity: 1;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--glass-strong);
  padding: 6px 16px 6px 6px;
  border-radius: 999px;
  margin-bottom: 22px;
  font-size: 0.88rem;
}

.user-chip img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

/* Count selector */
.counts {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0 6px;
}

.count-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-strong);
  color: var(--cream);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 104px;
}

.count-pill b {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
}

.count-pill span {
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  opacity: 0.8;
  text-transform: uppercase;
}

.count-pill:hover {
  transform: translateY(-3px);
}

.count-pill.active {
  background: linear-gradient(120deg, var(--rose), var(--rose-deep));
  border-color: transparent;
  box-shadow: 0 12px 26px rgba(226, 69, 106, 0.4);
}

.count-pill.locked b,
.count-pill.locked span {
  background: linear-gradient(120deg, var(--gold), var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.note {
  font-size: 0.8rem;
  opacity: 0.78;
  margin-top: 12px;
  line-height: 1.5;
}

/* Builder + general quiz shared bits */
.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  margin-bottom: 20px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.q-count {
  font-size: 0.74rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 14px;
}

.q-text {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.55rem;
  line-height: 1.35;
  margin-bottom: 24px;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-wrap: balance;
}

.answers {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.answer {
  position: relative;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--glass-strong);
  color: var(--cream);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  font-size: 0.98rem;
  transition: transform 0.16s ease, background 0.18s ease, border-color 0.18s ease;
}

.answer:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.answer.selected {
  border-color: var(--gold);
  background: rgba(255, 210, 138, 0.25);
}

/* Green confirm animation on auto-advance */
.answer.chosen {
  border-color: var(--green);
  background: rgba(58, 208, 127, 0.28);
  color: #fff;
  animation: chosenPulse 0.5s ease;
}

.answer.chosen::after {
  content: "\2713";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  animation: checkPop 0.35s ease 0.05s both;
}

.answers.locked .answer:not(.chosen) {
  opacity: 0.45;
}

@keyframes chosenPulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes checkPop {
  to {
    transform: translateY(-50%) scale(1);
  }
}

.btn-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
  border: 1px dashed var(--glass-strong);
}

.btn-skip:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.btn-skip svg {
  opacity: 0.9;
}

.field {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-strong);
  background: rgba(255, 255, 255, 0.14);
  color: var(--cream);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 12px;
}

.field::placeholder {
  color: rgba(255, 246, 239, 0.6);
}

.field:focus {
  outline: none;
  border-color: var(--gold);
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.opt-row .field {
  margin-bottom: 0;
}

.opt-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--glass-strong);
  cursor: pointer;
  flex: none;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.opt-radio.on {
  border-color: var(--gold);
  background: var(--gold);
}

.opt-radio.on::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
}

.builder-nav {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.builder-nav .btn {
  flex: 1;
}

/* Share */
.share-box {
  display: flex;
  gap: 10px;
  margin: 20px 0 8px;
}

.share-box input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-strong);
  background: rgba(255, 255, 255, 0.16);
  color: var(--cream);
  font-size: 0.92rem;
}

.big-emoji {
  font-size: 3rem;
  animation: pop 0.6s ease both;
}

@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Milestone modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 9, 22, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease both;
}

.modal {
  position: relative;
  width: min(92vw, 420px);
  text-align: center;
  background: linear-gradient(160deg, rgba(58, 32, 60, 0.96), rgba(28, 16, 32, 0.96));
  border: 1px solid var(--glass-strong);
  border-radius: 26px;
  padding: 32px 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: popUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  width: 260px;
  height: 260px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 210, 138, 0.35), transparent 65%);
  pointer-events: none;
}

.modal h2 {
  font-family: "Playfair Display", serif;
  font-size: 1.7rem;
  margin: 8px 0 10px;
}

.modal p {
  opacity: 0.9;
  line-height: 1.55;
  margin-bottom: 22px;
  font-size: 0.95rem;
}

.ms-actions {
  display: grid;
  gap: 12px;
}

.ms-actions .btn {
  width: 100%;
}

.btn-finb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(120deg, var(--gold), var(--gold-deep));
  color: var(--ink);
  box-shadow: 0 14px 30px rgba(240, 180, 95, 0.45);
  text-decoration: none;
  font-weight: 700;
}

.btn-finb:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

@keyframes popUp {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide {
  animation: slideIn 0.4s ease both;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(28, 16, 32, 0.92);
  border: 1px solid var(--glass-strong);
  padding: 12px 22px;
  border-radius: 999px;
  z-index: 50;
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
