/* ================================================================
   salas.css — "Las Pantallas" game
   Reutiliza variables de styles.css (--bg1, --card, --accent, etc.)
   ================================================================ */

/* ─── Wrapper ─── */
.salas-wrap {
  width: min(92vw, 1320px);
  margin: 0 auto;
  padding: 0 clamp(18px, 2.4vw, 34px);
}

/* ═══════════════════════════════════════
   INTRO SCREEN (salas-specific overrides)
   ═══════════════════════════════════════ */
.intro-maletin {
  width: 160px;
  height: auto;
  image-rendering: pixelated;
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════
   GAME SCREEN — TOP BAR
   ═══════════════════════════════════════ */
.salas-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 20px 0 14px;
  gap: 16px;
  flex-wrap: wrap;
}

.progress-dots { display: flex; gap: 10px; align-items: center; }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.3s ease;
  flex-shrink: 0;
}
.dot.done { background: var(--success); }
.dot.active {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transform: scale(1.35);
}

.q-meta { display: flex; gap: 10px; align-items: center; justify-self: center; }
.q-num  { font-weight: 700; font-size: 0.98rem; color: #fff; }
.q-diff { font-size: 0.9rem; font-weight: 600; }

@keyframes moneyPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(250,204,21,0.5), 0 0 10px rgba(250,204,21,0.25); }
  50%       { box-shadow: 0 0 8px rgba(250,204,21,0.8), 0 0 20px rgba(250,204,21,0.4); }
}

.top-money {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
  font-size: 1.14rem;
  font-weight: 900;
  color: #0f172a;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50px;
  padding: 8px 18px;
  animation: moneyPulse 2.5s ease-in-out infinite;
}

/* ═══════════════════════════════════════
   QUESTION CARD
   ═══════════════════════════════════════ */
.question-card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: clamp(26px, 2.4vw, 34px) clamp(28px, 3vw, 42px);
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.question-text {
  font-size: clamp(1.55rem, 1.6vw, 2rem);
  font-weight: 700;
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

/* ═══════════════════════════════════════
   SCREENS GRID
   ═══════════════════════════════════════ */
.screens-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 1.4vw, 22px);
  margin-bottom: 24px;
}
@media (max-width: 720px) {
  .screens-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Single screen panel ─── */
.screen-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 0.45s ease, transform 0.45s ease;
  cursor: default;
}

/* ─── TV / monitor display ─── */
.screen-tv {
  background: #07071a;
  border: 2.5px solid var(--scol, rgba(255, 255, 255, 0.2));
  border-radius: 14px;
  padding: clamp(22px, 2.4vw, 32px) clamp(16px, 1.6vw, 24px) clamp(24px, 2.6vw, 34px);
  text-align: center;
  min-height: clamp(175px, 14vw, 225px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 0 18px var(--scol-a, transparent), inset 0 0 30px rgba(0,0,0,0.3);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.glass-table.drag-over,
.screen-tv.drag-over {
  border-color: var(--scol) !important;
  box-shadow: 0 0 18px var(--scol), 0 0 40px var(--scol-a) !important;
}
.mesa-central.drag-over {
  border-color: rgba(250, 204, 21, 0.6) !important;
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.3) !important;
}

.screen-panel:not(.panel-correct):not(.panel-wrong):hover {
  transform: scale(1.04);
  z-index: 2;
}
.screen-panel:not(.panel-correct):not(.panel-wrong):hover .screen-tv {
  border-color: var(--scol, rgba(255,255,255,0.5)) !important;
  box-shadow: 0 0 28px var(--scol-a, rgba(255,255,255,0.2)), 0 0 50px var(--scol-a, rgba(255,255,255,0.1)) !important;
}
.screen-panel:not(.panel-correct):not(.panel-wrong):hover .glass-table {
  border-color: color-mix(in srgb, var(--scol) 80%, transparent) !important;
  box-shadow: 0 0 20px var(--scol), 0 0 45px var(--scol-a) !important;
}

/* inner screen shine */
.screen-tv::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.07) 0%, transparent 65%);
  pointer-events: none;
}

.opt-letter {
  font-size: clamp(2.25rem, 2.6vw, 3.1rem);
  font-weight: 900;
  color: var(--scol, #fff);
  line-height: 1;
}
.opt-text {
  font-size: clamp(1.08rem, 1.15vw, 1.34rem);
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  word-break: break-word;
}

/* ─── Glass table ─── */
.glass-table {
  background: rgba(255, 255, 255, 0.035);
  border: 1.5px solid color-mix(in srgb, var(--scol) 55%, transparent);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.4s ease;
}

.glass-bundles-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-content: flex-start;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.screens-grid.has-placed .glass-bundles-area {
  max-height: 300px;
  opacity: 1;
}

.glass-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.glass-amount {
  font-size: 0.85rem;
  font-weight: 800;
  color: #86efac;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.glass-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.gc-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
}
.gc-btn.minus { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }
.gc-btn.minus:hover:not(:disabled) { background: rgba(239, 68, 68, 0.42); }
.gc-btn.plus  { background: rgba(34, 197, 94, 0.22);  color: #86efac; }
.gc-btn.plus:hover:not(:disabled)  { background: rgba(34, 197, 94, 0.42); }
.gc-btn:active:not(:disabled) { transform: scale(0.88); }
.gc-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.gc-quick-btns {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.gc-btn-allin,
.gc-btn-clear {
  flex: 1;
  border-radius: 6px;
  font-family: "Poppins", sans-serif;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 6px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid;
}

.gc-btn-allin {
  background: rgba(250, 204, 21, 0.1);
  border-color: rgba(250, 204, 21, 0.3);
  color: var(--accent);
}
.gc-btn-allin:hover:not(:disabled) {
  background: rgba(250, 204, 21, 0.22);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.3);
}

.gc-btn-clear {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.gc-btn-clear:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.22);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.gc-btn-allin:disabled,
.gc-btn-clear:disabled { opacity: 0.25; cursor: not-allowed; }

.gc-count {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  min-width: 18px;
  text-align: center;
  cursor: pointer;
  border-bottom: 1px dashed rgba(255,255,255,0.35);
  transition: border-color 0.15s ease;
}
.gc-count:hover { border-color: var(--accent); color: var(--accent); }

.gc-count-input {
  width: 38px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  padding: 2px 3px;
  outline: none;
}
.gc-count-input::-webkit-outer-spin-button,
.gc-count-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gc-count-input[type=number] { -moz-appearance: textfield; }

/* ─── Bundle images (img/fajo.png) ─── */
.bundle-img-sm {
  width: 34px;
  height: auto;
  display: inline-block;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5));
  margin-right: -4px;
}

.bundle-img-md {
  width: 42px;
  height: auto;
  display: inline-block;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 3px rgba(0,0,0,0.5));
}

.bundle-img-lg {
  width: 54px;
  height: auto;
  display: inline-block;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

/* ═══════════════════════════════════════
   MESA CENTRAL
   ═══════════════════════════════════════ */
.mesa-central {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 22px 26px;
  margin-bottom: 22px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.4s ease;
}

.mesa-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}


.mesa-bundles-row {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0;
  margin-bottom: 10px;
  min-height: 19px;
  padding-top: 20px;
}
.mesa-bundles-row:empty {
  margin-bottom: 0;
  min-height: 0;
  padding-top: 0;
}

.mesa-bundle-row {
  display: flex;
  gap: 0;
  justify-content: center;
  margin-top: -14px;
  position: relative;
}

.mesa-bundle-row .bundle-img-md { margin-left: -11px; }
.mesa-bundle-row .bundle-img-md:first-child { margin-left: 0; }

.mesa-total {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════
   FOOTER / CONFIRM
   ═══════════════════════════════════════ */
.salas-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 4px 0;
}

.unplaced-status {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s ease;
}
.unplaced-status.warn  { color: #fbbf24; }
.unplaced-status.ok    { color: var(--success); }

#placementErrorPopup {
  display: none;
  position: absolute;
  background: rgba(20, 10, 10, 0.95);
  border: 2px solid #f87171;
  border-radius: 14px;
  padding: 18px 28px;
  color: #f87171;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 40px rgba(248, 113, 113, 0.35), 0 8px 32px rgba(0,0,0,0.6);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}
#placementErrorPopup.visible {
  display: flex;
  animation: popupIn 0.25s ease forwards;
}
#placementErrorPopup.fade-out {
  animation: popupOut 0.35s ease forwards;
}
@keyframes popupIn {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}
@keyframes popupOut {
  from { opacity: 1; transform: translate(-50%, -100%) scale(1); }
  to   { opacity: 0; transform: translate(-50%, -110%) scale(0.95); }
}

.btn-salas-confirm {
  background: var(--accent);
  color: #0f172a;
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: 1.06rem;
  padding: 14px 38px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(250, 204, 21, 0.3);
}
.btn-salas-confirm:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(250, 204, 21, 0.52);
}
.btn-salas-confirm:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
}

/* ═══════════════════════════════════════
   REVEAL STATES (applied on panels)
   ═══════════════════════════════════════ */
.screen-panel.panel-correct {
  transform: scale(1.04);
}
.screen-panel.panel-correct .screen-tv {
  border-color: var(--success) !important;
  box-shadow: 0 0 28px rgba(34,197,94,0.65), 0 0 56px rgba(34,197,94,0.28) !important;
}
.screen-panel.panel-correct .glass-table {
  border-color: var(--success) !important;
  background: rgba(34, 197, 94, 0.09) !important;
}

.screen-panel.panel-wrong {
  opacity: 0.28;
  filter: grayscale(65%);
  transform: scale(0.965);
}

/* ═══════════════════════════════════════
   REVEAL PANEL
   ═══════════════════════════════════════ */
.reveal-panel {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 40%, rgba(250, 204, 21, 0.08), transparent 34%),
    rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(9px);
  animation: revealBackdropIn 0.28s ease both;
}
@keyframes revealBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.reveal-card {
  position: relative;
  width: min(94vw, 680px);
  max-height: min(88vh, 820px);
  overflow: hidden auto;
  background:
    linear-gradient(145deg, rgba(38, 38, 38, 0.98), rgba(18, 18, 18, 0.99)),
    var(--card);
  border: 1px solid rgba(250, 204, 21, 0.24);
  border-radius: 28px;
  padding: clamp(36px, 4vw, 48px) clamp(34px, 4vw, 50px) clamp(32px, 3.4vw, 42px);
  text-align: center;
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.62),
    0 0 42px rgba(250, 204, 21, 0.16);
  animation: revealCardPop 0.5s cubic-bezier(.2, 1.15, .25, 1) both;
}
.result-correct .reveal-card {
  border-color: rgba(34, 197, 94, 0.48);
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.62),
    0 0 28px rgba(34, 197, 94, 0.34),
    0 0 58px rgba(34, 197, 94, 0.18);
}
.result-wrong .reveal-card {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.62),
    0 0 28px rgba(239, 68, 68, 0.34),
    0 0 58px rgba(239, 68, 68, 0.18);
}
.reveal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.78), rgba(249, 115, 22, 0.5), rgba(255, 255, 255, 0.08));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}
.result-correct .reveal-card::before {
  background: linear-gradient(135deg, rgba(134, 239, 172, 0.88), rgba(34, 197, 94, 0.56), rgba(255, 255, 255, 0.08));
}
.result-wrong .reveal-card::before {
  background: linear-gradient(135deg, rgba(252, 165, 165, 0.88), rgba(239, 68, 68, 0.56), rgba(255, 255, 255, 0.08));
}
@keyframes revealCardPop {
  0%   { opacity: 0; transform: translateY(28px) scale(0.9); filter: blur(4px); }
  65%  { opacity: 1; transform: translateY(-4px) scale(1.018); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.reveal-header { margin-bottom: 16px; }
.reveal-badge {
  display: inline-block;
  font-size: clamp(1.18rem, 1.3vw, 1.42rem);
  font-weight: 800;
  padding: 10px 26px;
  border-radius: 50px;
  letter-spacing: 0.01em;
}
.reveal-badge.correct { background: rgba(34,197,94,0.18);  color: #bbf7d0; border: 1px solid rgba(34,197,94,0.5);  box-shadow: 0 0 22px rgba(34,197,94,0.2); }
.reveal-badge.wrong   { background: rgba(239,68,68,0.18);  color: #fecaca; border: 1px solid rgba(239,68,68,0.5);  box-shadow: 0 0 22px rgba(239,68,68,0.2); }

.reveal-answer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.reveal-lbl   { font-size: 0.85rem; color: var(--muted); }
.reveal-answer {
  font-size: clamp(1.22rem, 1.35vw, 1.48rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 18px rgba(250, 204, 21, 0.16);
}

.reveal-money-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.045);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.reveal-money-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
}
.reveal-divider {
  width: 1px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.rm-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.rm-value { font-size: clamp(1.65rem, 1.7vw, 2rem); font-weight: 900; }
.rm-sub   { font-size: 0.8rem; color: var(--muted); }

.reveal-money-item.kept .rm-value  { color: var(--success); }
.reveal-money-item.lost .rm-value  { color: var(--error); }

.reveal-expl {
  font-size: clamp(0.96rem, 1vw, 1.08rem);
  color: rgba(245, 245, 245, 0.82);
  line-height: 1.65;
  margin-bottom: 24px;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 16px 18px;
}

.game-over-msg {
  font-size: 1.95rem;
  font-weight: 900;
  color: var(--error);
  text-shadow: 0 0 18px rgba(220, 38, 38, 0.7), 0 0 36px rgba(220, 38, 38, 0.35);
  margin-bottom: 16px;
  animation: gameOverPulse 1.2s ease-in-out infinite;
}
@keyframes gameOverPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 18px rgba(220,38,38,0.7); }
  50%       { opacity: 0.65; text-shadow: 0 0 36px rgba(220,38,38,0.9), 0 0 60px rgba(220,38,38,0.4); }
}

.btn-salas-next {
  background: linear-gradient(90deg, #facc15, #f97316);
  color: #111827;
  font-family: "Poppins", sans-serif;
  font-weight: 900;
  font-size: 1.08rem;
  padding: 15px 40px;
  border: 0;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(249, 115, 22, 0.28);
}
.btn-salas-next:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 32px rgba(249, 115, 22, 0.4);
}

/* ═══════════════════════════════════════
   END SCREEN
   ═══════════════════════════════════════ */
.end-box {
  text-align: center;
  max-width: 500px;
  margin: 54px auto 0;
  padding: 44px 28px;
  background: var(--card);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.end-emoji  { font-size: 4rem; margin-bottom: 4px; }
.end-title  { font-size: 1.7rem; font-weight: 900; margin: 0 0 8px; }
.end-amount {
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--accent);
  margin: 10px 0 16px;
  letter-spacing: -0.02em;
}
.end-bundles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-bottom: 16px;
  min-height: 24px;
  overflow: hidden;
  max-height: 90px;
}
.end-msg {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 26px;
}

/* ═══════════════════════════════════════
   MOBILE TWEAKS
   ═══════════════════════════════════════ */
@media (max-width: 720px) {
  .salas-wrap {
    width: 100%;
    padding: 0 12px;
  }
  .screen-tv   { min-height: 88px; padding: 12px 8px 16px; }
  .opt-letter  { font-size: 1.3rem; }
  .opt-text    { font-size: 0.76rem; }
  .bundle-sm,
  .bundle-img-sm { width: 20px; height: auto; }
  .mesa-total  { font-size: 1.25rem; }
  .salas-topbar { gap: 6px; }
  .top-money   { font-size: 1rem; }
  .reveal-panel { padding: 14px; }
  .reveal-card {
    width: min(94vw, 560px);
    padding: 28px 20px 24px;
    border-radius: 22px;
  }
  .reveal-money-row {
    flex-direction: column;
  }
  .reveal-divider {
    width: 100%;
    height: 1px;
  }
  .rm-value {
    font-size: 1.35rem;
  }
}
