* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(168,85,247,0.18) 0%, transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgba(255,107,107,0.15) 0%, transparent 40%),
    linear-gradient(160deg, #0f0f1a 0%, #1a1030 40%, #12182b 100%);
  color: #eee;
  min-height: 100vh;
  padding: 14px;
}
h1 {
  text-align: center;
  margin: 6px 0 16px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #ff6b9d, #c084fc, #ff6b6b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(192,132,252,0.45));
}
.setup, .game { max-width: 1240px; margin: 0 auto; }
.setup {
  background: linear-gradient(160deg, rgba(30,20,50,0.85), rgba(15,15,30,0.9));
  padding: 28px 24px 32px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}
.setup h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: #e9d5ff;
  font-weight: 700;
}
.setup label { display: block; margin: 16px 0 8px; font-weight: 600; color: rgba(255,255,255,0.85); font-size: 0.95rem; }
.setup input, .setup select {
  padding: 11px 14px; font-size: 1rem; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35); color: #fff; width: 200px;
  outline: none;
}
.setup input:focus, .setup select:focus {
  border-color: #c084fc;
  box-shadow: 0 0 0 3px rgba(192,132,252,0.25);
}
.player-names { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 18px 0; }
.player-setup-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 138px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.player-setup-card input { width: 120px; text-align: center; }
.emoji-picker {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  max-width: 148px;
}
.emoji-picker span {
  font-size: 1.35rem; cursor: pointer; padding: 3px 4px;
  border-radius: 8px; transition: background 0.15s, transform 0.1s;
}
.emoji-picker span:hover { background: rgba(255,255,255,0.18); transform: scale(1.15); }
.emoji-picker span.selected {
  background: rgba(192,132,252,0.4);
  outline: 2px solid #c084fc;
}
button {
  background: linear-gradient(135deg, #ff6b9d 0%, #ee5a24 100%);
  color: white; border: none; padding: 12px 26px; font-size: 1.05rem;
  border-radius: 999px; cursor: pointer; font-weight: 700; margin: 6px;
  box-shadow: 0 6px 18px rgba(255,107,107,0.35);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,107,107,0.5); filter: brightness(1.05); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
button.secondary {
  background: linear-gradient(135deg, #7c3aed, #4c1d95);
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}
button.secondary:hover { box-shadow: 0 6px 18px rgba(124,58,237,0.5); }
.board-wrapper {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start;
}
.panel-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(233,213,255,0.9);
  margin-bottom: 2px;
}
.log-panel {
  flex: 1; min-width: 200px; max-width: 270px;
  background: linear-gradient(165deg, rgba(30,20,50,0.88), rgba(12,12,24,0.92));
  border-radius: 16px;
  padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
  order: 0;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.log-panel .log {
  flex: 1; min-height: 280px; max-height: 480px;
}
.board { order: 1; }
.sidebar { order: 2; }
@media (max-width: 900px) {
  .log-panel { order: 2; max-width: 100%; min-width: 100%; }
  .board { order: 0; }
  .sidebar { order: 1; max-width: 100%; }
}
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  width: min(96vw, 580px);
  aspect-ratio: 1;
  background: linear-gradient(145deg, #3f3f46 0%, #27272a 50%, #18181b 100%);
  padding: 6px;
  border-radius: 10px;
  box-shadow: 0 0 25px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.12);
  position: relative;
}
.cell {
  background: linear-gradient(145deg, #6b7280 0%, #4b5563 40%, #374151 100%);
  border-radius: 6px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  font-size: clamp(0.42rem, 1.25vw, 0.68rem);
  font-weight: 600;
  padding: 3px 3px 1.35em 3px;
  line-height: 1.12;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.35),
    0 1px 3px rgba(0,0,0,0.35);
  color: #f3f4f6;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
}
.cell-text {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: 1px 1px 2px;
  pointer-events: none;
}
.cell.black {
  background: linear-gradient(145deg, #9ca3af 0%, #6b7280 35%, #4b5563 70%, #374151 100%);
  color: #fff;
}
.cell.blue {
  background: linear-gradient(145deg, #38bdf8 0%, #0ea5e9 45%, #0284c7 100%);
  color: #0c1a24;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
.cell.salida {
  background: linear-gradient(145deg, #c084fc 0%, #a855f7 40%, #7e22ce 100%);
  color: #fff;
  font-weight: 800;
  font-size: clamp(0.5rem, 1.4vw, 0.78rem);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 0 12px rgba(168, 85, 247, 0.4);
}
.cell.ganador {
  background: linear-gradient(145deg, #c084fc 0%, #a855f7 45%, #7e22ce 100%);
  color: #fff;
  font-size: clamp(0.5rem, 1.45vw, 0.8rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.15;
  padding: 3px 2px;
  overflow: visible;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 0 14px rgba(168, 85, 247, 0.5);
}
.cell.ganador .ganador-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  padding: 2px;
}
.cell.ganador .star {
  font-size: 0.95em;
  line-height: 1;
}
.cell.ganador .ganador-label {
  font-size: 1em;
  line-height: 1.05;
  word-break: keep-all;
  white-space: normal;
}
.cell .star { font-size: 1.3em; }
.tokens {
  position: absolute;
  bottom: 1px;
  right: 1px;
  left: auto;
  max-width: 55%;
  display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end;
  align-items: center;
  pointer-events: none;
  z-index: 4;
}
.token {
  --ring: #fbbf24;
  font-size: clamp(0.55rem, 1.5vw, 0.9rem);
  line-height: 1;
  width: 1.45em;
  height: 1.45em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, #ffffff 0%, #f8fafc 18%, #e2e8f0 42%, #94a3b8 78%, #64748b 100%);
  border: 2px solid rgba(255,255,255,0.95);
  outline: 2.5px solid var(--ring);
  outline-offset: 0px;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.55),
    0 1px 2px rgba(0,0,0,0.4),
    inset 0 3px 5px rgba(255,255,255,0.9),
    inset 0 -3px 5px rgba(15,23,42,0.28);
  cursor: default;
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
  isolation: isolate;
}
.token::before {
  content: '';
  position: absolute;
  top: 3px; right: 3px; bottom: 3px; left: 3px; inset: 3px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  pointer-events: none;
  z-index: 0;
}
.token::after {
  content: '';
  position: absolute;
  top: 12%;
  left: 18%;
  width: 42%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.75) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}
.token.active-token {
  transform: scale(1.22) translateY(-2px);
  outline-width: 3px;
  box-shadow:
    0 0 0 2px #fff,
    0 0 14px 3px color-mix(in srgb, var(--ring) 75%, transparent),
    0 6px 12px rgba(0,0,0,0.55),
    inset 0 3px 5px rgba(255,255,255,0.95),
    inset 0 -3px 5px rgba(15,23,42,0.25);
  z-index: 6;
  animation: tokenPulse 1.6s ease-in-out infinite;
}
@keyframes tokenPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}
/* Path direction arrows */
.cell .path-arrow {
  position: absolute;
  font-size: clamp(0.45rem, 1.2vw, 0.7rem);
  opacity: 0.55;
  z-index: 2;
  pointer-events: none;
  line-height: 1;
}
.path-arrow.right { right: 1px; top: 50%; transform: translateY(-50%); }
.path-arrow.left  { left: 1px;  top: 50%; transform: translateY(-50%); }
.path-arrow.down  { bottom: 0px; left: 50%; transform: translateX(-50%); }
.path-arrow.up    { top: 0px;    left: 50%; transform: translateX(-50%); }
.sidebar {
  flex: 1; min-width: 240px; max-width: 300px;
  background: linear-gradient(165deg, rgba(30,20,50,0.88), rgba(12,12,24,0.92));
  border-radius: 16px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.turn-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(192,132,252,0.12);
  border: 1px solid rgba(192,132,252,0.35);
}
.turn-badge strong { font-size: 0.75rem; opacity: 0.8; letter-spacing: 0.04em; text-transform: uppercase; }
#currentPlayerName {
  color: #f0abfc !important;
  font-weight: 800 !important;
  font-size: 1.05rem;
}
.players-list {
  max-height: 220px; overflow-y: auto;
  padding-right: 2px;
}
.players-list::-webkit-scrollbar { width: 6px; }
.players-list::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.4); border-radius: 6px; }
.player-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; margin-bottom: 5px;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.player-row.active {
  background: rgba(192,132,252,0.22);
  border-color: rgba(192,132,252,0.55);
  box-shadow: 0 0 12px rgba(168,85,247,0.2);
}
.player-emoji { font-size: 1.35rem; flex-shrink: 0; line-height: 1; }
.dice-area {
  text-align: center;
  padding: 12px 8px;
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
}
.dice {
  width: 78px; height: 78px; margin: 8px auto 12px;
  background: linear-gradient(145deg, #ffffff 0%, #e5e7eb 100%);
  color: #111; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 900;
  box-shadow:
    0 8px 20px rgba(0,0,0,0.45),
    inset 0 2px 4px rgba(255,255,255,0.9),
    inset 0 -2px 4px rgba(0,0,0,0.12);
  transition: transform 0.3s;
  border: 2px solid rgba(255,255,255,0.85);
}
.dice.rolling { animation: shake 0.5s ease-in-out; }
@keyframes shake {
  0%,100% { transform: rotate(0); }
  25% { transform: rotate(-15deg) scale(1.1); }
  75% { transform: rotate(15deg) scale(1.1); }
}
.ctrl-row {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 2px;
}
.ctrl-row button {
  font-size: 0.78rem !important;
  padding: 8px 12px !important;
  margin: 2px !important;
}

/* ===== Animaciones de casilla (fluidas y naturales) ===== */
.cell {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.4s ease,
              box-shadow 0.4s ease;
}
.cell.anim-pulse {
  animation: cellPulse 3s cubic-bezier(0.37, 0, 0.63, 1);
  z-index: 8;
}
@keyframes cellPulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 transparent; }
  50% { transform: scale(1.07); box-shadow: 0 0 14px 3px rgba(255,255,255,0.3); }
}
.cell.anim-drink {
  animation: cellDrink 3s cubic-bezier(0.34, 1.2, 0.64, 1);
  z-index: 8;
}
@keyframes cellDrink {
  0%   { transform: scale(1) translateY(0); filter: brightness(1); }
  25%  { transform: scale(1.05) translateY(-3px); filter: brightness(1.12); }
  50%  { transform: scale(1.09) translateY(-5px); filter: brightness(1.2); }
  75%  { transform: scale(1.04) translateY(-2px); filter: brightness(1.1); }
  100% { transform: scale(1) translateY(0); filter: brightness(1); }
}
.cell.anim-kiss {
  animation: cellKiss 3s cubic-bezier(0.34, 1.25, 0.64, 1);
  z-index: 8;
}
@keyframes cellKiss {
  0%   { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  30%  { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(255,105,180,0.55)); }
  55%  { transform: scale(1.12); filter: drop-shadow(0 0 16px rgba(255,20,147,0.65)); }
  80%  { transform: scale(1.05); filter: drop-shadow(0 0 8px rgba(255,105,180,0.35)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
}
.cell.anim-strip {
  animation: cellStrip 3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 8;
}
@keyframes cellStrip {
  0%   { transform: scale(1) skewX(0deg); }
  20%  { transform: scale(1.04) skewX(-2deg); }
  40%  { transform: scale(1.07) skewX(1.8deg); }
  60%  { transform: scale(1.05) skewX(-1.2deg); }
  80%  { transform: scale(1.02) skewX(0.6deg); }
  100% { transform: scale(1) skewX(0deg); }
}
.cell.anim-retreat {
  animation: cellRetreat 3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 8;
}
@keyframes cellRetreat {
  0%   { transform: translateX(0); filter: brightness(1); }
  35%  { transform: translateX(-5px); filter: brightness(1.08); }
  70%  { transform: translateX(3px); filter: brightness(1.04); }
  100% { transform: translateX(0); filter: brightness(1); }
}
.cell.anim-extra {
  animation: cellExtra 3s cubic-bezier(0.34, 1.35, 0.64, 1);
  z-index: 8;
}
@keyframes cellExtra {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(1.08) rotate(4deg); }
  55%  { transform: scale(1.1) rotate(-3.5deg); }
  80%  { transform: scale(1.04) rotate(1.5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.cell.anim-win {
  animation: cellWin 3s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  z-index: 8;
}
@keyframes cellWin {
  0%,100% { transform: scale(1); box-shadow: 0 0 12px rgba(255,215,0,0.45); }
  50% { transform: scale(1.08); box-shadow: 0 0 26px rgba(255,215,0,0.7), 0 0 36px rgba(255,107,107,0.3); }
}
.cell.anim-fantasy {
  animation: cellFantasy 3s cubic-bezier(0.37, 0, 0.63, 1);
  z-index: 8;
}
@keyframes cellFantasy {
  0%   { filter: hue-rotate(0deg) brightness(1); transform: scale(1); }
  40%  { filter: hue-rotate(45deg) brightness(1.12); transform: scale(1.06); }
  70%  { filter: hue-rotate(70deg) brightness(1.15); transform: scale(1.05); }
  100% { filter: hue-rotate(0deg) brightness(1); transform: scale(1); }
}
.cell.anim-blind {
  animation: cellBlind 3s cubic-bezier(0.37, 0, 0.63, 1);
  z-index: 8;
}
@keyframes cellBlind {
  0%   { filter: brightness(1); transform: scale(1); opacity: 1; }
  35%  { filter: brightness(0.5); transform: scale(0.98); opacity: 0.88; }
  65%  { filter: brightness(1.15); transform: scale(1.05); opacity: 1; }
  100% { filter: brightness(1); transform: scale(1); opacity: 1; }
}

/* GIF a pantalla completa */
.fx-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; pointer-events: none; z-index: 200;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fx-gif-wrap {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.72);
  animation: fxGifIn 3s cubic-bezier(0.37, 0, 0.63, 1) forwards;
}
@keyframes fxGifIn {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}
.fx-gif-wrap img {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
  object-position: center;
}
.fx-pinita { display: block; margin: 0 auto; height: 56vh; height: 56vmin; min-height: 160px; }
.fx-gif-label {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  font-weight: 700;
  white-space: nowrap;
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.log {
  flex: 1; min-height: 140px; max-height: 220px; overflow-y: auto;
  background: rgba(0,0,0,0.3); border-radius: 8px; padding: 10px;
  font-size: 0.85rem; line-height: 1.4;
}
.log div {
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 4px;
  color: rgba(238, 238, 238, 0.65);
  transition: color 0.2s ease;
}
.log div.log-latest {
  color: #ffe566;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 229, 102, 0.7);
  background: rgba(255, 229, 102, 0.08);
  border-radius: 4px;
  padding: 6px;
  border: 1.5px solid #ffe566;
  box-shadow: 0 0 8px rgba(255, 229, 102, 0.25);
}
.modal-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  background: rgba(8,6,18,0.78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: linear-gradient(165deg, #2a1a40 0%, #16122a 100%);
  padding: 26px 22px;
  border-radius: 18px;
  max-width: 400px; width: 90%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
  border: 1px solid rgba(192,132,252,0.35);
}
.modal h3 { margin-bottom: 12px; color: #e9d5ff; font-size: 1.2rem; }
.modal p { margin-bottom: 16px; line-height: 1.45; color: rgba(255,255,255,0.88); }
.modal select, .modal button { margin: 6px; }
.winner-banner {
  background: linear-gradient(135deg, #f0abfc, #a855f7, #ff6b9d);
  color: #1a0a2e; padding: 18px 20px; border-radius: 14px; text-align: center;
  font-size: 1.35rem; font-weight: 900; margin-bottom: 16px;
  animation: pulse 1.5s infinite;
  box-shadow: 0 8px 28px rgba(168,85,247,0.4);
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.03)} }
.hidden { display: none !important; }

/* ===== Ajustes de seguridad y avisos (Fase 3a) ===== */
.opts {
  border: 1px solid rgba(255,255,255,0.12); border-radius: 14px;
  padding: 10px 16px 14px; margin: 14px auto 6px; max-width: 560px; text-align: left;
}
.opts legend { padding: 0 8px; color: #e9d5ff; font-weight: 700; font-size: 0.95rem; }
.setup .opts label.check { display: block; margin: 10px 0 4px; font-weight: 500; font-size: 0.92rem; }
.setup .opts label.check input[type=checkbox] { width: auto; margin-right: 8px; }
.setup .opts select { width: auto; max-width: 100%; padding: 6px 10px; font-size: 0.9rem; margin-top: 4px; }
.couple-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.setup .couple-row select { width: auto; flex: 1 1 110px; padding: 6px 8px; font-size: 0.88rem; }
.couple-row button { padding: 6px 12px; font-size: 0.85rem; margin: 0; }
.hint { font-size: 0.8rem; opacity: 0.75; margin-top: 6px; }
.setup-error {
  max-width: 560px; margin: 8px auto; padding: 8px 12px; border-radius: 10px;
  background: rgba(239,68,68,0.18); border: 1px solid rgba(239,68,68,0.55); color: #fecaca;
}
.age-gate { z-index: 400; background: #0b0814; }
.modal button.pass { background: linear-gradient(135deg, #475569, #334155); box-shadow: none; }
.modal .who { font-size: 1.05rem; font-weight: 800; color: #f0abfc; }
.modal ul { text-align: left; margin: 0 0 14px 18px; line-height: 1.5; color: rgba(255,255,255,0.88); }
.modal .modal-text { margin-bottom: 16px; line-height: 1.45; color: rgba(255,255,255,0.88); }

/* ===== Reacciones: efecto a pantalla con emoji y animaciones nuevas (Fase 4) ===== */
.fx-emoji {
  font-size: clamp(6rem, 32vw, 16rem); line-height: 1;
  animation: fxEmoji 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0 28px rgba(192,132,252,0.55));
}
@keyframes fxEmoji {
  0%, 100% { transform: translateY(0) scale(1) rotate(-3deg); }
  50% { transform: translateY(-4%) scale(1.12) rotate(3deg); }
}
.fx-gif-wrap img { object-fit: contain; }
.cell.anim-sparkle { animation: cellSparkle 3s ease-in-out; z-index: 8; }
@keyframes cellSparkle {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  30% { transform: scale(1.07); filter: brightness(1.3) drop-shadow(0 0 8px rgba(250,204,21,0.8)); }
  60% { transform: scale(1.04); filter: brightness(1.15); }
}
.cell.anim-dance { animation: cellDance 3s ease-in-out; z-index: 8; }
@keyframes cellDance {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-6deg) scale(1.06); }
  40% { transform: rotate(6deg) scale(1.08); }
  60% { transform: rotate(-4deg) scale(1.06); }
  80% { transform: rotate(3deg) scale(1.03); }
}
.cell.anim-soft { animation: cellSoft 3s ease-in-out; z-index: 8; }
@keyframes cellSoft {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.09); filter: brightness(1.12) drop-shadow(0 0 12px rgba(251,191,36,0.55)); }
}
.cell.anim-heart { animation: cellHeart 3s ease-in-out; z-index: 8; }
@keyframes cellHeart {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  25% { transform: scale(1.1); filter: drop-shadow(0 0 14px rgba(244,63,94,0.7)); }
  50% { transform: scale(1.03); }
  75% { transform: scale(1.09); filter: drop-shadow(0 0 12px rgba(244,63,94,0.55)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .fx-gif-wrap { animation: none !important; opacity: 1; }
}

/* ===== Selector de tablero ===== */
.board-picker { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 4px 0 6px; }
.board-card {
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.12); border-radius: 14px;
  padding: 10px 12px; width: 168px; text-align: left; cursor: pointer; color: #eee;
  display: flex; flex-direction: column; gap: 6px; margin: 0; box-shadow: none; font-size: 0.85rem; font-weight: 500;
}
.board-card:hover { transform: none; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.board-card[aria-checked="true"] { border-color: #c084fc; background: rgba(192,132,252,0.2); box-shadow: 0 0 0 3px rgba(192,132,252,0.25); }
.board-card .board-name { font-weight: 800; font-size: 1rem; }
.board-card .board-summary { opacity: 0.8; line-height: 1.3; }
.badge { align-self: flex-start; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; color: #111; }
.badge-original { background: #e5e7eb; }
.badge-suave { background: #86efac; }
.badge-picante { background: #fde047; }
.badge-hot { background: #fb923c; }
.badge-intenso { background: #f43f5e; color: #fff; }
.game-badge { display: inline-block; margin-left: 8px; vertical-align: middle; }

/* ===== Casillas legibles en móvil + tarjeta grande de reto (Fase 4) ===== */
.cell { cursor: pointer; }
.cell:focus-visible { outline: 3px solid #facc15; outline-offset: 1px; z-index: 9; }
.cell-compact { display: none; }
@media (max-width: 640px) {
  .cell-full { display: none; }
  .cell-compact {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; width: 100%;
  }
  .cell-icon { font-size: 1.35rem; line-height: 1.1; }
  .cell-short { font-size: 0.7rem; line-height: 1.05; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 100%; }
  .cell { padding: 2px 1px 1.2em 1px; }
  .cell.ganador, .cell.salida { font-size: 0.7rem; }
}
.modal.modal-card { max-width: min(94vw, 680px); width: 94%; padding: 30px 22px; }
.modal.modal-card h3 { font-size: clamp(1.4rem, 4.5vw, 2.1rem); margin-bottom: 16px; }
.modal.modal-card .modal-text { font-size: clamp(1.25rem, 4.2vw, 2rem); line-height: 1.35; color: #fff; }
.modal.modal-card .modal-text .who { font-size: clamp(1.2rem, 3.8vw, 1.8rem); }
.modal.modal-card button { font-size: clamp(1.1rem, 3.4vw, 1.5rem); min-height: 56px; }
.board-card { width: auto; flex: 1 1 150px; max-width: 230px; }
.cell-short { font-size: 0.72rem; }
.cell-short { font-size: 0.7rem; letter-spacing: -0.03em; }
.cell .cell-compact { padding: 0; }
.modal-overlay { z-index: 250; }
.modal-overlay.age-gate { z-index: 400; }
.resume-box { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }

/* ===== Marca del creador (pie fijo, discreto y con buen contraste, en todas las pantallas) ===== */
.creator-mark {
  position: fixed; right: 8px; bottom: 6px; z-index: 600; pointer-events: none;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; line-height: 1;
  color: #f5f3ff; background: rgba(15, 10, 30, 0.82); border: 1px solid rgba(255,255,255,0.22);
  padding: 4px 9px; border-radius: 999px; user-select: none;
}
body { padding-bottom: 40px; }
.modal-overlay { padding-bottom: 36px; }
.modal-mark, .banner-mark { margin-top: 12px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; opacity: 0.7; }

/* ===== Accesibilidad: foco visible ===== */
button:focus-visible, select:focus-visible, input:focus-visible, .emoji-picker span:focus-visible,
.board-card:focus-visible { outline: 3px solid #facc15; outline-offset: 2px; }
.fx-gif-wrap img { width: min(78vmin, 512px); height: min(78vmin, 512px); object-fit: contain; filter: drop-shadow(0 0 28px rgba(192,132,252,0.45)); }

/* ===== Editor de tableros y herramientas (Fase 6) ===== */
.badge-mio { background: #a5b4fc; }
.board-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0; }
.board-tools button { padding: 8px 14px; font-size: 0.9rem; margin: 0; }
.editor { max-width: 1000px; text-align: left; }
.editor h2 { text-align: center; }
.ed-fields { display: grid; gap: 4px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.setup.editor label { margin: 10px 0 2px; font-size: 0.85rem; }
.setup.editor input, .setup.editor select, .setup.editor textarea {
  width: 100%; padding: 7px 9px; font-size: 0.9rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.35); color: #fff; font-family: inherit;
}
.ed-cells { display: grid; gap: 6px; margin: 12px 0; }
.ed-row { display: grid; grid-template-columns: 34px minmax(130px, 170px) 1fr 70px minmax(110px, 140px) minmax(110px, 140px); gap: 6px; align-items: start;
  padding: 6px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.ed-row.locked { opacity: 0.75; background: rgba(168,85,247,0.12); }
.ed-row .ed-idx { font-weight: 800; text-align: center; padding-top: 8px; color: #e9d5ff; }
.ed-row textarea { resize: vertical; min-height: 54px; }
.ed-row.invalid { outline: 2px solid rgba(239,68,68,0.7); }
.ed-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.ed-actions button { padding: 9px 16px; font-size: 0.95rem; margin: 0; }
.ed-share { background: rgba(255,255,255,0.07); border-radius: 12px; padding: 10px 12px; margin: 8px 0; word-break: break-all; }
@media (max-width: 720px) {
  .ed-row { grid-template-columns: 30px 1fr; }
  .ed-row .ed-text, .ed-row .ed-extra { grid-column: 1 / -1; }
}

/* ===== Controles de voz ===== */
.voice-controls { display: grid; gap: 8px; text-align: left; }
.voice-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; margin: 0 !important; font-size: 0.9rem; }
.voice-row select, .voice-row input[type=range] { width: 100% !important; max-width: none; }
.voice-controls button { margin: 4px 0; padding: 9px 16px; font-size: 0.9rem; }
.modal .voice-controls label.check { display: block; font-size: 0.85rem; line-height: 1.3; }
.modal .voice-controls select { width: 100%; padding: 8px; font-size: 1rem; }

/* ===== Salas online ===== */
.online-bar { text-align: center; padding: 10px 14px; margin-bottom: 10px; border-radius: 12px; font-weight: 700;
  background: rgba(192,132,252,0.18); border: 1px solid rgba(192,132,252,0.45); }
.lobby { max-width: 760px; }
.room-code { font-size: 2.2rem; letter-spacing: 0.18em; color: #4ecdc4; font-weight: 900; }
.lobby-players .player-row { align-items: center; }
.lobby-players .player-row.offline { opacity: 0.55; }
.lobby-tags { margin-left: auto; font-size: 0.8rem; opacity: 0.8; }
.lobby-players button { margin: 0 0 0 8px; padding: 6px 10px; font-size: 0.8rem; }
.lobby .opts { text-align: left; }
.lobby .voice-row select { width: 100%; }

/* Clips cortos (D11) */
.fx-gif-wrap .fx-clip { width: min(78vmin, 512px); height: min(78vmin, 512px); object-fit: cover; border-radius: 16px; box-shadow: 0 0 28px rgba(192,132,252,0.45); background: #000; }

.credits-note { text-align: center; font-size: 0.7rem; opacity: 0.55; margin: 6px 0 0; }

/* Diagnóstico (?diag=1): pantalla grande para leer desde el sofá */
.diag-on body > *:not(#diagScreen) { display: none !important; }
.diag-screen { position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; overflow: auto; background: #0d0818; color: #fff; padding: 2vmin 4vmin; z-index: 500; font-size: clamp(18px, 2.6vmin, 40px); }
.diag-screen h1 { font-size: 1.5em; margin: 0 0 0.5em; }
.diag-screen table { border-collapse: collapse; width: 100%; }
.diag-screen th, .diag-screen td { text-align: left; padding: 0.3em 0.6em; border-bottom: 1px solid #fff3; vertical-align: top; word-break: break-word; }
.diag-screen th { width: 46%; font-weight: 600; }
.diag-screen tr.ok th { color: #6ee7a0; } .diag-screen tr.no th { color: #ff7b8a; }
.diag-screen p { opacity: 0.8; }

.audio-gate { text-align: center; margin: 0 0 8px; }
.audio-gate button { margin: 0; }

/* Subtítulo grande cuando no hay voz propia ni remota (smart TV) */
.speech-caption { position: fixed; left: 50%; bottom: 4vh; transform: translateX(-50%); max-width: 90vw; z-index: 450; padding: 0.6em 1em; border-radius: 14px;
  background: rgba(0,0,0,0.85); color: #fff; font-size: clamp(1.4rem, 4vmin, 3rem); font-weight: 600; text-align: center; pointer-events: none; }

/* Foco visible y grueso (mando): siempre, no solo con teclado */
/* Partida: el tablero ocupa casi toda la altura de la pantalla */

/* Inicio: iniciar / crear sala / unirse arriba del todo; lo avanzado, plegado debajo */
.start-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 4px 0 10px; }
.start-actions button { margin: 0; }
.start-actions #btnChooseGame { font-size: 1.15rem; padding: 12px 26px; }
.advanced { margin-top: 14px; border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 4px 12px 12px; background: rgba(255,255,255,0.03); }
.advanced > summary { cursor: pointer; font-weight: 700; padding: 10px 4px; list-style-position: inside; border-radius: 8px; }
.advanced > summary:focus-visible { outline: 3px solid #facc15; outline-offset: 2px; }
.advanced-links { text-align: center; margin-top: 10px; }

/* Sexo y orientación por jugador (la orientación se oculta al elegirla) */
.profile-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 6px; }
.profile-row select, .profile-row button { margin: 3px; font-size: 0.85rem; padding: 6px 8px; }
.profile-row .orient-box { display: inline-block; }
/* Ventanas largas (p. ej. «Créditos y privacidad»): se ven desde el principio y se desplazan por dentro */
.modal { max-height: calc(100vh - 56px); overflow-y: auto; -webkit-overflow-scrolling: touch; box-sizing: border-box; }
/* Modo simple: «Paso» pequeño y siempre a mano en la barra de turno */
#btnPasoBar { padding: 6px 14px; min-height: 44px; font-size: 0.95rem; background: linear-gradient(135deg, #475569, #334155); box-shadow: none; }
#btnPasoBar:focus { outline: 3px solid #facc15; }
/* Enlaces a la guía «Cómo se juega» */
.site-links { text-align: center; margin: 14px 0 4px; }
.site-links a, .guide-link { display: inline-block; min-height: 44px; padding: 10px 16px; color: #f0abfc; font-weight: 700; text-decoration: none; }
.site-links a:focus, .guide-link:focus { outline: 3px solid #facc15; }
.guide-link { border-radius: 999px; background: linear-gradient(135deg, #7c3aed, #4c1d95); color: #fff; margin: 6px; }
/* Dentro de la app Android: el audio ya no necesita gesto y no se ofrece instalar la app */
.in-app #btnUnlockAudio, .in-app .install-link { display: none !important; }
