/* ---------- Overlays & cards ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding:
    max(16px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 222, 155, 0.06), transparent 44%),
    rgba(5, 4, 15, 0.48);
  backdrop-filter: blur(5px) saturate(0.9);
  -webkit-backdrop-filter: blur(5px) saturate(0.9);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.card {
  position: relative;
  width: min(100%, 510px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 32px clamp(22px, 5vw, 42px) 26px;
  border-radius: 34px;
  color: var(--cream);
  background:
    radial-gradient(circle at 15% 8%, rgba(242, 200, 107, 0.09), transparent 26%),
    radial-gradient(circle at 88% 92%, rgba(109, 88, 178, 0.2), transparent 34%),
    linear-gradient(155deg, rgba(30, 25, 56, 0.97), rgba(13, 11, 29, 0.98));
  border: 1px solid rgba(242, 200, 107, 0.28);
  box-shadow:
    0 14px 0 rgba(3, 2, 12, 0.24),
    0 36px 90px rgba(1, 1, 8, 0.62),
    inset 0 1px 0 rgba(255, 245, 219, 0.12);
  text-align: center;
  scrollbar-width: none;
  animation: cardIn 0.52s cubic-bezier(0.2, 0.9, 0.25, 1.04) both;
}

.card::-webkit-scrollbar {
  display: none;
}

.overlay.is-hidden .card {
  animation: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 238, 196, 0.07);
  border-radius: 27px;
  pointer-events: none;
}

.card-sound {
  position: absolute;
  z-index: 2;
  top: 15px;
  right: 15px;
  width: 34px;
  height: 34px;
  color: rgba(242, 200, 107, 0.78);
  background: rgba(255, 246, 222, 0.04);
  border-color: rgba(242, 200, 107, 0.16);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.card-sound svg {
  width: 16px;
  height: 16px;
}

.eyebrow {
  color: rgba(242, 200, 107, 0.7);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.34em;
  padding-left: 0.34em;
  text-transform: uppercase;
}

.logo-lockup {
  margin-top: 2px;
}

.bunny-mark {
  display: block;
  width: clamp(74px, 14vw, 96px);
  height: auto;
  margin: 2px auto -2px;
  filter: drop-shadow(0 8px 18px rgba(240, 196, 104, 0.16));
  animation: bunnyFloat 4s ease-in-out infinite;
}

.logo-lockup h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 7vw, 46px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.08em;
  padding-left: 0.08em;
  color: #fff0c9;
  text-shadow:
    0 2px 0 rgba(100, 65, 27, 0.34),
    0 0 30px rgba(255, 216, 130, 0.12);
}

.latin-title {
  margin: 4px 0 0;
  color: rgba(242, 200, 107, 0.56);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.52em;
  padding-left: 0.52em;
}

.lead {
  margin: 11px auto 19px;
  max-width: 29em;
  color: rgba(235, 219, 196, 0.6);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.85;
  letter-spacing: 0.02em;
}

.steps {
  display: grid;
  gap: 5px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 13px;
  border-radius: 14px;
  background: rgba(255, 245, 221, 0.035);
  border: 1px solid rgba(255, 240, 207, 0.055);
}

.step-number {
  flex: none;
  width: 23px;
  color: rgba(242, 200, 107, 0.52);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.steps b {
  display: block;
  color: rgba(255, 245, 226, 0.9);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.steps small {
  display: block;
  margin-top: 2px;
  color: rgba(218, 202, 181, 0.43);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.45;
}

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 19px;
  min-height: 22px;
}

.chain i {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow:
    0 0 8px rgba(255, 235, 190, 0.22),
    inset 0 -1px 1px rgba(69, 39, 29, 0.22);
}

.chain i:nth-child(2) { width: 10px; height: 10px; }
.chain i:nth-child(3) { width: 11px; height: 11px; }
.chain i:nth-child(4) { width: 12px; height: 12px; }
.chain i:nth-child(5) { width: 13px; height: 13px; }
.chain i.chain-moon { width: 17px; height: 17px; box-shadow: 0 0 14px rgba(255, 220, 136, 0.7); }
.chain > span {
  color: rgba(237, 219, 188, 0.34);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.chain small {
  flex-basis: 100%;
  color: rgba(222, 204, 180, 0.32);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 53px;
  padding: 0 22px;
  border-radius: 16px;
  color: #3d2a1a;
  background: linear-gradient(145deg, #fff0bc 0%, #f5ce78 46%, #eab753 100%);
  border: 1px solid rgba(255, 249, 222, 0.72);
  box-shadow:
    0 5px 0 #9c6b2b,
    0 14px 28px rgba(5, 2, 12, 0.42),
    inset 0 1px 0 rgba(255, 254, 240, 0.7);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow:
    0 7px 0 #9c6b2b,
    0 18px 32px rgba(5, 2, 12, 0.46),
    inset 0 1px 0 rgba(255, 254, 240, 0.7);
}

.primary-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 #9c6b2b,
    0 8px 18px rgba(5, 2, 12, 0.38);
}

.primary-btn:focus-visible,
.card-sound:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid #ffe2a0;
  outline-offset: 3px;
}

.btn-arrow {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(92, 58, 17, 0.12);
  font-size: 14px;
  font-weight: 700;
}

.best-line {
  margin: 14px 0 0;
  color: rgba(222, 204, 180, 0.42);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.best-line strong {
  color: rgba(242, 200, 107, 0.9);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* ---------- Result card ---------- */

.result-card {
  width: min(100%, 440px);
  padding-top: 29px;
}

.result-card h2 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  color: #fff0c9;
  font-size: clamp(30px, 6.4vw, 40px);
  line-height: 1.2;
  letter-spacing: 0.08em;
  padding-left: 0.08em;
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(100, 65, 27, 0.34);
}

.result-card .lead {
  margin: 5px auto 16px;
  color: rgba(231, 213, 187, 0.56);
  font-size: 11px;
}

.final-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-bottom: 14px;
  padding: 13px 14px 12px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 221, 142, 0.13), transparent 68%),
    rgba(255, 245, 220, 0.035);
  border: 1px solid rgba(242, 200, 107, 0.13);
}

.final-score span {
  color: rgba(242, 218, 176, 0.45);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.final-score strong {
  color: #ffe8aa;
  font-size: clamp(48px, 12vw, 62px);
  font-weight: 900;
  line-height: 1.04;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 2px 0 rgba(105, 67, 22, 0.26),
    0 0 25px rgba(255, 211, 122, 0.18);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 15px;
}

.result-grid > div {
  padding: 8px 4px 9px;
  border-radius: 12px;
  background: rgba(255, 245, 220, 0.04);
  border: 1px solid rgba(255, 240, 208, 0.055);
}

.result-grid span {
  display: block;
  color: rgba(225, 207, 183, 0.36);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.result-grid strong {
  display: block;
  margin-top: 3px;
  color: rgba(255, 242, 218, 0.9);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.new-best {
  margin: 0 0 13px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  animation: bestGlow 1.7s ease-in-out infinite;
}

.new-best.is-hidden {
  display: none;
}

/* ---------- Animations ---------- */

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bunnyFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes bestGlow {
  0%, 100% { opacity: 0.55; text-shadow: none; }
  50% { opacity: 1; text-shadow: 0 0 16px rgba(255, 213, 120, 0.6); }
}

/* ---------- Responsive overlays ---------- */

@media (max-width: 560px) {
  .overlay {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .card {
    width: min(100%, 450px);
    max-height: calc(100dvh - 24px);
    border-radius: 28px;
    padding: 25px 20px 21px;
  }

  .card::after {
    inset: 6px;
    border-radius: 22px;
  }

  .card-sound {
    top: 11px;
    right: 11px;
    width: 31px;
    height: 31px;
  }

  .bunny-mark {
    width: 68px;
  }

  .logo-lockup h1 {
    font-size: clamp(31px, 9.4vw, 38px);
  }

  .latin-title {
    letter-spacing: 0.44em;
    padding-left: 0.44em;
  }

  .lead {
    margin: 8px auto 14px;
    font-size: 11px;
    line-height: 1.75;
  }

  .steps {
    margin-bottom: 12px;
  }

  .steps li {
    padding: 7px 11px;
  }

  .steps b {
    font-size: 10.5px;
  }

  .chain {
    margin-bottom: 15px;
  }

  .primary-btn {
    min-height: 49px;
    font-size: 13px;
  }

  .result-card {
    padding-top: 24px;
  }

  .result-card h2 {
    font-size: clamp(28px, 8.6vw, 34px);
  }

  .final-score {
    margin-bottom: 12px;
  }

  .result-grid strong {
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .card {
    padding: 21px 16px 18px;
  }

  .bunny-mark {
    width: 58px;
  }

  .logo-lockup h1 {
    font-size: 29px;
  }

  .lead {
    font-size: 10.5px;
  }

  .steps small {
    display: none;
  }

  .chain {
    margin-bottom: 12px;
  }

  .primary-btn {
    min-height: 47px;
  }

  .result-grid span {
    font-size: 7px;
  }

  .result-grid strong {
    font-size: 12px;
  }
}

@media (max-height: 730px) {
  .card {
    padding-top: 23px;
    padding-bottom: 18px;
  }

  .bunny-mark {
    width: 60px;
  }

  .logo-lockup h1 {
    font-size: clamp(28px, 6vw, 36px);
  }

  .lead {
    margin: 6px auto 11px;
    line-height: 1.65;
  }

  .steps {
    gap: 4px;
    margin-bottom: 10px;
  }

  .steps li {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .chain {
    margin-bottom: 12px;
  }

  .primary-btn {
    min-height: 47px;
  }

  .best-line {
    margin-top: 10px;
  }

  .result-card .lead {
    margin-bottom: 10px;
  }

  .final-score {
    padding: 9px 12px;
    margin-bottom: 10px;
  }

  .final-score strong {
    font-size: 47px;
  }

  .result-grid {
    margin-bottom: 11px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .overlay {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .card {
    width: min(100%, 760px);
    padding: 15px 24px 14px;
    border-radius: 22px;
    max-height: calc(100dvh - 16px);
  }

  .card::after {
    border-radius: 17px;
  }

  .eyebrow,
  .mobile-break {
    display: none;
  }

  .logo-lockup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .bunny-mark {
    width: 54px;
    margin: 0;
  }

  .logo-lockup h1 {
    font-size: 28px;
  }

  .latin-title {
    display: none;
  }

  .lead {
    margin: 4px auto 9px;
    font-size: 10.5px;
    line-height: 1.5;
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 8px;
  }

  .steps li {
    align-items: flex-start;
    padding: 6px 8px;
  }

  .steps small {
    display: none;
  }

  .steps b {
    font-size: 10px;
  }

  .step-number {
    width: 17px;
    font-size: 11px;
  }

  .chain {
    margin: 0 0 9px;
  }

  .chain small {
    display: none;
  }

  .primary-btn {
    width: min(100%, 320px);
    min-height: 42px;
    margin: 0 auto;
    font-size: 12px;
  }

  .best-line {
    display: none;
  }

  .result-card {
    width: min(100%, 620px);
  }

  .result-card h2 {
    font-size: 26px;
    margin-top: 3px;
  }

  .result-card .lead {
    margin-bottom: 7px;
  }

  .final-score {
    display: inline-flex;
    min-width: 190px;
    padding: 5px 20px 6px;
  }

  .final-score strong {
    font-size: 37px;
  }

  .result-grid {
    margin: 8px auto 9px;
    max-width: 440px;
  }

  .result-grid > div {
    padding: 5px 4px;
  }

  .new-best {
    margin-bottom: 8px;
  }

  .result-card .primary-btn {
    min-height: 40px;
  }
}
