/* The Capsule Machine (v1.177). */
.cpm { position: relative; padding: 32px; }
.cpm-head { max-width: 62ch; margin-bottom: 8px; }
.cpm-head .dwx-kicker { color: var(--dwx-gold); font-family: var(--dwx-serif); font-style: italic; font-size: 1.25rem; margin: 0 0 8px; }
.cpm-main { position: relative; display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 28px; align-items: center; margin-top: 10px; }

/* each machine */
.cpm-unit { position: relative; margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--dwx-line); }
.cpm-unit__h { font-family: var(--dwx-serif); font-weight: 500; font-size: clamp(1.6rem, 3.6vw, 2rem); color: var(--dwx-cream); margin: 0 0 4px; }
.cpm-unit--red .cpm-unit__h::before, .cpm-unit--yellow .cpm-unit__h::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border-radius: 50%; vertical-align: 3px; background: #d81d3a; box-shadow: 0 0 10px rgba(216, 29, 58, .6); }
.cpm-unit--yellow .cpm-unit__h::before { background: #ffcc1a; box-shadow: 0 0 10px rgba(255, 204, 26, .6); }
.cpm-inside { max-width: 66ch; margin: 10px 0 4px; padding: 14px 18px 14px 20px; border-radius: 14px; border: 1px solid var(--dwx-line-strong); border-left: 4px solid #d81d3a; background: rgba(255, 255, 255, .03); }
.cpm-unit--yellow .cpm-inside { border-left-color: #ffcc1a; }
.cpm-inside__h { font-family: var(--dwx-sans); font-size: 12.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dwx-gold); margin: 0 0 6px; }
.cpm-inside__lead { color: var(--dwx-cream); font-size: 1.02rem; margin: 0 0 8px; }
.cpm-inside__list { list-style: none; margin: 0 0 8px; padding: 0; }
.cpm-inside__list li { position: relative; padding-left: 18px; color: var(--dwx-muted); font-size: 15px; margin: 3px 0; }
.cpm-inside__list li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: #d81d3a; }
.cpm-unit--yellow .cpm-inside__list li::before { background: #ffcc1a; }
.cpm-inside__eg { margin: 0; font-family: var(--dwx-serif); font-style: italic; font-size: 1.12rem; color: var(--dwx-lav); }
.cpm-unit__blurb { color: var(--dwx-muted); max-width: 62ch; margin: 0; }
.cpm-unit--yellow .cpm-spot { background: radial-gradient(closest-side, rgba(255, 214, 90, .16), rgba(182, 164, 206, .07) 55%, transparent); }
.cpm-shelf__h { font-family: var(--dwx-serif); font-weight: 500; font-size: 1.35rem; color: var(--dwx-cream); margin: 14px 0 4px; }
.cpm-head .cpm-sound { margin-top: 14px; }
/* the machine */
.cpm-machine { position: relative; width: 100%; aspect-ratio: 420 / 796; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.cpm-spot { position: absolute; left: -12%; right: -12%; top: 4%; height: 62%; border-radius: 50%; background: radial-gradient(closest-side, rgba(217, 185, 138, .16), rgba(182, 164, 206, .08) 55%, transparent); pointer-events: none; }
.cpm-svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
.cpm-decal { font-family: var(--dwx-serif); font-size: 15px; font-weight: 600; letter-spacing: 5px; fill: #f0cf86; paint-order: stroke; stroke: #5a0410; stroke-width: 1.2px; }
.cpm-etch { font-family: var(--dwx-sans); font-size: 8px; font-weight: 700; letter-spacing: 2px; fill: #3a4048; paint-order: stroke; stroke: rgba(255, 255, 255, .7); stroke-width: .8px; }
.cpm-etch--sm { font-size: 7px; letter-spacing: 1.6px; }
.cpm-glow { opacity: 0; transition: opacity .4s; }
.cpm-unit[data-state="ready"] .cpm-glow { opacity: 1; animation: cpm-glow 1.4s ease-in-out infinite; }
@keyframes cpm-glow { 0%, 100% { stroke-opacity: .25; stroke-width: 2px; } 50% { stroke-opacity: .95; stroke-width: 5px; } }
.cpm-rotor { transform-box: view-box; }
.cpm-flap { transform-box: view-box; }
.cpm-led { transition: fill .2s; }
.cpm-unit[data-state="ready"] .cpm-led, .cpm-unit[data-state="turning"] .cpm-led { filter: drop-shadow(0 0 4px #3dff7a); }

.cpm-hit { position: absolute; display: block; padding: 0; margin: 0; border: 0; border-radius: 18px; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cpm-hit:focus-visible { outline: 2px solid var(--dwx-gold); outline-offset: 3px; }
.cpm-hit--knob { border-radius: 50%; }
.cpm-unit[data-state="ready"] .cpm-hit--knob::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; box-shadow: 0 0 26px 6px rgba(255, 217, 138, .35); animation: cpm-halo 1.4s ease-in-out infinite; pointer-events: none; }
@keyframes cpm-halo { 50% { box-shadow: 0 0 34px 12px rgba(255, 217, 138, .5); } }
.cpm-unit[data-state="collect"] .cpm-hit--chute::after { content: ""; position: absolute; inset: 0; border-radius: 18px; box-shadow: 0 0 22px 4px rgba(255, 217, 138, .45); animation: cpm-halo 1.4s ease-in-out infinite; pointer-events: none; }
.cpm-hit.is-nudge, .cpm-coinbtn.is-nudge { animation: cpm-nudge .5s ease; }
@keyframes cpm-nudge { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* the side panel */
.cpm-steps { list-style: none; margin: 0 0 18px; padding: 0; counter-reset: s; }
.cpm-steps li { display: flex; align-items: center; gap: 12px; padding: 9px 0; color: var(--dwx-muted); transition: color .3s; }
.cpm-steps li span { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--dwx-line-strong); font-family: var(--dwx-serif); font-size: 1.1rem; color: var(--dwx-gold); transition: background .3s, border-color .3s, color .3s; }
.cpm-steps li.is-now { color: var(--dwx-cream); }
.cpm-steps li.is-now span { border-color: var(--dwx-gold); background: rgba(217, 185, 138, .18); box-shadow: 0 0 14px rgba(217, 185, 138, .35); }
.cpm-steps li.is-done span { background: var(--dwx-gold); color: #1a1408; border-color: var(--dwx-gold); }

.cpm-coinbtn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 18px 12px 12px; border-radius: 18px; border: 1px solid rgba(217, 185, 138, .45); background: linear-gradient(180deg, rgba(217, 185, 138, .14), rgba(217, 185, 138, .04)); color: var(--dwx-cream); font: inherit; text-align: left; cursor: pointer; transition: border-color .2s, background .2s, opacity .2s; }
.cpm-coinbtn:hover, .cpm-coinbtn:focus-visible { border-color: var(--dwx-gold); background: linear-gradient(180deg, rgba(217, 185, 138, .24), rgba(217, 185, 138, .08)); outline: none; }
.cpm-coinbtn[disabled] { opacity: .55; cursor: default; }
.cpm-coinbtn__coin { flex: none; display: block; width: 64px; height: 64px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); transition: transform .3s; }
.cpm-coinbtn:not([disabled]):hover .cpm-coinbtn__coin { transform: rotate(-12deg) scale(1.05); }
.cpm-coinbtn__coin svg { width: 100%; height: 100%; }
.cpm-coinbtn__txt { display: flex; flex-direction: column; gap: 2px; }
.cpm-coinbtn__txt strong { font-family: var(--dwx-serif); font-weight: 600; font-size: 1.35rem; }
.cpm-bal { font-size: 14px; color: var(--dwx-muted); }
.cpm-msg { min-height: 3.2em; margin-top: 12px; color: var(--dwx-cream); }
.cpm-msg p + p { margin-top: 6px; }
.cpm-msg .dwx-row { margin-top: 8px; }
.cpm-sound { margin-top: 10px; }
.cpm-fly { position: absolute; z-index: 5; display: none; width: 56px; height: 56px; pointer-events: none; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .5)); }
.cpm-fly svg { width: 56px; height: 56px; display: block; }

/* the shelf */
.cpm-shelf { margin-top: 18px; }
.cpm-count { font-family: var(--dwx-sans); font-size: 14px; color: var(--dwx-gold); margin-left: 8px; letter-spacing: .04em; }
.cpm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 12px; }
.cpm-slot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; min-height: 92px; padding: 8px 5px; border-radius: 14px; border: 1px dashed rgba(217, 185, 138, .2); background: rgba(255, 255, 255, .02); color: var(--dwx-muted); font: inherit; text-align: center; }
.cpm-slot__q { display: grid; place-items: center; width: 44px; height: 44px; margin-top: 4px; border-radius: 50%; border: 1px dashed rgba(217, 185, 138, .3); font-family: var(--dwx-serif); font-size: 1.3rem; color: rgba(217, 185, 138, .5); }
.cpm-slot.is-rare .cpm-slot__q { border-color: rgba(255, 220, 140, .55); box-shadow: 0 0 10px rgba(255, 210, 120, .15); }
.cpm-slot.is-got { border-style: solid; border-color: rgba(217, 185, 138, .3); background: rgba(217, 185, 138, .06); cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.cpm-slot.is-got:hover, .cpm-slot.is-got:focus-visible { border-color: var(--dwx-gold); background: rgba(217, 185, 138, .14); transform: translateY(-2px); outline: none; }
.cpm-slot.is-got svg { width: 46px; height: 46px; margin-top: 3px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5)); }
.cpm-slot.is-rare.is-got { border-color: rgba(255, 220, 140, .6); box-shadow: 0 0 14px rgba(255, 210, 120, .18); }
.cpm-slot__n { font-size: 12.5px; line-height: 1.3; color: var(--dwx-cream); }
.cpm-slot.is-new { animation: cpm-new 1.6s ease 2; }
@keyframes cpm-new { 50% { box-shadow: 0 0 22px rgba(255, 217, 138, .6); border-color: var(--dwx-gold); } }
.cpm-safety { margin-top: 22px; }

/* the opened capsule (sits on <body> so nothing on the page can clip it) */
html.cpm-noscroll { overflow: hidden; }
.dwx-app.cpm-layer { position: fixed; inset: 0; z-index: 100000; max-width: none; margin: 0; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .3s ease; }
.cpm-layer.is-in { opacity: 1; }
.cpo-back { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(18, 36, 74, .92), rgba(1, 8, 22, .97)); backdrop-filter: blur(4px); }
.cpo-box { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; align-items: center; padding: 8px 4px 16px; }
.cpo-x { position: sticky; top: 0; align-self: flex-end; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--dwx-line-strong); background: rgba(10, 26, 58, .85); color: var(--dwx-cream); font-size: 26px; line-height: 1; cursor: pointer; }
.cpo-x:hover, .cpo-x:focus-visible { border-color: var(--dwx-gold); outline: none; }
.cpo-stagecap { display: flex; flex-direction: column; align-items: center; margin-top: 6vh; }
.cpo-cap { width: min(300px, 70vw); height: auto; overflow: visible; cursor: pointer; animation: cpo-arrive .7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes cpo-arrive { from { transform: translateY(60px) scale(.4); opacity: 0; } }
.cpo-cap g { transform-box: fill-box; transform-origin: center; }
.cpo-whole { animation: cpo-bob 3s ease-in-out infinite; }
@keyframes cpo-bob { 50% { transform: translateY(-5px) rotate(2deg); } }
.cpo-paper { opacity: 0; }
.cpo-hint { min-height: 52px; margin-top: 18px; }
.is-twisting .cpo-whole { animation: cpo-twist .9s ease-in-out both; }
@keyframes cpo-twist { 0% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-8deg) scale(1.03); } 80% { transform: rotate(5deg) scale(1.05); } 100% { transform: rotate(0) scale(1.06); } }
.is-twisting .cpo-top { animation: cpo-turn .9s ease-in-out both; }
@keyframes cpo-turn { 30% { transform: rotate(-6deg); } 70% { transform: rotate(8deg) translateY(-2px); } 100% { transform: rotate(0) translateY(-3px); } }
.is-popped .cpo-whole { animation: none; transform: scale(1.06); }
.is-popped .cpo-top { animation: cpo-lift .8s cubic-bezier(.3, .6, .3, 1) forwards; }
@keyframes cpo-lift { from { transform: translateY(-3px); } to { transform: translate(-70px, -110px) rotate(-38deg); opacity: 0; } }
.is-popped .cpo-bot { animation: cpo-drop .8s cubic-bezier(.5, 0, .7, .4) forwards; }
@keyframes cpo-drop { to { transform: translate(40px, 70px) rotate(24deg); opacity: 0; } }
.is-popped .cpo-floor { transition: opacity .6s; opacity: 0; }
.is-popped .cpo-paper { animation: cpo-rise .8s ease-out forwards; }
@keyframes cpo-rise { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 1; transform: translateY(-14px) scale(1.5); } }

.cpo-slipwrap { width: 100%; display: flex; flex-direction: column; align-items: center; }
.cpm-layer.is-open:not(.is-direct) .cpo-stagecap:not([hidden]) { position: absolute; top: 50px; left: 0; right: 0; pointer-events: none; }
.cpm-layer.is-open:not(.is-direct) .cpo-stagecap:not([hidden]) .cpo-cap { animation: none; opacity: 0; transition: opacity .4s; }
.cpm-layer.is-open:not(.is-direct) .cpo-slip { animation: cpo-unroll 1s cubic-bezier(.2, .8, .3, 1) both; }
.cpm-layer.is-open:not(.is-direct) .cpo-row, .cpm-layer.is-open:not(.is-direct) .cpo-saved { animation: cpo-fade .6s .8s both; }
@keyframes cpo-unroll { 0% { clip-path: inset(46% 30% 46% 30% round 20px); transform: scale(.7) translateY(-40px); opacity: .8; } 45% { clip-path: inset(0 0 calc(100% - 40px) 0 round 10px); transform: scale(1) translateY(0); opacity: 1; } 100% { clip-path: inset(0 0 0 0 round 6px); transform: none; } }
@keyframes cpo-fade { from { opacity: 0; transform: translateY(8px); } }

.cpo-slip { position: relative; width: 100%; margin-top: 8px; padding: 34px 34px 26px; border-radius: 6px; color: #2a2236; text-align: center;
  background-color: #f6eedb;
  background-image:
    linear-gradient(180deg, transparent calc(33.3% - 1px), rgba(120, 90, 40, .14) 33.3%, rgba(255, 255, 255, .5) calc(33.3% + 1px), transparent calc(33.3% + 3px)),
    linear-gradient(180deg, transparent calc(66.6% - 1px), rgba(120, 90, 40, .12) 66.6%, rgba(255, 255, 255, .5) calc(66.6% + 1px), transparent calc(66.6% + 3px)),
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(150, 110, 50, .18)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 2px 0 rgba(255, 255, 255, .6) inset; }
.cpo-slip::before { content: ""; position: absolute; top: 0; left: 50%; width: 64px; height: 6px; transform: translateX(-50%); border-radius: 0 0 6px 6px; background: var(--cap, #c41230); opacity: .85; }
.cpo-slip.is-rare { box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 0 2px rgba(226, 178, 60, .6), 0 0 40px rgba(255, 210, 120, .35); }
.cpo-eyebrow { font-family: var(--dwx-sans); font-size: 12.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: #8a6a2e; margin: 0 0 6px; }
.cpo-slip.is-rare .cpo-eyebrow { color: #a8740f; }
.cpo-slip.is-rare .cpo-eyebrow::before, .cpo-slip.is-rare .cpo-eyebrow::after { content: " ✦ "; }
.cpo-name { font-family: var(--dwx-serif); font-weight: 600; font-size: clamp(1.9rem, 6vw, 2.5rem); line-height: 1.1; color: #2a2236; margin: 0 0 12px; outline: none; }
.cpo-cue { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; align-items: baseline; margin: 0 auto 16px; padding: 7px 14px; border-radius: 999px; background: rgba(107, 77, 138, .1); font-family: var(--dwx-serif); font-style: italic; font-size: 1.2rem; color: #4d2f6e; }
.cpo-cue span, .cpo-meta span { font-family: var(--dwx-sans); font-style: normal; font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8a6a2e; }
.cpo-text { font-family: var(--dwx-serif); font-size: 1.28rem; line-height: 1.6; color: #2a2236; text-align: left; margin: 0 0 18px; }
.cpo-slip--affirm .cpo-text { text-align: center; font-style: italic; font-size: clamp(1.6rem, 5vw, 2.05rem); line-height: 1.4; color: #3b2160; margin: 6px 0 22px; }
.cpo-slip--affirm .cpo-text::before { content: "“"; } .cpo-slip--affirm .cpo-text::after { content: "”"; }
.cpo-slip:not(.cpo-slip--affirm) .cpo-text::first-letter { font-size: 2.6em; float: left; line-height: .9; margin: 4px 8px 0 0; color: #6b4d8a; }
.cpo-meta { display: grid; gap: 12px; text-align: left; padding: 14px 0 0; border-top: 1px dashed rgba(120, 90, 40, .35); }
.cpo-meta p { margin: 0; font-size: 15.5px; line-height: 1.5; color: #3b3344; }
.cpo-meta span { display: block; margin-bottom: 2px; }
.cpo-off { margin: 16px 0 0; font-size: 13px; line-height: 1.5; color: #6a6070; font-style: italic; }
.cpo-row { justify-content: center; }
.cpo-saved { text-align: center; min-height: 1.4em; margin-top: 8px; }

@media (max-width: 760px) {
  .cpm { padding: 22px 18px; }
  .cpm-main { grid-template-columns: 1fr; gap: 16px; }
  .cpm-machine { width: min(320px, 84%); margin: 0 auto; order: 1; }
  .cpm-side { display: contents; }
  .cpm-steps { order: 0; display: flex; gap: 6px; margin: 0; }
  .cpm-pouch { order: 2; }
  .cpm-msg { min-height: 2.4em; }
  .cpm-steps li { flex: 1; flex-direction: column; gap: 6px; padding: 0; font-size: 13.5px; line-height: 1.3; text-align: center; }
  .cpo-slip { padding: 28px 20px 22px; }
  .cpo-text { font-size: 1.18rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cpm-unit[data-state="ready"] .cpm-glow, .cpm-hit::after, .cpo-whole, .cpo-cap { animation: none !important; }
  .cpm-layer.is-open .cpo-slip, .cpm-layer.is-open .cpo-row { animation: none !important; }
}
