@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
/* ============== VARIABLES GLOBALES ============== */
:root {
  /* Categorías */
  --intimidad: hsl(340, 75%, 55%);
  --intimidad-light: hsl(340, 75%, 85%);
  --bdsm: hsl(270, 60%, 45%);
  --bdsm-light: hsl(270, 60%, 85%);
  --exploratoria: hsl(30, 90%, 55%);
  --exploratoria-light: hsl(30, 90%, 85%);
  --impersonal: hsl(180, 70%, 50%);
  --impersonal-light: hsl(180, 70%, 85%);

  /* General */
  --brand: #1f2d5c;
  --surface: #ffffff;
  --bg: #f7f8fb;
  --game-bg: radial-gradient(1200px 700px at 50% 18%, #e1e0ec 0%, #c9c7d8 48%, #9b99ae 100%);
  --layout-max: 960px;
  --board-max: 860px;
  --board-pad: clamp(28px, 4vw, 56px);
  --board-cols: 10;
  --board-surface-width: calc((var(--board-cols) * var(--tile)) + ((var(--board-cols) - 1) * var(--gapX)) + (2 * var(--board-pad)));
  --page-pad: 14px;
  --panel-width: 200px;
  --tile: clamp(72px, 7vw, 100px);
  --gapX: clamp(14px, 1.8vw, 26px);
  --gapY: clamp(18px, 2.4vw, 34px);
  --pad: clamp(18px, 3vw, 44px);
  --number-color: #3b2d24;
  --dice-base: #243b55;
  --dice-tint: #243b55;
  --dice-glow: rgba(36, 59, 85, 0.28);

  /* Colores de casillas */
  --color-intimidad: rgb(242, 185, 183);
  --color-bdsm: rgb(247, 234, 227);
  --color-exploratoria: rgb(253, 220, 194);
  --color-impersonal: rgb(219, 222, 208);
  --color-intimidad-text: rgb(154, 96, 94);
  --color-bdsm-text: rgb(136, 116, 131);
  --color-exploratoria-text: rgb(165, 118, 88);
  --color-impersonal-text: rgb(114, 122, 107);
  --legend-desc: #5f5a55;
  --board-surface: rgba(235, 229, 220, 0.95);
  --board-surface-shadow: rgba(0, 0, 0, 0.06);
  --master-surface: #f3f1f7;
  --master-surface-shadow: rgba(0, 0, 0, 0.08);
  --legend-surface: #ffffff;
  --token-fill: #f3eee2;
  --token-stroke: #e7e0d7;
  --token-ring: #c5cbd1;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Poppins', sans-serif;
  color: #e8e4df;
  text-align: center;
  padding: 8px 14px 24px;
  background: #1a1a18;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Logo Mi Turno en setup */
.setup-logo {
  height: 56px;
  width: auto;
  margin: 8px auto 4px;
  display: block;
  opacity: 0.9;
}

.form-container {
  background: #2a2a27;
  padding: 28px 24px;
  border-radius: 16px;
  border: 1px solid #3a3835;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  max-width: 480px;
  width: 100%;
  margin: 40px auto 20px auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
label {
  text-align: left;
  font-weight: 500;
  color: #a8a49d;
  font-size: 0.88em;
  letter-spacing: 0.3px;
}
input, select {
  font-size: 1em;
  padding: 11px 14px;
  border: 1px solid #3a3835;
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
  background: #1a1a18;
  color: #e8e4df;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
input::placeholder { color: #6e6b65; }
input:focus, select:focus {
  outline: none;
  border-color: #c9a96e;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8a49d' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
select option {
  background: #2a2a27;
  color: #e8e4df;
}
button {
  font-size: 1em;
  padding: 13px;
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
  background: #c9a96e;
  color: #1a1a18;
  border: none;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  font-family: inherit;
}
button:hover { background-color: #d4b87a; }
button:active { transform: translateY(1px); }

#game {
  display: none;
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  background: transparent;
  padding-left: 6px;
  padding-right: 6px;
  position: relative;
  z-index: 0;
  color: #1f2d5c;
  font-family: 'Poppins', sans-serif;
}
#game::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--game-bg);
  z-index: -1;
  pointer-events: none;
}
#turnIndicator {
  font-size: 0.85em;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: #666;
}

.dice-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.turn-player { display: inline-flex; align-items: center; gap: 8px; }
.player-name-inline { white-space: nowrap; }
.player-icon { width: 18px; height: 18px; border-radius: 50%; background: currentColor; border: 2px solid #fff; display: inline-block; }

.board-legend {
  margin: 0 auto 5px;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 18px;
  background: var(--legend-surface);
  box-shadow: none;
  padding: 8px 14px;
  box-sizing: border-box;
  cursor: pointer;
  min-height: 58px;
}
.board-legend__content {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
.board-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  justify-content: center;
  position: relative;
  padding: 4px 8px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.board-legend__item:hover {
  background: #faf6f1;
}
.board-legend__item .legend-icon img { width: 22px; height: 22px; }
.legend-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 240px;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
}
.legend-label .legend-title { font-size: 0.85em; }
.legend-label .legend-desc { font-size: 0.75em; }
.board-legend__detail {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8edf7;
  box-shadow: none;
  color: var(--legend-desc);
  font-size: 0.8em;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 2;
}
.board-legend__item:hover .board-legend__detail,
.board-legend__item:focus-within .board-legend__detail,
.board-legend__item.is-expanded .board-legend__detail {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.legend-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; }
.legend-icon img { width: 26px; height: 26px; display: block; }
.legend-title {
  font-weight: 800;
  color: inherit;
  font-size: 1em;
}
.legend-title.intimidad    { color: var(--color-intimidad-text); }
.legend-title.bdsm         { color: var(--color-bdsm-text); }
.legend-title.exploratoria { color: var(--color-exploratoria-text); }
.legend-title.impersonal   { color: var(--color-impersonal-text); }
.legend-desc { font-size: 0.9em; color: var(--legend-desc); }
.top-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding: 12px 16px 12px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Fila 1: Logos + Turno */
.hero-row-1 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  width: 100%;
}

.hero-row-1 .hero-logo:first-child { justify-self: center; }
.hero-row-1 #turnIndicator { justify-self: center; }
.hero-row-1 .hero-logo:last-child { justify-self: center; }

.hero-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Fila 2: Dado + Timer (centrados) */
.hero-row-2 {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.hero-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Fila 3: Paneles de jugadores (2 columnas) */
.hero-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

@media (max-width: 700px) {
  :root {
    --board-pad: clamp(12px, 3vw, 18px);
    --board-cols: 5;
    --gapX: clamp(6px, 2vw, 10px);
    --gapY: clamp(8px, 2.5vw, 12px);
  }
  .hero-logo { width: 44px; height: 44px; }
  .hero-row-3 { display: none !important; }
  .board {
    width: 100%;
    grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr));
  }
  .cell {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .board-surface { overflow: hidden; }
}
.timer-box {
  gap: 10px;
}

.players-panel {
  background: #fff;
  border: 1px solid #e8ebf5;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 22px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  box-sizing: border-box;
}
.players-panel .title { font-weight: 700; font-size: 0.98em; color: #1f2d5c; }
.players-list { display: flex; flex-direction: column; gap: 6px; }
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f5f6fb;
  box-sizing: border-box;
  width: 100%;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
.player-row.active {
  background: #dfe6ff;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(31,45,92,0.15);
  border: 1px solid rgba(31,45,92,0.12);
  transform: translateY(-1px);
}
.player-row:not(.active) { opacity: 1; }
.player-row:not(.active) .player-name { opacity: 0.65; }
.player-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25); flex-shrink: 0; }
.player-row.active .player-dot {
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.95),
    0 6px 12px rgba(0,0,0,0.28);
}
.player-name { font-size: 0.9em; color: #1f2d5c; }

#dice.dice{
  display:grid;
  place-items:center;
  margin: 16px 0 6px;
  width: 82px;
  height: 82px;
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  transform: translateZ(0);
  font-weight: 700;
  background: radial-gradient(160% 140% at 30% 20%, rgba(255,255,255,0.08), transparent 45%),
              linear-gradient(160deg, rgba(255,255,255,0.05), rgba(0,0,0,0.35)),
              linear-gradient(0deg, var(--dice-tint-rgba, rgba(255,255,255,0.05)), rgba(0,0,0,0)),
              var(--dice-base);
  box-shadow:
    0 12px 32px rgba(0,0,0,0.45),
    0 0 16px var(--dice-glow),
    inset 0 0 12px rgba(255,255,255,0.05),
    inset 0 -6px 10px rgba(0,0,0,0.35);
  transition: box-shadow 200ms ease, transform 180ms ease, background 200ms ease;
}
#dice.dice::before{
  content:"";
  position:absolute;
  inset:-6px;
  border-radius: 22px;
  background: radial-gradient(120% 120% at 50% 50%, rgba(255,255,255,0.06), transparent 60%);
  box-shadow: 0 0 26px var(--dice-glow);
  pointer-events:none;
  transition: box-shadow 200ms ease, filter 200ms ease;
}
#dice.dice:active{ transform: scale(0.98); }
.dice-value{ display:none !important; }

/* Pips para el dado 2D */
#dice .pip{
  position:absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 28%, #fff 0%, #f8f8f8 55%, #d9d9d9 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.35),
    inset 0 1px 2px rgba(255,255,255,0.7),
    inset 0 -1px 2px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 120ms ease, transform 140ms ease;
  z-index: 10;
  transform: translate(var(--tx,-50%), var(--ty,-50%)) scale(1);
}
#dice .p1{ top: 25%; left: 25%; --tx:-50%; --ty:-50%; }
#dice .p2{ top: 50%; left: 25%; --tx:-50%; --ty:-50%; }
#dice .p3{ top: 75%; left: 25%; --tx:-50%; --ty:-50%; }
#dice .p4{ top: 50%; left: 50%; --tx:-50%; --ty:-50%; }
#dice .p5{ top: 25%; left: 75%; --tx:-50%; --ty:-50%; }
#dice .p6{ top: 50%; left: 75%; --tx:-50%; --ty:-50%; }
#dice .p7{ top: 75%; left: 75%; --tx:-50%; --ty:-50%; }
#dice:hover .pip{ transform: translate(var(--tx,-50%), var(--ty,-50%)) scale(1.07); }
#dice[data-value="1"] .p4{ opacity:1; }
#dice[data-value="2"] .p1, #dice[data-value="2"] .p7{ opacity:1; }
#dice[data-value="3"] .p1, #dice[data-value="3"] .p4, #dice[data-value="3"] .p7{ opacity:1; }
#dice[data-value="4"] .p1, #dice[data-value="4"] .p5, #dice[data-value="4"] .p3, #dice[data-value="4"] .p7{ opacity:1; }
#dice[data-value="5"] .p1, #dice[data-value="5"] .p5, #dice[data-value="5"] .p3, #dice[data-value="5"] .p7, #dice[data-value="5"] .p4{ opacity:1; }
#dice[data-value="6"] .p1, #dice[data-value="6"] .p2, #dice[data-value="6"] .p3, #dice[data-value="6"] .p5, #dice[data-value="6"] .p6, #dice[data-value="6"] .p7{ opacity:1; }

.dice-face-icon {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  display:grid;
  place-items:center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.55));
}
.dice-face-icon svg {
  width: 48px;
  height: 48px;
}
.dice-face-icon.intimidad   svg { fill:#ff4f6f; stroke:#ff8fab; stroke-width:1; }
.dice-face-icon.bdsm        svg { fill:#6c6ff3; stroke:#a2a6ff; stroke-width:1; }
.dice-face-icon.exploratoria svg{ fill:#f5a623; stroke:#ffd27a; stroke-width:1; }
.dice-face-icon.impersonal  svg { fill:#4ef6e4; stroke:#9cfaf1; stroke-width:1; }
@keyframes diceShake{ 0%{ transform: rotate(0deg) scale(1); } 25%{ transform: rotate(-7deg) scale(1.04); } 50%{ transform: rotate(7deg) scale(1.04); } 100%{ transform: rotate(0deg) scale(1); } }

/* Animación Bounce (solo rebote, sin 3D) */
@keyframes diceBounce {
  0%, 100% { 
    transform: translateY(0) scale(1);
  }
  10% { 
    transform: translateY(-18px) scale(1.08);
  }
  20% { 
    transform: translateY(0) scale(0.95);
  }
  30% { 
    transform: translateY(-10px) scale(1.04);
  }
  40% { 
    transform: translateY(0) scale(0.98);
  }
  50% { 
    transform: translateY(-5px) scale(1.02);
  }
  60% { 
    transform: translateY(0) scale(1);
  }
}

#dice.rolling{ 
  animation: diceBounce 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
}


.board-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  overflow: visible;
}
.board-surface {
  position: relative;
  display: block;
  padding: var(--board-pad);
  border-radius: 20px;
  background: var(--board-surface);
  box-shadow: inset 0 1px 2px var(--board-surface-shadow), 0 8px 18px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--board-cols), var(--tile));
  grid-auto-rows: var(--tile);
  column-gap: var(--gapX);
  row-gap: var(--gapY);
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border-radius: 18px;
  box-shadow: none;
  border: none;
  margin: 0 auto;
  width: fit-content;
}
.board > .cell { z-index: 1; }
.board-surface svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.board { z-index: 1; }
.cell {
  width: var(--tile);
  height: var(--tile);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1em;
  color: #1f2d5c;
  position: relative;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.cell:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.12); }
.cell.intimidad    { background-color: var(--color-intimidad); }
.cell.bdsm         { background-color: var(--color-bdsm); color: #fff; }
.cell.exploratoria { background-color: var(--color-exploratoria); }
.cell.impersonal   { background-color: var(--color-impersonal); }
.cell.special { background-color: #fff3e6; border: 2px solid #f5a623; }
.cell.start {
  background: transparent;
  border: none;
  color: #d00203;
  font-weight: bold;
}
.cell.impacto { animation: pop 0.3s ease; }
.cell.current {
  animation: pulseCell 2s infinite;
  box-shadow:
    0 0 0 6px rgba(255,255,255,0.7),
    0 6px 16px rgba(0,0,0,0.16);
  transform: translateY(-2px);
}
.cell.placeholder {
  visibility: hidden;
  pointer-events: none;
}

.cell > span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: translateY(-1px);
  padding: 0;
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Palatino", "Book Antiqua", "Georgia", serif;
  font-weight: 600;
  color: var(--number-color);
  font-size: clamp(22px, 2.8vw, 34px);
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  filter: none !important;
  opacity: 1;
  outline: none;
  z-index: 1;
}

.tile-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-width: none;
  z-index: 0;
  pointer-events: none;
}

/* Intimidad: usar PNG como silueta en lugar de círculo */
.cell.intimidad {
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
}
.cell.intimidad::before {
  content: none;
}
.cell.intimidad span {
  color: inherit;
}
.cell.intimidad:hover::before {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 6px 12px rgba(255, 143, 171, 0.4));
}
.cell.intimidad:active::before {
  transform: translateY(0) scale(0.98);
  filter: drop-shadow(0 3px 8px rgba(255, 143, 171, 0.45));
}
.cell.intimidad.current::before {
  animation: pulseIntimidad 1.5s infinite ease-in-out;
}
.cell.intimidad .token { z-index: 3; }

/* BDSM: usar PNG de aro con efectos en la silueta */
.cell.bdsm {
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
  color: #fff;
}
.cell.bdsm::before {
  content: none;
}
.cell.bdsm span {
  color: var(--number-color);
}
.cell.bdsm:hover::before {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 6px 12px rgba(47, 38, 117, 0.35));
}
.cell.bdsm:active::before {
  transform: translateY(0) scale(0.98);
  filter: drop-shadow(0 3px 8px rgba(47, 38, 117, 0.45));
}
.cell.bdsm.current::before {
  animation: pulseBdsm 1.5s infinite ease-in-out;
}
.cell.bdsm .token { z-index: 3; }

/* Impersonal: usar PNG (sombrero) y posicionar número en la parte superior */
.cell.impersonal {
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
}
.cell.impersonal::before {
  content: none;
}
.cell.impersonal span {
  color: inherit;
}
.cell.impersonal:hover::before {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 6px 12px rgba(20, 137, 128, 0.35));
}
.cell.impersonal:active::before {
  transform: translateY(0) scale(0.98);
  filter: drop-shadow(0 3px 8px rgba(20, 137, 128, 0.45));
}
.cell.impersonal.current::before {
  animation: pulseImpersonal 1.5s infinite ease-in-out;
}
.cell.impersonal .token { z-index: 3; }

/* Exploratoria: usar PNG y centrar número en la lente central */
.cell.exploratoria {
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
}
.cell.exploratoria::before {
  content: none;
}
.cell.exploratoria span {
  color: inherit;
}
.cell.exploratoria:hover::before {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 6px 12px rgba(193, 120, 9, 0.38));
}
.cell.exploratoria:active::before {
  transform: translateY(0) scale(0.98);
  filter: drop-shadow(0 3px 8px rgba(193, 120, 9, 0.45));
}
.cell.exploratoria.current::before {
  animation: pulseExploratoria 1.5s infinite ease-in-out;
}
.cell.exploratoria .token { z-index: 3; }
.token {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--token-fill);
  border: 1px solid var(--token-stroke);
  box-shadow: none;
  animation: pulse 1.5s infinite ease-in-out;
  transition: transform 0.15s cubic-bezier(.68,-0.55,.27,1.55);
  z-index: 3;
}
.token.is-active {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
  animation: tokenPulse 1.4s ease-in-out infinite;
}
.token.pos-0 { top: 15px; left: 15px; }
.token.pos-1 { top: 15px; right: 15px; }
.token.pos-2 { bottom: 15px; left: 15px; }
.token.pos-3 { bottom: 15px; right: 15px; }
.token.pos-4 { top: 15px; left: 50%; transform: translate(-50%, 0); }
.token.pos-5 { bottom: 15px; left: 50%; transform: translate(-50%, 0); }
.token.pos-6 { top: 50%; left: 15px; transform: translate(0, -50%); }
.token.pos-7 { top: 50%; right: 15px; transform: translate(0, -50%); }

#game { width: 100%; box-sizing: border-box; margin: 0 auto; }
.game-surface {
  width: min(100%, var(--board-surface-width));
  margin: 0 auto;
  padding: 18px 16px 22px;
  border-radius: 22px;
  background: var(--master-surface);
  border: 1px solid #dedbe8;
  box-shadow:
    inset 0 1px 3px rgba(255,255,255,0.7),
    0 12px 26px rgba(32, 32, 45, 0.22);
  box-sizing: border-box;
}

#dice .dice-number, #dice #diceNumber, #dice #diceValue { display: none !important; }
#dice { color: transparent !important; text-shadow: none !important; }

.timer-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e6e9f4;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.timer-time {
  font-weight: 700;
  font-size: 1.05em;
  letter-spacing: 0.5px;
  color: #1f2d5c;
  min-width: 54px;
  text-align: center;
}
.timer-actions { display: flex; gap: 6px; }
.timer-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #dbe0ea;
  background: linear-gradient(145deg, #f8f9ff 0%, #eef1ff 100%);
  color: #1f2d5c;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.timer-btn:hover { box-shadow: 0 6px 12px rgba(0,0,0,0.12); }
.timer-btn:active { transform: translateY(1px) scale(0.98); }

.instructions-screen {
  display: none;
  background: #2a2a27;
  border: 1px solid #3a3835;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  padding: 24px;
  max-width: 640px;
  margin: 40px auto;
  box-sizing: border-box;
}
.instructions-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.4em;
  font-weight: 500;
  margin-bottom: 16px;
  color: #e8e4df;
  letter-spacing: 0.5px;
}
.instructions-box {
  max-height: 320px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid #3a3835;
  border-radius: 12px;
  background: #1a1a18;
  line-height: 1.6;
  font-size: 0.92em;
  color: #a8a49d;
}
.instructions-box p { margin: 0 0 12px 0; }
.instructions-box p:last-child { margin-bottom: 0; }
.instructions-box::-webkit-scrollbar { width: 6px; }
.instructions-box::-webkit-scrollbar-track { background: transparent; }
.instructions-box::-webkit-scrollbar-thumb { background: #3a3835; border-radius: 3px; }
.instructions-box::-webkit-scrollbar-thumb:hover { background: #4a4845; }
.instructions-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.instructions-actions .left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #a8a49d;
  font-size: 0.9em;
}
.instructions-actions .left input[type="checkbox"] {
  accent-color: #c9a96e;
  width: 18px;
  height: 18px;
}
.instructions-actions button {
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  background: #c9a96e;
  color: #1a1a18;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: background-color 0.2s ease;
}
.instructions-actions button:hover { background-color: #d4b87a; }
.instructions-actions button.secondary {
  background: transparent;
  color: #a8a49d;
  border: 1px solid #3a3835;
}
.instructions-actions button.secondary:hover {
  border-color: #c9a96e;
  color: #c9a96e;
}

.footer{
  max-width: 920px;
  margin: 28px auto 0 auto;
  padding: 14px 10px;
  font-size: 0.8em;
  color: #666;
  border-top: 1px solid rgba(0,0,0,0.06);
}

@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes pulseCell { 0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0.2); } 50% { box-shadow: 0 0 0 6px rgba(0,0,0,0.05); } }
@keyframes pulseIntimidad {
  0%   { filter: drop-shadow(0 0 0 rgba(255, 143, 171, 0)); }
  50%  { filter: drop-shadow(0 0 14px rgba(255, 143, 171, 0.5)); }
  100% { filter: drop-shadow(0 0 0 rgba(255, 143, 171, 0)); }
}
@keyframes pulseBdsm {
  0%   { filter: drop-shadow(0 0 0 rgba(47, 38, 117, 0)); }
  50%  { filter: drop-shadow(0 0 14px rgba(47, 38, 117, 0.5)); }
  100% { filter: drop-shadow(0 0 0 rgba(47, 38, 117, 0)); }
}
@keyframes pulseImpersonal {
  0%   { filter: drop-shadow(0 0 0 rgba(20, 137, 128, 0)); }
  50%  { filter: drop-shadow(0 0 14px rgba(20, 137, 128, 0.45)); }
  100% { filter: drop-shadow(0 0 0 rgba(20, 137, 128, 0)); }
}
@keyframes pulseExploratoria {
  0%   { filter: drop-shadow(0 0 0 rgba(193, 120, 9, 0)); }
  50%  { filter: drop-shadow(0 0 14px rgba(193, 120, 9, 0.45)); }
  100% { filter: drop-shadow(0 0 0 rgba(193, 120, 9, 0)); }
}
@keyframes tokenPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.75); }
  50% { box-shadow: 0 0 0 4px rgba(255,255,255,0.95); }
}

@media (max-width: 900px) {
  :root {
    --board-max: 100%;
    --layout-max: 100%;
    --board-cols: 6;
    --tile: clamp(56px, 10vw, 74px);
    --gapX: clamp(10px, 2.6vw, 16px);
    --gapY: clamp(12px, 3vw, 18px);
  }
  body { padding: 14px 10px 16px; }
  :root { --page-pad: 10px; }
  .top-row { padding: 14px 12px 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.08); }
  .board {
    max-width: 100%;
    width: 100%;
    grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr));
  }
  .cell {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .board-surface { overflow: hidden; }
  .board-legend { padding: 8px 10px; }
  .board-legend__content { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
}

@media (max-width: 700px) {
  :root {
    --board-cols: 5;
    --gapX: clamp(6px, 2vw, 10px);
    --gapY: clamp(8px, 2.5vw, 12px);
    --board-pad: clamp(12px, 3vw, 18px);
  }
}

@media (max-width: 540px) {
  :root {
    --card-max: 100%;
    --board-cols: 5;
    --tile: clamp(48px, 12vw, 64px);
    --gapX: clamp(8px, 2.6vw, 12px);
    --gapY: clamp(10px, 3vw, 14px);
    --board-pad: clamp(12px, 3vw, 18px);
  }
  body { padding: 10px 8px 14px; }
  :root { --page-pad: 8px; }
  .top-row { gap: 12px; padding: 12px 8px 10px; }
  #turnIndicator { font-size: 1.05em; gap: 6px; }
  .turn-label { width: 100%; }
  .players-panel { width: 100%; max-width: 340px; }
  .board { max-width: 100%; }
  .board-legend__content { grid-template-columns: 1fr; }
}

/* ============== TARJETA EMERGENTE MEJORADA ============== */
.card-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
}

.card-overlay.active {
  display: block !important;
  pointer-events: auto;
}

.card-popup {
  width: 90vw;
  max-width: 400px;
  height: 250px;
  max-height: 250px;
  background: #faf6f1;
  border-radius: 18px;
  padding: 6px;
  opacity: 0;
  border: 2.5px solid var(--category-color, #ccc);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  transform-origin: center center;
  transform: scale(0.1);
  transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Borde interior (doble borde) */
.card-popup::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 7px;
  right: 7px;
  bottom: 7px;
  border: 1.5px solid var(--category-color, #ccc);
  border-radius: 12px;
  pointer-events: none;
  opacity: 0.5;
}

/* Adorno circular superior */
.card-popup::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #faf6f1;
  border: 2px solid var(--category-color, #ccc);
  z-index: 2;
}

.card-overlay.active .card-popup {
  opacity: 1;
  transform: scale(1);
}

.card-popup__header {
  padding: 14px 24px 4px;
  position: relative;
  flex-shrink: 0;
}

/* Adorno circular inferior (via header pseudo-element para no usar el ::after del popup) */
.card-popup__footer::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #faf6f1;
  border: 2px solid var(--category-color, #ccc);
  z-index: 2;
}

.category-label {
  font-size: 1.1em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  color: var(--category-color, #333);
}

.category-label::after {
  display: none;
}

.card-popup__body {
  padding: 4px 20px 6px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.challenge-text {
  font-size: 1em;
  line-height: 1.5;
  text-align: center;
  color: #4a4440;
  width: 100%;
}

.card-popup__footer {
  padding: 0 24px 10px;
  display: flex;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.close-button {
  background: transparent !important;
  background-color: transparent !important;
  color: #bbb !important;
  border: none !important;
  padding: 6px 16px !important;
  width: auto !important;
  border-radius: 8px;
  font-size: 0.8em;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.5px;
  pointer-events: auto;
  transition: none !important;
}

.close-button:hover {
  background: transparent !important;
  background-color: transparent !important;
  color: #bbb !important;
}

.card-popup.intimidad {
  --category-color: #a0605e;
}

.card-popup.bdsm {
  --category-color: #7a7087;
}

.card-popup.exploratoria {
  --category-color: #c17809;
}

.card-popup.impersonal {
  --category-color: #5a9e97;
}

/* ============== PICTOGRAMA INSTRUCCIONES ============== */
.hero-logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
}

.info-btn {
  width: 28px !important;
  height: 28px;
  border-radius: 50%;
  background: transparent !important;
  background-color: transparent !important;
  border: 1.5px solid #c5cbd1 !important;
  color: #999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 !important;
  transition: none !important;
  flex-shrink: 0;
}

.info-btn:hover {
  background: transparent !important;
  background-color: transparent !important;
  border-color: #999 !important;
  color: #666;
}

.info-btn svg {
  width: 16px;
  height: 16px;
}

.instructions-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
  width: 100%;
}

.instructions-panel.open {
  max-height: 500px;
  opacity: 1;
}

.instructions-panel__content {
  background: #faf6f1;
  border: 1px solid #e8e0d6;
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 0.85em;
  line-height: 1.55;
  color: #4a4440;
  max-height: 280px;
  overflow-y: auto;
}

.instructions-panel__content p {
  margin: 0 0 10px 0;
}

.instructions-panel__content p:last-child {
  margin-bottom: 0;
}

/* ============== TUTORIAL INTERACTIVO ============== */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 200000;
  pointer-events: auto;
}

.tutorial-spotlight {
  position: fixed;
  z-index: 200001;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.72);
  transition: top 0.4s ease, left 0.4s ease, width 0.4s ease, height 0.4s ease;
  pointer-events: none;
}

.tutorial-tooltip {
  position: fixed;
  z-index: 200002;
  max-width: 320px;
  width: calc(100vw - 32px);
  background: #2a2a27;
  border: 1px solid #3a3835;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transition: top 0.4s ease, left 0.4s ease, opacity 0.3s ease;
}

.tutorial-step-counter {
  font-size: 0.75em;
  color: #c9a96e;
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.tutorial-text {
  font-size: 0.95em;
  line-height: 1.6;
  color: #e8e4df;
  margin: 0 0 16px 0;
  font-weight: 300;
}

.tutorial-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tutorial-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tutorial-btn-back {
  background: transparent !important;
  color: #a8a49d !important;
  border: 1px solid #3a3835 !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  font-size: 0.9em !important;
  cursor: pointer !important;
  width: auto !important;
  line-height: 1 !important;
  transition: border-color 0.2s ease, color 0.2s ease !important;
}
.tutorial-btn-back:hover {
  border-color: #c9a96e !important;
  color: #c9a96e !important;
  background: transparent !important;
}
.tutorial-btn-back:disabled {
  opacity: 0.3 !important;
  cursor: default !important;
}
.tutorial-btn-back:disabled:hover {
  border-color: #3a3835 !important;
  color: #a8a49d !important;
}

.tutorial-btn-skip {
  background: transparent !important;
  color: #6e6b65 !important;
  border: none !important;
  padding: 8px 4px !important;
  font-size: 0.85em !important;
  cursor: pointer !important;
  width: auto !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  transition: color 0.2s ease !important;
}
.tutorial-btn-skip:hover {
  color: #a8a49d !important;
  background: transparent !important;
}

.tutorial-btn-next {
  background: #c9a96e !important;
  color: #1a1a18 !important;
  border: none !important;
  padding: 10px 22px !important;
  border-radius: 10px !important;
  font-size: 0.9em !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  width: auto !important;
  letter-spacing: 0.3px !important;
  transition: background-color 0.2s ease !important;
}
.tutorial-btn-next:hover {
  background: #d4b87a !important;
}

.tutorial-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78em;
  color: #6e6b65;
  font-weight: 400;
  cursor: pointer;
}
.tutorial-remember input[type="checkbox"] {
  accent-color: #c9a96e;
  width: 14px;
  height: 14px;
}

@media (max-width: 700px) {
  .tutorial-tooltip {
    max-width: calc(100vw - 24px);
    left: 12px !important;
    right: 12px;
  }
}
