/* Tivity Minigames · entrega de la luz y carné */
.tmg-luz, .tmg-carne {
	--tmg-bg: #1C2736;
	max-width: 560px; margin: 0 auto; padding: 16px; border-radius: 22px;
	background: radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, .08), transparent 60%), var(--tmg-bg);
	color: #F7EED9; font-family: "Nunito", "Trebuchet MS", system-ui, sans-serif; line-height: 1.4; text-align: center;
	overflow: hidden; box-sizing: border-box;
}
.tmg-luz *, .tmg-carne * { box-sizing: border-box; }
.tmg-estrella { display: inline-block; vertical-align: middle; }
.tmg-estrella-img { object-fit: contain; }
.tmg-hidden { display: none !important; }
@keyframes twinkle { 50% { opacity: .35; } }
.tw { animation: twinkle 2.2s ease-in-out infinite; }

/* Escena de aparición */
.tmg-luz-scene { position: relative; min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 6px; }
.tmg-luz-rays {
	position: absolute; left: 50%; top: 42%; width: 520px; height: 520px; transform: translate(-50%, -50%);
	background: repeating-conic-gradient(from 0deg, rgba(249, 216, 123, .22) 0 8deg, transparent 8deg 30deg);
	-webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .5) 30%, transparent 62%); mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .5) 30%, transparent 62%);
	opacity: 0; transition: opacity 1s;
}
.tmg-luz-go .tmg-luz-rays { opacity: 1; animation: tmg-luz-spin 16s linear infinite; }
@keyframes tmg-luz-spin { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.tmg-luz-burst {
	position: absolute; left: 50%; top: 42%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
	background: radial-gradient(circle, #fff 0%, #fff3b0 35%, rgba(255, 210, 63, 0) 70%); opacity: 0; pointer-events: none;
}
.tmg-luz-go .tmg-luz-burst { animation: tmg-luz-burst 1.4s ease-out forwards; }
@keyframes tmg-luz-burst { 0% { opacity: 0; transform: scale(.2); } 40% { opacity: 1; transform: scale(8); } 100% { opacity: 0; transform: scale(14); } }
.tmg-luz-star { position: relative; transform: scale(0); opacity: 0; filter: drop-shadow(0 0 18px rgba(249, 216, 123, .9)); }
.tmg-luz-shown .tmg-luz-star { opacity: 1; transform: none; animation: tmg-luz-pop 1s cubic-bezier(.25, 1.5, .45, 1) forwards, tmg-luz-float 3.4s ease-in-out 1s infinite; }
@keyframes tmg-luz-pop { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes tmg-luz-float { 50% { transform: translateY(-8px) rotate(2deg); } }
.tmg-luz-talking .tmg-luz-star { animation: tmg-luz-talk .34s ease-in-out infinite alternate; }
@keyframes tmg-luz-talk { from { transform: translateY(0) scale(1); } to { transform: translateY(-3px) scale(1.04, .97); } }
.tmg-luz-title { margin: 10px 0 0; font-size: 26px; font-weight: 900; color: #F9D87B; opacity: 0; transition: opacity .6s .3s; }
.tmg-luz-place { margin: 2px 0 0; font-size: 14px; opacity: 0; transition: opacity .6s .5s; }
.tmg-luz-shown .tmg-luz-title, .tmg-luz-shown .tmg-luz-place { opacity: 1; }
.tmg-luz-shown .tmg-luz-place { opacity: .8; }

/* Diálogo */
.tmg-luz-dialog { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; text-align: left; }
.tmg-luz-bubble { position: relative; background: #fff8dc; color: #1c2333; border-radius: 16px; padding: 10px 14px; font-size: 16px; animation: tmg-pop .25s ease-out; }
.tmg-luz-bubble::before { content: ""; position: absolute; left: 50%; top: -8px; margin-left: -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: #fff8dc; }
.tmg-luz-saved { margin: 10px 0 0; font-weight: 800; color: #9be7ff; opacity: 0; transition: opacity .4s; }
.tmg-luz-saved.tmg-on { opacity: 1; }
.tmg-luz-carne { margin-top: 10px; }
.tmg-luz .tmg-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }

/* Fila de estrellitas */
.tmg-carne-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.tmg-carne-star { display: inline-flex; opacity: .25; filter: grayscale(1); transition: opacity .3s, filter .3s; }
.tmg-carne-star.on { opacity: 1; filter: none; }

/* Carné */
.tmg-carne-card { padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .05); box-shadow: 0 0 0 2px rgba(249, 216, 123, .45); }
.tmg-carne-head { display: flex; align-items: center; gap: 12px; text-align: left; }
.tmg-carne-head h2 { margin: 0; font-size: 22px; color: #F9D87B; }
.tmg-carne-sub { margin: 2px 0 0; font-size: 14px; opacity: .8; }
.tmg-carne-name { display: flex; gap: 8px; align-items: flex-end; margin: 12px 0 6px; text-align: left; }
.tmg-carne-name label { flex: 1; font-size: 13px; font-weight: 700; }
.tmg-carne-name input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .35); background: #fff; color: #1c2333; font: inherit; font-weight: 700; }
.tmg-carne-name .tmg-btn { padding: 10px 14px; font-size: 14px; }
.tmg-carne-count { margin: 8px 0; font-size: 15px; }
.tmg-carne-count b { color: #F9D87B; font-size: 22px; }
.tmg-carne-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.tmg-carne-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; background: rgba(255, 255, 255, .04); opacity: .35; filter: grayscale(1); font-size: 12px; font-weight: 700; }
.tmg-carne-cell.on { opacity: 1; filter: none; background: rgba(249, 216, 123, .12); box-shadow: 0 0 12px rgba(249, 216, 123, .35); color: #F9D87B; }
.tmg-carne-msg { margin: 10px 0 0; font-size: 15px; min-height: 1em; }
.tmg-carne-date { margin: 4px 0 0; font-size: 12px; opacity: .6; }
.tmg-carne .tmg-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }

@media (max-width: 420px) {
	.tmg-luz, .tmg-carne { padding: 12px; border-radius: 16px; }
	.tmg-luz-scene { min-height: 290px; }
	.tmg-luz-scene .tmg-estrella { width: 180px; height: 180px; }
}

/* ================= Estrellas animadas ================= */
.tmg-estrella-anim [class^="st-"], .tmg-estrella-anim [class*=" st-"] { transform-box: fill-box; transform-origin: center; }
.tmg-estrella-anim .st-eyes { animation: st-blink 4.6s ease-in-out infinite; }
.tmg-estrella-anim .st-mouth { transform-origin: 50% 20%; }
.tmg-luz-talking .st-mouth, .tmg-bola-talking .st-mouth { animation: st-talk .26s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-arm-l { transform-origin: 100% 0; animation: st-wave-l 2.2s ease-in-out infinite; }
.tmg-estrella-anim .st-arm-r { transform-origin: 0 0; animation: st-wave-r 2.2s ease-in-out infinite; }
.tmg-estrella-anim .st-wave { animation: st-slide 3s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-bubble { animation: st-rise 2.6s ease-in-out infinite; }
.tmg-estrella-anim .st-heart { animation: st-pulse 1.3s ease-in-out infinite; }
.tmg-estrella-anim .st-sway { transform-origin: 50% 100%; animation: st-rock 3.2s ease-in-out infinite; }
.tmg-estrella-anim .st-pulse { animation: st-pulse-soft .9s ease-in-out infinite; }
.tmg-estrella-anim .st-foot-l { animation: st-step 1.1s ease-in-out infinite; }
.tmg-estrella-anim .st-foot-r { animation: st-step 1.1s ease-in-out infinite reverse; }
.tmg-estrella-anim .st-rock { animation: st-rock 4.2s ease-in-out infinite; }
.tmg-estrella-anim .st-bell { transform-origin: 50% 0; animation: st-rock 2.2s ease-in-out infinite; }
.tmg-estrella-anim .st-clapper { animation: st-slide 1.1s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-ripple { animation: st-ripple 2.4s ease-in-out infinite; }
.tmg-estrella-anim .st-drip { animation: st-drip 1.8s ease-in infinite; }
.tmg-estrella-anim .st-beam { animation: st-flicker 1.5s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-fringe { transform-origin: 50% 0; animation: st-skew 2s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-grains { animation: st-spin 14s linear infinite; }
.tmg-estrella-anim .st-light { animation: st-blinklight 1.2s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-quill { transform-origin: 0 100%; animation: st-rock 2.8s ease-in-out infinite; }
.tmg-estrella-anim .st-beams { animation: st-flicker 1.7s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-foam { animation: st-slide 2.2s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-heartbeat { animation: st-heartbeat 1.2s ease-in-out infinite; }
.tmg-estrella-anim .st-flag { transform-origin: 0 50%; animation: st-flag 1.3s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-grain { animation: st-rock 2.6s ease-in-out infinite; }
.tmg-estrella-anim .st-berry { animation: st-berry 1.6s ease-in-out infinite; }
.tmg-estrella-anim .st-window { animation: st-glow 2.2s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-bulb { animation: st-bulb 1.3s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-ember { animation: st-ember 1.3s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-float { animation: st-float 3.4s ease-in-out infinite; }
.tmg-estrella-anim .st-leaf { transform-origin: 0 100%; animation: st-rock 2.8s ease-in-out infinite; }
.tmg-estrella-anim .st-crawl { animation: st-slide 2.6s ease-in-out infinite alternate; }
.tmg-estrella-anim .st-flower { animation: st-rock 3.4s ease-in-out infinite; }
.tmg-estrella-anim .st-d2 { animation-delay: -1.1s; }
@keyframes st-blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(.08); } }
@keyframes st-talk { from { transform: scaleY(1); } to { transform: scaleY(.55) scaleX(1.1); } }
@keyframes st-wave-l { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-16deg); } }
@keyframes st-wave-r { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(16deg); } }
@keyframes st-slide { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@keyframes st-rise { 0% { transform: translateY(0); opacity: .9; } 70% { opacity: .6; } 100% { transform: translateY(-9px); opacity: 0; } }
@keyframes st-pulse { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.18); } }
@keyframes st-pulse-soft { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes st-rock { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes st-step { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes st-ripple { 0%, 100% { transform: scaleX(1); opacity: .5; } 50% { transform: scaleX(1.12); opacity: .25; } }
@keyframes st-drip { 0% { transform: translateY(-6px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }
@keyframes st-flicker { from { opacity: .18; } to { opacity: .45; } }
@keyframes st-skew { from { transform: skewX(-4deg); } to { transform: skewX(4deg); } }
@keyframes st-spin { to { transform: rotate(360deg); } }
@keyframes st-blinklight { from { opacity: .45; } to { opacity: 1; filter: drop-shadow(0 0 3px #FFE16B); } }
@keyframes st-heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.08); } 30% { transform: scale(1); } 45% { transform: scale(1.05); } }
@keyframes st-flag { from { transform: scaleX(1) skewY(0); } to { transform: scaleX(.86) skewY(-6deg); } }
@keyframes st-berry { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.45) drop-shadow(0 0 3px #fff); } }
@keyframes st-glow { from { opacity: .65; } to { opacity: 1; filter: drop-shadow(0 0 4px #FFD54A); } }
@keyframes st-bulb { from { opacity: .35; } to { opacity: 1; filter: drop-shadow(0 0 3px #fff); } }
@keyframes st-ember { from { opacity: .45; } to { opacity: 1; filter: drop-shadow(0 0 3px #FF6A2B); } }
@keyframes st-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .tmg-estrella-anim [class^="st-"], .tmg-estrella-anim [class*=" st-"] { animation: none !important; } }

/* La luz dentro de una bola */
.tmg-luz-bola { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); z-index: 2; transition: opacity .6s; }
.tmg-luz-bola .tmg-bola { --bola-size: 240px; }
.tmg-luz-bola .tmg-bola-inside { display: none; }
.tmg-luz-bola-out { opacity: 0; pointer-events: none; }
.tmg-luz-conbola .tmg-luz-scene { min-height: 360px; }
.tmg-luz-conbola:not(.tmg-luz-shown) .tmg-luz-title, .tmg-luz-conbola:not(.tmg-luz-shown) .tmg-luz-place { visibility: hidden; }
