/* =========================================================
   Party Games Hub · estilos
   Tema oscuro con un color de acento por juego (--game),
   que app.js activa con <body data-game="...">.
   ========================================================= */
:root {
  --bg-dark: #0c1222;
  --bg-deep: #070b16;
  --bg-card: rgba(23, 32, 54, 0.78);
  --bg-card-border: rgba(255, 255, 255, 0.09);
  --bg-inset: rgba(0, 0, 0, 0.28);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --accent-red: #ef4444;
  --text-main: #f4f6fb;
  --text-muted: #94a3b8;
  --font-sans: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 22px;
  --game: #6366f1;
  --game-2: #a855f7;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 12px 32px rgba(0, 0, 0, 0.38);
}

/* Acento por juego */
body[data-game="spyfall"]      { --game: #6366f1; --game-2: #38bdf8; }
body[data-game="undercover"]   { --game: #ec4899; --game-2: #f97316; }
body[data-game="wavelength"]   { --game: #06b6d4; --game-2: #6366f1; }
body[data-game="timesup"]      { --game: #f59e0b; --game-2: #ef4444; }
body[data-game="justone"]      { --game: #10b981; --game-2: #06b6d4; }
body[data-game="mostlikely"]   { --game: #a855f7; --game-2: #ec4899; }
body[data-game="smart10"]      { --game: #14b8a6; --game-2: #6366f1; }
body[data-game="riddles"]      { --game: #8b5cf6; --game-2: #06b6d4; }
body[data-game="blackstories"] { --game: #e11d48; --game-2: #7c3aed; }

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea { user-select: text; -webkit-user-select: text; }

html { background: var(--bg-deep); }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(120% 60% at 0% 0%, color-mix(in srgb, var(--game) 26%, transparent) 0%, transparent 60%),
    radial-gradient(90% 50% at 100% 100%, color-mix(in srgb, var(--game-2) 20%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-dark), var(--bg-deep));
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s;
}

#app-container {
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(30px + env(safe-area-inset-bottom));
  position: relative;
}

h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }

/* ---------- Cabecera ---------- */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -16px 18px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, rgba(12, 18, 34, 0.92), rgba(12, 18, 34, 0.7));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--game), var(--game-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--game) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: background 0.3s;
}

.logo-text { min-width: 0; }

.logo-text h1 {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-text span {
  font-size: 0.68rem;
  color: color-mix(in srgb, var(--game) 55%, white);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  border-radius: 13px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.12s, background-color 0.2s;
}

.icon-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- Tarjetas y botones ---------- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  position: relative;
  animation: cardIn 0.28s cubic-bezier(.2, .8, .2, 1);
}

/* Filo de color arriba de cada tarjeta dentro de un juego */
body[data-game] .card::before {
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--game), var(--game-2), transparent);
  opacity: 0.9;
}

.card h2 {
  font-size: 1.4rem !important;
  font-weight: 800;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 1.04rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  color: white;
  position: relative;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.2s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 6px 18px rgba(0, 0, 0, 0.25);
}

.btn:active {
  transform: translateY(2px) scale(0.985);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.25);
  filter: brightness(1.08);
}

.btn + .btn { margin-top: 0; }

.btn-sm {
  width: auto;
  min-height: 0;
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: 12px;
}

.btn-primary {
  background: var(--game);
  background: linear-gradient(135deg, var(--game), color-mix(in srgb, var(--game) 55%, var(--game-2)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 8px 22px color-mix(in srgb, var(--game) 40%, transparent);
}

.btn-accent {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 8px 22px rgba(236, 72, 153, 0.38);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 8px 22px rgba(16, 185, 129, 0.32);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 8px 22px rgba(245, 158, 11, 0.32);
}

/* ---------- Menú principal ---------- */
.game-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-item {
  --c: var(--primary);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--c) 16%, transparent), transparent 55%),
    var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--c) 22%, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius);
  padding: 14px 14px 14px 14px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: cardIn 0.35s cubic-bezier(.2, .8, .2, 1) backwards;
}

.game-item:nth-child(2) { animation-delay: 0.03s; }
.game-item:nth-child(3) { animation-delay: 0.06s; }
.game-item:nth-child(4) { animation-delay: 0.09s; }
.game-item:nth-child(5) { animation-delay: 0.12s; }
.game-item:nth-child(6) { animation-delay: 0.15s; }
.game-item:nth-child(7) { animation-delay: 0.18s; }
.game-item:nth-child(8) { animation-delay: 0.21s; }
.game-item:nth-child(9) { animation-delay: 0.24s; }

.game-item:active {
  transform: scale(0.975);
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
}

/* Flecha a la derecha */
.game-item::after {
  content: '›';
  font-size: 1.6rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--c) 60%, white);
  opacity: 0.55;
  padding-left: 2px;
}

.game-item.spyfall      { --c: #6366f1; }
.game-item.undercover   { --c: #ec4899; }
.game-item.wavelength   { --c: #06b6d4; }
.game-item.timesup      { --c: #f59e0b; }
.game-item.justone      { --c: #10b981; }
.game-item.mostlikely   { --c: #a855f7; }
.game-item.smart10      { --c: #14b8a6; }
.game-item.riddles      { --c: #8b5cf6; }
.game-item.blackstories { --c: #e11d48; }

.game-icon-box {
  font-size: 30px;
  min-width: 58px;
  height: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  background: var(--c);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 85%, white 0%), color-mix(in srgb, var(--c) 55%, black));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 8px 18px color-mix(in srgb, var(--c) 35%, transparent);
}

.game-info {
  flex: 1;
  min-width: 0;
}

.game-title {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.game-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 8px;
}

.game-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.badge {
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 4px 9px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
  display: inline-block;
}

.game-badges .badge {
  background: color-mix(in srgb, var(--c) 14%, rgba(255, 255, 255, 0.04));
  color: color-mix(in srgb, var(--c) 35%, #dbe3ee);
}

.badge.hot {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #1a1203;
  border: none;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

button.badge {
  cursor: pointer;
  padding: 8px 14px;
  font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.1s;
}

button.badge:active { transform: scale(0.94); }

/* ---------- Vistas ---------- */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Amigos ---------- */
.players-manager {
  margin-top: 18px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.player-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-tag .remove-tag {
  color: var(--accent-red);
  cursor: pointer;
  font-weight: bold;
}

/* ---------- Carta secreta (Pass & Play) ---------- */
.secret-card-container {
  min-height: 270px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 12px, transparent 12px 24px),
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--game) 22%, transparent), transparent 65%),
    rgba(9, 14, 28, 0.95);
  border: 2px dashed color-mix(in srgb, var(--game) 45%, rgba(255, 255, 255, 0.2));
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.15s;
  margin: 18px 0;
}

.secret-card-container:active { transform: scale(0.985); }

.secret-card-container.revealed {
  border-style: solid;
  border-color: var(--game);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--game) 25%, transparent), transparent 70%), rgba(20, 28, 48, 0.98);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--game) 15%, transparent), 0 0 40px color-mix(in srgb, var(--game) 35%, transparent);
  animation: flipIn 0.35s cubic-bezier(.2, .8, .2, 1);
}

.secret-card-container.spy-revealed {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15), 0 0 40px rgba(239, 68, 68, 0.4);
}

@keyframes flipIn {
  from { transform: perspective(700px) rotateY(-70deg); opacity: 0.3; }
  to { transform: none; opacity: 1; }
}

.big-emoji {
  font-size: 64px;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  animation: bounce 1.2s ease-in-out infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

/* ---------- Temporizador ---------- */
.timer-box {
  text-align: center;
  padding: 20px 18px;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--game) 18%, transparent), transparent 70%), var(--bg-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  margin-bottom: 16px;
}

.timer-digits {
  font-size: 3.8rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-main);
  text-shadow: 0 0 24px color-mix(in srgb, var(--game) 55%, transparent);
}

.timer-digits.urgent {
  color: var(--accent-red);
  text-shadow: 0 0 24px rgba(239, 68, 68, 0.6);
  animation: pulse 0.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

/* Palabra de Time's Up */
#timesup-word {
  font-size: 2.1rem !important;
  letter-spacing: -0.03em;
  line-height: 1.15;
  animation: cardIn 0.25s cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Bloques comunes de fase ---------- */
.eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 16px;
}

.stat-big {
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: color-mix(in srgb, var(--game) 70%, white);
}

.phase-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 10px 0 4px;
}

.phase-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

.pill-warn {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--game) 20%, transparent);
  color: color-mix(in srgb, var(--game) 45%, white);
  border: 1px solid color-mix(in srgb, var(--game) 45%, transparent);
}

/* ---------- Wavelength: dial semicircular ---------- */
.dial-panel {
  background: radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--game) 16%, transparent), transparent 70%), var(--bg-inset);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  padding: 16px 14px 14px;
  margin: 12px 0 16px;
}

.wave-dial {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.wave-dial.draggable {
  touch-action: none;
  cursor: grab;
}

.wave-dial.draggable:active { cursor: grabbing; }

.wd-face {
  fill: #18223a;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.wd-band { stroke: rgba(7, 11, 22, 0.55); stroke-width: 0.8; }
.wd-band.b2 { fill: #f59e0b; }
.wd-band.b3 { fill: #f97316; }
.wd-band.b4 { fill: #06b6d4; }

.wd-bands.reveal {
  animation: bandsIn 0.6s cubic-bezier(.2, .8, .2, 1);
  transform-origin: 100px 104px;
}

@keyframes bandsIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

.wd-num {
  fill: #0b1222;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
}

.wd-tick { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; stroke-linecap: round; }

.wd-rim {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 2;
}

.wd-needle line {
  stroke: #fb3b5e;
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(251, 59, 94, 0.7));
}

.wd-tip { fill: #fb3b5e; stroke: #fff; stroke-width: 1.5; }

.wd-hub {
  fill: #fb3b5e;
  stroke: #fff;
  stroke-width: 2.5;
}

.dial-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.dial-ends span {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.dial-ends span:first-child { text-align: left; color: #7dd3fc; }
.dial-ends span:last-child { text-align: right; color: #f9a8d4; }

.dial-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.4;
}

.wave-pts-chip {
  display: inline-block;
  min-width: 84px;
  font-size: 2.2rem;
  font-weight: 900;
  padding: 6px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  animation: popIn 0.45s cubic-bezier(.3, 1.6, .5, 1);
}

.wave-pts-chip.pts-4 { background: linear-gradient(135deg, #06b6d4, #6366f1); color: #fff; box-shadow: 0 8px 26px rgba(6, 182, 212, 0.45); }
.wave-pts-chip.pts-3 { background: linear-gradient(135deg, #f97316, #ec4899); color: #fff; box-shadow: 0 8px 26px rgba(249, 115, 22, 0.4); }
.wave-pts-chip.pts-2 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1203; box-shadow: 0 8px 26px rgba(245, 158, 11, 0.4); }

@keyframes popIn {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Dial antiguo (por compatibilidad) */
.dial-container {
  position: relative;
  width: 100%;
  padding-bottom: 60%;
  margin: 20px 0 10px;
}

.dial-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.slider-custom {
  width: 100%;
  margin: 16px 0 4px;
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #f472b6);
  outline: none;
  opacity: 0.85;
}

.slider-custom::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #fb3b5e;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.slider-custom::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #fb3b5e;
  cursor: pointer;
}

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: linear-gradient(180deg, #1a2540, #131b30);
  border: 1px solid var(--bg-card-border);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  max-width: 540px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 14px 22px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.6);
  animation: sheetUp 0.3s cubic-bezier(.2, .8, .2, 1);
}

/* Asa de la hoja inferior */
.modal-content::before {
  content: '';
  display: block;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 auto 14px;
}

@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
}

.modal-body {
  font-size: 0.93rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.modal-body li {
  margin-bottom: 6px;
}

/* ---------- Formularios ---------- */
.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(7, 11, 22, 0.6);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

select option { background: #131b30; }

input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--game);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--game) 22%, transparent);
}

/* ---------- Smart 10 ---------- */
.smart10-slots-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.smart10-slot {
  background: rgba(23, 32, 54, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 11px 14px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.12s, background-color 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.smart10-slot:active {
  transform: scale(0.98);
}

.smart10-slot.unrevealed:hover {
  border-color: var(--game);
  background: rgba(255, 255, 255, 0.08);
}

.smart10-slot-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--game) 22%, rgba(255, 255, 255, 0.06));
  color: color-mix(in srgb, var(--game) 40%, white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 900;
  margin-right: 10px;
  flex-shrink: 0;
}

.smart10-slot-label {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}

.smart10-slot-cover {
  font-size: 0.72rem;
  font-weight: 800;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.smart10-slot.revealed-correct {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10b981;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.22);
  cursor: default;
  animation: popIn 0.3s ease-out;
}

.smart10-slot.revealed-correct .smart10-slot-num {
  background: #10b981;
  color: #04140d;
}

.smart10-slot.revealed-wrong {
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.22);
  cursor: default;
  animation: shake 0.35s ease-out;
}

.smart10-slot.revealed-wrong .smart10-slot-num {
  background: #ef4444;
  color: white;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.smart10-player-chip {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.smart10-player-chip.active {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.16);
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.smart10-player-chip.passed {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
}

.smart10-player-chip.eliminated {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  text-decoration: line-through;
  opacity: 0.6;
}

/* ---------- Varios ---------- */
.offline-banner {
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 10. Lógica y Series ---------- */
body[data-game="logic"] { --game: #f97316; --game-2: #eab308; }
.game-item.logic { --c: #f97316; }
.game-item.whenidream { --c: #6366f1; }
.game-item:nth-child(10) { animation-delay: 0.27s; }

.logic-label { font-size: 0.85rem; font-weight: 700; display: block; margin-bottom: 6px; }
.logic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.logic-chip {
  font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--text-main);
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12);
}
.logic-chip.on { background: var(--game); border-color: var(--game); color: #fff; }
.logic-record { font-size: 0.8rem; color: var(--accent-amber, #f59e0b); font-weight: 700; margin: 4px 0 12px; min-height: 1em; }

.logic-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.logic-progress { font-weight: 800; font-size: 0.9rem; }
.logic-turn { font-size: 0.82rem; font-weight: 700; color: var(--game); text-align: right; }
.logic-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-bottom: 12px; }
.logic-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--game), var(--game-2)); transition: width 0.3s; }
.logic-tags { display: flex; gap: 6px; margin-bottom: 10px; }
.logic-diff[data-diff="Fácil"] { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.logic-diff[data-diff="Medio"] { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.logic-diff[data-diff="Difícil"] { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.logic-q {
  background: rgba(0, 0, 0, 0.3); border-radius: 16px; padding: 18px 16px; margin-bottom: 14px;
  font-size: 1.15rem; font-weight: 700; line-height: 1.45; text-align: center; overflow-wrap: anywhere;
}
.logic-q b { color: var(--game); }
.logic-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.logic-opt {
  font: inherit; font-size: 1.05rem; font-weight: 800; color: var(--text-main);
  min-height: 56px; padding: 10px 8px; border-radius: 14px; cursor: pointer; overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 0.1s, background 0.2s;
}
.logic-opt:active { transform: scale(0.97); }
.logic-opt:disabled { cursor: default; opacity: 0.55; }
.logic-opt.ok { background: rgba(16, 185, 129, 0.3); border-color: #10b981; opacity: 1; }
.logic-opt.ko { background: rgba(239, 68, 68, 0.3); border-color: #ef4444; opacity: 1; }
.logic-hint { background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.4); border-radius: 12px; padding: 10px 14px; font-size: 0.88rem; margin: 10px 0; }
.logic-feedback { border-radius: 14px; padding: 12px 14px; font-size: 0.9rem; line-height: 1.5; margin-bottom: 12px; }
.logic-feedback.ok { background: rgba(16, 185, 129, 0.14); border: 1px solid #10b981; }
.logic-feedback.ko { background: rgba(239, 68, 68, 0.14); border: 1px solid #ef4444; }
.logic-fb-title { font-weight: 800; margin-bottom: 4px; }
.logic-big { font-size: 3rem; font-weight: 800; color: var(--game); }
.logic-big span { font-size: 1.3rem; color: var(--text-muted); }
.logic-msg { font-weight: 700; margin-top: 4px; }
.logic-new-record { color: #fcd34d; font-weight: 800; margin-top: 6px; }
.logic-rank { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); margin-bottom: 6px; }
.logic-rank.top { background: color-mix(in srgb, var(--game) 25%, transparent); border: 1px solid var(--game); }
.logic-record a { color: #fdba74; font-weight: 700; }
.logic-diff[data-diff="Experto"] { background: rgba(168, 85, 247, 0.25); color: #d8b4fe; }
.logic-opts.long { grid-template-columns: 1fr; }
.logic-opts.long .logic-opt { font-size: 0.92rem; min-height: 48px; text-align: left; padding: 12px 14px; }
.logic-q.long { font-size: 0.98rem; text-align: left; font-weight: 600; }

/* ---------- Portada: filtros por tipo de partida ---------- */
.hub-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  margin-bottom: 6px;
  scrollbar-width: none;
}
.hub-filters::-webkit-scrollbar { display: none; }

.hub-chip {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-card);
  color: var(--text-main);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s;
}
.hub-chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.hub-filter-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-height: 1.2em;
  margin: 0 4px 12px;
}

.hub-gastos-link {
  display: block;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.hub-projects-link {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--bg-card-border);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

/* ===== Juegos de tablero: 4 en raya y 3 en raya infinito ===== */
body[data-game="cuatro"] { --game: #ef4444; --game-2: #facc15; }
body[data-game="tres"] { --game: #14b8a6; --game-2: #a855f7; }
.game-item.cuatro { --c: #ef4444; }
.game-item.tres { --c: #14b8a6; }

.tab-setup { display: flex; flex-direction: column; gap: 12px; }
.tab-title { margin: 0; font-size: 1.5rem; }
.tab-intro { margin: 0; color: var(--text-muted); line-height: 1.45; }
.tab-label { font-weight: 700; font-size: 0.95rem; margin-top: 6px; }
.tab-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tab-chip {
  flex: 1 1 0; min-height: 48px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--bg-card-border); background: var(--bg-inset);
  color: var(--text-main); font: inherit; font-weight: 600; cursor: pointer;
}
.tab-chip.on { background: var(--game, #6366f1); border-color: transparent; color: #fff; }

.tab-score { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tab-player {
  flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 14px; background: var(--bg-card); border: 2px solid transparent;
  transition: border-color .2s, transform .2s; min-width: 0;
}
.tab-player.p2 { flex-direction: row-reverse; text-align: right; }
.tab-player.turn { border-color: var(--text-main); transform: scale(1.03); }
.tab-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.tab-dot.p1, .c4-disc.p1 { background: radial-gradient(circle at 35% 30%, #fca5a5, #ef4444 55%, #b91c1c); }
.tab-dot.p2, .c4-disc.p2 { background: radial-gradient(circle at 35% 30%, #fef08a, #facc15 55%, #ca8a04); }
body[data-game="tres"] .tab-dot.p1 { background: #14b8a6; }
body[data-game="tres"] .tab-dot.p2 { background: #a855f7; }
.tab-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-points { font-size: 1.5rem; font-weight: 800; }
.tab-draws { font-size: 0.75rem; color: var(--text-muted); text-align: center; min-width: 52px; }

.tab-status { text-align: center; font-size: 1.15rem; font-weight: 700; margin: 6px 0 12px; min-height: 1.6em; }
.tab-status.done { font-size: 1.4rem; color: var(--game-2, #facc15); }
.tab-actions { display: flex; gap: 10px; margin-top: 14px; }
.tab-actions .btn { flex: 1; min-height: 52px; }
.tab-actions .btn:disabled { opacity: .4; }
.tab-link {
  display: block; margin: 14px auto 0; background: none; border: none;
  color: var(--text-muted); font: inherit; text-decoration: underline; padding: 8px; cursor: pointer;
}

/* 4 en raya: cada columna es un botón alto, fácil de acertar con el dedo */
.c4-board {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px;
  background: linear-gradient(180deg, #1d4ed8, #1e3a8a); border-radius: 18px;
  width: min(100%, 460px, calc((100dvh - 290px) * 7 / 6)); margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.c4-col {
  display: grid; grid-template-rows: repeat(6, 1fr); gap: 4px; padding: 0;
  background: none; border: none; border-radius: 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.c4-col:not(:disabled):active { background: rgba(255,255,255,.12); }
.c4-col:disabled { cursor: default; }
.c4-cell {
  aspect-ratio: 1; border-radius: 50%; background: var(--bg-deep);
  box-shadow: inset 0 3px 6px rgba(0,0,0,.6); display: grid; place-items: center; overflow: visible;
}
.c4-disc { width: 88%; height: 88%; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.c4-disc.drop { animation: c4drop calc(.12s + var(--rows) * .05s) cubic-bezier(.5,0,1,1); }
@keyframes c4drop { from { transform: translateY(calc(var(--rows) * -115%)); } to { transform: translateY(0); } }
.c4-disc.win { animation: winglow 0.8s ease-in-out infinite alternate; }
.c4-board.over .c4-disc:not(.win) { opacity: .45; }
@keyframes winglow { from { box-shadow: 0 0 0 3px #fff; } to { box-shadow: 0 0 0 3px #fff, 0 0 18px 6px #fff; } }

/* 3 en raya infinito */
.t3-board {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: min(100%, 380px, calc(100dvh - 330px)); margin: 0 auto;
}
.t3-cell {
  aspect-ratio: 1; border-radius: 18px; border: 1px solid var(--bg-card-border);
  background: var(--bg-card); color: var(--text-main); display: grid; place-items: center;
  font-size: clamp(3rem, 18vw, 5rem); font-weight: 800; padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.t3-cell:disabled { cursor: default; }
.t3-cell:not(:disabled):active { background: var(--bg-inset); }
.t3-cell.win { background: rgba(255,255,255,.14); border-color: #fff; }
.t3-mark { line-height: 1; }
.t3-mark.p1 { color: #2dd4bf; }
.t3-mark.p2 { color: #c084fc; }
.t3-mark.pop { animation: t3pop .25s ease-out; }
.t3-mark.vanishing { animation: t3fade 1s ease-in-out infinite; }
@keyframes t3pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes t3fade { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .c4-disc.drop, .t3-mark.pop { animation: none; }
  .c4-disc.win { animation: none; box-shadow: 0 0 0 3px #fff; }
  .t3-mark.vanishing { animation: none; opacity: .4; }
}
