/* Screw Shooot — estilos, en la línea de Shhhot (shhhot.app). Móvil primero; en escritorio se centra en una columna.
   Los colores salen de variables que define js/theme.js (aquí van los mismos valores por si el JS tarda). */

/* Letras de Shhhot (las dos con licencia OFL, servidas desde aquí).
   Russo One: la marca. Varela Round: todos los demás textos. */
@font-face { font-family: "Shhhot Texto"; src: url("../fonts/varela-round.woff2") format("woff2"); font-weight: 400;
             font-style: normal; font-display: swap; }
@font-face { font-family: "Shhhot Marca"; src: url("../fonts/russo-one.woff2") format("woff2"); font-weight: 400;
             font-style: normal; font-display: swap; }

:root {
  --fondo: #17132B;
  --fondo-2: #241E3F;
  --fondo-3: #2E2752;
  --borde: #5A5285;
  --texto: #FFFFFF;
  --suave: #B8B2D1;
  --coral: #FF6B5E;
  --amarillo: #FFD23F;
  --verde: #2FA398;
  --oscuro: #17132B;
  --radio: 16px;
  --titulos: "Shhhot Texto", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  --marca: "Shhhot Marca", "Russo One", "Arial Black", sans-serif;
  --cuerpo: "Shhhot Texto", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--cuerpo);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  color: var(--texto);
  background: var(--fondo);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; display: flex; justify-content: center; }

.screen {
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  position: relative;
}
.screen[hidden] { display: none; }

h1, h2, h3 { margin: 0; font-family: var(--titulos); }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }

/* ---------- botones (como en Shhhot) ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 18px;
  border-radius: var(--radio);
  border: 1px solid var(--coral);
  background: var(--coral);
  color: var(--oscuro);
  font-family: var(--titulos); font-weight: 700; font-size: 17px;
  text-decoration: none;
}
.btn:hover { background: #FF8478; border-color: #FF8478; }
.btn.soft { min-height: 52px; background: transparent; border-color: var(--borde); color: var(--texto); font-weight: 600; font-size: 15px; }
.btn.soft:hover { background: transparent; border-color: var(--suave); }
.btn.good, .btn.warn { background: var(--amarillo); border-color: var(--amarillo); color: var(--oscuro); }
.btn.good:hover, .btn.warn:hover { background: #FFE27A; border-color: #FFE27A; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn small { font-weight: 600; font-size: 13px; opacity: 0.85; display: inline-flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px;
  background: transparent;
  border: 1px solid var(--borde);
  color: var(--texto);
  display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--suave); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- marca ---------- */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
  font-family: var(--marca); font-weight: 400; font-size: 18px; letter-spacing: 1.5px;
  color: var(--amarillo); text-decoration: none; white-space: nowrap;
}
.marca svg { flex: none; }
.barra-der { display: flex; align-items: center; gap: 8px; }

/* ---------- monedas ---------- */
.coins {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 14px 0 10px;
  border: 1px solid var(--borde);
  border-radius: 999px;
  font-family: var(--titulos); font-weight: 700; font-size: 15px;
  justify-content: center;
}
.coin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: var(--amarillo);
  box-shadow: inset 0 0 0 3px rgba(23, 19, 43, 0.22);
  display: inline-block;
}

/* ---------- inicio ---------- */
.portada { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4vh 0 3vh; }
.portada .marca-grande {
  font-family: var(--marca); font-size: clamp(34px, 11.5vw, 50px); line-height: 1; letter-spacing: 3px;
  color: var(--amarillo); text-align: center;
}
.etiqueta { font-size: 13px; font-weight: 600; letter-spacing: 1.5px; color: var(--amarillo); text-transform: uppercase; }

.home-card {
  background: var(--fondo-2);
  border-radius: 20px;
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.home-card .thumb {
  width: 96px; height: 96px; flex: none;
  border-radius: var(--radio);
  background: var(--fondo-3);
  display: grid; place-items: center;
  overflow: hidden;
}
.home-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.home-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.home-card .info .title { font-family: var(--titulos); font-size: 22px; font-weight: 700; line-height: 1.1; margin-bottom: 6px; }
.home-card .info .sub { font-size: 13px; color: var(--suave); margin-bottom: 6px; }
.home-card .btn { width: 100%; min-height: 48px; }
.home-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 12px; }
.legal { font-size: 13px; color: var(--suave); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-lang {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--borde); background: transparent; color: var(--texto); font-size: 14px;
}
.chip-lang:hover { border-color: var(--suave); }
.chip-lang.activo { background: var(--amarillo); border-color: var(--amarillo); color: var(--oscuro); font-weight: 600; }

/* ---------- barra superior ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.topbar h2 { flex: 1; text-align: center; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 20px; }

/* ---------- niveles ---------- */
.lap-title { font-size: 13px; font-weight: 600; letter-spacing: 1.5px; color: var(--amarillo); text-transform: uppercase; margin: 14px 2px 8px; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.level-cell {
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--fondo-2);
  border: 1px solid transparent;
  color: var(--texto);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--titulos); font-weight: 700; font-size: 18px;
}
.level-cell.current { background: var(--coral); color: var(--oscuro); }
.level-cell.locked { opacity: 0.4; pointer-events: none; background: transparent; border-color: var(--borde); }
.level-cell .st { font-size: 10px; letter-spacing: 1px; margin-top: 2px; color: var(--amarillo); height: 12px; line-height: 12px; }

/* ---------- colección ---------- */
.col-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.col-cell { background: var(--fondo-2); border-radius: 20px; padding: 12px; text-align: center; }
.col-cell img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.col-cell.locked img { filter: brightness(0) invert(1) opacity(0.12); }
.col-cell .name { font-family: var(--titulos); font-weight: 700; font-size: 15px; }
.col-cell.locked .name { color: var(--suave); font-weight: 400; }
.col-cell .cnt { font-size: 12px; color: var(--suave); }

/* ---------- partida ---------- */
.hud { display: flex; flex-direction: column; gap: 10px; }
.boxes-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
#boxes { display: flex; gap: 10px; }
.box {
  --c: #999;
  display: flex; gap: 6px;
  padding: 8px 9px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 24%, var(--fondo-2));
  border: 2px solid var(--c);
  transition: transform 0.24s, opacity 0.24s;
  justify-content: center;
}
.box.empty { border-style: dashed; border-color: var(--borde); background: transparent; }
.box.closing { transform: scale(0.6) translateY(-14px); opacity: 0; }
.box.arriving { animation: arrive 0.25s ease-out; }
@keyframes arrive { from { transform: translateY(-16px) scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.slot {
  width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 30%, var(--fondo));
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.35);
  display: grid; place-items: center;
}
.box.empty .slot { background: var(--fondo-2); }
#upnext { display: flex; align-items: center; gap: 4px; font-size: 18px; color: var(--suave); min-width: 58px; }
#upnext i { width: 16px; height: 16px; border-radius: 5px; background: var(--c); display: block; }
#upnext i:nth-of-type(n+2) { width: 13px; height: 13px; opacity: 0.75; }
#upnext i:nth-of-type(n+3) { width: 10px; height: 10px; opacity: 0.55; }

#holes { display: flex; justify-content: center; gap: 8px; }
.hole {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--fondo-3);
  box-shadow: inset 0 3px 4px rgba(0, 0, 0, 0.4);
  display: grid; place-items: center;
}
.hole.extra { outline: 2px dashed var(--amarillo); outline-offset: 1px; }
#holes.danger .hole { animation: danger 0.7s ease-in-out infinite alternate; }
@keyframes danger { to { background: color-mix(in srgb, var(--coral) 55%, var(--fondo-3)); } }

/* cabeza de tornillo (ficha 2D) */
.chip {
  --c: #999;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, white), var(--c) 65%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  position: relative;
  display: block;
}
.chip::before, .chip::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 56%; height: 14%; border-radius: 2px;
  background: rgba(23, 19, 43, 0.7);
  transform: translate(-50%, -50%);
}
.chip::after { transform: translate(-50%, -50%) rotate(90deg); }
#fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.chip.fly { position: absolute; left: 0; top: 0; margin: -13px 0 0 -13px; }

#stage { flex: 1; min-height: 0; position: relative; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

#progress { height: 6px; border-radius: 3px; background: var(--fondo-3); overflow: hidden; margin: 4px 30px 12px; }
#progress i { display: block; height: 100%; width: 0; background: var(--verde); border-radius: 3px; transition: width 0.25s; }

.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tool {
  background: transparent;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  color: var(--texto);
  min-height: 68px;
  padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-weight: 600; font-size: 14px;
  touch-action: none;
}
.tool:hover { border-color: var(--suave); }
.tool:active, .tool.on { background: var(--fondo-2); border-color: var(--amarillo); }
.tool:disabled { opacity: 0.45; pointer-events: none; }
.tool .ico { display: block; height: 22px; color: var(--amarillo); }
.tool .ico svg { width: 22px; height: 22px; }
.tool .tag { font-size: 12px; font-weight: 400; color: var(--suave); display: inline-flex; align-items: center; gap: 4px; }
.tool .tag .coin { width: 11px; height: 11px; box-shadow: none; }

#toast {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: var(--fondo-3); color: var(--texto);
  border: 1px solid var(--borde);
  padding: 10px 14px; border-radius: 12px;
  font-size: 14px;
  width: max-content; max-width: 88%; text-align: center;
  z-index: 20; pointer-events: none;
  animation: toast 0.2s ease-out;
}
#toast[hidden] { display: none; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }

/* hoja inferior (como en Shhhot) */
#overlay {
  position: absolute; inset: 0;
  background: rgba(10, 8, 22, 0.7);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 30;
}
#overlay[hidden] { display: none; }
.dialog {
  width: 100%; max-width: 480px;
  background: var(--fondo-2);
  border-radius: 28px 28px 0 0;
  padding: 26px 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  text-align: center;
  animation: sube 0.22s ease-out;
}
@keyframes sube { from { transform: translateY(30px); opacity: 0; } }
.dialog h3 { font-size: 26px; font-weight: 700; line-height: 1.1; }
.dialog p { color: var(--suave); font-size: 15px; }
.dialog .stars { font-size: 40px; line-height: 1; letter-spacing: 8px; color: var(--amarillo); }
.dialog .stars .off { color: var(--borde); }
.dialog .reward { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--titulos); font-weight: 700; font-size: 20px; }
.dialog .btns { display: grid; gap: 10px; margin-top: 6px; }
.dialog .btns.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.dialog img.fig { width: 130px; height: 130px; object-fit: contain; align-self: center; }

@media (min-height: 760px) {
  .slot { width: 34px; height: 34px; }
  .chip { width: 30px; height: 30px; }
  .chip.fly { margin: -15px 0 0 -15px; }
  .hole { width: 38px; height: 38px; }
}
