.pacing-ending { position:absolute;inset:0;z-index:49;isolation:isolate;color:#fff2ec; }
.pacing-ending[hidden],.pacing-ending [hidden] { display:none!important; }
.ending-veil { position:absolute;inset:0;background:rgba(16,5,20,.38);animation:endingDim 2400ms ease both; }
@keyframes endingDim { from { opacity:0; } to { opacity:1; } }
/* The ending owns the portrait, including the receipt; transparent sprites must not reveal old poses. */
.hostess-stage[data-ending="bad"] :is(.hostess-character-motion,.hostess-boob-reaction-scene,.service-spine-layer,.wager-anticipation-pose,.wager-place-pose,.wager-handing-pose,.wager-opponent-win-pose) { display:none!important; }
.ending-spine-canvas,.ending-cum-canvas { position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none;z-index:5; }
.ending-spine-canvas[hidden],.ending-cum-canvas[hidden] { display:none!important; }
.ending-climax-flash { position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none;z-index:6; }
.ending-dialogue { position:absolute;inset:0;z-index:2;pointer-events:none; }
.ending-dialogue .portrait-callout { opacity:1;visibility:visible;transform:none;transition:none; }
.ending-dialogue:not(.has-left-callout) .portrait-callout.left,
.ending-dialogue:not(.has-right-callout) .portrait-callout.right { display:none; }
.pacing-ending[data-speaker="narration"] .portrait-callout { font-style:italic;font-weight:400; }
.pacing-ending[data-speaker="narration"] .portrait-callout::after { content:none; }
.pacing-ending[data-kind="foot"] { pointer-events:none; }
.hostess-stage[data-ending] .hostess-portrait > .portrait-callout { visibility:hidden; }
.hostess-stage[data-ending="bad"] .defeat-declaration { visibility:hidden; }
.ending-card { position:absolute;left:calc(50% + 190px);bottom:45px;width:370px;max-height:790px;z-index:65;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:12px;color:#372335; }
.ending-card[hidden],.ending-card [hidden] { display:none!important; }
/* Paper scroll uses the shared 1440 x 900 layout coordinates. */
.ending-paper-scroll { width:100%;max-height:720px;overflow-y:auto;overscroll-behavior:contain;padding:10px 12px 16px;scrollbar-width:none; }
.ending-paper-scroll::-webkit-scrollbar { display:none; }
.ending-scroll-glow { position:absolute;height:44px;z-index:2;pointer-events:none;opacity:0;transition:opacity 200ms ease; }
.ending-scroll-glow-top { background:linear-gradient(to top,transparent,rgba(224,109,155,.28)); }
.ending-scroll-glow-bottom { background:linear-gradient(to bottom,transparent,rgba(224,109,155,.28)); }
.ending-scroll-glow.is-visible { opacity:1; }
.ending-paper { position:relative;padding:32px 18px 45px;box-shadow:2px 12px 24px #08030e80,inset -3px 0 8px #91897913;background:linear-gradient(100deg,#fffef9,#faf9f4 85%,#f2f0e9);font:500 12px/1.55 "Courier New","MingLiU","PMingLiU",monospace;color:#353532;font-variant-numeric:tabular-nums; }
.ending-card[data-kind="bad"] { width:324px; }
.ending-card[data-kind="bad"] .ending-paper { min-height:780px; }
.ending-card[data-kind="bad"][data-printing="true"] .ending-paper:not(:has(.receipt-handwriting:not([hidden]))) { animation:receipt-feed 60ms steps(2,end) infinite; }
@keyframes receipt-feed { from { translate:0 4px; } to { translate:0 0; } }
.ending-paper::after { content:"";position:absolute;right:0;bottom:0;width:36px;height:30px;border-radius:90% 0 0 0;background:linear-gradient(145deg,transparent 38%,#ddc6b680 60%,#fff6e9 80%);pointer-events:none; }
.receipt-heading { text-align:center;font-family:Georgia,"PMingLiU",serif;font-size:24px;font-weight:700;letter-spacing:.06em;margin:4px 0 14px; }
.receipt-hostess { font-size:13px;white-space:nowrap; }
.receipt-date { font-size:14px;letter-spacing:.04em; }
.receipt-rule { border-top:1px dashed #5d5d57;margin:10px 0; }
.receipt-double { border-top:3px double #5d5d57; }
.receipt-pair { display:flex;justify-content:space-between;align-items:baseline;gap:7px; }
.receipt-label { overflow-wrap:anywhere; }

.receipt-amount { white-space:nowrap; }
.receipt-total { font-weight:700;font-size:23px;line-height:1.6; }
.receipt-lifetime { font-size:12px;white-space:nowrap; }
.receipt-footer { text-align:center;letter-spacing:.12em; }
.receipt-code { font-size:11px;text-align:center;margin-top:26px;letter-spacing:.04em; }
.host-panel > .ending-continue { position:absolute;left:50%;bottom:0;z-index:66;transform:translateX(-50%);box-sizing:border-box;border:1px solid rgba(240,214,160,.9);border-radius:0;outline:none;animation:ending-restart-in 180ms ease-out both; }
.ending-continue[hidden] { display:none!important; }
body[data-title-screen="1"] .ending-continue { visibility:hidden;pointer-events:none; }
.host-panel > .ending-continue:focus-visible { border-color:#fff0cb;outline:none; }
.hostess-stage.ending-receipt-ready { cursor:pointer; }
@keyframes ending-restart-in { from { opacity:0; } to { opacity:1; } }
body[data-layout-reduced="1"] .ending-continue,.ending-continue[data-motion="still"] { animation:none; }
body[data-ending-scene] :is(.wager-portrait-controls,.wager-winnings-hover,.wager-dock,.wager-shop-trigger,.onboarding-cue,.onboarding-piece,#shimei-panel) { visibility:hidden!important;pointer-events:none!important; }
body[data-ending-scene] .board-panel { opacity:.25; }
body[data-ending-scene][data-portrait-camera="1"] .hostess-stage .heart-burst { position:absolute;inset:0;width:100%;height:100%;overflow:hidden;clip-path:inset(0); }
.ending-error { position:absolute;bottom:18px;left:8%;right:8%;z-index:4;text-align:center;color:#ffc7e7; }
body[data-layout-reduced="1"] :is(.ending-card,.ending-veil,.ending-paper) { animation:none; }

.receipt-sequence { font-size:27px;font-weight:400;line-height:1.2;margin:0 0 24px; }
.receipt-logo { width:120px;margin:0 auto 22px; }
.receipt-logo-image { display:block;width:100%;height:auto; }
.receipt-shop { text-align:center;font-size:16px;font-weight:400; }
.receipt-address { text-align:center;font-size:9px;margin:3px -5px 0;white-space:nowrap; }
.receipt-info { font-size:11px;white-space:nowrap; }
.receipt-item { display:grid;grid-template-columns:16px minmax(0,1fr) auto;column-gap:5px;margin:3px 0; }
.receipt-item .receipt-label { grid-column:2; }
.receipt-item .receipt-amount { grid-column:3;grid-row:1;align-self:end;text-align:right; }
.receipt-item:has(.receipt-modifier) .receipt-amount { grid-row:2; }
.receipt-modifier { grid-column:2;grid-row:2;padding-left:8px;font-size:10px;overflow-wrap:anywhere; }
.ending-card[data-kind="bad"] .receipt-total { font-size:24px;font-weight:700;line-height:1.6; }
.ending-card[data-kind="bad"] .receipt-code { font-size:9px;margin-top:18px; }
.receipt-handwriting { position:relative;margin:32px 0 0 0;min-height:142px;transform:rotate(-5deg); }
.receipt-handwriting > span { display:block;position:relative;aspect-ratio:1024 / 200;overflow:hidden; }
.receipt-handwriting > span > img { position:absolute;left:0;top:0;width:100%;height:200%;max-width:none; }
.receipt-note-detail > img { top:-100%!important; }
.receipt-note-text { width:72%;animation:hand-write-note 900ms steps(2,end) both; }
.receipt-note-detail { width:100%;margin-top:14px;animation:hand-write-note 1350ms 980ms steps(2,end) both; }
.receipt-signature { width:150px;aspect-ratio:1024 / 300!important;margin:16px 20px 0 auto;animation:hand-write-short 350ms 2400ms steps(2,end) both; }
.receipt-handwriting > .receipt-heart { position:absolute;aspect-ratio:341.333 / 200;overflow:hidden; }
.receipt-handwriting > .receipt-heart > img { width:300%;top:-100%; }
.receipt-heart-2 > img { left:-100%!important; }
.receipt-heart-3 > img { left:-200%!important; }
.receipt-heart { width:18px;animation:heart-note-pop 120ms 2800ms ease-out both; }
.receipt-heart-1 { top:5px;left:65%;width:38px; }
.receipt-heart-2 { bottom:30px;right:2px;width:18px;animation-delay:2940ms; }
.receipt-heart-3 { bottom:9px;right:26px;width:30px;animation-delay:3080ms; }
@keyframes heart-note-pop { from { opacity:0;transform:scale(.6); } to { opacity:1;transform:scale(1); } }
.writing-done > * { animation:none; }
body[data-layout-reduced="1"] .receipt-handwriting > * { animation:none; }

.handwritten-image { display:block;height:auto;border:0; }
@keyframes hand-write-note {
  0% { clip-path:inset(0 100% 0 0); }
  9% { clip-path:inset(0 89% 0 0); }
  18% { clip-path:inset(0 78% 0 0); }
  25%,37% { clip-path:inset(0 68% 0 0); }
  46% { clip-path:inset(0 60% 0 0); }
  55% { clip-path:inset(0 48% 0 0); }
  64% { clip-path:inset(0 37% 0 0); }
  73% { clip-path:inset(0 25% 0 0); }
  82% { clip-path:inset(0 12% 0 0); }
  91%,100% { clip-path:inset(0 0 0 0); }
}
@keyframes hand-write-short {
  0% { clip-path:inset(0 100% 0 0); }
  24% { clip-path:inset(0 79% 0 0); }
  51% { clip-path:inset(0 47% 0 0); }
  77% { clip-path:inset(0 23% 0 0); }
  100% { clip-path:inset(0 0 0 0); }
}
.writing-done .handwritten-image { animation:none;clip-path:none; }
.writing-done .receipt-handwriting > span { animation:none;clip-path:none; }
body[data-layout-reduced="1"] .handwritten-image,
[data-motion="still"] .handwritten-image { animation:none;clip-path:none; }
/* Inline the generated PNG masks so file:// also works without CORS. */
.ending-card[data-kind="bad"] .ending-paper { box-shadow:2px 10px 20px -4px #08030e70;background:linear-gradient(100deg,#fffef9,#faf9f4 85%,#f2f0e9); }
.ending-card[data-kind="bad"] .ending-paper::before,
.ending-card[data-kind="bad"] .ending-paper::after { content:"";position:absolute;left:0;right:0;width:auto;height:8px;border-radius:0;background:linear-gradient(100deg,#fffef9,#faf9f4 85%,#f2f0e9);pointer-events:none;mask-size:160px 8px;mask-repeat:repeat-x; }
.ending-card[data-kind="bad"] .ending-paper::before { top:-7px;mask-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAAgCAYAAACCTsnkAAAGBUlEQVR4nO3ca6hVRRTA8WUPtYd9CHoYVFAaRVRUPkowbt00emAlZBkKIZZRRJQVldHjQ5SBH7IS0yCQDHsQvYiwbkZCiBfEKAmEUAlEKyosKslaMbGGFsPM3vuc7vV63f8fDGffvdeemT17Zp91z7k6QlUFAAAA7XHIUHcAAIAajzNCwMAawSeAGEb+cNurROQ7EVkpIjvk4LVARDaIyNki8upQdwYYApNtDewVkdHcAWBg8Angf+ZZaYtbZPglf6NcuVVEFonI9kFud5zbHor5sVxENovI6pr2xydzOLxOEZFrkmQyOLNh2/5cz78Jz3fbY0TkKumev77ZhZiR9rrL4k9Ojh9aUX84Z5ZtX5k53tOwn9Maxl3X4LnS7Zw6ydXtS5U05nJbS2Hf1MI5K2zcHqmo9yh7vUQGR0j+xPq6T4bOsYX9F9kYxTk5EK7o4pzDG8ZNrzh2nlvDpT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c91T1HJs7S2z/T6q61z4Q2Bj+BrDTfwbcl/zc2/C8b0Tk9GTfZ4P4tUHTa+gdxDbOsq9qvKdFZGKyr7dmjLuNGYy48NXx3C7qW2N/r9dtuwOhz+r+q/BVYSfzos/FxXpL7ZWOY3ivcTT3u4hsEZEJbt9O93wc4d4ThuqrR7+md4vICRVxna7rg+UZsE5ELi0cmyQiT9U8C3P7pWY8w9e4e5I/OQhfu3s/iMgXInKkiFzcYLz73HbvMLxnA9K3bhJAAAAGUkgqPg1/lcSwAvsHCSAA4EAQPgUkAQT2E/4VMAAAQMuQAAIADgT8Z8/AfsRXwAAAAC3DJ4AAAAAtQwIIAADQMiSAAAAALUMCCAAA0DIkgAAAAC1DAggAANAyJIAAAAAtQwIIAADQMiSAAAAALUMCCAAA0DIkgAAAAC1DAggAANAyJIAAAAAtQwIIAADQMiSAAAAALUMCCAAA0DIkgAAAAC1DAggAANAyJIAAAAAtQwIIAAAg7fIPGPH/VAv/zbgAAAAASUVORK5CYII="); }
.ending-card[data-kind="bad"] .ending-paper::after { bottom:-7px;mask-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAAgCAYAAACCTsnkAAAGKElEQVR4nO3cW6hVRRzH8d+RhIzIMC3ZD4E9dEGiYluCioV2MaIj9CAG3cDwlBFFREFkaiT1UFAUhUlGVmZlRRpU0o3CJKGCjLIku4FJF0iJLlBNTM2CYZg1M/uix936fmDhPnv+a9Z/Lmvt/zlHHTLGGAEAAKAxxox2AgAAADiwKAABAAAahgIQAACgYSgAAQAAGoYCEAAAoGEoAAEAABqGAhAAAKBhKAABAAAahgIQAACgYSgAAQAAGoYCEAAAoGEoAAEAABqGAhAAAKBhKAABAAAahgIQAACgYSgAAQAAGoYCEAAAoGEoAAEAABqGAhAAAKBhKAABAAAahgIQAP6zYsAnYtDzB3AADVoBuLswbiQ4Um4Mzkv12U1bJ1a7P1/U/vFapr1f4+hEuEYjhWvaa1x4Tq7t1YLY97x2+zrl58T1tmXOf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3qMa/fQ38wg5qYOng91fYb3/yJjzNoe9p0f94f3epyr7ea5Wm+prf1SD5HqmGGMGet93UrErnXt4U3uH63gSF3bjzumINdUf9uC/lITWMXsThQAVczcgtxzC5WKqXLd617vLJyvkrVtuQ14VWFsK5Ojda7Jq/p6uzDP0j0yvjD/I2titns5ruhzbrG5K12n9e4brNL4qu9belxXP8e6uKMLx9rNESssc/O82RhzTw/jLY3ZV/gwLjmWGGNO61Nfufxbibnbl+gzvH9T7WfVXHeaMWZxQd7WroJ92XL3Rux64XhPdf1uT8Qe1eH89rrX+33P5J41de9bKzPrXpdf6IJIzIJI3PRI3JOu7dLMZ3TozZq41UHcRYl5C6Xug5L1ut2LO7twL+f69KVib/VqtkNdURmN/fc7HKDPcpsq9utGYFBd7v1avOmekHTJaCeBg479u7+tPvVlf53+Y5/6ajQKQBzoAvB9SdOYdgAARs+g/StgDIbYX4C1vqH4AwBg9PETQOwvq4KvF/OrXwAADg6HjHYC+N8K/9+i70YpDwAAEOAngAAAAGqWfwC/ECAvC9V0lwAAAABJRU5ErkJggg=="); }

/* Endings use viewport space on mobile; desktop keeps the authored board-side placement. */
@media (max-width:960px) {
  .ending-card { position:fixed;left:50%;bottom:16px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 32px); }
  .ending-paper-scroll { min-height:0;max-height:calc(100dvh - 88px); }
}
