#scratchTicketDialog { color: #fff4c2; background: transparent; border: 0; padding: 0; max-width: calc(100vw - 12px); max-height: calc(100dvh - 12px); overflow: visible; }
#scratchTicketDialog::backdrop { background: #070411c9; }
.scratch-close { right: 0; top: 0; width: 44px; height: 46px; }
.scratch-stage { position: relative; z-index: 2; }
.scratch-actions { position: relative; z-index: 1; height: 82px; }
.scratch-message { position: absolute; z-index: 2; left: 8%; right: 8%; bottom: 1%; margin: 0; text-align: center; font: 12px/1.5 'Silkscreen', monospace; background: #240e25ee; }
.scratch-message:empty { display: none; }
.scratch-card { position: relative; width: min(1100px, calc(100vw - 12px), calc((100dvh - 102px) * 1.5)); aspect-ratio: 1.5; --scratch-art: url('/public/assets/scratch-tickets/landscape-v2.png'); image-rendering: pixelated; }
.scratch-fields { touch-action: none; position: absolute; left: 6.6%; right: 6.8%; top: 49.2%; height: 19.6%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.8%; }
.scratch-field { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #ffeac5; border-radius: 13%; color: #231426; gap: 2%; }
.scratch-field .item-icon { flex-shrink: 0; width: 64%; height: 64%; margin: 0; }
.scratch-field strong { font: bold clamp(14px, 2vw, 25px)/1 'Silkscreen', monospace; text-align: center; max-width: 95%; }
.scratch-loser .item-icon { filter: grayscale(1) contrast(1.15) brightness(.95); }
.scratch-field canvas { z-index: 3; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.scratch-field canvas:focus-visible { outline: 3px solid #44d8ff; outline-offset: -4px; }
@media (orientation: portrait) {
  .scratch-card { width: min(calc(100vw - 12px), calc((100dvh - 102px) * 11 / 16)); aspect-ratio: 11 / 16; --scratch-art: url('/public/assets/scratch-tickets/portrait-v2.png'); }
  .scratch-fields { left: 11.2%; right: 10.4%; top: 43.6%; height: 29.8%; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 6% 5%; }
  .scratch-field strong { font-size: clamp(14px, 4.5vw, 24px); }
}

.scratch-next { position: absolute; z-index: 2; top: 12px; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: 90%; white-space: nowrap; }
.item-icon.scratchTicket { background: url('/public/assets/scratch-tickets/icon.png') 50% 55% / 140% no-repeat; image-rendering: pixelated; }
@media (orientation: portrait) { .scratch-next { max-width: 90%; white-space: normal; font-size: 14px; } }

.scratch-next { font: 13px/1.5 'Silkscreen', monospace; color: #fff4c2; background: #4f194e; border: 2px solid #dfac37; padding: 8px 12px; cursor: pointer; }
.scratch-next[hidden] { display: none; }
.scratch-next:disabled { opacity: .5; cursor: wait; }
.scratch-field { isolation: isolate; }
.scratch-field .item-icon, .scratch-field strong { z-index: 1; position: relative; }
.scratch-winner { --prize-base: #205fa8; --prize-top: #348bd0; --prize-bottom: #16356f; --prize-texture: #87d9ff1a; --prize-border: #a4e4ff7a; --prize-highlight: #a4e4ff59; --prize-shadow: #0a1d4f80; --prize-text-shadow: #0a1d4f; background-color: var(--prize-base); background-image: conic-gradient(var(--prize-texture) 25%, transparent 0 50%, var(--prize-texture) 0 75%, transparent 0), linear-gradient(var(--prize-top), var(--prize-bottom)); background-size: 10px 10px, 100% 100%; color: #fff1b8; }
.scratch-winner.scratch-rare { --prize-base: #a91e35; --prize-top: #cf3445; --prize-bottom: #85152d; --prize-texture: #ff79631a; --prize-border: #ffbb697a; --prize-highlight: #ff8e6859; --prize-shadow: #550d2c80; --prize-text-shadow: #4f0b28; }
.scratch-winner::after { content: ''; position: absolute; z-index: 2; inset: 3px; border: 2px solid var(--prize-border); border-radius: 9%; box-shadow: inset 2px 2px var(--prize-highlight), inset -2px -2px var(--prize-shadow); pointer-events: none; }
.scratch-winner strong { text-shadow: 2px 2px var(--prize-text-shadow); }
.scratch-winner.scratch-revealed::before { content: ''; position: absolute; z-index: 0; inset: -65%; background: repeating-conic-gradient(from 0deg, #ffc83a00 0deg 13deg, #ffc83ab8 15deg 24deg, #fff5b54d 26deg 30deg); animation: scratch-rays-turn 9s linear infinite, scratch-rays-glow 2.8s ease-in-out infinite; }
.scratch-winner.scratch-revealed .item-icon { animation: scratch-prize-celebrate 2.8s ease-in-out infinite; transform-origin: center; }
@keyframes scratch-prize-celebrate { 0%, 55%, 100% { transform: scale(1) rotate(0deg); } 65% { transform: scale(1.17) rotate(-9deg); } 76% { transform: scale(1.2) rotate(9deg); } 87% { transform: scale(1.13) rotate(-6deg); } }
@keyframes scratch-rays-turn { to { transform: rotate(360deg); } }
@keyframes scratch-rays-glow { 0%, 55%, 100% { opacity: .35; } 75% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scratch-winner.scratch-revealed .item-icon, .scratch-winner.scratch-revealed::before { animation: none; } }

.scratch-next { color: #ffeab4; background: linear-gradient(#6b246e, #3e123f); border: 2px solid #ffd45b; min-height: 54px; font-size: 16px; padding: 14px 24px; text-shadow: 2px 2px #240b2a; box-shadow: 0 0 0 2px #291027, 0 4px 0 #251022, inset 0 2px #b552a5; }
.scratch-next::before { content: '✦'; color: #ffd45b; margin-right: 9px; }
.scratch-next:hover, .scratch-next:active { transform: none; background: linear-gradient(#85348a, #4f1c50); box-shadow: 0 0 0 2px #291027, 0 4px 0 #251022, inset 0 2px #db7bc9; }
.scratch-next:not([hidden]) { animation: scratch-next-appear .48s cubic-bezier(.2,.8,.2,1) both; }
@keyframes scratch-next-appear { from { opacity: 0; transform: translateY(-52px) scale(.65); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .scratch-next:not([hidden]) { animation: none; } }

.scratch-card::before { content: ''; position: absolute; inset: 0; background: var(--scratch-art) center / 100% 100%; image-rendering: pixelated; pointer-events: none; }

.scratch-outgoing { position: absolute; inset: 0 auto auto 0; z-index: 4; pointer-events: none; transform-origin: center; }
.scratch-card { isolation: isolate; }
.scratch-card.scratch-rare-ticket::after { content: ''; position: absolute; z-index: -1; inset: -18%; pointer-events: none; border-radius: 50%; background: radial-gradient(ellipse, #ffdc7770 15%, #f5b8ff45 48%, transparent 70%); animation: scratch-aura 2.2s ease-in-out infinite; }
.scratch-rare.scratch-revealed { z-index: 4; transform: scale(1.07); box-shadow: 0 0 10px #fff6b7, 0 0 24px #ffbe37cc; }
.scratch-rare.scratch-revealed::before { background: repeating-conic-gradient(#ffce4700 0deg 10deg, #fff6b5 13deg 22deg, #ffc637bb 24deg 30deg); animation: scratch-rays-turn 6s linear infinite, scratch-rare-rays 1.8s ease-in-out infinite; }
@keyframes scratch-aura { 0%,100% { opacity:.65; transform:scale(.96); } 50% { opacity:1; transform:scale(1.04); } }
@keyframes scratch-rare-rays { 0%,100% { opacity:.65; } 50% { opacity:1; } }
@media (prefers-reduced-motion: reduce) { .scratch-card.scratch-rare-ticket::after, .scratch-rare.scratch-revealed::before { animation:none; } }
.scratch-actions { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; padding:12px 4px 0; box-sizing:border-box; align-items:start; }
.scratch-next, .scratch-auto { position:relative; top:auto; left:auto; right:auto; width:100%; max-width:none; margin:0; white-space:normal; min-height:54px; padding:12px 10px; font-size:clamp(11px,2vw,16px); }
.scratch-next[hidden] { display:block; visibility:hidden; }
.scratch-auto { font-family:'Silkscreen',monospace; line-height:1.5; color:#edffef; background:linear-gradient(#286d6a,#143b46); border:2px solid #7edfc1; box-shadow:0 0 0 2px #142e38,0 4px #0c222c,inset 0 2px #509e92; cursor:pointer; text-shadow:2px 2px #10343f; }
.scratch-auto:hover { background:linear-gradient(#348b80,#1b5055); }
.scratch-auto[aria-pressed="true"] { border-color:#ffe489; color:#fff1bb; }
.scratch-auto:disabled { opacity:.5; cursor:wait; }
.scratch-auto span { display:inline-block; margin-right:7px; }
.scratch-brush { position:fixed; z-index:10; left:0; top:0; width:20px; height:20px; box-sizing:border-box; border:3px solid #ffe69d; border-radius:50%; background:#c99335; box-shadow:inset 2px 2px #fff0b2,inset -2px -2px #805018,2px 3px #321a4699; pointer-events:none; }
.scratch-brush[hidden] { display:none; }
