/* Interfaz: barra superior, ajustes, mensajes, globitos, aviso de obra y efectos */

/* ── Barra superior ── */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 950; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 14px; background: linear-gradient(#2a56c8, #14286a); border-bottom: 3px solid #f2d27a; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.tb-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-cin, 'Cinzel', serif); font-weight: 900; font-size: 13px; letter-spacing: 5px; color: #fff6d8; text-shadow: 0 2px 0 rgba(0,0,0,.45); }
.tb-brand img { filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.tb-btns { display: flex; gap: 4px; }
.tb-btn { width: 30px; height: 26px; display: grid; place-items: center; background: rgba(255,246,214,.1); border: 2px solid rgba(242,210,122,.55); border-radius: 8px; color: #f2d27a; cursor: pointer; padding: 0; transition: background .15s, transform .1s; }
.tb-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-btn:hover { background: rgba(255,246,214,.25); }
.tb-btn:active { transform: translateY(1px); }
.tb-btn.off { color: #8a94b8; border-color: rgba(138,148,184,.45); }
.tb-btn.off svg { opacity: .55; }
.tb-btn.off::after { content: ''; position: absolute; width: 2px; height: 20px; background: #c8d0ec; transform: rotate(45deg); border-radius: 2px; }
.tb-btn { position: relative; }
:focus-visible { outline: 3px solid #fff6a0; outline-offset: 2px; }

/* ── Botones y poderes ── */
.btn { transition: transform .1s, box-shadow .15s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(2px); }
.pu-btn { position: relative; transition: transform .12s, filter .15s; }
.pu-btn:hover:not(.pu-disabled) { transform: translateY(-2px) scale(1.04); }
.pu-btn .pu-icon { display: grid; place-items: center; }
.pu-svg { width: 24px; height: 24px; }
.pu-btn.pu-active { animation: pu-pulse .8s ease-in-out infinite alternate; }
@keyframes pu-pulse { from { box-shadow: 0 0 0 0 rgba(255,236,150,.9), 0 4px 0 rgba(0,0,0,.4); } to { box-shadow: 0 0 0 7px rgba(255,236,150,0), 0 4px 0 rgba(0,0,0,.4); } }
.pu-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 8px); width: max-content; max-width: 190px; padding: 6px 9px; background: #14286a; color: #fff6d8; border: 2px solid #f2d27a; border-radius: 8px; font: 700 11px/1.3 var(--font-cin, serif); letter-spacing: .5px; text-align: center; z-index: 60; pointer-events: none; }
@media (hover: none) { .pu-btn[data-tip]:hover::after { display: none; } }

/* ── Canvas de partículas ── */
#fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 880; }

/* ── Mensajes de combo ── */
.callout { position: fixed; transform: translate(-50%, -50%); z-index: 940; pointer-events: none; font-family: var(--font-cin, 'Cinzel', serif); font-weight: 900; font-size: clamp(26px, 5vw, 46px); letter-spacing: 4px; color: #fff6d8; -webkit-text-stroke: 2px #2a1604; paint-order: stroke fill; text-shadow: 0 4px 0 #2a1604, 0 0 22px rgba(255,210,90,.8); animation: callout 1.1s cubic-bezier(.2,.9,.3,1.2) forwards; white-space: nowrap; }
.callout.c3 { color: #ffe27a; } .callout.c4 { color: #ffb040; font-size: clamp(30px, 6vw, 54px); } .callout.c5 { color: #ff6a50; font-size: clamp(34px, 7vw, 62px); }
@keyframes callout { 0% { transform: translate(-50%, -30%) scale(.4); opacity: 0; } 22% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; } 40% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -110%) scale(1); opacity: 0; } }

/* ── Sacudida de pantalla ── */
#screen-game.shaking { animation: shake-screen .32s linear; }
@keyframes shake-screen { 0%, 100% { transform: translate(0); } 15% { transform: translate(calc(-5px * var(--amp, 1)), calc(3px * var(--amp, 1))); } 35% { transform: translate(calc(5px * var(--amp, 1)), calc(-3px * var(--amp, 1))); } 55% { transform: translate(calc(-3px * var(--amp, 1)), calc(-2px * var(--amp, 1))); } 75% { transform: translate(calc(3px * var(--amp, 1)), calc(2px * var(--amp, 1))); } }

/* ── Obreros: salto y globitos ── */
.g-lane .idle.hop { animation: hop .6s ease-out; }
.g-lane .idle.pacer.hop { animation: pace 15s linear infinite, hop .6s ease-out; }
@keyframes hop { 0%, 100% { translate: 0 0; } 35% { translate: 0 -16px; } 65% { translate: 0 -4px; } }
.bubble { position: fixed; transform: translate(-50%, -100%); z-index: 945; pointer-events: none; padding: 4px 10px; background: #fff6d8; color: #2a1604; border: 2px solid #6a4a1c; border-radius: 12px; font: 700 12px/1.2 var(--font-cin, serif); white-space: nowrap; animation: bubble 1.9s ease-out forwards; box-shadow: 0 3px 6px rgba(0,0,0,.3); }
.bubble::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: #6a4a1c; }
@keyframes bubble { 0% { transform: translate(-50%, -60%) scale(.6); opacity: 0; } 12% { transform: translate(-50%, -100%) scale(1.05); opacity: 1; } 20% { transform: translate(-50%, -100%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -150%); opacity: 0; } }

/* ── Aviso de inicio de obra y pistas ── */
.intro { position: fixed; left: 50%; top: 118px; transform: translateX(-50%); z-index: 930; pointer-events: none; text-align: center; padding: 14px 34px 16px; background: linear-gradient(#f6e8bc, #dcc080); border: 4px solid #6a4a1c; border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.5), inset 0 0 0 3px #f2d27a; color: #2a1604; animation: intro-in .5s cubic-bezier(.2,.9,.3,1.2) both; max-width: 92vw; }
.intro.out { animation: intro-out .6s ease-in forwards; }
.intro small { display: block; font: 700 10px var(--font-cin, serif); letter-spacing: 3px; color: #6a4a1c; }
.intro b { display: block; font: 900 clamp(20px, 4vw, 30px) var(--font-cin, serif); letter-spacing: 3px; margin: 3px 0; }
.intro span { font-size: 13px; }
@keyframes intro-in { from { transform: translate(-50%, -30px) scale(.9); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes intro-out { to { transform: translate(-50%, -20px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 935; pointer-events: none; max-width: min(92vw, 520px); padding: 9px 18px; background: #14286a; color: #fff6d8; border: 3px solid #f2d27a; border-radius: 12px; font: 700 13px/1.35 var(--font-cin, serif); letter-spacing: .5px; text-align: center; box-shadow: 0 6px 16px rgba(0,0,0,.45); animation: toast-in .35s ease-out both; }
.toast.out { animation: toast-out .4s ease-in forwards; }
@keyframes toast-in { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes toast-out { to { transform: translate(-50%, 10px); opacity: 0; } }

/* ── Ajustes ── */
.modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; background: rgba(8,16,40,.62); backdrop-filter: blur(3px); padding: 12px; }
.modal.show { display: flex; }
.modal-card { position: relative; width: min(480px, 100%); max-height: calc(100vh - 24px); overflow: auto; padding: 18px 22px 20px; background: linear-gradient(#f6e8bc, #dcc080); border: 4px solid #6a4a1c; border-radius: 16px; box-shadow: 0 14px 34px rgba(0,0,0,.6), inset 0 0 0 3px #f2d27a; color: #2a1604; text-align: center; animation: intro-in .3s ease-out; }
.modal-card .sp-title { margin-bottom: 10px; }
.set-row { display: grid; grid-template-columns: 1fr 1.4fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(106,74,28,.35); text-align: left; font: 700 13px var(--font-cin, serif); letter-spacing: 1px; }
.set-row input[type=range] { width: 100%; accent-color: #b07a10; }
.mini { min-width: 46px; padding: 3px 10px; font: 900 11px var(--font-cin, serif); letter-spacing: 1px; background: #14286a; color: #fff6d8; border: 2px solid #f2d27a; border-radius: 10px; cursor: pointer; }
.set-help { text-align: left; font-size: 12.5px; line-height: 1.45; margin: 12px 0 14px; }
.set-help b { font-family: var(--font-cin, serif); letter-spacing: 1.5px; }
.set-help ul { margin: 4px 0 10px; padding-left: 18px; }
kbd { background: #fff6d8; border: 1px solid #8a6a3a; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font: 700 11px monospace; }

/* ── Pantalla final ── */
.mchip { display: inline-flex; align-items: center; gap: 6px; margin: 2px 6px; padding: 2px 12px 2px 4px; background: rgba(255,246,214,.8); border: 2px solid #8a6a3a; border-radius: 18px; }
.mchip img { width: 28px; height: 28px; object-fit: contain; }
.mchip b { font: 900 16px var(--font-cin, serif); color: #2a1604; }
.mchip i { font: 700 9px var(--font-cin, serif); letter-spacing: 1.5px; color: #6a4a1c; font-style: normal; }
.ov-tip { min-height: 16px; margin: 2px 0 6px; font: 700 12px var(--font-cin, serif); letter-spacing: .5px; color: #8a4a10; }
.ov-star.lit { animation: star-pop .5s cubic-bezier(.2,.9,.3,1.6); }
@keyframes star-pop { 0% { transform: scale(.2) rotate(-40deg); } 70% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }

/* ── Pieza que cae del tablero, brillo del montón ── */
.pblock.drop { filter: drop-shadow(0 0 10px #fff3b0) drop-shadow(0 3px 3px rgba(0,0,0,.55)); }

/* ── Reducir movimiento (ajuste propio) ── */
body.reduce-motion .spr, body.reduce-motion .g-lane .idle, body.reduce-motion .pulse, body.reduce-motion .pu-btn.pu-active, body.reduce-motion .callout, body.reduce-motion .ov-star.lit { animation: none !important; }
body.reduce-motion .callout { opacity: 1; }
@media (max-width: 520px) { .tb-brand span { display: none; } .toast { bottom: 10px; font-size: 12px; } .intro { top: 18%; padding: 10px 18px 12px; } .set-row { grid-template-columns: 1fr auto; } .set-row input[type=range] { grid-column: 1 / 3; order: 3; } }

/* ── La pantalla final cabe en pantallas bajas ── */
#overlay { overflow-y: auto; z-index: 960; }
#overlay.show { align-items: flex-start; }
.ov-inner { margin: auto; }
.ov-scene { height: clamp(150px, 30vh, 250px); }
.ov-inner { padding-top: clamp(14px, 3vh, 28px); padding-bottom: clamp(14px, 3vh, 28px); }
@media (max-height: 760px) { .ov-title { font-size: clamp(28px, 6vh, 44px); } .ov-score { font-size: 22px; } }
