/* ───────── Suno Gacha — arcade / capsule-toy look ───────── */
:root {
  --ink: #1b1035;
  --paper: #fffdf5;
  --pink: #ff3d8b;
  --yellow: #ffd83d;
  --cyan: #35e0ff;
  --violet: #7a4dff;
  --bg1: #3a1a8a;
  --bg2: #12072f;
  --ray: rgba(255, 255, 255, .07);
  --accent: var(--yellow);
  --accent2: var(--pink);
  --hard: 0 5px 0 var(--ink);
  --ease-pop: cubic-bezier(.2, 1.6, .4, 1);
  --f-head: "Fredoka", "Heebo", system-ui, sans-serif;
  --f-body: "Heebo", system-ui, sans-serif;
}

/* verses arrive with vowels + cantillation marks; Heebo has no cantillation glyphs, Keter does */
@font-face { font-family: "KeterAramTsova"; src: url("fonts/KeterAramTsova.woff2") format("woff2"); font-display: swap; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--f-body);
  color: var(--paper);
  background: var(--bg2);
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ── sky: pinned to the viewport, never scrolls ── */
.sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg1) 0%, var(--bg2) 70%);
  transition: background .6s; }
.rays { position: absolute; left: 50%; top: 18%; width: 220vmax; height: 220vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, var(--ray) 0 9deg, transparent 9deg 18deg);
  animation: spin 80s linear infinite; }
.dots { position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(rgba(255,255,255,.18) 1.5px, transparent 1.6px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 30%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 30%, #000 100%); }
.stars i { position: absolute; color: var(--accent); font-style: normal; opacity: .9;
  animation: twinkle 2.4s ease-in-out infinite; text-shadow: 0 0 8px currentColor; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(.4) rotate(0); opacity: .25; } 50% { transform: scale(1) rotate(20deg); opacity: 1; } }

main { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: 18px 14px 8px; }

/* ── logo ── */
.logo { text-align: center; padding: 10px 0 6px; }
.logo-badge { display: inline-block; font-weight: 700; font-size: 12px; letter-spacing: .08em;
  color: var(--ink); background: var(--cyan); border: 3px solid var(--ink); border-radius: 999px;
  padding: 3px 12px; box-shadow: 0 3px 0 var(--ink); transform: rotate(-4deg); direction: ltr; }
.logo h1 { margin: 4px 0 0; font-family: var(--f-head); font-weight: 700;
  font-size: clamp(46px, 14.5vw, 70px); line-height: 1.05; }
.logo h1 span { display: inline-block; color: var(--yellow);
  text-shadow: 0 4px 0 var(--ink), 0 7px 0 rgba(0,0,0,.25);
  animation: float 2.6s ease-in-out infinite; }
.logo h1 .l2 { color: var(--pink); animation-delay: -1.3s; }
.logo .sub { margin: 8px 0 0; font-weight: 500; font-size: 18px; color: #fff;
  text-shadow: 0 2px 0 var(--ink); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }

/* ── shared bits ── */
.step-chip { display: inline-flex; align-items: center; gap: 8px; font: 600 17px var(--f-head);
  color: var(--ink); background: var(--paper); border: 3px solid var(--ink); border-radius: 999px;
  padding: 4px 14px 4px 6px; box-shadow: 0 3px 0 var(--ink); margin-bottom: 10px; }
.step-chip b, .foot b { display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--pink); color: #fff; border: 2px solid var(--ink); font-size: 14px; }

.panel { margin-top: 24px; background: rgba(255,255,255,.1); border: 3px solid var(--ink);
  border-radius: 22px; padding: 14px; box-shadow: var(--hard); backdrop-filter: blur(6px); }
textarea, input[type=text] { width: 100%; font: 400 18px/1.7 var(--f-body); color: var(--ink);
  background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 12px 14px;
  outline: none; resize: vertical; }
textarea { display: block; min-height: 132px; font: 400 21px/1.9 "KeterAramTsova", var(--f-body); }
textarea::placeholder { font: 400 18px/2.2 var(--f-body); }
textarea:focus, input[type=text]:focus { box-shadow: 0 0 0 4px var(--accent); }
input[type=text] { margin-top: 10px; font-size: 16px; line-height: 1.3; min-height: 48px; }
::placeholder { color: #8a80a8; }
.count { min-height: 18px; font-size: 12.5px; font-weight: 500; opacity: .85; margin: 6px 4px 0; }
.count.warn { color: var(--yellow); opacity: 1; font-weight: 700; }

/* ── buttons ── */
.btn { appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  font: 700 22px var(--f-head); color: var(--ink); display: block; width: 100%;
  border-radius: 999px; }
.btn .btn-in { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 62px; padding: 10px 22px; border-radius: 999px; border: 4px solid var(--ink);
  background: linear-gradient(#fff3a6, var(--yellow) 45%, #ffb300);
  box-shadow: 0 7px 0 var(--ink), 0 12px 18px rgba(0,0,0,.35);
  transform: translateY(0); transition: transform .08s, box-shadow .08s; overflow: hidden; }
.btn .btn-in::before { content: ""; position: absolute; top: 5px; left: 12%; right: 12%; height: 32%;
  border-radius: 999px; background: linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,0)); }
.btn:active .btn-in { transform: translateY(6px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { cursor: default; }
.btn:disabled .btn-in { background: #cfc9e2; color: #2f2850; box-shadow: 0 4px 0 var(--ink); }
.btn.pull .btn-in { font-size: 24px; min-height: 66px;
  background: linear-gradient(#ffb1cf, var(--pink) 50%, #d8005f); color: #fff;
  text-shadow: 0 2px 0 var(--ink); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
.btn.pull:active .btn-in { animation: none; }
.plane { transform: scaleX(-1); flex: none; }

/* ── the machine: optional extra, folded at the bottom ── */
.lucky { margin-top: 26px; border: 3px dashed rgba(255,255,255,.45); border-radius: 22px; padding: 2px 12px; background: rgba(0,0,0,.2); }
.lucky summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px;
  text-align: center; font: 500 16.5px var(--f-head); color: #fff; }
.lucky summary::-webkit-details-marker { display: none; }
.lucky summary::after { content: "▾"; font-size: 14px; }
.lucky[open] summary::after { content: "▴"; }
.machine-wrap { margin: 6px 0 14px; text-align: center; }
.machine { position: relative; width: 250px; margin: 2px auto 16px; filter: drop-shadow(0 14px 14px rgba(0,0,0,.4)); }
.marquee { display: flex; justify-content: center; gap: 12px; margin-bottom: -6px; position: relative; z-index: 2; }
.marquee i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: var(--yellow);
  animation: blink 1s steps(1) infinite; }
.marquee i:nth-child(even) { background: var(--cyan); animation-delay: .5s; }
@keyframes blink { 50% { filter: brightness(.45); } }
.dome { position: relative; width: 230px; height: 200px; margin: 0 auto; border: 5px solid var(--ink);
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: radial-gradient(120% 100% at 30% 20%, rgba(255,255,255,.55), rgba(190,230,255,.22) 45%, rgba(120,90,255,.25));
  overflow: hidden; }
.dome .shine { position: absolute; top: 14px; right: 30px; width: 26px; height: 70px; border-radius: 20px;
  background: rgba(255,255,255,.7); transform: rotate(-28deg); z-index: 3; }
.balls { position: absolute; inset: 0; }
.capsule { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink);
  background: linear-gradient(var(--c, #ff3d8b) 0 48%, var(--ink) 48% 54%, #fff 54%);
  box-shadow: inset -5px -6px 0 rgba(0,0,0,.14), inset 5px 6px 0 rgba(255,255,255,.35); }
.balls .capsule { animation: jiggle var(--d, 2.4s) ease-in-out infinite; animation-delay: var(--dl, 0s); }
@keyframes jiggle { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-7px) rotate(calc(var(--r, 0deg) + 14deg)); } }
.machine.spin .balls .capsule { animation: tumble .38s linear infinite; }
@keyframes tumble { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(14px, -34px) rotate(90deg); }
  50% { transform: translate(-10px, -58px) rotate(180deg); } 75% { transform: translate(-18px, -22px) rotate(270deg); } 100% { transform: translate(0, 0) rotate(360deg); } }
.machine.spin { animation: shake .16s linear infinite; }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-4px) rotate(-1.2deg); } 75% { transform: translateX(4px) rotate(1.2deg); } }
.base { position: relative; width: 250px; height: 118px; margin-top: -8px; border: 5px solid var(--ink);
  border-radius: 20px 20px 28px 28px; background: linear-gradient(#ff77ad, var(--pink) 60%, #c70f5d); }
.base::before { content: ""; position: absolute; inset: 6px 8px auto; height: 10px; border-radius: 8px; background: rgba(255,255,255,.35); }
.plate { position: absolute; top: 22px; right: 18px; font: 700 15px var(--f-head); letter-spacing: .14em; direction: ltr;
  color: var(--ink); background: var(--yellow); border: 3px solid var(--ink); border-radius: 8px; padding: 2px 9px; transform: rotate(3deg); }
.knob { position: absolute; top: 46px; right: 34px; width: 50px; height: 50px; border-radius: 50%; border: 4px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff, #d9d6ea 60%, #9c95bd); display: grid; place-items: center; }
.knob span { width: 38px; height: 10px; border-radius: 6px; background: var(--ink); }
.machine.spin .knob { animation: turn .45s linear infinite; }
@keyframes turn { to { transform: rotate(-360deg); } }
.chute { position: absolute; bottom: 12px; left: 22px; width: 92px; height: 58px; border: 4px solid var(--ink);
  border-radius: 12px 12px 22px 22px; background: #2a0c45; box-shadow: inset 0 8px 0 rgba(0,0,0,.45); overflow: visible; }
.capsule.out { left: 19px; top: 4px; opacity: 0; }
.capsule.out.drop { animation: drop .55s var(--ease-pop) forwards; }
@keyframes drop { 0% { opacity: 1; transform: translateY(-60px) rotate(-120deg) scale(.6); } 100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); } }
.hint { margin: 12px 0 0; font-size: 14px; opacity: .85; }

/* ── collection: the main picker ── */
.collection { margin-top: 18px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mini { position: relative; display: flex; flex-direction: column; border: 3px solid var(--ink); border-radius: 18px; padding: 0;
  min-height: 168px; color: var(--ink); background: var(--t-bg); box-shadow: 0 5px 0 var(--ink); text-align: center; cursor: pointer;
  font: inherit; overflow: hidden; transition: transform .15s var(--ease-pop); }
.mini:active { transform: scale(.96); }
.mini .art { position: relative; flex: 1; min-height: 88px; display: grid; place-items: center; overflow: hidden; }
.mini .art::after { content: ""; position: absolute; inset: 0; transform: translateX(-130%);
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.4) 50%, transparent 62%);
  animation: sheen 5s ease-in-out infinite; }
.mini:nth-child(2n) .art::after { animation-delay: -1.6s; }
.mini:nth-child(3n) .art::after { animation-delay: -3.2s; }
@keyframes sheen { 0%, 60% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.mini .e { font-size: 46px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.mini .label { display: block; background: var(--paper); border-top: 3px solid var(--ink); padding: 8px 8px 10px; }
.mini .n { display: block; font: 600 19px/1.2 var(--f-head); color: var(--ink); }
.mini .g { display: block; margin-top: 3px; font-size: 13.5px; font-weight: 400; line-height: 1.35; color: #3f3760; }
.mini .id { position: absolute; top: 6px; left: 6px; z-index: 2; font: 600 11px var(--f-head); direction: ltr; padding: 1px 7px; border-radius: 999px;
  background: var(--ink); color: #fff; }
.mini.on { transform: translateY(-4px); box-shadow: 0 9px 0 var(--ink), 0 0 0 4px var(--yellow), 0 0 24px 6px rgba(255,216,61,.7); }
.mini.on::after { content: "✓ נבחר"; position: absolute; top: 6px; right: 6px; z-index: 2; font: 600 12.5px var(--f-head); color: var(--ink);
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 9px; }

/* ── the big card ── */
.stage { margin-top: 24px; scroll-margin-top: 12px; }
.big { position: relative; border: 4px solid var(--ink); border-radius: 26px; overflow: hidden;
  background: var(--t-panel, #fff); color: var(--t-panel-ink, var(--ink)); box-shadow: 0 8px 0 var(--ink), 0 18px 30px rgba(0,0,0,.45);
  animation: cardin .5s var(--ease-pop); }
@keyframes cardin { from { transform: translateY(30px) scale(.92) rotate(2deg); opacity: 0; } }
.decor { position: relative; height: 132px; border-bottom: 4px solid var(--ink); overflow: hidden; background: var(--t-bg); }
.decor .hero { position: absolute; inset: 0; display: grid; place-items: center; font-size: 68px;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); animation: bob 3s ease-in-out infinite; z-index: 3; }
.decor .side { position: absolute; bottom: 10px; left: 16px; font-size: 32px; transform: rotate(12deg); z-index: 3;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.decor .pid { position: absolute; top: 10px; right: 12px; z-index: 4; font: 700 13px var(--f-head); direction: ltr;
  background: var(--ink); color: #fff; padding: 3px 10px; border-radius: 999px; }
.body { padding: 14px 16px 18px; }
.big h3 { margin: 0; font: 700 30px/1.15 var(--f-head); }
.big .tag { margin: 4px 0 0; font-weight: 700; font-size: 17px; color: var(--t-accent-ink, var(--pink)); }
.meters { display: flex; gap: 18px; margin: 12px 0 2px; flex-wrap: wrap; }
.meter { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; }
.pips { display: inline-flex; gap: 3px; direction: ltr; }
.pips i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; }
.pips i.f { background: var(--t-pip, var(--pink)); }
.quote { position: relative; margin: 14px 0; padding: 12px 14px; border: 3px dashed var(--ink); border-radius: 16px;
  font-weight: 500; font-size: 17.5px; line-height: 1.6; background: rgba(255,255,255,.55); color: var(--ink); }
.quote::before { content: "🖌️"; position: absolute; top: -16px; right: 10px; font-size: 22px; }
.big h4 { margin: 16px 0 6px; font: 600 17px var(--f-head); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 5px 38px 5px 0; font-size: 16.5px; line-height: 1.55; }
.steps li::before { content: counter(s); position: absolute; right: 0; top: 4px; width: 26px; height: 26px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; border-radius: 50%; border: 2px solid var(--ink); background: var(--t-pip, var(--yellow)); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span { font-weight: 500; font-size: 15px; padding: 5px 12px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--ink); color: #fff; }
.warn { margin: 14px 0 0; font-size: 15.5px; line-height: 1.5; font-weight: 500; padding: 9px 12px; border-radius: 12px;
  background: rgba(27,16,53,.1); border-right: 5px solid var(--t-pip, var(--pink)); }

.more summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 18px;
  font: 600 16px var(--f-head); color: var(--ink); background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "▾"; font-size: 14px; }
.more[open] summary::after { content: "▴"; }
.more[open] summary { margin-bottom: 6px; }

/* ── themes: one colour world + one decor per protocol ── */
[data-t=P1] { --t-bg: #0d0221; --t-ink: #fff; --t-panel: #fff8e6; --t-pip: #ff2bd6; --t-accent-ink: #c4009b; }
[data-t=P2] { --t-sw: 0px; --t-bg: #fff3a8; --t-ink: #2b2b2b; --t-panel: #fffdf2; --t-pip: #ff8fb1; --t-accent-ink: #d2476f; }
[data-t=P3] { --t-bg: #0fa3a3; --t-ink: #fff; --t-panel: #fff6ea; --t-pip: #ff7a59; --t-accent-ink: #0b7d7d; }
[data-t=P4] { --t-bg: #07102e; --t-ink: #ffe9b0; --t-panel: #f6efe0; --t-pip: #f2b32b; --t-accent-ink: #8a5a00; }
[data-t=P5] { --t-bg: #6d0f3a; --t-ink: #fff; --t-panel: #fff1f4; --t-pip: #ff4757; --t-accent-ink: #b0123a; }
[data-t=P0] { --t-sw: 0px; --t-bg: #d9c9a0; --t-ink: #3b2a12; --t-panel: #fbf5e4; --t-pip: #c9a227; --t-accent-ink: #7a5a10; }

/* mini-card fills reuse the same worlds */
.mini[data-t=P1] { background: radial-gradient(circle at 20% 25%, #ff2bd6 0 16%, transparent 17%), radial-gradient(circle at 80% 70%, #ffe600 0 20%, transparent 21%), radial-gradient(circle at 60% 15%, #00f0ff 0 9%, transparent 10%), #0d0221; }
.mini[data-t=P2] { background: linear-gradient(#9ec9ff66 1.5px, transparent 1.5px) 0 0/100% 14px, linear-gradient(90deg, #9ec9ff66 1.5px, transparent 1.5px) 0 0/14px 100%, #fff3a8; }
.mini[data-t=P3] { background: repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 4px, transparent 4px 8px), linear-gradient(135deg, #0fa3a3 0 50%, #ff7a59 50%); }
.mini[data-t=P4] { background: radial-gradient(80% 34% at 50% 62%, #f2b32b, transparent 70%), linear-gradient(#07102e, #1b2a63); }
.mini[data-t=P5] { background: conic-gradient(from 160deg at 25% 0, rgba(255,255,255,.35) 0 22deg, transparent 22deg), conic-gradient(from 178deg at 75% 0, rgba(255,255,255,.3) 0 22deg, transparent 22deg), linear-gradient(#3b0a5c, #b0123a); }
.mini[data-t=P0] { background: radial-gradient(circle at 50% 30%, #fff8e0, #d9c9a0 75%); }

/* P1 — neon paint splatter */
.decor[data-t=P1] { background:
  radial-gradient(circle at 12% 30%, #ff2bd6 0 15%, transparent 15.5%),
  radial-gradient(circle at 22% 62%, #ff2bd6 0 5%, transparent 5.5%),
  radial-gradient(circle at 84% 28%, #ffe600 0 18%, transparent 18.5%),
  radial-gradient(circle at 70% 58%, #ffe600 0 4%, transparent 4.5%),
  radial-gradient(circle at 58% 88%, #00f0ff 0 14%, transparent 14.5%),
  radial-gradient(circle at 36% 12%, #00f0ff 0 5%, transparent 5.5%),
  radial-gradient(circle at 92% 84%, #7dff3a 0 9%, transparent 9.5%),
  #0d0221; }
.decor[data-t=P1]::before { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 26px, rgba(255,255,255,.09) 26px 30px); animation: slide 3s linear infinite; }
.decor[data-t=P1]::after { content: "⚡"; position: absolute; top: 14px; left: 26px; font-size: 38px; animation: twinkle 1.1s infinite; }
@keyframes slide { to { background-position: 120px 0; } }

/* P2 — graph paper, pencil doodles, eraser */
.decor[data-t=P2] { background:
  linear-gradient(#8fc0ff77 1.5px, transparent 1.5px) 0 0/100% 20px,
  linear-gradient(90deg, #8fc0ff77 1.5px, transparent 1.5px) 0 0/20px 100%, #fff6b8; }
.decor[data-t=P2]::before { content: ""; position: absolute; inset: 0; opacity: .75;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 176'%3E%3Cg fill='none' stroke='%23444' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M18 140c30-40 50 30 84-10s40-50 70-12' stroke-dasharray='2 9'/%3E%3Cpath d='M300 30c18-22 52-14 50 12s-40 30-52 8'/%3E%3Cpath d='M318 120l18 18m0-18l-18 18'/%3E%3Cpath d='M40 30h70M40 44h46'/%3E%3C/g%3E%3C/svg%3E") center/cover no-repeat; }
.decor[data-t=P2]::after { content: ""; position: absolute; bottom: 18px; right: 22px; width: 74px; height: 34px; border-radius: 7px;
  border: 3px solid var(--ink); background: linear-gradient(90deg, #ff8fb1 0 62%, #6fb6ff 62%); transform: rotate(-14deg); box-shadow: 0 4px 0 rgba(0,0,0,.25); }

/* P3 — fabric patchwork with stitches */
.decor[data-t=P3] { background:
  repeating-linear-gradient(45deg, rgba(255,255,255,.14) 0 5px, transparent 5px 10px),
  linear-gradient(90deg, #0fa3a3 0 34%, #ffb627 34% 66%, #ff7a59 66%); }
.decor[data-t=P3]::before { content: ""; position: absolute; inset: 12px; border: 3px dashed rgba(255,255,255,.9); border-radius: 14px; }
.decor[data-t=P3]::after { content: ""; position: absolute; left: 34%; right: 34%; top: 0; bottom: 0;
  border-inline: 3px dashed rgba(27,16,53,.55);
  background: repeating-linear-gradient(-45deg, rgba(27,16,53,.12) 0 5px, transparent 5px 10px); }

/* P4 — cinema: night sky, rising sun, film strip */
.decor[data-t=P4] { background:
  radial-gradient(70% 70% at 50% 118%, #ffd36b 0, #f2892b 30%, transparent 62%),
  radial-gradient(1.5px 1.5px at 18% 22%, #fff 99%, transparent), radial-gradient(1.5px 1.5px at 72% 16%, #fff 99%, transparent),
  radial-gradient(2px 2px at 86% 40%, #fff 99%, transparent), radial-gradient(1.5px 1.5px at 38% 34%, #fff 99%, transparent),
  radial-gradient(2px 2px at 8% 50%, #fff 99%, transparent),
  linear-gradient(#050a22, #1b2a63 70%, #5a3a6e); }
.decor[data-t=P4]::before, .decor[data-t=P4]::after { content: ""; position: absolute; left: 0; right: 0; height: 18px; z-index: 2;
  background: repeating-linear-gradient(90deg, #000 0 8px, #f6efe0 8px 20px, #000 20px 28px) 0 50%/28px 9px repeat-x, #000; }
.decor[data-t=P4]::before { top: 0; } .decor[data-t=P4]::after { bottom: 0; }

/* P5 — stage: spotlights, vinyl, crowd */
.decor[data-t=P5] { background:
  radial-gradient(circle at 50% 135%, #1b1035 0 38%, transparent 38.5%),
  linear-gradient(#3b0a5c, #b0123a); }
.decor[data-t=P5]::before { content: ""; position: absolute; inset: -20% -10% 0; transform-origin: 50% 0;
  background: conic-gradient(from 150deg at 22% 0, rgba(255,240,170,.5) 0 20deg, transparent 20deg),
              conic-gradient(from 190deg at 78% 0, rgba(140,230,255,.45) 0 20deg, transparent 20deg);
  animation: sway 3.2s ease-in-out infinite alternate; }
.decor[data-t=P5]::after { content: ""; position: absolute; bottom: -34px; right: 18px; width: 96px; height: 96px; border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle, #ff4757 0 16%, #1b1035 17% 22%, #111 23% 40%, #2b2b2b 41% 44%, #111 45% 62%, #2b2b2b 63% 66%, #111 67%);
  animation: spinflat 4s linear infinite; }
@keyframes sway { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@keyframes spinflat { to { transform: rotate(360deg); } }

/* P0 — parchment and gold */
.decor[data-t=P0] { background:
  radial-gradient(circle at 50% 40%, #fffaf0 0, #e9dcb8 60%, #c9b37a 100%); }
.decor[data-t=P0]::before { content: ""; position: absolute; inset: 10px; border: 3px double #8a6d1f; border-radius: 12px; }
.decor[data-t=P0]::after { content: "❦"; position: absolute; top: 12px; left: 20px; font-size: 30px; color: #8a6d1f; }

/* whole-page mood follows the chosen card */
body[data-theme=P1] { --bg1: #6a0f8f; --bg2: #0a0118; --accent: #ffe600; }
body[data-theme=P2] { --bg1: #c9a52b; --bg2: #3a2c08; --accent: #ff8fb1; --ray: rgba(255,255,255,.1); }
body[data-theme=P3] { --bg1: #0fa3a3; --bg2: #06302f; --accent: #ffb627; }
body[data-theme=P4] { --bg1: #24336f; --bg2: #03061a; --accent: #f2b32b; }
body[data-theme=P5] { --bg1: #b0123a; --bg2: #1d0322; --accent: #ffd83d; }
body[data-theme=P0] { --bg1: #8a7440; --bg2: #2a2110; --accent: #ffe9a8; }

/* ── footer + send bar ── */
.foot { text-align: center; margin: 22px 8px 8px; font-size: 16px; line-height: 1.6; }
.foot p { margin: 4px 0; }
.tiny { text-align: center; margin: 14px 8px 4px; font-size: 13.5px; opacity: .75; }
.sendbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(10,4,30,.92) 38%); }
.sendbar .btn { max-width: 492px; margin: 0 auto; }
.btn.send .btn-in { font-size: 20px; background: linear-gradient(#b8f4ff, var(--cyan) 50%, #12a7d6); }
.btn.send:disabled .btn-in { background: #cfc9e2; font-size: 18px; }

/* ── reveal overlay ── */
.reveal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow: hidden;
  background: #fff; animation: flash .5s ease-out forwards; }
.reveal[hidden] { display: none; }
@keyframes flash { 0% { background: #fff; } 100% { background: var(--t-bg, #12072f); } }
.burst { position: absolute; left: 50%; top: 50%; width: 240vmax; height: 240vmax; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.22) 0 10deg, transparent 10deg 20deg);
  animation: spin 14s linear infinite; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; opacity: .95;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(115vh) rotate(720deg); } }
.reveal-capsule { position: relative; width: 150px; height: 150px; z-index: 2; animation: wiggle .22s ease-in-out 5, popout .3s .9s forwards; }
.reveal-capsule i { position: absolute; left: 0; width: 150px; height: 75px; border: 5px solid var(--ink); }
.reveal-capsule .top { top: 0; border-radius: 150px 150px 0 0; background: var(--t-pip, var(--pink));
  box-shadow: inset 12px 12px 0 rgba(255,255,255,.35); animation: opentop .45s 1.1s var(--ease-pop) forwards; }
.reveal-capsule .bottom { bottom: 0; border-radius: 0 0 150px 150px; background: #fff;
  box-shadow: inset -12px -12px 0 rgba(0,0,0,.12); animation: openbot .45s 1.1s var(--ease-pop) forwards; }
@keyframes wiggle { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes popout { to { transform: scale(1.12); } }
@keyframes opentop { to { transform: translateY(-46vh) rotate(-24deg); opacity: 0; } }
@keyframes openbot { to { transform: translateY(46vh) rotate(18deg); opacity: 0; } }
.reveal-card { position: absolute; z-index: 3; width: min(78vw, 320px); text-align: center; color: var(--t-ink, #fff);
  transform: scale(0); animation: cardpop .6s 1.3s var(--ease-pop) forwards; }
@keyframes cardpop { to { transform: scale(1); } }
.reveal-card .rc { border: 5px solid var(--ink); border-radius: 28px; padding: 22px 16px 20px; background: var(--t-panel, #fff); color: var(--ink);
  box-shadow: 0 10px 0 var(--ink), 0 0 0 6px var(--yellow), 0 0 60px 14px rgba(255,255,255,.55); }
.reveal-card .new { display: inline-block; font: 700 14px var(--f-head); letter-spacing: .1em; direction: ltr; color: #fff; background: var(--pink);
  border: 3px solid var(--ink); border-radius: 999px; padding: 2px 14px; transform: rotate(-5deg); margin-bottom: 6px; }
.reveal-card .e { font-size: 92px; line-height: 1.1; filter: drop-shadow(0 6px 0 rgba(0,0,0,.3)); }
.reveal-card .n { font: 700 32px/1.15 var(--f-head); margin-top: 6px; }
.reveal-card .g { font-weight: 700; font-size: 16px; margin-top: 6px; color: var(--t-accent-ink, var(--pink)); }
.reveal-card .st { margin-top: 10px; font-size: 22px; letter-spacing: 3px; color: #f5b400; text-shadow: 0 2px 0 var(--ink); direction: ltr; }
.btn.take { position: absolute; bottom: calc(34px + env(safe-area-inset-bottom)); left: 50%; width: min(78vw, 320px);
  transform: translateX(-50%); z-index: 4; opacity: 0; animation: fadein .3s 1.9s forwards; }
@keyframes fadein { to { opacity: 1; } }

/* ── toast ── */
.toast { position: fixed; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px);
  max-width: min(92vw, 460px); padding: 11px 16px; border-radius: 16px; border: 3px solid var(--ink); background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 15px; line-height: 1.45; text-align: center; box-shadow: var(--hard); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease-pop); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.act.show { pointer-events: auto; }
.toast a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 640px) {
  main { padding-top: 28px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
