/* ==========================================================
   Runaway No button. Everything here is prefixed rw-.
   ========================================================== */

.rw-card {
  position: relative;
  max-width: 560px;
  margin: 34px auto 0;
  padding: 36px clamp(12px, 4vw, 26px) clamp(12px, 4vw, 26px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 162, 75, 0.42);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(90% 60% at 100% 100%, rgba(242, 196, 206, 0.35) 0%, rgba(242, 196, 206, 0) 70%),
    repeating-linear-gradient(0deg, rgba(128, 0, 32, 0.016) 0 1px, transparent 1px 4px),
    var(--paper);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--text);
  text-align: center;
  isolation: isolate;
}

/* Thin inner gold line, like fancy stationery. */
.rw-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(201, 162, 75, 0.32);
  border-radius: calc(var(--radius-lg) - 6px);
  pointer-events: none;
}

.rw-seal {
  position: absolute;
  top: -26px;
  left: 50%;
  width: 54px;
  height: 54px;
  transform: translateX(-50%) rotate(-8deg);
  filter: drop-shadow(0 4px 6px rgba(74, 14, 28, 0.32));
  pointer-events: none;
}

.rw-question {
  position: relative;
  margin: 4px auto 0;
  max-width: 18ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 7.6vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.005em;
  color: var(--burgundy-deep);
  white-space: pre-line;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.rw-flourish {
  width: 132px;
  height: auto;
  margin: 10px auto 16px;
}

/* Arena and result share one grid cell so the card never jumps. */
.rw-stage {
  position: relative;
  display: grid;
}

.rw-stage > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.rw-arena {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1.5px dashed rgba(201, 162, 75, 0.62);
  background:
    radial-gradient(circle, rgba(201, 79, 109, 0.15) 1.2px, transparent 1.7px) 0 0 / 18px 18px,
    linear-gradient(180deg, #fff7f5 0%, var(--blush-soft) 100%);
  box-shadow: inset 0 2px 12px rgba(74, 14, 28, 0.06);
  /* While the page resizes, a button can sit outside for a frame. Never let that widen the page. */
  overflow: hidden;
  overflow: clip;
  overflow-clip-margin: 6px;
  transition:
    opacity 0.35s var(--ease),
    transform 0.45s var(--ease),
    visibility 0s linear 0s;
}

.rw-card[data-state="yes"] .rw-arena {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94);
  transition:
    opacity 0.25s var(--ease),
    transform 0.3s var(--ease),
    visibility 0s linear 0.3s;
}

/* Phrase bubble */
.rw-bubble-row {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 62px;
  padding: 8px 12px 0;
  pointer-events: none;
}

.rw-bubble {
  position: relative;
  margin: 0;
  max-width: 100%;
  padding: 5px 14px 6px;
  border-radius: 16px;
  border: 1.5px solid var(--blush);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(19px, 5.6vw, 23px);
  line-height: 1.05;
  color: var(--wine);
  overflow-wrap: break-word;
  opacity: 0;
  transform: rotate(var(--rw-tilt, 0deg));
}

.rw-bubble:empty {
  visibility: hidden;
}

/* Little tail pointing down into the field. */
.rw-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: #fff;
  border-right: 1.5px solid var(--blush);
  border-bottom: 1.5px solid var(--blush);
  transform: rotate(45deg);
}

.rw-bubble.rw-pop {
  opacity: 1;
  animation: rw-pop 0.42s var(--ease-bounce);
}

@keyframes rw-pop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.6) rotate(calc(var(--rw-tilt, 0deg) - 6deg));
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1.08) rotate(var(--rw-tilt, 0deg));
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(var(--rw-tilt, 0deg));
  }
}

/* Where the buttons live. Height is fixed so nothing jumps. */
.rw-field {
  position: relative;
  height: 228px;
  height: clamp(228px, 64vw, 280px);
}

/* Buttons */
.rw-btn {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 96px;
  min-height: 52px;
  margin: 0;
  padding: 0 24px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transform-origin: 50% 50%;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  visibility: hidden; /* until JS places them */
  transition:
    transform 0.56s cubic-bezier(0.3, 1.35, 0.5, 1),
    opacity 0.3s var(--ease),
    box-shadow 0.25s var(--ease),
    filter 0.2s var(--ease);
}

.rw-field.rw-ready .rw-btn {
  visibility: visible;
}

.rw-field.rw-instant .rw-btn {
  transition: none !important;
}

.rw-btn:focus {
  outline: none;
}

.rw-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.rw-btn-label {
  display: block;
  pointer-events: none;
}

.rw-yes {
  z-index: 1;
  color: var(--cream);
  background: linear-gradient(180deg, var(--wine) 0%, var(--burgundy) 62%, #6c001b 100%);
  box-shadow:
    0 8px 18px rgba(128, 0, 32, 0.32),
    0 2px 4px rgba(74, 14, 28, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 0.56s cubic-bezier(0.3, 1.25, 0.5, 1),
    box-shadow 0.25s var(--ease),
    filter 0.2s var(--ease);
}

.rw-yes-icon {
  width: 17px;
  height: 17px;
  flex: none;
  pointer-events: none;
}

.rw-yes:active {
  filter: brightness(0.92);
}

@media (hover: hover) {
  .rw-yes:hover {
    filter: brightness(1.08);
    box-shadow:
      0 10px 24px rgba(128, 0, 32, 0.38),
      0 2px 4px rgba(74, 14, 28, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.28);
  }
}

/* After a few dodges Yes gets a soft gold halo, as a hint. */
.rw-yes::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid var(--gold-soft);
  opacity: 0;
  pointer-events: none;
}

.rw-eager .rw-yes::after {
  animation: rw-halo 1.8s var(--ease) infinite;
}

@keyframes rw-halo {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.16, 1.4);
  }
}

.rw-no {
  z-index: 2;
  color: var(--burgundy);
  background: var(--paper);
  border-color: var(--burgundy);
  box-shadow: var(--shadow-sm);
}

/* Result */
.rw-result {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 12px 10px;
  border-radius: var(--radius);
  background: radial-gradient(70% 60% at 50% 40%, rgba(242, 196, 206, 0.45) 0%, rgba(242, 196, 206, 0) 70%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.92);
  transition:
    opacity 0.2s var(--ease),
    transform 0.2s var(--ease),
    visibility 0s linear 0.2s;
}

.rw-card[data-state="yes"] .rw-result {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.4s var(--ease) 0.15s,
    transform 0.65s var(--ease-bounce) 0.15s,
    visibility 0s linear 0s;
}

.rw-result-heart {
  width: 58px;
  height: 58px;
  filter: drop-shadow(0 6px 10px rgba(128, 0, 32, 0.28));
}

.rw-card[data-state="yes"] .rw-result-heart {
  animation: rw-beat 1.3s var(--ease) 0.5s infinite;
}

@keyframes rw-beat {
  0%,
  100% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.14);
  }
  28% {
    transform: scale(0.98);
  }
  42% {
    transform: scale(1.08);
  }
  60% {
    transform: scale(1);
  }
}

.rw-result-title {
  margin: 6px 0 2px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(42px, 13vw, 62px);
  line-height: 1.02;
  color: var(--burgundy);
  white-space: pre-line;
  overflow-wrap: break-word;
  max-width: 100%;
}

.rw-result-title:focus {
  outline: none;
}

.rw-result-title:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
}

.rw-result-text {
  margin: 0;
  max-width: 30ch;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-soft);
  white-space: pre-line;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.rw-again {
  margin-top: 10px;
  min-height: 48px;
  min-width: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  color: var(--wine);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.2s var(--ease);
}

.rw-again:focus {
  outline: none;
}

.rw-again:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

@media (hover: hover) {
  .rw-again:hover {
    background: var(--blush-soft);
  }
}

/* Hearts burst, confined to the card. */
.rw-fx {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.rw-heart {
  position: absolute;
  display: block;
  pointer-events: none;
  will-change: transform, opacity;
}

.rw-ring {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid var(--gold-soft);
  box-shadow: 0 0 18px rgba(201, 162, 75, 0.45);
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  pointer-events: none;
}

/* Bigger screens get a bit more room to run. */
@media (min-width: 560px) {
  .rw-field {
    height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rw-btn,
  .rw-yes {
    transition:
      transform 0.16s ease-out,
      opacity 0.16s ease-out,
      box-shadow 0.2s ease,
      filter 0.2s ease;
  }

  .rw-bubble.rw-pop {
    animation: rw-fade 0.2s ease-out;
  }

  .rw-eager .rw-yes::after,
  .rw-card[data-state="yes"] .rw-result-heart {
    animation: none;
  }

  .rw-arena,
  .rw-result,
  .rw-card[data-state="yes"] .rw-arena,
  .rw-card[data-state="yes"] .rw-result {
    transform: none;
  }

  .rw-card[data-state="yes"] .rw-result {
    transition:
      opacity 0.25s ease-out,
      visibility 0s linear 0s;
  }
}

@keyframes rw-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
