:root { font-family: "Segoe UI", system-ui, sans-serif; color: #29473b; background: #faf5e9; font-synthesis: none; }
* { box-sizing: border-box; }
body { min-width: 0; min-height: 100vh; margin: 0; padding: clamp(8px, 2.5vw, 14px); overflow-x: hidden; background: radial-gradient(ellipse at 0 12%, #e7eddb 0, transparent 50%), #faf5e9; }
button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.game { width: 100%; max-width: 360px; margin: 0 auto; }
header { padding: 3px 0 6px; text-align: center; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 7vw, 32px); font-weight: 500; letter-spacing: -1px; line-height: 1.1; }
h1 span { color: #b88a45; font: .6em Georgia, serif; vertical-align: top; margin-left: 3px; }
.rules { margin: 0; color: #526450; font-size: clamp(11px, 3vw, 12px); line-height: 1.35; text-align: center; }
.primary { width: 100%; min-height: 42px; margin: 8px 0 7px; padding: 10px 14px; border: 1px solid #244b35; border-radius: 12px; background: #315b40; box-shadow: 0 2px 0 #20432e; color: #fffcef; font-weight: 700; cursor: pointer; transition: background .2s; }
.primary:enabled:hover { background: #244b35; }
.primary:disabled { opacity: .55; cursor: default; }
.counters { display: flex; justify-content: center; align-items: baseline; gap: 6px; min-height: 21px; color: #526450; font-size: clamp(11px, 3.2vw, 13px); font-variant-numeric: tabular-nums; }
.counters strong { color: #29473b; }
.result { min-height: 0; margin: 5px 0; color: #526450; font-size: 11px; line-height: 1.35; text-align: center; }
.result h2 { display: inline; margin: 0; color: #375a43; font-size: 12px; }
.result h2::after { content: " — "; }
.result p { display: inline; margin: 0; }
.result[data-state="ready"] { display: none; }
.result[data-state="win"] h2 { color: #976d24; }
.result[data-state="loss"] h2, .result[data-state="limit"] h2 { color: #8a5d45; }
.board-wrap { padding: 7px; border: 1px solid #e4dece; border-radius: 16px; background: #fffaf0a6; box-shadow: 0 7px 20px #7b6b4210; }
.board { display: grid; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: clamp(54px, 18vw, 64px); gap: clamp(4px, 1.4vw, 6px); perspective: 800px; }
.card { position: relative; display: flex; width: 100%; min-width: 0; min-height: 54px; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px; overflow: hidden; border: 1px solid #cad3b7; border-bottom-width: 2px; border-radius: 9px; background: linear-gradient(145deg, #eaf0dc, #dbe4c9); color: #6b8157; cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s; }
.card:not(.open)::before { content: ""; position: absolute; inset: 4px; border: 1px solid #ffffff80; border-radius: 6px; pointer-events: none; }
.card:enabled:active { transform: scale(.95); }
.card:disabled { cursor: default; }
.card.open { border-color: #e3dcca; background: #fffdf7; animation: reveal .35s ease-out; }
.card.winner { border-color: #c4a359; background: #fff0bd; box-shadow: 0 0 0 1px #e8ca7870; }
.media { display: grid; place-items: center; min-height: 0; }
.media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card .media { width: 100%; }
.card-logo { height: 72%; }
.product-photo { height: 65%; }
.card .name { flex-shrink: 0; color: #3e5544; font-size: clamp(8px, 2.4vw, 10px); line-height: 1.1; }
.media-fallback { overflow-wrap: anywhere; font-size: 10px; text-align: center; }
.card-logo .media-fallback { font: italic 20px Georgia, serif; }
button:focus-visible { outline: 3px solid #aa6b22; outline-offset: 3px; }
[hidden] { display: none !important; }
.warning { margin: 6px 0; color: #8a321d; font-size: 11px; text-align: center; }
footer { margin-top: 10px; color: #687260; font-size: 10px; line-height: 1.35; text-align: center; }
.demo-tag { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
footer p { margin: 3px 0; }
.reset { min-height: 32px; padding: 5px 8px; border: 0; background: transparent; color: #687260; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
dialog { width: min(400px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid #e8d9ad; border-radius: 22px; padding: 24px 18px 18px; color: #29473b; text-align: center; background-color: #fffaf0; background-image: url("../assets/backgrounds/win-bg.png"); background-position: center; background-size: cover; box-shadow: 0 30px 100px #1f35274d; }
dialog::backdrop { background: #20372d88; backdrop-filter: blur(4px); }
body:has(dialog[open]) { overflow: hidden; }
dialog h2 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 24px; line-height: 1.2; }
dialog p { margin: 5px 0; font-size: 13px; line-height: 1.5; }
dialog .eyebrow { font-size: 9px; font-weight: 800; letter-spacing: 1.5px; }
#win-dialog h2, #win-dialog p { position: relative; border-radius: 8px; background: #fffaf0d9; padding: 4px; }
.prize-icon { display: grid; place-items: center; width: 108px; height: 108px; margin: 0 auto 12px; padding: 6px; border-radius: 50%; background: #fffaf0c9; }
.prize-photo { width: 100%; height: 100%; }
.prize-photo .media-fallback { font-size: 16px; }
dialog .prize-note { color: #717663; font-size: 10px; }
.confetti { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.confetti i { position: absolute; top: -20px; left: var(--left); width: 8px; height: 13px; background: var(--color); animation: confetti-fall 2.6s var(--delay) ease-in both; }
@keyframes reveal { from { transform: rotateY(80deg) scale(.9); opacity: .4; } to { transform: rotateY(0) scale(1); opacity: 1; } }
@keyframes confetti-fall { from { transform: translateY(-20px) rotate(0); opacity: 1; } to { transform: translateY(650px) rotate(var(--rotation)); opacity: 0; } }
@media (max-width: 480px) { body { padding: 8px 10px; } .board-wrap { padding: 6px; border-radius: 14px; } .board { gap: 4px; } .card { border-radius: 8px; } .card-logo { height: 68%; } }
@media (max-width: 340px) { h1 { font-size: 24px; } .rules { font-size: 10px; } .primary { min-height: 40px; margin: 6px 0; } .counters { font-size: 10px; } .card .name { font-size: 8px; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } .confetti { display: none; } }
