:root {
	--bosque: #1F3A2B;
	--tinta: #16231B;
	--texto: #3E4A42;
	--ambar: #D39A3A;
	--ambar2: #E9B864;
	--hueso: #F3EFE4;
	--superficie: #FBF9F3;
	--linea: #DCD6C6;
	--ok: #1F7A45;
	--err: #B4442F;
	--glass: rgba(16, 30, 22, .72);
	--glass-borde: rgba(243, 239, 228, .2);
	--sombra: 0 8px 24px rgba(0, 0, 0, .28);
	--safe-t: env(safe-area-inset-top, 0px);
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-l: env(safe-area-inset-left, 0px);
	--safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bosque); font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--tinta); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
h1, h2 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; margin: 0; text-wrap: balance; }
.eyebrow { margin: 0; font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #A8731F; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; }
kbd { display: inline-block; min-width: 24px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--linea); border-bottom-width: 3px; background: #fff; font: 700 12px/1.4 "Manrope", sans-serif; color: var(--tinta); text-align: center; }

/* ---------- fundido y carga ---------- */
.fade { position: fixed; inset: 0; z-index: 45; background: var(--bosque); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.fade.on { opacity: 1; }
.loader { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 12px; background: radial-gradient(circle at 50% 35%, #2b4d38, var(--bosque) 70%); color: #fff; text-align: center; padding: 24px; transition: opacity .6s; }
.loader.out { opacity: 0; pointer-events: none; }
.loader img { border-radius: 26px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.loader .eyebrow { color: var(--ambar2); }
.loader h1 { font-size: 32px; }
.loader .bar { width: 240px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.loader .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ambar), var(--ambar2)); transition: width .2s; }
.loader .tip { margin: 0; font-size: 14px; color: #CFD8CC; min-height: 1.4em; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; border: 0; border-radius: 999px; padding: 12px 22px; font: 800 16px/1.1 "Manrope", system-ui, sans-serif; cursor: pointer; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .2s, filter .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: linear-gradient(180deg, #E5B256 0%, var(--ambar) 100%); color: var(--tinta); box-shadow: 0 6px 16px rgba(211,154,58,.45), inset 0 1px 0 rgba(255,255,255,.45); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(211,154,58,.55), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-ghost { background: #fff; color: var(--bosque); border: 2px solid var(--linea); }
.btn-ghost:hover { border-color: var(--bosque); }
.btn:focus-visible, .hb:focus-visible, .chip:focus-visible, .pn:focus-visible, .menu button:focus-visible, .code:focus-visible { outline: 3px solid var(--ambar2); outline-offset: 2px; }

/* ---------- barra superior ---------- */
.hud { position: fixed; z-index: 20; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; pointer-events: none; }
.hud > *, .hud-mid > *, .hud-right > * { pointer-events: auto; }
.hud-mid { display: flex; gap: 8px; justify-self: center; }
.hud-right { display: flex; gap: 8px; justify-self: end; }
.hb { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--glass-borde); background: var(--glass); color: #fff; font: 800 14px "Manrope", sans-serif; text-decoration: none; cursor: pointer; box-shadow: var(--sombra); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .15s ease, border-color .2s, background .2s; justify-self: start; }
.hb:hover { border-color: rgba(233,184,100,.8); transform: translateY(-1px); }
.hb:active { transform: scale(.96); }
.hb[aria-expanded="true"] { background: rgba(31,58,43,.95); border-color: var(--ambar2); }
.hb-icon { width: 44px; padding: 0; justify-content: center; }
.hb-gold { color: var(--ambar2); border-color: rgba(233,184,100,.55); }
.hb-gold.is-done { color: #9fe0b5; border-color: rgba(159,224,181,.6); }
.hb-cart { background: linear-gradient(180deg, #E5B256, var(--ambar)); color: var(--tinta); border-color: transparent; transition: transform .2s; }
.hb-cart b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--tinta); color: #fff; font-size: 12px; display: inline-grid; place-items: center; }
.hb-cart.bump { transform: scale(1.15); }

/* ---------- menú de puestos ---------- */
.menu { position: fixed; z-index: 25; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(340px, calc(100vw - 24px)); background: rgba(251,249,243,.97); border: 1px solid var(--linea); border-radius: 20px; padding: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.3); display: grid; gap: 4px; animation: pop .16s ease; }
.menu-t { margin: 4px 8px 6px; font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #A8731F; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 14px; padding: 10px; background: transparent; cursor: pointer; font: inherit; color: var(--tinta); }
.menu button:hover { background: #EFE9DB; }
.menu b { display: block; font-size: 15px; }
.menu small { display: block; color: #7a8279; font-size: 12px; }
.menu .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ambar); color: var(--tinta); font-weight: 800; }
.menu .dot-c { background: var(--bosque); color: var(--ambar2); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- minimapa, brújula y avisos ---------- */
.minimap { position: fixed; z-index: 18; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); width: 140px; height: 140px; border-radius: 50%; box-shadow: var(--sombra); cursor: pointer; }
.compass { position: fixed; z-index: 19; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--glass); border: 1px solid rgba(233,184,100,.6); color: var(--ambar2); font-weight: 800; box-shadow: var(--sombra); pointer-events: none; }
.compass i { width: 34px; height: 34px; border-radius: 50%; background: var(--ambar); position: relative; transition: transform .1s linear; }
.compass i::before { content: ""; position: absolute; left: 50%; top: 5px; transform: translateX(-50%); border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 18px solid var(--tinta); }
.toasts { position: fixed; z-index: 30; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: min(92vw, 460px); pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: rgba(22,35,27,.92); color: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--sombra); opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; pointer-events: auto; }
.toast.on { opacity: 1; transform: none; }
.toast a { color: var(--ambar2); }
.toast .ic { width: 18px; height: 18px; color: var(--ambar2); }
.toast-ok .ic { color: #9fe0b5; }
.toast-gold { background: linear-gradient(90deg, #3b2a08, #6b4b12); border: 1px solid rgba(233,184,100,.7); }
.t-gold { color: var(--ambar2); font-size: 18px; }
.near { position: fixed; z-index: 15; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--glass); border: 1px solid var(--glass-borde); color: #fff; font-size: 14px; padding: 8px 16px; border-radius: 999px; pointer-events: none; white-space: nowrap; max-width: calc(100vw - 340px); overflow: hidden; text-overflow: ellipsis; box-shadow: var(--sombra); }
.near kbd { margin-right: 2px; }

/* ---------- mando táctil ---------- */
.stick { position: fixed; z-index: 20; left: calc(22px + var(--safe-l)); bottom: calc(26px + var(--safe-b)); width: 124px; height: 124px; border-radius: 50%; background: radial-gradient(circle, rgba(16,30,22,.25), rgba(16,30,22,.5)); border: 2px solid rgba(243,239,228,.55); touch-action: none; box-shadow: var(--sombra); }
.stick::before { content: "▲\A◀       ▶\A▼"; white-space: pre; position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: rgba(243,239,228,.5); font-size: 10px; line-height: 2.6; }
.stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: linear-gradient(180deg, #E5B256, var(--ambar)); box-shadow: 0 4px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.5); }

/* ---------- ventanas ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(16,30,22,.6); padding: 16px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.card { position: relative; background: var(--hueso); border-radius: 24px; padding: 26px; max-width: 380px; width: 100%; text-align: center; display: grid; gap: 12px; justify-items: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); max-height: calc(100vh - 32px); overflow-y: auto; }
.card-wide { max-width: 460px; }
.card img { border-radius: 18px; background: #fff; }
.card h2 { font-size: 28px; line-height: 1.1; }
.card p { margin: 0; line-height: 1.5; }
.card .x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(22,35,27,.08); color: var(--tinta); display: grid; place-items: center; cursor: pointer; }
.howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; text-align: left; }
.howto li { background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.6; }
.howto.touch { display: none; }
@media (pointer: coarse) { .howto.desk { display: none; } .howto.touch { display: grid; } }
.game-card { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; background: linear-gradient(135deg, #3b2a08, #6b4b12); color: #fff; border-radius: 16px; padding: 14px; }
.game-card p { color: #F1E3C2; font-size: 14px; margin-top: 2px; }
.gc-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--ambar); color: var(--tinta); display: grid; place-items: center; flex: 0 0 auto; }
.dots { display: flex; gap: 8px; }
.dots span { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #E8E2D2; color: #bfb7a3; font-size: 20px; }
.dots span.on { background: linear-gradient(180deg, #F2C66A, var(--ambar)); color: var(--tinta); box-shadow: 0 4px 12px rgba(211,154,58,.5); }
.prizes { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 6px; }
.prizes li { display: flex; justify-content: space-between; gap: 10px; background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.prizes li span { color: #7a8279; text-align: right; }
.prizes li.first { border-color: rgba(211,154,58,.7); background: #FFF7E8; }
.legal { margin: 0; font-size: 12px; color: #7a8279; text-align: center; line-height: 1.5; }
.link { background: none; border: 0; padding: 0; color: var(--bosque); font: 700 15px "Manrope", sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: center; }
.field { display: grid; gap: 6px; width: 100%; text-align: left; font-weight: 700; font-size: 14px; }
.field input { width: 100%; min-height: 50px; border: 2px solid var(--linea); border-radius: 14px; padding: 12px 14px; font: 16px "Manrope", sans-serif; background: #fff; color: var(--tinta); }
.field input:focus { outline: none; border-color: var(--bosque); }
.check { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 14px; line-height: 1.4; width: 100%; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--bosque); flex: 0 0 auto; }
.check a { color: var(--bosque); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#claim-form { display: grid; gap: 12px; width: 100%; justify-items: center; }
.prize { display: grid; gap: 12px; width: 100%; justify-items: center; }
.prize-big { font-family: "DM Serif Display", Georgia, serif; font-size: 40px !important; line-height: 1.05; color: var(--tinta); }
.code { display: inline-flex; align-items: center; gap: 8px; border: 2px dashed var(--ambar); background: #FFF7E8; color: var(--bosque); border-radius: 14px; padding: 10px 16px; font: 800 20px "Manrope", sans-serif; letter-spacing: .08em; cursor: pointer; }
.code .ic { width: 18px; height: 18px; }
#game-status { font-size: 15px; }
#game-status small { color: #7a8279; }

/* ---------- ficha de producto ---------- */
.panel { position: fixed; z-index: 35; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--hueso); box-shadow: -12px 0 40px rgba(0,0,0,.32); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.panel.on { transform: none; }
.p-top { display: flex; align-items: center; gap: 8px; padding: calc(12px + var(--safe-t)) 14px 10px; background: var(--hueso); border-bottom: 1px solid var(--linea); }
.p-count { flex: 1; text-align: center; font-weight: 800; font-size: 13px; color: #7a8279; }
.pn { width: 40px; height: 40px; border: 1px solid var(--linea); border-radius: 50%; background: #fff; color: var(--tinta); font: 700 22px/1 "Manrope", sans-serif; display: grid; place-items: center; cursor: pointer; }
.pn:disabled { opacity: .4; cursor: default; }
.p-close { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.p-close .ic { width: 18px; height: 18px; }
.p-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.p-imgwrap { background: #fff; }
.p-imgwrap img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.p-body { padding: 18px 20px 20px; display: grid; gap: 10px; }
.p-body h2 { font-size: 28px; line-height: 1.1; }
.p-desc { margin: 0; font-size: 15px; line-height: 1.55; color: var(--texto); }
.p-groups { display: grid; gap: 14px; }
.grp-t { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--texto); }
.grp-t b { color: var(--tinta); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; border: 2px solid var(--linea); background: #fff; border-radius: 999px; padding: 8px 16px; font: 700 14px "Manrope", sans-serif; color: var(--tinta); cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.chip:hover:not(:disabled) { border-color: var(--bosque); }
.chip:active:not(:disabled) { transform: scale(.96); }
.chip.on { border-color: var(--bosque); background: var(--bosque); color: #fff; }
.chip:disabled { opacity: .4; text-decoration: line-through; cursor: default; }
.p-bar { display: flex; gap: 10px; align-items: center; padding: 12px 14px calc(12px + var(--safe-b)); background: var(--superficie); border-top: 1px solid var(--linea); box-shadow: 0 -6px 18px rgba(0,0,0,.06); }
.qty { display: flex; align-items: center; border: 2px solid var(--linea); border-radius: 999px; background: #fff; height: 52px; }
.qty button { width: 42px; height: 100%; border: 0; background: none; font: 800 20px "Manrope", sans-serif; color: var(--bosque); cursor: pointer; }
.qty output { min-width: 26px; text-align: center; font-weight: 800; }
.btn-add { flex: 1; width: auto; justify-content: space-between; padding: 12px 18px; }
.btn-add b { font-weight: 800; }
.btn-add.is-ok { background: linear-gradient(180deg, #2a9a5b, var(--ok)); color: #fff; box-shadow: 0 6px 16px rgba(31,122,69,.4); }
.btn-add.is-err { box-shadow: 0 0 0 3px rgba(180,68,47,.45); }
.p-msg { margin: 0; min-height: 0; font-weight: 700; text-align: center; font-size: 14px; }
.panel > .p-msg:not(:empty) { padding: 0 14px 10px; background: var(--superficie); }
.p-msg.ok { color: var(--ok); }
.p-msg.err { color: var(--err); }

/* ---------- móvil ---------- */
@media (max-width: 640px) {
	.hud { display: flex; justify-content: space-between; gap: 6px; }
	.hud-mid, .hud-right { gap: 6px; }
	.hb { height: 42px; padding: 0 12px; }
	.hb span { display: none; }
	#juego-prog { display: inline; }
	.hb-icon { width: 42px; padding: 0; }
	.menu { top: calc(62px + var(--safe-t)); }
	.minimap { width: 112px; height: 112px; }
	.near { bottom: calc(160px + var(--safe-b)); max-width: calc(100vw - 32px); }
	.panel { top: auto; height: 88vh; width: 100vw; border-radius: 24px 24px 0 0; transform: translateY(105%); box-shadow: 0 -12px 40px rgba(0,0,0,.35); }
	.panel.on { transform: none; }
	.p-top { padding-top: 12px; border-radius: 24px 24px 0 0; }
	.p-top::before { content: ""; position: absolute; left: 50%; top: 6px; transform: translateX(-50%); width: 44px; height: 4px; border-radius: 2px; background: #cfc8b6; }
	.p-imgwrap img { aspect-ratio: 4 / 3; }
	.card { padding: 22px 18px; }
	.prize-big { font-size: 34px !important; }
}
@media (prefers-reduced-motion: reduce) {
	.panel, .loader, .fade, .toast, .btn, .hb, .hb-cart { transition: none; }
	.menu { animation: none; }
}
