@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');
:root{color-scheme:dark;--gold:#f6c979;--gold2:#e69d37;--violet:#b46dff;--cream:#fff2d7;--text:#fff3e4;--panel:#24152f;--line:rgba(251,207,128,.24)}
*{box-sizing:border-box}html{height:100%;scroll-behavior:smooth}body{margin:0;min-height:100%;font-family:Inter,system-ui,-apple-system,sans-serif;color:var(--text);background:#0c0811}button{font:inherit;cursor:pointer}button:disabled{cursor:not-allowed}button:focus-visible,summary:focus-visible{outline:3px solid #f8dc8d;outline-offset:4px}button,.button{-webkit-tap-highlight-color:transparent}
[hidden]{display:none!important}.atmosphere{z-index:-1;position:fixed;inset:0;background:linear-gradient(180deg,rgba(17,9,25,.42),rgba(14,7,23,.48) 40%,rgba(9,6,14,.85)),url('/sombreroencantado/assets/fondo.webp') center center/cover no-repeat;filter:saturate(1.1)}.atmosphere::before{content:"";position:absolute;inset:0;background:radial-gradient(ellipse 65% 40% at 50% 60%,transparent,#09040b8c)}
.app{min-height:calc(100dvh - 38px);width:100%;display:flex;flex-direction:column;align-items:center}.brand{font-size:.64rem;letter-spacing:.32em;font-weight:800;color:#e9bb76;text-align:center;text-shadow:0 2px 5px #150c1e}
.intro{width:100%;min-height:calc(100dvh - 38px);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:9px 16px 19px;gap:3px}.brand-intro{margin:6px 0 4px}.poster{width:auto;height:auto;max-width:min(100%,500px);max-height:min(76dvh,790px);display:block;object-fit:contain;filter:drop-shadow(0 15px 50px rgba(0,0,0,.66));border-radius:16px}.intro-actions{display:flex;flex-direction:column;align-items:center;gap:10px;margin-top:7px;width:100%}.intro-note{font-size:.75rem;letter-spacing:.04em;opacity:.85;margin:0;text-align:center}
.button{display:inline-flex;justify-content:center;align-items:center;gap:8px;border-radius:999px;min-height:48px;padding:12px 28px;font-weight:800;letter-spacing:.075em;border:1px solid rgba(255,225,164,.66);transition:transform .18s ease,filter .18s ease,box-shadow .18s ease}.button:hover:not(:disabled){transform:translateY(-2px);filter:brightness(1.08)}.button-main{color:#301126;background:linear-gradient(135deg,#ffefbc 0%,#e8a540 52%,#ffd891 100%);box-shadow:0 5px 21px #d8833b50,0 0 0 3px rgba(110,50,57,.2) inset}.button-soft{color:#ffe6bc;background:#392340;border-color:#8e6b66}
.game-screen{width:100%;max-width:1150px;display:flex;flex-direction:column;align-items:center;padding:10px 15px 22px;min-height:calc(100dvh - 38px)}.game-header{text-align:center}.game-header .brand{margin:7px 0 9px}.game-header h1{font-family:Cinzel,Cambria,serif;color:#ffe1a2;line-height:1.08;font-size:clamp(1.85rem,5vw,3.25rem);font-weight:700;margin:0;text-shadow:0 2px 1px #5a2630,0 5px 20px #fa873071}.game-header h1 span{color:#ffcd79}.game-lead{font-size:clamp(.78rem,1.6vw,.95rem);color:#ffdeb1;margin:9px 0 0}.game-toolbar{display:flex;align-items:center;justify-content:space-between;width:min(100%,920px);margin-top:8px;gap:12px}.tool-right{display:flex;gap:7px}.tool-button{background:#221428bb;color:#ffddac;border:1px solid #f0c27655;padding:8px 11px;border-radius:22px;font-size:.72rem;backdrop-filter:blur(4px)}.tool-button:hover{background:#4c2952}.status-area{min-height:57px;position:relative;display:flex;align-items:center;justify-content:center}.status{margin:12px 0 6px;font-weight:800;font-family:Cinzel,Cambria,serif;letter-spacing:.03em;color:#ffe0a4;text-align:center;text-shadow:0 2px 10px #1c0b29;font-size:clamp(.96rem,2.5vw,1.34rem)}.countdown{font-family:Cinzel,serif;font-size:2.4rem;color:#fbd787}
.game-field{width:min(100%,870px);height:clamp(340px,57vw,520px);max-height:65dvh;position:relative;isolation:isolate;background:radial-gradient(ellipse 45% 50% at 50% 50%,#9b48cd20,transparent 80%);border:1px solid rgba(244,180,97,.17);border-radius:34px;box-shadow:inset 0 0 80px #0a04147a,0 0 50px #4a1b4e45;overflow:hidden}.game-field::before{content:"";position:absolute;inset:0;opacity:.62;pointer-events:none;background:radial-gradient(circle at 50% 15%,#e0a25e2e,transparent 38%),linear-gradient(transparent 80%,#1e0d27a6)}.moon-glow{position:absolute;left:50%;top:6%;width:45%;height:65%;background:radial-gradient(ellipse,#b453dc27,transparent 70%);transform:translateX(-50%);pointer-events:none}.tiles{position:absolute;inset:0}
.hat-tile{--x:50%;--y:50%;position:absolute;top:var(--y);left:var(--x);transform:translate(-50%,-50%);width:32%;max-width:246px;height:49%;max-height:249px;min-height:130px;border:0;background:none;padding:0;appearance:none;transition:left 310ms cubic-bezier(.5,.04,.3,1),top 310ms cubic-bezier(.5,.04,.3,1),opacity 220ms ease,filter 220ms ease;z-index:1;isolation:isolate}.hat-tile .pedestal{position:absolute;width:82%;height:16%;left:9%;bottom:2%;border-radius:50%;background:radial-gradient(ellipse,#ffc875ad 8%,#99514090 40%,#3e2344 70%,transparent 72%);border-top:1px solid #e8ba5ea6;box-shadow:0 0 16px 3px #c7755d5a,0 9px 25px #040209;transition:opacity .28s}.hat-tile .pedestal::after{content:"";position:absolute;top:25%;left:12%;width:76%;height:30%;border-radius:50%;background:#f7bd6d33;filter:blur(10px)}.product-preview{position:absolute;left:50%;bottom:17%;transform:translate(-50%,0) scale(1);width:69%;height:67%;background:#f8f4eb;border:2px solid #ffdda0;border-radius:22px;padding:6px;box-shadow:0 8px 21px #040308,0 0 26px #ffd97799;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:opacity .36s ease,transform .45s ease;z-index:2}.product-preview img{max-width:100%;max-height:100%;width:100%;height:100%;object-fit:contain;border-radius:14px}.hat-image{position:absolute;left:50%;top:48%;width:113%;max-height:95%;height:auto;object-fit:contain;transform:translate(-50%,-75%) scale(.9) rotate(var(--angle,0deg));opacity:0;filter:drop-shadow(0 0 13px var(--aura,#b05fea)) drop-shadow(0 9px 6px #06020c);z-index:3;transition:transform .55s cubic-bezier(.24,1.14,.2,1),opacity .28s ease;pointer-events:none}.hat-tile.covering .hat-image,.hat-tile.covered .hat-image{transform:translate(-50%,-47%) scale(1) rotate(var(--angle,0deg));opacity:1}.hat-tile.covered .product-preview,.hat-tile.covering .product-preview{opacity:0;transform:translate(-50%,0) scale(.5)}.hat-tile.covered:not(:disabled){cursor:pointer}.hat-tile.selectable:hover .hat-image,.hat-tile.selectable:focus-visible .hat-image{filter:drop-shadow(0 0 25px #d9aaff) drop-shadow(0 0 12px #ffe2a3);transform:translate(-50%,-53%) scale(1.06) rotate(var(--angle,0deg))}.hat-tile.selectable:active .hat-image{transform:translate(-50%,-47%) scale(.97) rotate(var(--angle,0deg))}.hat-tile .star{position:absolute;top:0;right:6%;font-size:clamp(14px,3vw,27px);color:#eac0ff;opacity:0;filter:drop-shadow(0 0 10px #a645ff);pointer-events:none;transition:opacity .2s}.hat-tile.selectable .star{opacity:.9;animation:sparkle 2s ease-in-out infinite}.hat-tile.revealed .hat-image{transform:translate(-50%,-133%) scale(.73) rotate(-15deg);opacity:0;transition:transform .75s ease,opacity .5s ease .3s}.hat-tile.revealed .product-preview{opacity:1;transform:translate(-50%,-2%) scale(1.05);transition-delay:.1s}.hat-tile.faded{opacity:.3;filter:grayscale(.35)}.hat-tile.is-shuffling{z-index:5}.hat-tile.selected{z-index:10}
.hint{font-size:.7rem;line-height:1.5;text-align:center;color:#dcc7de;max-width:700px;margin:14px 0 3px}.bottom-bar{width:min(100%,870px);display:flex;justify-content:center;align-items:center;gap:12px;margin-top:auto;padding-top:15px}.rules{width:min(100%,590px);border:1px solid var(--line);border-radius:14px;background:#281628bc;overflow:hidden}.rules summary{list-style:none;padding:11px 14px;cursor:pointer;font-size:.77rem;font-weight:700;color:#ffdaa5}.rules summary::before{content:'✦';margin-right:9px}.rules[open] summary{border-bottom:1px solid var(--line)}.rules-body{padding:6px 14px 12px;font-size:.78rem;line-height:1.65;color:#f4e1dc}.rules-body p{margin:9px 0}.rules-body ul{padding-left:18px;margin:8px 0}.history-link{min-width:220px;text-align:center;color:#eccda4;background:#281628bc;border:1px solid var(--line);padding:12px 14px;border-radius:14px;font-size:.75rem;white-space:nowrap}.history-link:hover{background:#5a2f5b}
.footer{text-align:center;font-size:.65rem;letter-spacing:.07em;color:#d8ab7a;padding:11px 10px 14px;text-shadow:0 2px 5px #0008}.footer strong{font-weight:800}
dialog{color:#fff0d7;border:1px solid #e3ab65b3;border-radius:28px;background:linear-gradient(160deg,#3d2051,#190f24 68%,#291b31);box-shadow:0 16px 80px #050208e8,0 0 50px #a34edf65;max-height:min(93dvh,920px);overflow-y:auto}dialog::backdrop{background:rgba(3,2,8,.83);backdrop-filter:blur(9px)}.result-dialog{width:min(90vw,450px);padding:0;text-align:center}.result-inner{padding:20px 22px 27px}.result-sparkles{font-size:1.35rem;color:#e6b8ff;letter-spacing:1.5em;animation:sparkle 2s infinite}.winner-kicker{font-weight:800;letter-spacing:.14em;color:#ce9ff1;font-size:.66rem;margin:6px 0 6px}.result-dialog h2{font-family:Cinzel,Cambria,serif;color:var(--gold);font-size:clamp(1.8rem,6vw,2.55rem);margin:5px 0 14px;text-shadow:0 0 20px #edaf607a}.win-image-wrap{height:clamp(175px,32dvh,240px);width:100%;border:2px solid rgba(255,209,145,.56);border-radius:22px;padding:8px;background:linear-gradient(135deg,#fffefa,#ece8e2);box-shadow:0 0 33px #f1a65d3b;display:flex;align-items:center;justify-content:center}.win-image-wrap img{height:100%;width:100%;object-fit:contain;border-radius:14px}.winner-caption{color:#f1d3c0;font-size:.82rem;margin:15px 0 4px}.winner-name{font-family:Cinzel,Cambria,serif;color:#ffe1a1;font-weight:700;font-size:clamp(1.17rem,5vw,1.55rem);margin:0 0 6px}.winner-copy{font-size:.72rem;color:#d7becf;margin:8px 0 19px}.result-dialog .button{width:100%}
.history-dialog{width:min(92vw,580px);padding:25px}.history-dialog h2{font-family:Cinzel,Cambria,serif;color:#ffe1a1;margin:0 0 8px}.history-description{font-size:.75rem;color:#e1c9d6;margin:0 0 20px}.history-row{display:flex;justify-content:space-between;gap:14px;border-bottom:1px solid var(--line);padding:9px 0;font-size:.85rem}.history-row strong{color:#f4ca87}.history-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:19px}.history-actions .button{font-size:.7rem;min-height:39px;padding:9px 14px}.empty-history{font-size:.82rem;color:#e0cbde}.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:22px;background:#422a4c;color:#fff;border:1px solid #e7b273;padding:12px 18px;border-radius:14px;box-shadow:0 9px 23px #0009;z-index:1000;font-size:.8rem;opacity:0;pointer-events:none;transition:opacity .2s}.toast.visible{opacity:1}
@keyframes sparkle{0%,100%{opacity:.65;filter:drop-shadow(0 0 7px #e7a4ff)}50%{opacity:1;filter:drop-shadow(0 0 16px #fae3c7)}}
@media(max-width:620px){.game-screen{padding:5px 10px 15px}.game-header .brand{margin:8px 0 7px}.game-lead{margin:6px 0 0}.game-toolbar{margin-top:10px}.tool-button{font-size:.7rem;padding:8px 10px}.tool-button span{display:none}.game-field{height:clamp(395px,113vw,550px);max-height:none;border-radius:22px}.hat-tile{width:36%;height:39%;min-height:0}.hat-tile .product-preview{height:59%;width:65%;bottom:14%;border-radius:13px;padding:4px}.hat-tile .product-preview img{border-radius:9px}.hat-tile .hat-image{width:100%;top:49%}.hat-tile .pedestal{bottom:5%}.status-area{min-height:55px}.hint{font-size:.66rem;margin:11px 6px 5px}.bottom-bar{align-items:stretch}.rules{flex:1}.history-link{max-width:unset;min-width:220px;white-space:normal;font-size:.72rem;padding:10px 16px}.poster{max-width:100%;max-height:75dvh}.intro-note{font-size:.7rem}}
@media(max-width:380px){.tool-button{padding:6px 8px}.game-header h1{font-size:1.68rem}.game-field{height:420px}.status{font-size:.91rem}.hat-tile{width:37%}.game-screen{padding-inline:6px}.result-inner{padding:18px 16px 20px}}
@media(min-width:621px){.hat-tile{width:27%;height:52%}.game-screen{padding-bottom:25px}.intro{padding-top:12px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}

/* Pantalla de campaña */
.campaign-note{font-size:.73rem;line-height:1.6;text-align:center;color:#ead3c2;margin:4px 0}
.campaign-note a{color:#ffdd98;text-underline-offset:3px}

.claim-help{font-size:.73rem;line-height:1.55;color:#ebd4e2;max-width:340px;margin:12px auto}
.result-dialog .secondary-action{margin-top:10px;font-size:.77rem;letter-spacing:.02em}
.result-dialog a.button{text-decoration:none}
@media(max-width:620px){.brand-intro{font-size:.54rem;letter-spacing:.15em}.game-header .brand{letter-spacing:.1em;font-size:.61rem}.campaign-note{font-size:.66rem}.result-inner{padding:19px 17px 20px}}

/* Experiencia sin código y con transparencia legal */
.disclosure-links{text-align:center;color:#ffe1aa;font-size:.72rem;line-height:1.6;margin:3px auto 0}
.disclosure-links a,.result-legal a,.footer a{color:#ffe0a5;text-underline-offset:3px}
.result-legal{font-size:.69rem;line-height:1.7;margin:12px auto;color:#e3cbcf}
.privacy-settings{border:0;background:none;color:#ffe0a5;font-size:inherit;font-weight:600;letter-spacing:inherit;text-decoration:underline;cursor:pointer;padding:2px}
.consent-banner{position:fixed;z-index:1100;bottom:10px;left:50%;transform:translateX(-50%);width:min(95vw,700px);padding:16px 18px;background:#20142bf5;color:#f7e6d8;border:1px solid #d4a977;border-radius:18px;box-shadow:0 15px 45px #050208bb;backdrop-filter:blur(10px)}
.consent-banner p{margin:0 0 10px;font-size:.82rem;line-height:1.5}
.consent-banner a{color:#ffdc9d}
.consent-actions{display:flex;flex-wrap:wrap;gap:9px;justify-content:flex-end}
.consent-actions button{border:1px solid #e2be89;padding:9px 13px;border-radius:50px;font-size:.78rem;font-weight:700;background:#392540;color:#ffdfac}
.consent-actions #acceptTracking{color:#311a30;background:linear-gradient(120deg,#ffe1a1,#f8bc70)}
.result-dialog .secondary-action{margin-top:12px}
@media(max-width:620px){.consent-banner{bottom:8px;padding:12px}.consent-banner p{font-size:.75rem}.consent-actions button{flex:1}.footer{line-height:1.75}.result-legal{font-size:.65rem}}

/* V5: the playable five-hat board is the landing screen, not an oversized poster. */
.game-screen{min-height:calc(100dvh - 35px);padding-top:8px;justify-content:flex-start}
.game-header .brand{margin:4px 0 8px}
.game-header h1{font-size:clamp(1.85rem,5.8vw,2.85rem)}
.game-lead{margin-top:5px}
.launch-panel{min-height:88px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;margin-top:12px;width:100%}
.start-hero{min-height:57px;min-width:min(89vw,340px);font-size:clamp(.9rem,2.4vw,1.1rem);animation:glowstart 2.4s ease-in-out infinite}
.launch-caption{margin:5px 5px 0;color:#ffdcaa;font-size:.76rem;text-align:center;line-height:1.35}
.toolbar-caption{font-size:.65rem;letter-spacing:.1em;color:#d7b884;font-weight:800}
.game-toolbar{margin-top:4px;min-height:37px}
.status-area{min-height:40px}
.status{margin:6px 0;font-size:clamp(.85rem,2.5vw,1.12rem)}
.game-field{height:min(51dvh,490px);min-height:350px;max-height:unset}
.hint{margin:8px 0 3px}
.bottom-bar{margin-top:4px;padding-top:6px}
@keyframes glowstart{50%{box-shadow:0 0 25px #efb96888,0 0 40px #7d3fa17a}}
@media(max-width:620px){
  .game-screen{padding:6px 10px 9px}
  .game-header h1{font-size:clamp(1.75rem,7vw,2.35rem)}
  .game-header .brand{margin:7px 0 5px;font-size:.54rem}
  .launch-panel{margin-top:8px;min-height:83px;gap:2px}
  .launch-caption{font-size:.65rem}
  .start-hero{min-height:49px;min-width:min(89vw,350px)}
  .game-toolbar{margin-top:4px}
  .toolbar-caption{font-size:.55rem}
  .status-area{min-height:43px}
  .game-field{height:clamp(330px,94vw,440px);min-height:0}
  .hint{font-size:.62rem;margin:6px 0}
  .campaign-note{font-size:.62rem;margin:2px}
}
@media(max-width:380px){.game-field{height:360px}.launch-panel{min-height:74px}.game-header h1{font-size:1.7rem}}
@media (prefers-reduced-motion:reduce){.start-hero{animation:none}}
