:root { color-scheme: dark; background: #1a1446; }
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; }
body { background: #1a1446; }
main { width: 100%; min-height: 100svh; display: grid; place-items: center; }
#artwork { display: block; width: 100%; height: 100svh; user-select: none; -webkit-user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }


#character-action:focus-visible { clip-path: none; width: auto; height: auto; padding: 12px 18px; margin: 0; left: 16px; bottom: 16px; background: #28166f; color: white; border: 2px solid #f4c83d; font: 16px sans-serif; z-index: 2; }

main { position: relative; isolation: isolate; overflow: hidden; }
#background-shader { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

#artwork { position: relative; z-index: 1; }
#table-extension { position: absolute; left: 0; right: 0; bottom: 0; top: 100%; z-index: 0; pointer-events: none; background-color: #d76d49; background-image: url('assets/table-edge.webp'); background-position: top left; background-repeat: repeat-x; }

.art-button { cursor: pointer; outline: none; }
.art-button image { pointer-events: none; }
.art-button .button-hover { visibility: hidden; }
.art-button:hover .button-normal, .art-button:focus-visible .button-normal { visibility: hidden; }
.art-button:hover .button-hover, .art-button:focus-visible .button-hover { visibility: visible; }
.art-button:focus-visible .button-hit { stroke: #f4c83d; stroke-width: 3; stroke-dasharray: 8 5; }

body:has(#calculator-dialog[open]) { overflow: hidden; }
#calculator-dialog { padding: 0; margin: auto; width: min(1080px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); border: 20px solid #C44940; border-radius: 70px; background: #f0e8d9; color: #231631; color-scheme: light; overflow: hidden; box-shadow: 0 16px 80px #0008; }
#calculator-dialog::backdrop { background: #100921b8; }
.calculator-header { position: absolute; top: 12px; right: 12px; z-index: 10; }

#calculator-close { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #C44940; color: white; font: 30px/1 system-ui, sans-serif; cursor: pointer; }
#calculator-close:focus-visible { outline: 3px solid #231631; outline-offset: 3px; }
.calculator-content { padding: 0; overflow: hidden; }
#calculator-frame { display: block; width: 100%; height: min(860px, calc(100dvh - 64px)); border: 0; background: #f0e8d9; }

@media (max-width: 600px) {
  #calculator-dialog { border-radius: 44px; }
}

.pat-heart { transform-box: fill-box; transform-origin: center; }
#pat-hearts.active .pat-heart { animation: heart-firefly 2.8s ease-in-out var(--delay) infinite; }
@keyframes heart-firefly {
  0%, 100% { opacity: .15; transform: translate(0, 18px) scale(.8) rotate(-5deg); }
  35% { opacity: 1; transform: translate(var(--drift), -10px) scale(1) rotate(4deg); }
  70% { opacity: .7; transform: translate(0, -40px) scale(.9) rotate(-3deg); }
  99% { opacity: 0; transform: translate(var(--drift), -60px) scale(.75); }
}
@media (prefers-reduced-motion: reduce) {
  #pat-hearts.active .pat-heart { animation: none; opacity: .85; }
}
