@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,560;9..144,700&family=Nunito:wght@600;700;800&display=swap");

/* Claire's Room battle FX. Palette matches battle-hud.css / room-hud.css. */
.bfx-root {
  --cr-cream: #f7ecd6;
  --cr-cream-2: #efe0c0;
  --cr-parchment: #fbf6ea;
  --cr-ink: #3b2a1c;
  --cr-ink-soft: #6d5340;
  --cr-amber: #e59a2d;
  --cr-amber-bright: #f5a524;
  --cr-amber-deep: #8a5514;
  --cr-pink: #d39298;
  --cr-pink-deep: #b56870;
  --cr-rose: #f3ddd8;
  --cr-hp: #c45b5b;
  --cr-shadow: 0 12px 32px rgba(59, 42, 28, 0.26);
  --cr-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --cr-sans: "Nunito", "Avenir Next", "Segoe UI", sans-serif;

  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
  color: var(--cr-ink);
  font-family: var(--cr-sans);
  -webkit-font-smoothing: antialiased;
}
.bfx-root.bfx-fixed { position: fixed; }
.bfx-root.is-interactive { pointer-events: auto; }
.bfx-root *, .bfx-root *::before, .bfx-root *::after { box-sizing: border-box; }

.bfx-live, .bfx-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.bfx-screen { position: absolute; inset: 0; }

/* ---------- transition wipe ---------- */
.bfx-wipe { position: absolute; inset: 0; z-index: 50; pointer-events: auto; }
.bfx-swirl {
  position: absolute;
  left: 50%; top: 50%;
  width: 165vmax; height: 165vmax;
  transform: translate(-50%, -50%);
  clip-path: circle(0% at 50% 50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(251, 246, 234, 0.95) 0 3%, rgba(251, 246, 234, 0) 13%),
    repeating-conic-gradient(from 0deg at 50% 50%,
      #f7ecd6 0deg 9deg, #f3ddd8 9deg 12deg, #d39298 12deg 21deg, #e9b9b3 21deg 24deg);
  will-change: transform, clip-path, opacity;
}
.bfx-swirl-glow {
  position: absolute; inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 18%, rgba(59, 42, 28, 0.06) 30%, rgba(59, 42, 28, 0.28) 46%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 0 34px, rgba(255, 250, 240, 0.32) 34px 38px);
}
.bfx-flash {
  position: absolute; inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fffdf6 0%, #fbf3e2 55%, #f3ddd8 100%);
}

/* ---------- VS intro ---------- */
.bfx-intro { display: grid; place-items: center; background: rgba(26, 18, 12, 0.32); animation: bfx-fade-in 260ms ease both; }
.bfx-band {
  position: absolute;
  left: -6%; right: -6%;
  height: 31%;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-block: 2px solid rgba(138, 85, 20, 0.55);
  box-shadow: var(--cr-shadow), inset 0 0 0 4px rgba(247, 236, 214, 0.55);
}
.bfx-band-left {
  top: 15%;
  transform: rotate(-6deg);
  justify-content: flex-start;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 250, 240, 0.18) 0 14px, transparent 14px 30px),
    linear-gradient(90deg, #f7ecd6 0%, #f3ddd8 60%, #e9b9b3 100%);
  animation: bfx-band-l 620ms cubic-bezier(0.2, 0.9, 0.25, 1.05) both;
}
.bfx-band-right {
  bottom: 15%;
  transform: rotate(-6deg);
  justify-content: flex-end;
  background:
    repeating-linear-gradient(45deg, rgba(255, 250, 240, 0.14) 0 14px, transparent 14px 30px),
    linear-gradient(270deg, #f5c77e 0%, #e59a2d 70%, #c97f22 100%);
  animation: bfx-band-r 620ms cubic-bezier(0.2, 0.9, 0.25, 1.05) 90ms both;
}
.bfx-band-inner { display: flex; flex-direction: column; padding: 0 14%; gap: 2px; }
.bfx-band-right .bfx-band-inner { align-items: flex-end; text-align: right; }
.bfx-band-left .bfx-band-inner { animation: bfx-name-l 700ms cubic-bezier(0.2, 0.9, 0.25, 1) 160ms both; }
.bfx-band-right .bfx-band-inner { animation: bfx-name-r 700ms cubic-bezier(0.2, 0.9, 0.25, 1) 250ms both; }
.bfx-band-who {
  font-size: clamp(11px, 1.1vw, 14px);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cr-pink-deep);
}
.bfx-band-right .bfx-band-who { color: #5e3a10; }
.bfx-band-name {
  font-family: var(--cr-serif);
  font-weight: 700;
  font-size: clamp(44px, 8.5vw, 132px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--cr-ink);
  text-shadow: 0 3px 0 rgba(255, 250, 240, 0.7);
  white-space: nowrap;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bfx-vs {
  position: relative;
  z-index: 2;
  display: grid; place-items: center;
  width: clamp(110px, 13vw, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 45%),
    var(--cr-parchment);
  border: 3px solid var(--cr-amber-deep);
  box-shadow: var(--cr-shadow), inset 0 0 0 6px rgba(247, 236, 214, 0.95), inset 0 0 0 9px rgba(213, 146, 152, 0.45), 0 0 0 10px rgba(245, 165, 36, 0.18);
  animation: bfx-vs-pop 560ms cubic-bezier(0.2, 1.4, 0.35, 1) 420ms both;
}
.bfx-vs span {
  font-family: var(--cr-serif);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(48px, 6vw, 88px);
  line-height: 1;
  color: var(--cr-amber-deep);
  letter-spacing: -0.02em;
  transform: translateY(-3%);
}
.bfx-intro-rule {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--cr-parchment);
  border: 1.5px solid rgba(138, 85, 20, 0.45);
  box-shadow: var(--cr-shadow);
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--cr-ink-soft);
  white-space: nowrap;
  animation: bfx-fade-up 400ms ease 700ms both;
}

/* ---------- throw reveal ---------- */
.bfx-throw {
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(26, 18, 12, 0.18), rgba(26, 18, 12, 0.5) 80%);
  animation: bfx-fade-in 200ms ease both;
}
.bfx-count { display: grid; place-items: center; }
.bfx-count-num {
  font-family: var(--cr-serif);
  font-weight: 700;
  font-size: clamp(110px, 16vw, 220px);
  line-height: 1;
  color: var(--cr-cream);
  -webkit-text-stroke: 3px var(--cr-amber-deep);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--cr-amber-deep), 0 18px 34px rgba(26, 18, 12, 0.45);
  animation: bfx-count 520ms cubic-bezier(0.2, 1.3, 0.35, 1) both;
}
.bfx-count-num.is-shoot {
  font-size: clamp(64px, 11vw, 168px);
  font-style: italic;
  color: var(--cr-amber-bright);
  -webkit-text-stroke: 3px #5e3a10;
  text-shadow: 0 6px 0 #5e3a10, 0 0 60px rgba(245, 165, 36, 0.55);
}
.bfx-throws {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "l c r" "line line line";
  align-items: center;
  justify-items: center;
  gap: 18px clamp(12px, 3vw, 48px);
  width: min(980px, calc(100% - 32px));
}
.bfx-hand {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(340px, 100%);
  padding: 20px 20px 18px;
  border-radius: 26px;
  background-color: var(--cr-parchment);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 15% 20%, rgba(243, 221, 216, 0.6), transparent 50%),
    repeating-linear-gradient(90deg, rgba(107, 74, 46, 0.025) 0 1px, transparent 1px 3px);
  border: 1.5px solid rgba(138, 85, 20, 0.45);
  box-shadow: var(--cr-shadow), inset 0 0 0 3px rgba(247, 236, 214, 0.9), inset 0 0 0 5px rgba(213, 146, 152, 0.3);
  transition: filter 300ms ease, opacity 300ms ease;
}
.bfx-hand-left { grid-area: l; animation: bfx-hand-l 420ms cubic-bezier(0.3, 0, 0.2, 1) both, bfx-recoil-l 380ms ease-out 420ms both; }
.bfx-hand-right { grid-area: r; animation: bfx-hand-r 420ms cubic-bezier(0.3, 0, 0.2, 1) both, bfx-recoil-r 380ms ease-out 420ms both; }
.bfx-hand-name {
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cr-pink-deep);
}
.bfx-hand-icon { width: clamp(110px, 12.5vw, 190px); aspect-ratio: 1; display: block; }
.bfx-hand-icon svg { width: 100%; height: 100%; display: block; }
.bfx-hand-right .bfx-hand-icon svg { transform: scaleX(-1); }
.bfx-hand-move { font-family: var(--cr-serif); font-weight: 700; font-size: clamp(22px, 2.2vw, 30px); color: var(--cr-ink); }
.bfx-hand.is-win {
  box-shadow: var(--cr-shadow), inset 0 0 0 3px rgba(247, 236, 214, 0.9), inset 0 0 0 6px rgba(245, 165, 36, 0.55), 0 0 0 6px rgba(245, 165, 36, 0.22), 0 0 46px rgba(245, 165, 36, 0.35);
}
.bfx-hand.is-lose { animation-fill-mode: both; filter: saturate(0.7) brightness(0.92); opacity: 0.86; }
.bfx-clash {
  grid-area: c;
  width: clamp(70px, 8vw, 120px);
  aspect-ratio: 1;
  animation: bfx-clash 700ms cubic-bezier(0.2, 1.4, 0.35, 1) 330ms both;
  filter: drop-shadow(0 6px 14px rgba(26, 18, 12, 0.35));
}
.bfx-clash svg { width: 100%; height: 100%; display: block; }
.bfx-throw-line {
  grid-area: line;
  margin: 0;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--cr-parchment);
  border: 1.5px solid rgba(138, 85, 20, 0.45);
  box-shadow: var(--cr-shadow);
  font-family: var(--cr-serif);
  font-weight: 560;
  font-size: clamp(16px, 1.6vw, 21px);
  color: var(--cr-ink);
  animation: bfx-fade-up 360ms ease 640ms both;
}

/* ---------- match result ---------- */
.bfx-result {
  display: grid; place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 42%, rgba(26, 18, 12, 0.3), rgba(26, 18, 12, 0.62) 85%);
  animation: bfx-fade-in 280ms ease both;
}
.bfx-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.bfx-confetto {
  position: absolute;
  top: -40px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(59, 42, 28, 0.35);
  animation-name: bfx-fall;
  animation-timing-function: cubic-bezier(0.3, 0.4, 0.6, 1);
  animation-fill-mode: both;
  will-change: transform;
}
.bfx-result-card {
  position: relative;
  width: min(460px, 100%);
  padding: 26px 30px 24px;
  border-radius: 30px;
  text-align: center;
  background-color: var(--cr-parchment);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 15% 15%, rgba(243, 221, 216, 0.65), transparent 50%),
    radial-gradient(circle at 90% 100%, rgba(245, 199, 126, 0.35), transparent 50%),
    repeating-linear-gradient(90deg, rgba(107, 74, 46, 0.025) 0 1px, transparent 1px 3px);
  border: 1.5px solid rgba(138, 85, 20, 0.5);
  box-shadow: 0 22px 60px rgba(26, 18, 12, 0.45), inset 0 0 0 3px rgba(247, 236, 214, 0.95), inset 0 0 0 6px rgba(213, 146, 152, 0.32);
  animation: bfx-card-in 560ms cubic-bezier(0.2, 1.15, 0.32, 1) 80ms both;
}
.bfx-result.is-win .bfx-result-card {
  box-shadow: 0 22px 60px rgba(26, 18, 12, 0.45), inset 0 0 0 3px rgba(247, 236, 214, 0.95), inset 0 0 0 7px rgba(245, 165, 36, 0.45), 0 0 0 8px rgba(245, 165, 36, 0.14);
}
.bfx-result-kicker {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(245, 165, 36, 0.16);
  font-size: 11px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cr-amber-deep);
}
.bfx-result.is-lose .bfx-result-kicker { background: rgba(213, 146, 152, 0.2); color: var(--cr-pink-deep); }
.bfx-result-title {
  margin: 10px 0 14px;
  font-family: var(--cr-serif);
  font-weight: 700;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.02;
  color: #7a4a10;
  text-shadow: 0 2px 0 rgba(247, 236, 214, 0.9);
}
.bfx-result.is-lose .bfx-result-title { color: var(--cr-pink-deep); }
.bfx-score {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(14px, 3vw, 28px);
  padding: 12px 10px 10px;
  border-radius: 20px;
  background: rgba(239, 224, 192, 0.55);
  box-shadow: inset 0 1px 3px rgba(59, 42, 28, 0.14);
}
.bfx-score-side { display: flex; flex-direction: column; align-items: center; min-width: 88px; }
.bfx-score-num {
  font-family: var(--cr-serif); font-weight: 700;
  font-size: clamp(48px, 6vw, 64px); line-height: 1;
  color: var(--cr-ink-soft);
  font-variant-numeric: tabular-nums;
}
.bfx-score-side.is-lead .bfx-score-num { color: var(--cr-ink); }
.bfx-score-name {
  margin-top: 4px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cr-ink-soft);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bfx-score-side.is-lead .bfx-score-name { color: var(--cr-amber-deep); }
.bfx-score-dash { font-family: var(--cr-serif); font-size: 40px; color: rgba(109, 83, 64, 0.6); transform: translateY(-10px); }
.bfx-pips { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.bfx-pip {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--cr-amber-deep);
  background: var(--cr-cream-2);
  box-shadow: inset 0 -2px 0 rgba(59, 42, 28, 0.12);
}
.bfx-pip.is-claire { background: radial-gradient(circle at 35% 30%, #ffd58f, var(--cr-amber) 70%); }
.bfx-pip.is-beans { background: radial-gradient(circle at 35% 30%, #f3c6c9, var(--cr-pink-deep) 75%); border-color: #8f4f56; }
.bfx-pip.is-tie { background: repeating-linear-gradient(45deg, var(--cr-cream-2) 0 3px, #dcc8a6 3px 6px); }
.bfx-result-meta { margin: 10px 0 18px; font-size: 13px; font-weight: 700; color: var(--cr-ink-soft); }
.bfx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bfx-btn {
  appearance: none; -webkit-appearance: none;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  font-family: var(--cr-sans);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}
.bfx-btn-primary {
  border: 1.5px solid #8a5514;
  color: #3b2210;
  background: linear-gradient(180deg, #ffc867 0%, #f5a524 55%, #e08f1b 100%);
  box-shadow: 0 3px 0 #8a5514, 0 10px 18px rgba(138, 85, 20, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.bfx-btn-ghost {
  border: 1.5px solid rgba(138, 85, 20, 0.55);
  color: var(--cr-ink);
  background: linear-gradient(180deg, #fffaf0 0%, #f3e0bf 100%);
  box-shadow: 0 3px 0 #8a5514, 0 8px 16px rgba(59, 42, 28, 0.14);
}
.bfx-btn:hover { filter: brightness(1.04); }
.bfx-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a5514, 0 4px 10px rgba(59, 42, 28, 0.14); }
.bfx-btn:focus-visible { outline: 3px solid var(--cr-amber-bright); outline-offset: 3px; }

/* ---------- keyframes ---------- */
@keyframes bfx-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bfx-fade-up { from { opacity: 0; transform: translate(var(--bfx-tx, 0), 10px); } to { opacity: 1; transform: translate(var(--bfx-tx, 0), 0); } }
.bfx-intro-rule { --bfx-tx: -50%; }
@keyframes bfx-band-l { from { transform: rotate(-6deg) translateX(-110%); } to { transform: rotate(-6deg) translateX(0); } }
@keyframes bfx-band-r { from { transform: rotate(-6deg) translateX(110%); } to { transform: rotate(-6deg) translateX(0); } }
@keyframes bfx-name-l { from { opacity: 0; transform: translateX(-60vw); } 70% { opacity: 1; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes bfx-name-r { from { opacity: 0; transform: translateX(60vw); } 70% { opacity: 1; transform: translateX(-14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes bfx-vs-pop { from { opacity: 0; transform: scale(0.2) rotate(-25deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes bfx-count { from { opacity: 0; transform: scale(1.9); } 55% { opacity: 1; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes bfx-hand-l { from { opacity: 0; transform: translateX(-70vw) rotate(-12deg); } to { opacity: 1; transform: translateX(28px) rotate(3deg); } }
@keyframes bfx-hand-r { from { opacity: 0; transform: translateX(70vw) rotate(12deg); } to { opacity: 1; transform: translateX(-28px) rotate(-3deg); } }
@keyframes bfx-recoil-l { from { transform: translateX(28px) rotate(3deg); } 40% { transform: translateX(-10px) rotate(-2deg); } to { transform: translateX(0) rotate(0); } }
@keyframes bfx-recoil-r { from { transform: translateX(-28px) rotate(-3deg); } 40% { transform: translateX(10px) rotate(2deg); } to { transform: translateX(0) rotate(0); } }
@keyframes bfx-clash { from { opacity: 0; transform: scale(0.1) rotate(-40deg); } 50% { opacity: 1; transform: scale(1.35) rotate(8deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes bfx-card-in { from { opacity: 0; transform: translateY(18px) scale(0.9); } 60% { opacity: 1; transform: translateY(0) scale(1.03); } to { opacity: 1; transform: none; } }
@keyframes bfx-fall {
  from { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); }
  10% { opacity: 1; }
  85% { opacity: 1; }
  to { opacity: 0; transform: translate3d(var(--bfx-drift, 0), 110vh, 0) rotate(var(--bfx-spin, 180deg)); }
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .bfx-band { height: 24%; }
  .bfx-band-left { top: 18%; }
  .bfx-band-right { bottom: 22%; }
  .bfx-band-inner { padding: 0 11%; }
  .bfx-band-name { font-size: clamp(40px, 13vw, 64px); }
  .bfx-vs { width: 104px; }
  .bfx-vs span { font-size: 50px; }
  .bfx-intro-rule { bottom: 8%; font-size: 11px; }
  .bfx-throws {
    grid-template-columns: 1fr;
    grid-template-areas: "r" "c" "l" "line";
    gap: 10px;
  }
  .bfx-hand { width: min(310px, 100%); display: grid; grid-template-columns: 56px 80px 1fr; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 22px; }
  .bfx-hand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bfx-hand-icon { width: 80px; }
  .bfx-hand-move { font-size: 21px; text-align: right; }
  .bfx-hand-left { animation: bfx-hand-b 420ms cubic-bezier(0.3, 0, 0.2, 1) both; }
  .bfx-hand-right { animation: bfx-hand-t 420ms cubic-bezier(0.3, 0, 0.2, 1) both; }
  .bfx-clash { width: 64px; margin: -26px 0; z-index: 2; }
  .bfx-throw-line { margin-top: 8px; text-align: center; }
  .bfx-result-card { padding: 22px 18px 18px; border-radius: 24px; }
  .bfx-score-side { min-width: 76px; }
  .bfx-actions { grid-template-columns: 1fr; }
}
@keyframes bfx-hand-t { from { opacity: 0; transform: translateY(-60vh); } to { opacity: 1; transform: none; } }
@keyframes bfx-hand-b { from { opacity: 0; transform: translateY(60vh); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .bfx-root *, .bfx-root *::before, .bfx-root *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition: none !important;
  }
  .bfx-confetti { display: none; }
}
