/* =========================================================
   SOPLA EL CARTUCHO · Herzio Tools (usa los tokens de style.css)
   ========================================================= */
.sopla-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 440px); gap: clamp(24px, 4vw, 48px); align-items: start; }
.sopla-side { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.sopla-side .tool-head { margin-bottom: 0; }

.sopla-how { display: grid; gap: 10px; }
.sopla-how li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--text-2); }
.sopla-how b { flex-shrink: 0; min-width: 52px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 400; font-size: 17px; letter-spacing: 1px; color: var(--text); }

/* Salón de la fama */
.sopla-board-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.sopla-board .card-title { margin-bottom: 0; }
.sopla-best { font-family: var(--display); font-size: 18px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.sopla-best strong { font-weight: 400; color: var(--sun); }
.board { display: flex; flex-direction: column; gap: 4px; counter-reset: pos; }
.board:empty { display: none; }
.board li { counter-increment: pos; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; font-family: var(--display); font-size: 22px; letter-spacing: 2px; background: rgba(255, 255, 255, 0.03); }
.board li::before { content: counter(pos) "º"; font-size: 17px; color: var(--muted); }
.board li:nth-child(1)::before { color: var(--sun); }
.board li:nth-child(2)::before { color: var(--cream); }
.board li:nth-child(3)::before { color: var(--orange, #ff8a4c); }
.board .b-name { color: var(--text); }
.board .b-points { color: var(--teal); font-variant-numeric: tabular-nums; }
.board li.is-you { background: rgba(255, 61, 139, 0.16); box-shadow: inset 0 0 0 1px var(--pink); }
.board-msg { font-size: 14px; color: var(--muted); }
.board-msg:empty { display: none; }

/* Juego */
.sopla-game { position: relative; width: 100%; aspect-ratio: 360 / 560; border-radius: 22px; overflow: hidden; background: var(--night); box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.1), 0 0 60px rgba(255, 61, 139, 0.18); touch-action: pan-y; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.sopla-game canvas { display: block; width: 100%; height: 100%; cursor: pointer; touch-action: pan-y; }
/* Solo en partida se bloquean los gestos del navegador (desplazar, zoom) */
.sopla-game.is-playing, .sopla-game.is-playing canvas { touch-action: none; }
.sopla-game canvas:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px; }
.sopla-game.is-playing canvas:focus-visible { outline: none; } /* durante la partida el marco distrae */
.sopla-game button, .sopla-game input { touch-action: manipulation; }

.sopla-hud { position: absolute; top: 12px; right: 12px; }
.sopla-icon-btn { width: 40px; height: 40px; border-radius: 12px; background: rgba(10, 6, 18, 0.55); border: 1px solid rgba(255, 255, 255, 0.14); color: var(--text); display: inline-flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.sopla-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sopla-icon-btn svg[hidden] { display: none; }

.sopla-ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: var(--text); pointer-events: none; }
.sopla-ov[hidden] { display: none; }
.sopla-ov.is-modal { pointer-events: auto; background: rgba(10, 6, 18, 0.66); backdrop-filter: blur(4px); }
.sopla-ov-ready { justify-content: flex-start; padding-top: 12%; gap: 8px; text-shadow: 0 2px 10px rgba(10, 6, 18, 0.9); }
.ov-kicker { font-family: var(--display); font-size: 18px; letter-spacing: 5px; color: var(--teal); text-transform: uppercase; }
.ov-title { font-family: var(--display); font-size: clamp(38px, 10vw, 54px); line-height: 0.95; letter-spacing: 2px; text-transform: uppercase; background: linear-gradient(180deg, var(--cream), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
.ov-title[hidden] { display: none; }
.ov-cart { width: 44%; max-width: 180px; height: auto; margin: 6px 0 4px; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 26px rgba(255, 61, 139, 0.35)); transform: rotate(-6deg); animation: sopla-float 2.4s ease-in-out infinite; }
.ov-cart[hidden] { display: none; }
@keyframes sopla-float { 50% { transform: rotate(-3deg) translateY(-8px); } }
.ov-text { font-size: 15px; line-height: 1.5; color: var(--text-2); max-width: 260px; }
.tap-hint { font-family: var(--display); font-size: 22px; letter-spacing: 3px; color: #fff; text-transform: uppercase; animation: sopla-pulse 0.8s ease-in-out infinite alternate; }
@keyframes sopla-pulse { to { opacity: 0.45; } }
.ov-score { display: flex; gap: 28px; margin: 4px 0 2px; }
.ov-score div { display: flex; flex-direction: column; align-items: center; }
.ov-score span { font-family: var(--display); font-size: 15px; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; }
.ov-score strong { font-family: var(--display); font-weight: 400; font-size: 52px; line-height: 1; color: #fff; }
.ov-record { font-family: var(--display); font-size: 20px; letter-spacing: 3px; color: var(--sun); text-transform: uppercase; animation: sopla-pulse 0.9s ease-in-out infinite alternate; }
.ov-record[hidden] { display: none; }
.ov-save { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 280px; padding: 12px; border-radius: 14px; border: 1px dashed var(--sun); background: rgba(255, 176, 87, 0.08); }
.ov-save[hidden] { display: none; }
.ov-save label { font-size: 14px; color: var(--text-2); }
.ov-save-row { display: flex; gap: 8px; }
.ov-save input { width: 110px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06); color: #fff; font-family: var(--display); font-size: 28px; letter-spacing: 8px; text-align: center; text-transform: uppercase; padding: 0 0 0 8px; }
.ov-save input:focus { outline: none; border-color: var(--teal); }
.ov-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

@media (max-width: 960px) {
  .sopla-layout { grid-template-columns: minmax(0, 1fr); }
  /* El juego cabe entero en la pantalla del móvil, debajo del menú */
  .sopla-game { max-width: 440px; margin: 0 auto; grid-row: 2; width: min(100%, calc((100vh - 96px) * 0.643)); width: min(100%, calc((100svh - 96px) * 0.643)); }
  .sopla-side { display: contents; }
  .sopla-side .tool-head { grid-row: 1; }
  .sopla-how { display: none; }
  .sopla-board { grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) { .ov-cart, .tap-hint, .ov-record { animation: none; } }

/* Gesto de ayuda durante la cuenta atrás: un dedo en el móvil, las teclas en el ordenador */
.gesture { position: absolute; left: 50%; top: 58%; z-index: 3; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.gesture[hidden] { display: none; }
.gesture-touch { position: relative; display: flex; justify-content: center; }
.gesture-hand { width: 58px; height: 72px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.65)); }
.gesture-tap .gesture-hand { animation: g-tap 0.8s ease-in-out infinite; }
@keyframes g-tap { 0%, 100% { transform: translateY(0) scale(1); } 45% { transform: translateY(9px) scale(0.94); } }
.gesture-ring { position: absolute; top: -8px; left: 50%; width: 30px; height: 30px; margin-left: -18px; border: 3px solid var(--teal); border-radius: 50%; opacity: 0; }
.gesture-tap .gesture-ring { animation: g-ring 0.8s ease-out infinite; }
@keyframes g-ring { 0%, 40% { transform: scale(0.4); opacity: 0; } 50% { opacity: 0.95; } 100% { transform: scale(1.9); opacity: 0; } }
.gesture-swipe .gesture-hand { animation: g-swipe 1.3s ease-in-out infinite; }
@keyframes g-swipe { 0%, 100% { transform: translateX(-48px) rotate(-10deg); } 50% { transform: translateX(48px) rotate(10deg); } }
.gesture-arrows { position: absolute; top: 12px; left: 50%; width: 190px; margin-left: -95px; display: flex; justify-content: space-between; }
.gesture-arrows b { font-family: var(--display); font-weight: 400; font-size: 48px; line-height: 1; color: var(--teal); text-shadow: 0 0 14px rgba(46, 230, 214, 0.8); }
.gesture-label { font-family: var(--display); font-size: 21px; letter-spacing: 3px; color: #fff; text-transform: uppercase; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95); white-space: nowrap; }
.gesture-keys { display: none; align-items: center; gap: 8px; }
.gesture kbd { min-width: 46px; height: 44px; padding: 0 12px; border-radius: 10px; border: 2px solid #fff; border-bottom-width: 5px; background: rgba(10, 6, 18, 0.7); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 24px; letter-spacing: 1px; color: #fff; }
/* En el ordenador (ratón y teclado) se enseñan las teclas en lugar del dedo */
@media (hover: hover) and (pointer: fine) {
  .gesture-touch, .gesture .only-touch { display: none; }
  .gesture-keys { display: flex; }
  .gesture-keys .gesture-label { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .gesture-hand, .gesture-ring { animation: none; } .gesture-ring { opacity: 0.8; } }

