/* Componentes de: multijugador local, caras y bocadillos de los bots, formas de accesibilidad,
   vista previa de la jugada, tutorial, ajustes / estadísticas, avisos y transiciones. */

/* ---------- menú: tres botones de la misma altura ---------- */
.mActions .mBtn { min-height: 50px; }
.mActions .mRow { align-items: stretch; }
.mBtn.continue { padding-block: 6px; }
.mBtn.continue .cTxt { gap: 1px; }

/* ---------- menú: entrada animada ---------- */
body.menuIntro[data-screen="menu"]:not(.loading) .mFrame { animation: menuFrameIn .6s var(--ease-out) both; }
body.menuIntro[data-screen="menu"]:not(.loading) .mArt svg { animation: menuArtIn 1.1s var(--ease-out) both; transform-origin: 60% 45%; }
body.menuIntro[data-screen="menu"]:not(.loading) .mTitle .l1 { animation: titleIn .7s .12s var(--ease-out) both; }
body.menuIntro[data-screen="menu"]:not(.loading) .mTitle .l2 { animation: titleIn .7s .22s var(--ease-out) both; }
body.menuIntro[data-screen="menu"]:not(.loading) .mTitle .l2::after { animation: dotDrop .5s .75s cubic-bezier(.3,1.6,.5,1) both; }
body.menuIntro[data-screen="menu"]:not(.loading) .mActions > *, body.menuIntro[data-screen="menu"]:not(.loading) .mRow > * { animation: btnUp .45s var(--ease-out) both; }
body.menuIntro[data-screen="menu"]:not(.loading) .mActions > :nth-child(1) { animation-delay: .38s; }
body.menuIntro[data-screen="menu"]:not(.loading) .mRow > :nth-child(1) { animation-delay: .46s; }
body.menuIntro[data-screen="menu"]:not(.loading) .mRow > :nth-child(2) { animation-delay: .54s; }
body.menuIntro[data-screen="menu"]:not(.loading) .mTag { animation: fadeIn .6s .7s both; }
body.menuIntro[data-screen="menu"]:not(.loading) .mBottom { animation: fadeIn .5s .8s both; }
@keyframes menuFrameIn { from { transform: translateY(18px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes menuArtIn { from { transform: scale(1.08); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes titleIn { from { transform: translateY(.35em); opacity: 0; clip-path: inset(0 0 100% 0); } to { transform: none; opacity: 1; clip-path: inset(0 0 -20% 0); } }
@keyframes dotDrop { from { transform: translateY(-1.2em) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- transición entre pantallas ---------- */
/* La presentación completa (menú escalonado, tarjetas que suben) solo la primera vez que se ve cada pantalla
   (body.menuIntro hasta salir del menú; .revisit en las demás): al volver, un fundido corto y todo a la vista
   enseguida. Así navegar deprisa no deja pantallas a medio aparecer. */
/* (el fundido de entrada lo anima showScreen con Web Animations: sin forzar la maquetación) */
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body:not(.menuIntro) .mFrame { animation: none; }
.revisit .lvlCard, .revisit #pveCard, .revisit .deckCard { animation: none; }
body:not(.menuIntro)[data-screen="menu"] .dDone { animation-delay: .15s !important; }
body:not(.menuIntro)[data-screen="menu"] .dFlame.ignite, body:not(.menuIntro)[data-screen="menu"] .dFlame.ignite .i { animation-delay: .25s !important; }
@keyframes screenFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- movimiento reducido (ajuste del juego o del sistema) ---------- */
html.reduceMotion *, html.reduceMotion *::before, html.reduceMotion *::after {
  animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}
html.reduceMotion #turnBanner { display: none; }
html.reduceMotion .portalRing, html.reduceMotion .portalCore { animation: none !important; }
html.reduceMotion .portalRing { opacity: .5; } html.reduceMotion .portalRing:nth-child(1) { transform: scale(.35); } html.reduceMotion .portalRing:nth-child(2) { transform: scale(.68); }

/* ---------- avatares con cara (bots) y formas de accesibilidad ---------- */
.avatar { position: relative; }
.avatar.hasFace { padding: 0; }
.avatar .face { width: 88%; height: 88%; display: block; }
.avatar.lg { width: 76px; height: 76px; font-size: 22px; box-shadow: 0 3px 9px var(--shadow), inset -5px -5px 0 rgba(0,0,0,.1), inset 5px 5px 0 rgba(255,255,255,.18); }
.shp { display: none; }
html.cbShapes .shp { display: block; }
html.cbShapes .avatar .shp {
  position: absolute; right: -4px; bottom: -4px; width: 15px; height: 15px; padding: 2px;
  color: var(--ink); background: var(--cream); border-radius: 50%; box-shadow: 0 1px 2px var(--shadow);
}
html.cbShapes .avatar.xs .shp { width: 11px; height: 11px; padding: 1.5px; right: -3px; bottom: -3px; }
html.cbShapes .tile-ball .circ .shp {
  position: absolute; left: 50%; top: -2px; width: 34%; height: 34%; transform: translate(-50%, -30%);
  color: var(--ink); background: #fff; border-radius: 50%; padding: 5%; box-shadow: 0 1px 2px var(--shadow);
}

/* ---------- bocadillos de los bots ---------- */
.bubble {
  --pc: var(--ink);
  position: fixed; left: 0; top: 0; z-index: 38; pointer-events: none;
  max-width: 180px; padding: 7px 12px; border-radius: 14px;
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: -.005em; line-height: 1.2;
  box-shadow: 0 0 0 1.5px var(--pc), 0 2.4px 7.2px var(--shadow);
  animation: bubbleIn .28s cubic-bezier(.3,1.5,.5,1) both;
}
.bubble::after { /* rabito hacia el avatar */
  content: ''; position: absolute; left: -6px; top: calc(50% - 5px); width: 10px; height: 10px; background: #fff;
  box-shadow: -1.5px 1.5px 0 0 var(--pc); transform: rotate(45deg);
}
.bubble[data-side="top"]::after { left: calc(50% - 5px); top: auto; bottom: -5px; box-shadow: 1.5px 1.5px 0 0 var(--pc); }
.bubble[data-side="below"]::after { left: 14px; top: -5px; box-shadow: -1.5px -1.5px 0 0 var(--pc); }
.bubble.hit, .bubble.fall { background: #FFF3EC; }
.bubble.hit::after, .bubble.fall::after { background: #FFF3EC; }
.bubble.out { opacity: 0; transition: opacity .3s; }
.bubble.still { animation: none; }
@keyframes bubbleIn { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }

/* ---------- multijugador local: asientos y pantalla de pasar el dispositivo ---------- */
.seatReact { margin-top: 6px; padding: 3px 11px; font-size: 11.5px; --b-line: var(--accent); --b-bg: rgba(232,135,58,.12); }
.seatReact:hover { background-color: rgba(232,135,58,.25); }
#passScreen {
  --pc: var(--accent);
  position: fixed; inset: 0; z-index: 44; display: none; align-items: center; justify-content: center; padding: 20px;
  background-image: var(--grain), radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--pc) 45%, #2B4E42), #1D3A2E 75%);
}
#passScreen.visible { display: flex; animation: fadeIn .25s var(--ease-out); }
.passCard {
  width: min(420px, 100%); text-align: center; padding: 34px 28px 24px; border-radius: 22px;
  background-image: var(--grain); background-color: var(--cream);
  box-shadow: 0 30px 70px rgba(10,25,10,.4), 0 0 0 2px var(--pc);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: winPop .35s var(--ease-out);
}
.passCard h2 { font-size: 28px; font-weight: 500; letter-spacing: -.035em; line-height: 1.05; margin-top: 6px; }
.passCard p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.4; max-width: 30ch; }
.passCard .btn-primary { margin-top: 8px; width: 100%; }
.passCard .avatar.lg { animation: passBob 2.4s ease-in-out infinite; }
@keyframes passBob { 50% { transform: translateY(-5px); } }

/* ---------- vista previa de la jugada ---------- */
#previewSvg { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; overflow: visible; opacity: 0; transition: opacity .12s; }
#previewSvg.visible { opacity: 1; }
#previewSvg .pvLine { fill: none; stroke: var(--pc); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 8; filter: drop-shadow(0 0 1.5px rgba(255,255,255,.95)) drop-shadow(0 0 1px rgba(255,255,255,.9)); }
#previewSvg .pvLine.fall { stroke: var(--accent-deep); stroke-dasharray: 5 6; }
#previewSvg .pvGhost { fill: color-mix(in srgb, var(--pc) 45%, transparent); stroke: #fff; stroke-width: 2.4; stroke-dasharray: 4 3; }
#previewSvg .pvGhost.hole { fill: rgba(36,36,36,.55); }
#previewSvg .pvPortal { fill: none; stroke: #7FA0CF; stroke-width: 2.4; }
#previewSvg .pvRespawn { fill: none; stroke: var(--pc); stroke-width: 2; stroke-dasharray: 2 3; }
#previewSvg .pvOut path { stroke: var(--accent-deep); stroke-width: 3; stroke-linecap: round; }
#previewSvg .pvHit path { stroke: #fff; stroke-width: 2.2; stroke-linecap: round; filter: drop-shadow(0 0 1px rgba(0,0,0,.4)); }
#previewSvg .pvSink { fill: none; stroke: var(--accent); stroke-width: 3; }
#previewSvg.jaque .pvSink { animation: pvPulse .9s ease-in-out infinite; }
#previewSvg .pvSand { fill: none; stroke: var(--sand); stroke-width: 2.4; stroke-dasharray: 3 3; }
#previewSvg .pvTap rect { fill: var(--ink); }
#previewSvg .pvTap text { fill: var(--cream); font: 600 11px var(--font); text-anchor: middle; }
/* táctil: la marca de la carta elegida (tocarla la juega) */
#previewSvg .pvTarget { fill: rgba(241,241,220,.16); stroke: rgba(241,241,220,.9); stroke-width: 2.2; animation: pvPulse 1.1s ease-in-out infinite; }
html.reduceMotion #previewSvg .pvTarget { animation: none; }
@keyframes pvPulse { 50% { stroke-width: 5; } }

/* ---------- cadena de choques cortada ---------- */
.chainStop {
  position: absolute; z-index: 9; pointer-events: none; transform: translate(-50%, -100%);
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 4px 10px 4px 7px; border-radius: 999px; background: var(--accent-deep); color: var(--cream);
  font-size: 12.5px; font-weight: 600; box-shadow: 0 1.8px 5.4px var(--shadow);
  animation: chainUp 1.6s var(--ease-out) forwards;
}
.chainStop.still { animation: none; }
@keyframes chainUp { 0% { opacity: 0; translate: 0 6px; } 12% { opacity: 1; translate: 0 0; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -14px; } }

/* ---------- aviso tras un rato sin jugar ---------- */
#hands .card.nudge { animation: nudge 1.6s ease-in-out infinite; box-shadow: 0 0 0 3px var(--accent), 0 2.4px 7.2px var(--shadow); }
@keyframes nudge { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-9px) rotate(-2deg); } 90% { transform: translateY(0) rotate(1deg); } }
.hint.nudgeHint { background: rgba(232,135,58,.92); color: var(--ink); font-weight: 500; }

/* ---------- tutorial ---------- */
#coach {
  position: fixed; left: 0; top: 0; z-index: 42; width: min(330px, calc(100vw - 20px));
  padding: 14px 16px 12px; border-radius: 16px;
  background-image: var(--grain); background-color: var(--cream); color: var(--ink);
  box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-soft), 0 4.8px 14.4px rgba(20,40,20,.2);
  display: none;
}
#coach.visible { display: block; animation: coachIn .3s var(--ease-out); }
#coach::after { /* flecha hacia el objetivo */
  content: ''; position: absolute; left: calc(var(--ax, 50%) - 7px); width: 14px; height: 14px;
  background: var(--cream); transform: rotate(45deg);
}
#coach[data-side="top"]::after { bottom: -7px; box-shadow: 1.5px 1.5px 0 0 var(--accent); }
#coach[data-side="bottom"]::after { top: -7px; box-shadow: -1.5px -1.5px 0 0 var(--accent); }
#coach[data-side="mid"]::after { display: none; }
#coach[data-side="left"]::after { left: -7px; top: var(--ay, 40px); box-shadow: -1.5px 1.5px 0 0 var(--accent); }
#coach[data-side="right"]::after { left: auto; right: -7px; top: var(--ay, 40px); box-shadow: 1.5px -1.5px 0 0 var(--accent); }
.coachBody p { font-size: 14px; line-height: 1.42; }
.coachBody p + p { margin-top: 6px; }
.coachCard { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.coachCard > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.coachCard b { font-size: 15px; font-weight: 600; }
.coachCard small { font-size: 11.5px; color: var(--ink-soft); }
.coachCard .hintCard { width: 34px; height: 46px; }
.coachBtns { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.coachBtns .btn-text { margin-right: auto; padding-left: 0; }
#coachRing {
  position: fixed; left: 0; top: 0; z-index: 41; pointer-events: none; border-radius: 16px;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px rgba(232,135,58,.25);
  opacity: 0; transition: opacity .2s;
}
#coachRing.visible { opacity: 1; animation: ringPulse 1.6s ease-in-out infinite; }
#coachRing.round { border-radius: 50%; }
@keyframes ringPulse { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 14px rgba(232,135,58,.12); } }
/* aviso de las cartas naranjas: el bocadillo, en naranja y con letra grande */
#coach.orange { width: min(300px, calc(100vw - 20px)); padding: 14px 16px 12px; background-color: var(--accent); color: var(--ink); box-shadow: var(--shadow-soft), 0 6px 18px rgba(120,60,10,.28); }
#coach.orange::after { background: var(--accent); box-shadow: none !important; }
#coach.orange .coachCard { margin: 0; gap: 12px; }
#coach.orange .coachCard b { font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
#coach.orange .coachBtns { margin-top: 12px; }
#coach.orange .coachBtns button { --b-bg: var(--ink); --b-fg: var(--cream); --b-line: var(--ink); margin-left: auto; padding-inline: 16px; }
@keyframes coachIn { from { opacity: 0; scale: .96; } to { opacity: 1; scale: 1; } }

/* ---------- ajustes y estadísticas ---------- */
#settingsOverlay {
  position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20,40,20,.5); backdrop-filter: blur(6px);
}
#settingsOverlay.visible { display: flex; animation: fadeIn .2s var(--ease-out); }
.setBox {
  width: min(620px, 100%); max-height: min(760px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  background-image: var(--grain); background-color: var(--cream); border-radius: 22px;
  box-shadow: 0 30px 70px rgba(10,25,10,.35); overflow: hidden; animation: winPop .3s var(--ease-out);
}
.setBox header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 4px; }
.setBox header h2 { font-size: 32px; font-weight: 500; letter-spacing: -.045em; text-transform: lowercase; line-height: 1; }
.setBox header h2::after { content: '.'; color: var(--accent); }
.setClose { --b-fg: var(--ink); --b-line: var(--cream-line); --b-bg: transparent; width: 34px; height: 34px; padding: 0; }
.setTabs { display: flex; gap: 6px; padding: 10px 22px 12px; border-bottom: 1px solid var(--cream-line); }
.setTabs button { --b-line: var(--cream-line); }
.setTabs button[aria-selected="true"] { --b-bg: var(--ink); --b-fg: var(--cream); --b-line: var(--ink); }
.setBody { overflow: auto; padding: 4px 22px 22px; }
.setBody section { padding: 14px 0 6px; }
.setBody section + section { border-top: 1px solid var(--cream-line); }
.setBody h4 { font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .18em; color: var(--ink-soft); margin-bottom: 10px; }
.setRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 14px; flex-wrap: wrap; }
.setRow.col { flex-direction: column; align-items: stretch; }
.muted { color: var(--ink-soft); font-size: 13px; }
.segBtns { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.segBtns button { padding: 5px 12px; font-size: 12.5px; }
.segBtns button[aria-pressed="true"], #sndPanel .speedBtns button[aria-pressed="true"] { --b-bg: var(--ink); --b-fg: var(--cream); --b-line: var(--ink); }
.setRange { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.setRange span { width: 64px; }
.setRange .i { color: var(--ink-soft); }
.setRange input { flex: 1; accent-color: var(--grass-dark); }
.setToggle { display: flex; align-items: center; gap: 12px; margin: 10px 0; cursor: pointer; }
.setToggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.setToggle .sw { flex: 0 0 auto; width: 40px; height: 23px; border-radius: 999px; background: var(--cream-line); position: relative; transition: background-color .2s; }
.setToggle .sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px var(--shadow); transition: transform .2s var(--ease-out); }
.setToggle input:checked + .sw { background: var(--grass-dark); }
.setToggle input:checked + .sw::after { transform: translateX(17px); }
.setToggle input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.setToggle .tl { display: flex; flex-direction: column; line-height: 1.25; }
.setToggle .tl b { font-size: 14px; font-weight: 500; }
.setToggle .tl small { font-size: 12px; color: var(--ink-soft); }
.themeOpts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.themeOpt { flex-direction: column; gap: 7px; padding: 10px 6px 9px; border-radius: 14px; --b-line: var(--cream-line); }
.themeOpt[aria-pressed="true"] { --b-line: var(--ink); --b-bg: rgba(163,193,115,.3); }
.themeOpt b { font-size: 12.5px; font-weight: 500; }
.themeOpt .sw { display: flex; width: 46px; height: 30px; border-radius: 8px; overflow: hidden; }
.themeOpt .sw i { flex: 1; }
.stCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stCard { border: 1px solid var(--cream-line); border-radius: 14px; padding: 12px 12px 10px; display: flex; flex-direction: column; }
.stCard small { font-size: 11px; color: var(--ink-soft); letter-spacing: .02em; }
.stCard > b { font-size: 30px; font-weight: 500; letter-spacing: -.04em; line-height: 1.1; margin-top: 4px; }
.stCard > span { font-size: 12px; color: var(--ink-soft); }
.stWin { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--cream-line); font-size: 12px; }
.stWin b { font-weight: 600; }
.stTotals { display: flex; flex-wrap: wrap; gap: 8px; }
.stTotals .st { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); border: 1px solid var(--cream-line); border-radius: 999px; padding: 5px 12px; }
.stTotals .st b { color: var(--ink); font-weight: 600; }
.stTableWrap { overflow-x: auto; }
.stTable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stTable th { text-align: left; font-weight: 500; font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .1em; padding: 4px 8px; }
.stTable td { padding: 7px 8px; border-top: 1px solid var(--cream-line); }
.stTable td.n { font-weight: 600; width: 32px; }
#sndPanel #moreSettings { width: 100%; margin-top: 10px; }

/* ---------- partida rápida: personas, dificultad y continuar ---------- */
.pveOpt.hum, .pveOpt.diff { flex: 1; min-width: 70px; }
.pveOpt:disabled { opacity: .3; }
.optPeople { display: flex; gap: 3px; height: 22px; align-items: flex-end; }
.optPeople i { width: 10px; height: 16px; border-radius: 5px 5px 2px 2px; background: var(--accent); box-shadow: 0 1.2px 3.6px var(--shadow); position: relative; }
.optPeople i::before { content: ''; position: absolute; left: 1.5px; top: -7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.optBots:empty::after { content: '—'; color: var(--ink-soft); font-size: 14px; }
.pveNote { display: none; margin-top: 8px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
#pveCard.local .pveNote { display: block; }
#pveContinue { width: 100%; margin-top: 22px; justify-content: space-between; }
#pveContinue + #pvePlay { margin-top: 10px; }

/* ---------- Modo Historia: continuar, récord y nivel a medias ---------- */
#storyContinue { margin: -2vh 0 3vh; }
#storyContinue:empty { display: none; }
#storyContinue .mBtn { min-width: 260px; justify-content: space-between; box-shadow: 0 10px 26px rgba(232,135,58,.35); }
.lvlFoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 4px; }
.lvlFoot .lvlState { margin: 0; }
.lvlBest { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.lvlBest .i { width: 12px; height: 12px; color: var(--accent); }
.lvlSaved { position: absolute; top: 16px; right: 16px; z-index: 1; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; background: var(--accent); color: #fff; box-shadow: 0 1.2px 3.6px var(--shadow); }
.lvlCard.saved { --b-line: var(--accent); }

/* ---------- resumen final: récord del nivel ---------- */
.winRec { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--cream-line); color: var(--ink-soft); }
.winRec.new { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1.8px 5.4px var(--shadow); animation: recPop .6s .2s cubic-bezier(.3,1.6,.5,1) both; }
/* racha del reto diario: la llama siempre encendida; al llegar a una meta, el chip en grande */
.winRec .i { width: 15px; height: 15px; flex: 0 0 auto; }
.winRec.streak { color: var(--ink); font-weight: 600; }
.winRec.streak .i { color: var(--accent); }
.winRec.streakGoal { font-size: 16px; font-weight: 700; padding: 7px 18px; background: var(--ink); border-color: var(--ink); color: var(--cream); }
.winRec.streakGoal .i { width: 18px; height: 18px; color: #F5A33A; }
@keyframes recPop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 560px) {
  .themeOpts { gap: 6px; }
  .themeOpt { padding: 8px 2px 7px; gap: 5px; }
  .themeOpt b { font-size: 11px; }
  .themeOpt .sw { width: 38px; height: 24px; }
  .stCards { grid-template-columns: 1fr; }
  .setBox header h2 { font-size: 26px; }
}

/* tarjeta de partida rápida más compacta (ahora tiene más opciones) */
#pveCard { padding: 26px 28px 16px; }
#pveCard h4 { margin: 16px 0 8px; }
#pveCard .pveOpt { padding-block: 8px 7px; }
#pveCard .pveOpt.size { gap: 4px; }
#pveCard .optGrid { width: 34px; height: 34px; }
#pveCard .pveColor { width: 36px; height: 36px; }
#pvePlay { margin-top: 18px; padding: 12px; }

/* ---------- móvil en vertical ---------- */
@media (max-width: 760px) {
  /* el tablero siempre en la fila flexible (sin asientos, antes caía en la fila automática) */
  #table #seats { grid-row: 1; }
  #table #boardCol { grid-row: 2; }
  #table.noSeats { grid-template-rows: 0 minmax(0, 1fr); gap: 0; }
  /* asientos compactos: caben 3 en una fila */
  #seats { gap: 6px; padding: 2px 0 6px; scroll-snap-type: x proximity; }
  .seat { padding: 5px 9px 5px 5px; gap: 6px; border-radius: 13px; scroll-snap-align: start; min-width: 0; }
  .seat .avatar { width: 30px; height: 30px; }
  .seatName { font-size: 12.5px; gap: 4px; }
  .seatName .botTag { display: none; }
  .seatStatus { font-size: 10.5px; margin: 0 0 3px; }
  .seatCards { min-height: 0; gap: 3px; }
  .seatCards .card.mini { --cw: 20px; }
  .seatReact { margin-top: 3px; padding: 2px 8px; font-size: 10.5px; }
  /* en partida: el panel de ajustes (con silencio dentro) en lugar del botón de silencio */
  body[data-screen="game"] #sndCfgBtn { display: inline-flex; right: 8px; top: 9px; width: 32px; height: 32px; }
  body[data-screen="game"] #sfxBtn { display: none; }
  body[data-screen="game"] #sndPanel { top: 50px; right: 8px; }
  #turnPill .avatar.hasFace .face { width: 92%; height: 92%; }
  /* menú: navegación inferior solo con iconos */
  .mBottom .cornerBtn span { display: none; }
  .mBottom .cornerBtn { width: 36px; padding: 0; }
  .mBottom { overflow: visible; }
}
@media (max-width: 560px) {
  #pveCard { padding: 22px 18px 14px; }
  #pveCard h2 { font-size: 30px; }
  .pveOpts { gap: 7px; flex-wrap: nowrap; }
  #pveColors { flex-wrap: wrap; }
  .pveOpt.size, .pveOpt.opp, .pveOpt.hum, .pveOpt.diff { min-width: 0; flex: 1 1 0; padding-inline: 4px; }
  .optBots i { width: 9px; height: 9px; }
  .optPeople i { width: 8px; }
  .optPeople i::before { left: .5px; }
  #pveCard .pveColor { width: 32px; height: 32px; }
  .pveOpt small { font-size: 10px; }
  #storyContinue .mBtn { min-width: 0; width: min(340px, 90vw); }
}
#sndPanel .muteRow { margin-top: 0; padding-bottom: 8px; border-bottom: 1px solid var(--cream-line); }
@media (min-width: 761px) { #sndPanel .muteRow { display: none; } }

/* panel rápido: la velocidad en su propia fila (tres botones no caben junto a la etiqueta) */
#sndPanel .speedRow { flex-direction: column; align-items: stretch; gap: 6px; }
#sndPanel .speedBtns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
#sndPanel .speedBtns button { padding: 4px 4px; min-width: 0; }

/* =========================================================
   Calidad de vida: pausa, reglas, historial, carga, perfil,
   logros, resumen final y accesibilidad extra
   ========================================================= */

/* ---------- pantalla de carga ---------- */
#loadScreen {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background-image: var(--grain); background-color: var(--cream);
  transition: opacity .45s var(--ease-out), visibility .45s;
}
#loadScreen.done { opacity: 0; visibility: hidden; }
.ldTitle { display: flex; flex-direction: column; font-size: clamp(48px, 9vw, 92px); font-weight: 500; line-height: .88; letter-spacing: -.055em; color: var(--grass-dark); }
.ldTitle span:last-child { color: #7FA95A; }
.ldTitle i { display: inline-block; width: .17em; height: .17em; margin-left: .06em; border-radius: 50%; background: var(--accent); animation: ldBounce .8s ease-in-out infinite; }
@keyframes ldBounce { 50% { transform: translateY(-.25em); } }
.ldBar { width: min(220px, 60vw); height: 4px; border-radius: 999px; background: var(--cream-line); overflow: hidden; }
.ldBar i { display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--grass-dark); animation: ldSlide 1.1s ease-in-out infinite; }
@keyframes ldSlide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.ldRetry { pointer-events: auto; animation: fadeIn .4s both; }

/* ---------- menú: repetir la última partida rápida ---------- */
.mRepeat { gap: 7px; padding: 4px 2px; font-size: 13.5px; text-decoration: none; color: var(--ink); animation-delay: .6s; }
.mRepeat .i { color: var(--accent); }
.mRepeat small { color: var(--ink-soft); font-size: 12px; }
.mRepeat small::before { content: '·'; margin: 0 6px 0 2px; }
.mRepeat:hover span { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- pausa ---------- */
#pauseOverlay {
  position: fixed; inset: 0; z-index: 45; display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(20,40,20,.55); backdrop-filter: blur(6px);
}
#pauseOverlay.visible { display: flex; animation: fadeIn .2s var(--ease-out); }
.pauseBox {
  width: min(360px, 100%); text-align: center; padding: 28px 24px 18px; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background-image: var(--grain); background-color: var(--cream); box-shadow: 0 30px 70px rgba(10,25,10,.35);
  animation: winPop .3s var(--ease-out);
}
.pauseIco { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--cream); font-size: 24px; }
.pauseBox h2 { font-size: 30px; font-weight: 500; letter-spacing: -.04em; text-transform: lowercase; }
.pauseBox h2::after { content: '.'; color: var(--accent); }
.pauseBox p { color: var(--ink-soft); font-size: 14px; margin-bottom: 6px; }
.pauseBox .btn-primary { width: 100%; }
.pauseRow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
html.paused #game .cell.selectable, html.paused #game .piece .turnMark, html.paused .thinkDots i { animation-play-state: paused; }

/* ---------- hoja de reglas ---------- */
#rulesOverlay {
  position: fixed; inset: 0; z-index: 91; display: none; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20,40,20,.5); backdrop-filter: blur(6px);
}
#rulesOverlay.visible { display: flex; animation: fadeIn .2s var(--ease-out); }
.rulesBox header { padding-bottom: 12px; border-bottom: 1px solid var(--cream-line); }
.rulesBox h4 { display: flex; align-items: center; gap: 7px; }
.rulesBox h4 .i { color: var(--accent); width: 15px; height: 15px; }
.rulesBox section p { font-size: 14px; line-height: 1.5; }
.rlCards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rlCard { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--cream-line); border-radius: 12px; }
.rlCard.orange { border-color: color-mix(in srgb, var(--accent) 45%, var(--cream-line)); }
.rlCard .hintCard { flex: 0 0 auto; width: 32px; height: 42px; }
.rlCard > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rlCard b { font-size: 13.5px; font-weight: 600; }
.rlCard small { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.rlKeys kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px; border-radius: 6px; border: 1px solid var(--cream-line); background: #fff; font: 600 12px var(--font); text-align: center; }
@media (max-width: 560px) { .rlCards { grid-template-columns: 1fr; } }

/* ---------- historial: grupos por turno, icono y color de quien juega ---------- */
#logHead { gap: 8px; }
#logHead h4 { margin-right: auto; }
.logMine { padding: 4px 10px; font-size: 11.5px; }
.logMine[aria-pressed="true"] { --b-bg: var(--ink); --b-fg: var(--cream); --b-line: var(--ink); }
#logList .lgGroup { padding: 6px 0 8px; border-bottom: 1px solid var(--cream-line); }
#logList .lgGroup div { border: 0; padding: 0; }
#logList .lgHead { display: flex; align-items: center; gap: 7px; margin: 4px 0 4px; color: var(--ink); font-size: 12px; }
#logList .lgHead b { font-weight: 600; }
#logList .lg { --pc: var(--cream-line); display: flex; align-items: flex-start; gap: 7px; padding: 3px 0 3px 0 !important; margin-left: 10px;
  color: var(--ink-soft); font-weight: 400; }
#logList .lg::before { content: ''; flex: 0 0 auto; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--pc); } /* de quién es la jugada */
#logList .lg .i { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px; color: var(--ink-soft); }
#logList .lgGroup:first-child .lg:first-of-type { color: var(--ink); font-weight: 500; }
#logList .lg.muted { border: 0 !important; margin: 10px 0; }

/* ---------- partida rápida: nombres y colores de cada persona ---------- */
#pvePeople { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
#pvePeople:empty { display: none; }
.pveName, .setName {
  width: 100%; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--cream-line); background: #fff;
  font-size: 14px; color: var(--ink); outline: none;
}
.pveName:focus, .setName:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(163,193,115,.35); }
.setName { width: min(240px, 100%); }
.pvePerson { display: flex; gap: 10px; align-items: center; }
.pveDot { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%; box-shadow: 0 1.8px 5.4px var(--shadow), inset -3px -3px 0 rgba(0,0,0,.1); }
.pveDot:hover { transform: rotate(-20deg) scale(1.05); }
.setColors { display: flex; gap: 8px; flex-wrap: wrap; }
.setColors .pveColor { width: 34px; height: 34px; }

/* ---------- Lo básico: progreso y dos tarjetas por fila en móvil ---------- */
#storyProgress { width: min(420px, 90vw); margin: -2.5vh 0 3.5vh; }
#storyProgress:empty { display: none; }
.spText { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px; color: var(--cream); font-size: 14px; margin-bottom: 8px; } /* (el texto y «¡Todo completado!», centrados sobre la barra) */
.spText b { font-weight: 500; }
.spAll { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--cream); background: rgba(241,241,220,.18); padding: 3px 10px; border-radius: 999px; }
.spBar { height: 8px; border-radius: 999px; background: rgba(241,241,220,.25); overflow: hidden; }
.spBar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease-out); }
@media (max-width: 560px) {
  .lvlRow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lvlCard { width: auto; padding: 8px 8px 10px; gap: 7px; }
  .lvlPreview { height: 88px; padding: 7px; }
  .lvlName { font-size: 13.5px; }
  .lvlNum { top: 12px; left: 12px; min-width: 22px; height: 22px; font-size: 11px; }
  .lvlSaved { top: 12px; right: 12px; }
  .lvlFoot { flex-wrap: wrap; }
  .lvlSection { padding: 16px 14px 18px; }
  #storyScreen { padding-top: 12vh; }
}

/* ---------- resumen final ---------- */
#winSummary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0 0 22px; text-align: left; }
#winSummary:empty { display: none; }
.sumTile { display: flex; gap: 9px; align-items: center; padding: 9px 12px; border-radius: 14px; background: rgba(163,193,115,.18); }
.sumTile .i { flex: 0 0 auto; width: 18px; height: 18px; color: var(--grass-dark); }
.sumTile span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sumTile small { font-size: 11px; color: var(--ink-soft); }
.sumTile b { font-size: 13.5px; font-weight: 600; }
#winChips { gap: 8px; }

/* ---------- logros ---------- */
.achToast {
  position: fixed; top: 14px; right: 14px; z-index: 96; display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 10px; border-radius: 999px; background: var(--ink); color: var(--cream);
  box-shadow: 0 12px 30px rgba(10,25,10,.35); animation: achIn .45s cubic-bezier(.3,1.4,.5,1);
}
.achToast.out { opacity: 0; transform: translateY(-10px); transition: opacity .35s, transform .35s; }
.achToast .achIco { background: var(--accent); color: var(--ink); }
.achToast small { color: rgba(241,241,220,.7); }
@keyframes achIn { from { opacity: 0; transform: translateY(-16px) scale(.9); } }
.achIco { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--cream-line); color: var(--ink-soft); }
.achTxt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.achTxt small { font-size: 11px; letter-spacing: .04em; }
.achTxt b { font-size: 14px; font-weight: 600; }
.achCount { margin-bottom: 10px; }
.achGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 14px; border: 1px dashed var(--cream-line); opacity: .6; }
.ach .achTxt small { color: var(--ink-soft); letter-spacing: 0; }
.ach.got { opacity: 1; border-style: solid; background: rgba(232,135,58,.1); border-color: color-mix(in srgb, var(--accent) 40%, var(--cream-line)); }
.ach.got .achIco { background: var(--accent); color: var(--ink); }
@media (max-width: 560px) { .achGrid { grid-template-columns: 1fr; } }

/* ---------- texto grande ---------- */
html.bigText #gameBar, html.bigText #dock, html.bigText #seats, html.bigText #piles, html.bigText #logPanel,
html.bigText .setBox, html.bigText #pveCard, html.bigText .mContent, html.bigText #storyScreen .sSub,
html.bigText .lvlSection, html.bigText #toast, html.bigText #coach, html.bigText #cardTip,
html.bigText .pauseBox, html.bigText .passCard, html.bigText #winOverlay .box, html.bigText .mBottom, html.bigText #sndPanel { zoom: 1.14; }

/* ---------- alto contraste ---------- */
html.hiContrast { --ink-soft: #33382F; --cream-line: #8E8E73; --ink-line: #242424; --on-grass: #fff; }
html.hiContrast .cell { box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
html.hiContrast .cell.selectable { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--ink); }
html.hiContrast .cell.selectable-out { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--accent-deep); }
html.hiContrast .btn-ghost { --b-bg: rgba(36,36,36,.55); --b-line: #fff; --b-fg: #fff; }
html.hiContrast .hint { background: #151515; }
html.hiContrast .seat { opacity: 1; border-color: var(--ink-line); }
html.hiContrast .card.dimmed, html.hiContrast .card.unplayable { opacity: .75; filter: grayscale(.6); }
html.hiContrast .tile-ball .circ { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink), 0 2.4px 7.2px var(--shadow); }
html.hiContrast :focus-visible { outline: 3px solid var(--accent-deep) !important; outline-offset: 2px; }
html.hiContrast .pileLbl, html.hiContrast #lastPlay { text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* ---------- zurdos: botones de turno a la izquierda ---------- */
html.leftHand #dockRow { grid-template-columns: auto minmax(0, 1fr) 190px; }
html.leftHand #turnActions { order: -1; flex-direction: row-reverse; }
@media (max-width: 1060px) { html.leftHand #dockRow { grid-template-columns: auto minmax(0, 1fr); } }
@media (max-width: 760px) {
  html.leftHand #dockRow { grid-template-columns: 1fr; }
  html.leftHand #turnActions { order: 0; }
}
html.leftHand #dockOwner { order: 1; }
/* el cajón del historial por encima de los botones de sonido (tapaban su botón de cerrar) */
#logPanel { z-index: 70; }
.setTabs button[aria-selected="true"]:hover { background-color: var(--ink); }
@media (max-width: 760px) {
  /* en el móvil la partida no admite más zoom sin desbordar: ahí se agranda solo el texto clave */
  html.bigText #gameBar, html.bigText #dock, html.bigText #seats, html.bigText #piles { zoom: 1; }
  html.bigText .hint { font-size: 14px; }
  html.bigText .seatName { font-size: 14px; }
  html.bigText .seatStatus { font-size: 12px; }
  html.bigText .tpText b { font-size: 16px; }
  html.bigText #turnActions button { font-size: 15px; }
  /* barra superior del móvil: las reglas se abren desde la pausa */
  #rulesBtn { display: none; }
  #gameBar .barSide.right { gap: 4px; }
}
#game { grid-template-columns: minmax(0, 1fr); } /* nada puede ensanchar la partida más que la pantalla */
.pauseLog { display: none; }
@media (max-width: 760px) {
  #logTab { display: none; }
  .pauseLog { display: inline-flex; grid-column: 1 / -1; }
}

/* ---------- JAQUE: la pelota embocada se ve como fantasma dentro del hoyo ---------- */
.piece.ghostHoled { z-index: 6; }
.piece.ghostHoled .tile-ball .circ {
  opacity: .5; transform: scale(.78);
  box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 0 3.5px var(--pc);
  outline: 2px dashed rgba(255,255,255,.95); outline-offset: 3px;
  transition: opacity .2s, transform .2s var(--ease-out);
}
.piece.ghostHoled .turnMark { display: none !important; }
/* tienes un palo 1 reactivo: halo suave para que sepas que se puede sacar */
.piece.ghostCan .tile-ball .circ { opacity: .7; animation: ghostCan 1.8s ease-in-out infinite; }
@keyframes ghostCan { 50% { box-shadow: 0 0 0 2px #fff, 0 0 0 6px var(--accent); } }
/* palo 1 reactivo elegido: objetivo claro, casi opaco, latiendo y con etiqueta */
.piece.ghostPick .tile-ball .circ { opacity: .9; transform: scale(.86); outline-color: var(--accent); animation: ghostPick 1s ease-in-out infinite; }
@keyframes ghostPick { 50% { transform: scale(.95); box-shadow: 0 0 0 3px #fff, 0 0 0 7px var(--accent); } }
.piece.ghostPick::after, .piece.ghostCan::after {
  content: attr(data-pull); position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  background: var(--accent); color: var(--ink); font-size: 11px; font-weight: 600; box-shadow: 0 1.2px 3.6px var(--shadow);
}
.piece.ghostCan::after { opacity: .85; }
html.reduceMotion .piece.ghostCan .tile-ball .circ, html.reduceMotion .piece.ghostPick .tile-ball .circ { animation: none; }

/* =========================================================
   Modos, rivales, ayudas, celebraciones y zoom
   ========================================================= */

/* ---------- menú: "Más modos" ---------- */
.mBtn.modes { --b-bg: transparent; --b-fg: var(--ink); --b-line: var(--cream-line); min-height: 44px; padding-block: 8px; font-size: 14.5px; }
.mBtn.modes .i { color: var(--grass-dark); }
.mDot { position: absolute; top: 7px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--cream); }
body.menuIntro[data-screen="menu"]:not(.loading) .mActions > .mBtn.modes { animation-delay: .6s; }

/* ---------- pantalla de Modos ---------- */
#modesScreen { display: none; min-height: 100vh; flex-direction: column; align-items: center; padding: 8vh 20px 60px; position: relative; z-index: 1; }
body[data-screen="modes"] #scene { display: block; }
#modesGrid { display: flex; flex-direction: column; gap: 20px; width: min(920px, 94vw); }
.mdSection { background-image: var(--grain); background-color: var(--cream); border-radius: 20px; padding: 18px 20px 20px; box-shadow: var(--mdShadow); }
.mdSection > h3, .lvlSection h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .18em; color: var(--ink-soft); }
.lvlCount { font-size: 11px; letter-spacing: .04em; padding: 1px 8px; border-radius: 999px; background: var(--grass-dark); color: var(--cream); }
.mdRow { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.modeCard { border: 1px solid var(--cream-line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.modeCard p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.4; }
.mdHead { display: flex; align-items: center; gap: 10px; }
.mdHead h3 { font-size: 19px; font-weight: 500; letter-spacing: -.02em; }
.mdHead small { font-size: 12px; color: var(--ink-soft); display: block; }
.mdHead small::first-letter { text-transform: uppercase; }
.mdIco { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--grass-dark); color: var(--cream); font-size: 18px; }
.modeCard.daily .mdIco { background: var(--accent); color: var(--ink); }
.modeCard.rush .mdIco { background: var(--navy); }
.mdPreview { height: 110px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background-image: var(--grain); background-color: var(--grass-dark); padding: 8px; }
.mdPreview svg { max-height: 100%; max-width: 100%; }
.mdStats { display: flex; flex-wrap: wrap; gap: 6px; }
.mdStat { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--cream-line); color: var(--ink-soft); }
.mdStat .i { width: 13px; height: 13px; color: var(--accent); }
.mdBtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.mdCfg { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.mdTable { display: flex; flex-wrap: wrap; gap: 6px; }
.mdTable span { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: rgba(163,193,115,.2); }
.mdTable span.me { background: var(--accent); color: var(--ink); }
.chGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.chCard { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; border: 1px solid var(--cream-line); border-radius: 14px; position: relative; }
.chCard.done { background: rgba(163,193,115,.15); }
.chTxt { flex: 1 1 150px; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.chTxt b { font-size: 14px; font-weight: 600; }
.chTxt small { font-size: 12px; color: var(--ink-soft); }
.chDone { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--grass-dark); color: var(--cream); font-size: 12px; }
.lvlSub { font-size: 13px; color: var(--ink-soft); margin: -8px 0 12px; }
.lvlGroup { font-size: 13px; font-weight: 600; color: var(--ink); margin: 16px 2px 8px; display: flex; align-items: baseline; gap: 8px; }
.lvlGroup:first-of-type { margin-top: 4px; }
.lvlGroup span { font-size: 11.5px; font-weight: 500; color: var(--ink-soft); }

/* ---------- etiqueta del modo en la partida ---------- */
#gameBar { position: relative; }
#modeChip { position: absolute; left: 50%; top: calc(100% - 2px); transform: translateX(-50%); z-index: 31; white-space: nowrap;
  padding: 3px 12px; border-radius: 999px; background: var(--ink); color: var(--cream); font-size: 11.5px; font-weight: 500; box-shadow: 0 1.2px 3.6px var(--shadow); }

/* ---------- rivales (partida rápida) ---------- */
.pveOpt.rival { flex: 1; min-width: 92px; gap: 3px; }
.pveOpt.rival .avatar { width: 36px; height: 36px; }
.pveOpt.rival.picked { --b-line: var(--ink); }
.rivalRandom { background: var(--cream-line); color: var(--ink-soft); font-size: 16px; font-weight: 600; box-shadow: 0 1.8px 5.4px var(--shadow); }
#pveRivals { flex-wrap: wrap; }

/* ---------- ayudas: consejo y deshacer ---------- */
.assistBtns { display: flex; flex-direction: column; gap: 6px; }
.assistBtns:not(:has(button:not([hidden]))) { display: none; }
#caddieBtn .i { color: var(--accent); }
#hands .card.caddiePick { box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(232,135,58,.25), 0 2.4px 7.2px var(--shadow); transform: translateY(-8px); }
#board .cell.caddieCell { box-shadow: inset 0 0 0 3px var(--accent) !important; }
#endTurnBtn.caddiePick { box-shadow: 0 0 0 4px var(--accent), 0 6px 16px rgba(20,40,20,.2); }
@media (max-width: 760px) {
  /* en el móvil, consejo y deshacer van en la fila de los botones de turno, solo con icono */
  .assistBtns { flex-direction: row; flex: 0 0 auto; gap: 6px; }
  #turnActions .assistBtns button { flex: 0 0 auto; width: 40px; height: 40px; padding: 0; }
  .assistBtns .btn-icon span { display: none; }
}

/* ---------- explicación de la jugada del bot ---------- */
.hint.botWhy { display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 0 0 1.5px var(--pc), 0 8px 24px rgba(20,40,20,.2); background: rgba(36,36,36,.82); padding: 4px 14px 4px 5px; }
#lastPlay .lastWhy { max-width: 190px; font-size: 11px; line-height: 1.3; letter-spacing: 0; text-transform: none; opacity: .9; }

/* ---------- resumen final: celebración, tabla del torneo y "¿por qué he perdido?" ---------- */
#winStyle:empty { display: none; }
#winStyle { margin: -6px 0 8px; }
.wsChip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  background: var(--ink); color: var(--cream); animation: recPop .6s .1s cubic-bezier(.3,1.6,.5,1) both; }
.wsChip.portal { background: var(--navy); } .wsChip.chain { background: #B8860B; } .wsChip.swallow { background: #5C4A2E; }
.wsChip.steal { background: var(--accent-deep); } .wsChip.first { background: var(--accent); color: var(--ink); }
.winTable { display: flex; flex-direction: column; gap: 4px; width: min(300px, 100%); margin: 0 auto 6px; }
.winTable span { display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 10px; background: rgba(163,193,115,.18); font-size: 14px; text-align: left; }
.winTable span i { margin-left: auto; font-style: normal; font-weight: 600; }
.winTable span.me { background: rgba(232,135,58,.22); }
.winTable span.champ { box-shadow: inset 0 0 0 1.5px var(--accent); }
#winChips { flex-wrap: wrap; justify-content: center; }
#winWhy:empty { display: none; }
#winWhy { margin: -8px 0 18px; }
.winWhyBtn { gap: 6px; }
.whyPanel { margin-top: 8px; padding: 12px; border-radius: 14px; border: 1px solid var(--cream-line); text-align: left; }
.whyHead b { font-size: 14px; }
.whyHead p { font-size: 13.5px; margin-top: 3px; color: var(--ink-soft); }
.whyBoards { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0; }
.whyBoards figure { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.whyBoards figure svg { width: min(140px, 30vw); max-height: 170px; border-radius: 8px; background: #3F7440; padding: 3px; }
.whyBoards .whyArrow { width: 22px; height: 22px; }
.whyBoards figcaption { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .12em; }
.whyArrow { color: var(--ink-soft); }
.whyTip { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; }
.whyTip .i { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
#winOverlay { overflow-y: auto; padding: 48px 12px 24px; } /* resúmenes largos: se desplaza la capa, no la caja (el icono sobresale) */
#winOverlay .box { margin: auto; }

/* ---------- zoom del tablero ---------- */
#boardZoom { transform-origin: 0 0; width: max-content; margin: 0 auto; }
#boardWrap.zoomed { overflow: hidden; }
#zoomReset { position: absolute; top: 8px; right: 8px; z-index: 12; width: 34px; height: 34px; padding: 0; box-shadow: var(--shadow-soft); }
@media (pointer: coarse) { #boardWrap { touch-action: none; } }
@media (max-width: 760px) {
  #modeChip { position: static; transform: none; grid-column: 1 / -1; justify-self: center; margin-top: 2px; font-size: 11px; padding: 2px 10px; }
  #modeChip[hidden] { display: none; }
}
@media (max-width: 760px) {
  #gameBar > .barSide:first-child { grid-row: 1; grid-column: 1; }
  #gameBar > #turnPill { grid-row: 1; grid-column: 2; }
  #gameBar > .barSide.right { grid-row: 1; grid-column: 3; }
  #gameBar > #modeChip { grid-row: 2; }
}

/* =========================================================
   Menú reorganizado, partida rápida, contrarreloj y sin barras de desplazamiento
   ========================================================= */

/* ---------- sin barras de desplazamiento a la vista (se sigue pudiendo desplazar) ---------- */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
#boardWrap { overflow: hidden; }          /* el tablero cabe siempre (y el zoom lo mueve) */
#pveScreen { align-items: flex-start; }
#pveCard { margin: auto; }                /* centrada si cabe; si no, la pantalla entera se desplaza */

/* ---------- menú principal: limpio, sin sombras ---------- */
#menuScreen button, body[data-screen="menu"] #sfxBtn, body[data-screen="menu"] #sndCfgBtn { box-shadow: none !important; }
.mActions { width: min(460px, 100%); align-items: stretch; }
.mActions .mRow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mActions .mRow .mBtn { justify-content: space-between; min-height: 50px; }
.mBtn.modes { --b-bg: transparent; --b-fg: var(--ink); --b-line: var(--ink-line); min-height: 50px; font-size: 15.5px; padding: 13px 22px; }
.mTitle { margin-bottom: 26px; }
/* tarjeta del reto diario */
.mDaily {
  --b-bg: var(--accent); --b-fg: var(--ink); --b-line: var(--accent);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  width: 100%; padding: 13px 16px 13px 10px; border-radius: 18px; text-align: left;
}
.mDaily:hover { background-color: #EE9550; }
.mDaily.done { --b-bg: rgba(232,135,58,.14); --b-line: var(--accent); }
.mDaily.done:hover { background-color: rgba(232,135,58,.24); }
.dPreview { width: 58px; height: 58px; border-radius: 12px; background: var(--grass-dark); display: flex; align-items: center; justify-content: center; padding: 5px; }
.dPreview svg { max-width: 100%; max-height: 100%; }
.dTxt { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.2; }
.dTxt b { font-size: 18px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.dWhen, .dVs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* una fila por línea: nunca parten la tarjeta */
.dWhen { font-size: 11.5px; opacity: .75; }
.dWhen::first-letter { text-transform: uppercase; }
.dMeta { display: flex; flex-wrap: wrap; gap: 1px 10px; font-size: 12px; margin-top: 1px; opacity: .85; }
.dMeta > * { max-width: 100%; }
.dPlay { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--cream); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.dPlay .i { flex: 0 0 auto; }
.mDaily.done .dPlay { background: var(--accent); color: var(--ink); }
body.menuIntro[data-screen="menu"]:not(.loading) .mActions > .mDaily { animation: btnUp .45s .34s var(--ease-out) both; }
@media (max-width: 820px) {
  .mFrame { grid-template-rows: minmax(30vh, 1fr) auto; } /* la ilustración ocupa el sitio sobrante: sin hueco vacío */
  .mActions { width: 100%; }
}
@media (max-width: 420px) {
  .dPreview { width: 48px; height: 48px; }
  /* en el móvil el botón es un círculo: el texto de la tarjeta se queda con el ancho */
  .dPlay { width: 40px; height: 40px; padding: 0; }
  .dPlay .dPlayLbl { display: none; }
  .dPlay .i { width: 18px; height: 18px; }
  .mActions .mRow .mBtn { padding-inline: 14px; font-size: 14.5px; }
}

/* ---------- Partida rápida: contra la máquina / multijugador local ---------- */
.pveKind { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pveOpt.kind { align-items: flex-start; text-align: left; gap: 3px; padding: 12px 14px; }
.pveOpt.kind .i { width: 20px; height: 20px; color: var(--accent); margin-bottom: 3px; }
.pveOpt.kind b { font-size: 15px; }
.pveOpt.kind.sel { --b-bg: rgba(163,193,115,.35); --b-line: var(--ink); }
#pveHumansRow[hidden], #pveRivalsRow[hidden], #pveDiffRow[hidden] { display: none; }
/* rivales con flechas: se ve que se pueden cambiar */
.pveOpt.rival { display: flex; flex-direction: row; align-items: center; gap: 4px; padding: 8px 6px; min-width: 150px; flex: 1 1 150px;
  border: 1px solid var(--cream-line); border-radius: 14px; background: transparent; }
.pveOpt.rival.picked { border-color: var(--ink); background: rgba(163,193,115,.18); }
.pveOpt.rival:hover { background-color: transparent; }
.rivalBody { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.rivalBody b { font-size: 14px; }
.rivalArrow { flex: 0 0 auto; width: 30px; height: 30px; padding: 0; --b-line: var(--cream-line); --b-bg: #fff; }
.rivalArrow:hover { --b-bg: var(--cream); background-color: var(--green-light); }
.rivalArrow .i { width: 15px; height: 15px; }

/* ---------- contrarreloj: la cuenta atrás, bien visible, y el tablero que se tiñe de rojo ---------- */
#rushTimer {
  --left: 1;
  grid-row: 2; grid-column: 2; justify-self: center; z-index: 31;
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  padding: 5px 14px 5px 10px; border-radius: 999px; background: var(--ink); color: var(--cream);
  font-size: 18px; font-variant-numeric: tabular-nums;
}
#rushTimer[hidden] { display: none; }
#rushTimer b { font-weight: 600; min-width: 42px; text-align: center; }
#rushTimer .i { width: 18px; height: 18px; color: var(--accent); }
.rtBar { display: block; width: 80px; height: 5px; border-radius: 999px; background: rgba(241,241,220,.25); overflow: hidden; }
.rtBar i { display: block; height: 100%; width: calc(var(--left) * 100%); border-radius: inherit; background: var(--accent); transition: width .25s linear; }
#rushTimer.danger { background: #C8341F; animation: rtBeat 1s ease-in-out infinite; }
#rushTimer.danger .i { color: #fff; }
#rushTimer.danger .rtBar i { background: #fff; }
@keyframes rtBeat { 50% { transform: scale(1.08); } }
/* con el modo en la barra, la etiqueta pasa a la segunda fila (junto al reloj si lo hay) */
#gameBar { grid-template-rows: auto auto; }
#gameBar > .barSide:first-child { grid-row: 1; grid-column: 1; }
#gameBar > #turnPill { grid-row: 1; grid-column: 2; }
#gameBar > .barSide.right { grid-row: 1; grid-column: 3; }
#modeChip { position: static; transform: none; grid-row: 2; grid-column: 1 / -1; justify-self: center; margin-top: 4px; }
#rushTimer:not([hidden]) ~ #modeChip, #modeChip:has(~ #rushTimer:not([hidden])) { grid-column: 1; justify-self: end; margin-right: 8px; }
#gameBar:has(#rushTimer:not([hidden])) #modeChip { grid-column: 1; justify-self: end; align-self: center; }
/* tinte rojo: viñeta sobre el campo y velo sobre el tablero, según el tiempo que queda */
#game::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(205,45,30,.6) 100%);
  opacity: var(--urgency, 0); transition: opacity .6s linear;
}
#boardArea::after {
  content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 8px;
  background: rgba(214,48,32,.42); mix-blend-mode: multiply;
  opacity: var(--urgency, 0); transition: opacity .6s linear;
}
#game.urgent #boardWrap { box-shadow: 0 0 0 4px rgba(214,48,32,.85), 0 8.4px 25.2px rgba(20,40,20,.22); animation: rtGlow 1s ease-in-out infinite; }
@keyframes rtGlow { 50% { box-shadow: 0 0 0 8px rgba(214,48,32,.35), 0 8.4px 25.2px rgba(20,40,20,.22); } }
html.reduceMotion #rushTimer.danger, html.reduceMotion #game.urgent #boardWrap { animation: none; }
@media (max-width: 760px) {
  #rushTimer { font-size: 15px; padding: 3px 10px 3px 8px; margin-top: 3px; }
  .rtBar { width: 50px; }
}
@media (max-width: 760px) {
  #gameBar:has(#rushTimer:not([hidden])) #modeChip { grid-row: 3; grid-column: 1 / -1; justify-self: center; margin-right: 0; }
  #gameBar > #rushTimer { grid-column: 1 / -1; }
}

/* tarjetas de Partida rápida y Contrarreloj en Modos: con su propio fondo */
#modesGrid > .mdRow > .modeCard, .mdPanel > .modeCard { background-image: var(--grain); background-color: var(--cream); border: none; padding: 18px; box-shadow: var(--mdShadow); border-radius: 20px; }
#modesGrid > .mdRow > .modeCard .mdHead h3, .mdPanel > .modeCard .mdHead h3 { font-size: 21px; }

/* reto diario: los dos rivales del día (cara a cara) y "contra X e Y · dificultad" */
.dRivals { position: relative; flex: 0 0 auto; padding: 0; background: rgba(36,36,36,.14); }
.dRivals .avatar { position: absolute; width: 34px; height: 34px; box-shadow: none; border: 2px solid var(--cream); background: var(--pc); }
.dRivals .avatar:first-child { left: 4px; top: 5px; }
.dRivals .avatar + .avatar { right: 4px; bottom: 5px; }
.dVs { font-size: 12.5px; font-weight: 500; }
/* la mecánica del día, bajo el título */
.dFeat { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: rgba(36,36,36,.12); color: inherit; white-space: nowrap; }
.dFeat > span { overflow: hidden; text-overflow: ellipsis; }
.dFeat .i { width: 13px; height: 13px; flex: 0 0 auto; }
.mDaily .dMeta { opacity: .75; }
@media (max-width: 420px) { .dRivals .avatar { width: 28px; height: 28px; } }
@media (max-width: 420px) { .mDaily { gap: 9px; padding-right: 12px; } .dTxt b { font-size: 16.5px; } .dVs { font-size: 12px; } }

/* continuar una partida guardada: siempre en naranja */
.btn-continue { --b-bg: var(--accent); --b-fg: #fff; --b-line: var(--accent); }
.btn-continue:hover { background-color: var(--accent-deep); border-color: var(--accent-deep); }

/* ningún botón lleva sombra (look limpio). Solo quedan los anillos que marcan algo:
   color elegido, "termina el turno" y el consejo del caddie */
button:where(:not(#endTurnBtn)) { box-shadow: none !important; } /* (sin especificidad: los anillos de abajo ganan) */
#endTurnBtn { box-shadow: none; }
#endTurnBtn.cta, #endTurnBtn.ctaEndTurn { box-shadow: 0 0 0 4px rgba(232,135,58,.45); }
@keyframes endPulse { 50% { box-shadow: 0 0 0 7px rgba(232,135,58,.25); } }
#endTurnBtn.caddiePick { box-shadow: 0 0 0 4px var(--accent); }
.pveColor.sel { box-shadow: 0 0 0 3px var(--cream), 0 0 0 4.5px var(--ink) !important; }

/* ---------- color de cada modo: partida rápida verde, contrarreloj azul, desafíos rojo,
   reto diario naranja (el campo de la partida usa la misma paleta, ver themes.css) ---------- */
/* (rápidas: el verde del césped un punto más oscuro, para que el crema encima llegue a AA; el taller: gris pizarra) */
:root { --mode-rush: var(--navy); --mode-challenge: #B5473F; --mode-daily: var(--accent); --mode-quick: #3A7139; --mode-workshop: #4E5E6A; }
.modeCard.quick .mdIco { background: var(--grass-dark); color: var(--cream); }
.mdSection.challenges .mdIco, .mdSection.challenges .lvlCount, .chDone { background: var(--mode-challenge); color: var(--cream); }
.chCard.done { background: rgba(181,71,63,.08); border-color: rgba(181,71,63,.3); }
#modeChip[data-variant="rush"] { background: var(--mode-rush); }
#modeChip[data-variant="challenge"], #modeChip[data-variant="weekly"] { background: var(--mode-challenge); }
#modeChip[data-variant="daily"] { background: var(--mode-daily); color: var(--ink); }
.themeFor { font-size: 11px; color: var(--ink-soft); font-weight: 400; }

/* ---------- tarjeta del reto diario: tic de completado ---------- */
.dHead { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; } /* título (con la racha) y, debajo, la mecánica: misma forma todos los días */
/* el tic, como insignia en la esquina de la miniatura (fuera del texto: no lo descoloca) */
.dDone { position: absolute; top: -7px; right: -7px; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--grass-dark); color: var(--cream); border: 2px solid var(--cream); }
.dDone .i { width: 11px; height: 11px; stroke-width: 3; }
body[data-screen="menu"]:not(.loading) .dDone { animation: donePop .5s .7s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes donePop { from { transform: scale(0); } }
/* la racha, junto al título: apagada y latiendo si hoy aún no has jugado,
   encendida (con una llamarada la primera vez) cuando ya cuenta */
.dTitle { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; max-width: 100%; min-height: 22px; } /* (misma altura con o sin llama) */ /* (si no cabe, la llama baja: nunca pisa el botón) */
.dFlame { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto;
  height: 22px; padding: 0 8px 0 6px; border-radius: 999px; background: var(--ink); color: var(--cream);
  font-size: 13px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dFlame b { font-size: inherit; font-weight: 700; letter-spacing: 0; }
.dFlame .i { width: 14px; height: 14px; color: rgba(241,241,220,.4); transition: color .4s; }
.dFlame.lit .i { color: #F5A33A; }
.dFlame.risk { animation: flameRisk 1.6s ease-in-out infinite; }
@keyframes flameRisk { 50% { box-shadow: 0 0 0 2px rgba(200,52,31,.35), 0 0 12px 2px rgba(200,52,31,.45); } }
body[data-screen="menu"]:not(.loading) .dFlame.ignite { animation: flamePop .6s .9s cubic-bezier(.34,1.56,.64,1) both; }
body[data-screen="menu"]:not(.loading) .dFlame.ignite .i { animation: flameIgnite 1s .9s ease-out both; }
@keyframes flamePop { 40% { transform: scale(1.3); } }
@keyframes flameIgnite { 0% { color: rgba(241,241,220,.4); } 35% { color: #FFD23F; transform: scale(1.35) translateY(-1px); } 100% { color: #F5A33A; } }
html.reduceMotion .dFlame.risk, html.reduceMotion .dFlame.ignite, html.reduceMotion .dFlame.ignite .i { animation: none !important; }
.dMeta.risk { opacity: 1; font-weight: 600; }
/* las estadísticas, a la derecha de la racha: la misma etiqueta, con las tres barras (si no caben junto al título, bajan juntas) */
.dTags { display: inline-flex; align-items: center; gap: inherit; flex: 0 0 auto; }
.dStats { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--ink); color: var(--cream); cursor: pointer; transition: background .15s, transform .15s; }
.dStats .i { width: 14px; height: 14px; }
.dStats:hover { background: var(--accent); color: var(--ink); }
.dStats:active { transform: scale(.92); }
@media (max-width: 420px) { .dTitle { column-gap: 5px; min-height: 20px; } .dFlame { height: 20px; padding: 0 7px 0 5px; font-size: 12px; } .dFlame .i { width: 12px; height: 12px; }
  .dStats { height: 20px; padding: 0 7px; } .dStats .i { width: 12px; height: 12px; } }
/* móviles muy estrechos: el título, la racha y el botón caben en una fila también en inglés */
@media (max-width: 380px) {
  .dTxt b { font-size: 15px; }
  .dTitle { column-gap: 4px; }
  .dPreview { width: 44px; height: 44px; }
  .dRivals .avatar { width: 26px; height: 26px; }
  .dFlame { gap: 1px; padding: 0 6px 0 4px; }
  .dStats { padding: 0 5px; }
}

/* ---------- ficha del rival: tu balance y tu némesis ---------- */
.rvRec { font-size: 11px; font-weight: 600; color: var(--ink-soft); letter-spacing: .02em; }
.rvNemesis { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 1px 7px; border-radius: 999px;
  background: var(--ink); color: var(--cream); }

/* ---------- desafío semanal (encabeza la sección de desafíos) ---------- */
.chCard.weekly { margin-bottom: 12px; border: 1.5px solid var(--mode-challenge); background: rgba(181,71,63,.06); }
.chCard.weekly .wkTag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--mode-challenge); font-weight: 600; }
.chCard.weekly .wkBest { font-size: 11.5px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.chCard.weekly.done { background: rgba(181,71,63,.1); }

/* ---------- primera vez en un modo: tarjeta de presentación ---------- */
.dlgBox.intro { text-align: center; align-items: center; padding: 26px 28px 22px; }
#dialog:has(.dlgBox.intro) { width: min(400px, 92vw); }
.dlgBox.intro .introIco { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--grass-dark); color: var(--cream); margin: 4px auto 8px; }
.dlgBox.intro .introIco .i { width: 26px; height: 26px; }
.dlgBox.intro.rush .introIco { background: var(--mode-rush); }
.dlgBox.intro.challenge .introIco, .dlgBox.intro.weekly .introIco { background: var(--mode-challenge); }
.dlgBox.intro.daily .introIco { background: var(--mode-daily); color: var(--ink); }
.introList { list-style: none; padding: 0; margin: 6px 0 14px; text-align: left; display: grid; gap: 8px; width: 100%; }
.introList li { position: relative; padding-left: 22px; font-size: 14px; line-height: 1.35; color: var(--ink); }
.introList li::before { content: ''; position: absolute; left: 4px; top: .45em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.dlgBox.intro .dlgBtns { justify-content: center; }
.dlgBox.intro .dlgBtns button { min-width: 160px; }

/* ---------- final: recorrido de tu pelota ---------- */
#winRoute:empty { display: none; }
#winRoute { margin: 0 0 20px; text-align: left; }
#winRoute h4 { margin: 0 0 8px; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .18em; color: var(--ink-soft); }
.rtWrap { display: flex; align-items: center; gap: 14px; }
.rtMap { flex: 0 0 auto; height: 170px; width: auto; max-width: 55%; }
.rtLegend { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink); }
.rtLg { display: inline-flex; align-items: center; gap: 6px; }
.rtSw { width: 20px; height: 20px; flex: 0 0 auto; }
@media (max-width: 480px) { .rtMap { height: 130px; } }

/* ---------- estadísticas: gráficas (victorias azul, derrotas naranja; cifras siempre escritas) ---------- */
:root { --ch-win: #3F6FA8; --ch-loss: #E8873A; --ch-track: rgba(36,36,36,.07); }
.chLegend { display: flex; gap: 14px; margin: -4px 0 10px; font-size: 12px; color: var(--ink-soft); }
.chLegend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chLegend .lg::before { content: ''; width: 10px; height: 10px; border-radius: 3px; }
.chLegend .lg.win::before { background: var(--ch-win); } .chLegend .lg.loss::before { background: var(--ch-loss); }
.chEmpty { margin: 0; font-size: 13px; }
/* evolución: columnas apiladas, 2px de separación entre tramos, extremos redondeados arriba */
.evChart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 130px; padding-top: 16px;
  border-bottom: 1px solid var(--cream-line); }
.evCol { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; cursor: default; }
.evBar { position: relative; flex: 1; width: 100%; max-width: 22px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.evBar i { display: block; width: 100%; min-height: 3px; }
.evBar i:first-of-type { border-radius: 4px 4px 0 0; }
.evBar i.win { background: var(--ch-win); } .evBar i.loss { background: var(--ch-loss); }
.evVal { position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--ink); }
.evCol:hover .evBar i { filter: brightness(1.08); }
.evDay { font-size: 10px; color: var(--ink-soft); margin-top: 4px; line-height: 1; transform: translateY(6px); }
.evCol.today .evDay { color: var(--ink); font-weight: 700; }
.evChart + * { margin-top: 10px; }
.evChart { margin-bottom: 12px; }
/* barras horizontales */
.hbars { display: grid; gap: 8px; }
.hbRow { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbLbl { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.hbLbl.rv .avatar { width: 22px; height: 22px; box-shadow: none; }
.hbTrack { display: flex; gap: 2px; height: 12px; border-radius: 0 4px 4px 0; background: var(--ch-track); overflow: hidden; }
.hbTrack i { display: block; height: 100%; }
.hbTrack i:last-child { border-radius: 0 4px 4px 0; }
.hbTrack i.win { background: var(--ch-win); } .hbTrack i.loss { background: var(--ch-loss); }
.hbTrack i[style*="width:0%"] { display: none; }
.hbVal { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; min-width: 44px; text-align: right; }
.hbVal small { font-weight: 400; color: var(--ink-soft); }
.hbRow:hover .hbTrack i { filter: brightness(1.08); }
/* ---------- Estadísticas: secciones (stats-sections.js) ---------- */
.setBody h4 .stMore { float: right; margin: -6px 0 0; padding: 3px 8px; font-size: 11px; letter-spacing: 0; text-transform: none; gap: 5px; }
.setBody h4 .stMore .i { width: 13px; height: 13px; }
/* por baraja: su emblema pequeño delante del nombre; las que aún no has jugado, apagadas */
.hbLbl.dk i { flex: 0 0 auto; display: grid; place-items: center; width: 22px; height: 22px; }
.hbLbl.dk .dkArt { width: 22px; height: 22px; }
.hbRow.zero { opacity: .5; }
.stNote { margin: 8px 0 0; font-size: 12px; }
/* el reto diario: cuatro cifras en una fila, como en su ventana */
.stNums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.stNum b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stNum small { display: block; font-size: 11.5px; color: var(--ink-soft); }
/* progreso: barra por apartado y, debajo de puzles y desafíos, una más fina por grupo */
.pgList { display: grid; gap: 7px; }
.pgRow { display: grid; grid-template-columns: minmax(110px, 32%) 1fr 52px; align-items: center; gap: 10px; font-size: 13px; }
.pgLbl { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgTrack { height: 10px; border-radius: 999px; background: var(--ch-track); overflow: hidden; }
.pgTrack i { display: block; height: 100%; border-radius: inherit; background: var(--grass-dark); }
.pgVal { text-align: right; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pgVal b { color: var(--ink); font-weight: 600; }
.pgRow.sub { font-size: 12px; margin-top: -2px; }
.pgRow.sub .pgLbl { color: var(--ink-soft); padding-left: 14px; }
.pgRow.sub .pgTrack { height: 6px; }
.pgRow.sub .pgTrack i { background: color-mix(in srgb, var(--grass-dark) 60%, transparent); }
/* tus pelotas: una por pelota, con el nivel que tienes */
.sbGrid { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 8px; }
.sbItem { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px 6px; border-radius: 12px; background: rgba(36,36,36,.04); }
.sbItem small { font-size: 11px; font-weight: 700; color: var(--ink); letter-spacing: .04em; }
.sbItem.off .skBall { filter: grayscale(1); opacity: .35; }
.sbItem.off small { color: var(--ink-soft); font-weight: 500; }
@media (max-width: 480px) {
  .hbRow { grid-template-columns: minmax(118px, 40%) 1fr auto; gap: 8px; font-size: 12.5px; }
  .hbLbl.rv { flex-wrap: wrap; white-space: normal; row-gap: 2px; }
  .hbVal { min-width: 38px; }
}

/* ---------- Ajustes: cada opción con su etiqueta encima y sus opciones en un control segmentado ---------- */
.setRow.seg { flex-direction: column; align-items: stretch; gap: 7px; margin: 14px 0; }
.setRow.seg > span:first-child { font-weight: 500; }
.setRow.seg .segBtns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; padding: 3px; border-radius: 12px;
  background: rgba(36,36,36,.07); }
.setRow.seg .segBtns button { --b-bg: transparent; --b-line: transparent; border-radius: 9px; padding: 8px 6px; font-size: 13px; }
.setRow.seg .segBtns button:hover { background-color: rgba(255,255,255,.6); }
.setRow.seg .segBtns button[aria-pressed="true"] { --b-bg: var(--ink); --b-fg: var(--cream); --b-line: var(--ink); }
.segBtns button[aria-pressed="true"]:hover, .setRow.seg .segBtns button[aria-pressed="true"]:hover, #sndPanel .speedBtns button[aria-pressed="true"]:hover { background-color: #3a3a3a; } /* (marcada: no se aclara al pasar) */

/* ---------- aviso de guardado (barra de la partida) ---------- */
#gameBar > .barSide:first-child { position: relative; }
.saveTick { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 8px; border-radius: 999px; white-space: nowrap;
  background: rgba(241,241,220,.94); color: var(--grass-dark); font-size: 12px; font-weight: 600; pointer-events: none;
  opacity: 0; transform: translateY(-3px); transition: opacity .3s, transform .3s var(--ease-out); }
.saveTick .i { width: 13px; height: 13px; stroke-width: 2.6; }
.saveTick.show { opacity: 1; transform: none; }
@media (max-width: 760px) { .saveTick { position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; padding: 3px 9px 3px 7px; font-size: 11px; } }
html.reduceMotion .saveTick { transition: opacity .2s; transform: none; }

/* ---------- Modos de juego: puzles y tus niveles (mismas tarjetas que Lo básico) ---------- */
#modesGrid .lvlSection { box-shadow: var(--mdShadow); }
.noLevels { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; grid-column: 1 / -1; }

/* ---------- Atajos: cada pareja de portales con su color (y su letra en la etiqueta) ---------- */
.tile-portal.pair2 { --pt-d: #5B3A8C; --pt-m: #6A4A9E; --pt-c: #7B5AB0; --pt-l: #CDB8EC; }
.tile-portal.pair3 { --pt-d: #1E6B63; --pt-m: #257A71; --pt-c: #2E8A80; --pt-l: #A6DDD5; }
.tile-portal.pair1 .sub, .tile-portal.pair2 .sub, .tile-portal.pair3 .sub { font-weight: 700; letter-spacing: .1em; }

/* ---------- asientos: nunca se recortan; con 5 o más rivales, compactos (sus cartas, en un contador) ---------- */
#seats { justify-content: safe center; }
.seatCnt { display: none; }
@media (min-width: 761px) {
  #seats.many { gap: 6px; }
  #seats.many .seat { padding: 6px 12px 6px 8px; gap: 9px; }
  #seats.many .avatar { width: 30px; height: 30px; font-size: 11px; }
  #seats.many .seatCards { display: none; }
  #seats.many .seatStatus { display: flex; align-items: center; gap: 8px; }
  #seats.many .seatCnt { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
  #seats.many .seatCnt .i { width: 12px; height: 12px; }
}

/* ---------- Lo básico: secciones (Lo básico · Lo no tan básico) → bloques (una baraja) → filas de 5 ----------
   La pantalla se desplaza; cada bloque, con su cabecera (icono de la baraja, nombre, barra y x/y) en su color. */
#storyScreen #lvlGrid { width: min(980px, 94vw); gap: 18px; }
#storyScreen .lvlSection { padding: 16px 18px 20px; }
#storyScreen .lvlSection > h3 { margin: 0 0 2px; }
.bkBlock { --dk: var(--grass-dark); margin-top: 14px; content-visibility: auto; contain-intrinsic-size: auto 330px; } /* (los bloques que no se ven no se pintan) */
.bkHead { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.bkArt { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: rgba(36,36,36,.05); }
.bkArt svg { width: 34px; height: 34px; overflow: visible; filter: drop-shadow(0 2px 4px rgba(20,40,20,.2)); transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
.bkBlock:hover .bkArt svg { transform: rotate(-5deg) scale(1.07); }
.bkName { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkBar { flex: 0 1 160px; height: 5px; border-radius: 999px; background: rgba(36,36,36,.08); overflow: hidden; }
.bkBar i { display: block; height: 100%; border-radius: inherit; background: var(--dk); transition: width .6s var(--ease-out); }
.bkCount { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.bkCount.all { color: var(--dk); }
#storyScreen .bkRow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
#storyScreen .bkRow + .bkRow { margin-top: 10px; }
#storyScreen .lvlCard { width: auto; min-width: 0; padding: 6px 6px 8px; gap: 5px; border-radius: 13px; }
#storyScreen .lvlPreview { height: 96px; padding: 6px; border-radius: 9px; }
#storyScreen .lvlName { font-size: 12.5px; min-height: 0; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#storyScreen .lvlNum { top: 10px; left: 10px; min-width: 20px; height: 20px; font-size: 10.5px; padding: 0 5px; }
#storyScreen .lvlCard.done .lvlNum { background: var(--grass-dark); color: var(--cream); }
/* completado: la miniatura apagada (al pasar por encima vuelve) y el nombre más suave; la siguiente destaca sola */
#storyScreen .lvlCard.done .lvlPreview { opacity: .42; filter: saturate(.6); transition: opacity .2s, filter .2s; }
#storyScreen .lvlCard.done:hover .lvlPreview, #storyScreen .lvlCard.done:focus-visible .lvlPreview { opacity: .85; filter: none; }
#storyScreen .lvlCard.done .lvlName { color: var(--ink-soft); }
#storyScreen .lvlFoot { margin: 0 2px; }
#storyScreen .lvlState { font-size: 10.5px; padding: 2px 8px; margin: 0; }
#storyScreen .lvlCard.done .lsTxt { display: none; } /* completado: solo el tic */
#storyScreen .lvlCard.done .lvlState { padding: 3px 6px; }
#storyScreen .lvlCard.next { --b-line: var(--accent); }
#storyScreen .lvlSaved { top: 10px; right: 10px; font-size: 9.5px; padding: 1px 6px; }
/* estrecho (móvil): las 5 por fila igual, solo el número y la miniatura (la siguiente, con el borde naranja) */
@media (max-width: 640px) {
  #storyScreen .lvlSection { padding: 12px 10px 14px; }
  .bkHead { font-size: 14.5px; gap: 8px; }
  .bkArt { width: 30px; height: 30px; border-radius: 9px; }
  .bkArt svg { width: 28px; height: 28px; }
  #storyScreen .bkRow { gap: 6px; }
  #storyScreen .bkRow + .bkRow { margin-top: 6px; }
  #storyScreen .lvlCard { padding: 4px; gap: 0; border-radius: 10px; }
  #storyScreen .lvlPreview { height: auto; aspect-ratio: 1; padding: 3px; border-radius: 7px; }
  #storyScreen .lvlName, #storyScreen .lvlFoot { display: none; }
  #storyScreen .lvlNum { top: 6px; left: 6px; min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
  #storyScreen .lvlSaved { top: auto; bottom: 6px; right: 6px; left: 6px; text-align: center; font-size: 8.5px; padding: 0 3px; }
}

/* ---------- Modos de juego: tres pestañas que se deslizan ---------- */
#modesGrid { --mdGap: 40px; }
/* sombra de las tarjetas de Modos: corta y suave (una larga se veía a través de la tarjeta de abajo mientras aparecía) */
:root { --mdShadow: 0 3px 8px rgba(10,25,10,.12), 0 10px 26px rgba(10,25,10,.16); }
/* la píldora: se desliza con un pequeño rebote y toma el color de su pestaña (verde, el rojo de los eventos, el gris
   del taller); el texto de la elegida, crema */
.mdTabs { --tabC: var(--grass-dark); position: relative; align-self: center; display: grid; grid-template-columns: repeat(3, 1fr); width: min(620px, 100%);
  padding: 5px; border-radius: 999px; background: rgba(20,12,60,.28); }
#modesGrid[data-tab="quick"] .mdTabs { --tabC: var(--mode-quick); }
#modesGrid[data-tab="special"] .mdTabs { --tabC: var(--mode-challenge); }
#modesGrid[data-tab="workshop"] .mdTabs { --tabC: var(--mode-workshop); }
.mdTabs button { position: relative; z-index: 1; --b-bg: transparent; --b-line: transparent; --b-fg: var(--cream); border-radius: 999px; min-width: 0;
  padding: 11px 10px; font-size: 15px; font-weight: 500; gap: 8px; justify-content: center; transition: color .3s; }
.mdTabs button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdTabs .tS { display: none; }
@media (max-width: 460px) { .mdTabs .tL { display: none; } .mdTabs .tS { display: inline; } }
.mdTabs button .i { width: 17px; height: 17px; flex: 0 0 auto; transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
.mdTabs button[aria-selected="true"] { --b-fg: var(--cream); font-weight: 600; }
.mdTabs button[aria-selected="true"] .i { transform: scale(1.15); }
.mdTabs button:hover { background-color: transparent; }
.mdTabs button:not([aria-selected="true"]):hover { --b-fg: #fff; }
.mdTabInd { position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 3); border-radius: 999px;
  background-color: var(--tabC); transition: transform .45s cubic-bezier(.34,1.32,.5,1), background-color .35s ease; }
#modesGrid[data-tab="special"] .mdTabInd { transform: translateX(100%); }
#modesGrid[data-tab="workshop"] .mdTabInd { transform: translateX(200%); }
.mdViewport { touch-action: pan-y; } /* (el desplazamiento vertical, del navegador; el horizontal, para arrastrar las pestañas) */
/* Eventos: más aire entre los desafíos y el contrarreloj */
#mdPanel-special .mdSection.rushWeek { margin-top: 14px; }
.mdTrack { display: block; }
.mdPanel { display: flex; flex-direction: column; gap: 20px; }
/* la pestaña oculta no se quita (display: none obligaba a recalcular sus ~2.000 elementos en cada cambio): se salta su
   dibujo y su tamaño, conservando su estado, y volver a enseñarla es inmediato */
.mdPanel.off { content-visibility: hidden; contain-intrinsic-size: none; height: 0; overflow: hidden; }
.mdLead { margin: 0 0 -6px; text-align: center; color: rgba(241,241,220,.92); font-size: 14px; } /* (al 92 %: AA también sobre una curva maestra del fondo) */
html.reduceMotion .mdTabInd, html.reduceMotion .mdTabs button .i { transition: none; }

/* ---------- tarjeta de baraja (lista vertical) ---------- */
.deckList { display: flex; flex-direction: column; gap: 14px; }
/* las barajas (sin Ultimate): filas iguales, todas con el alto de la más alta, sea cual sea su estado */
.dkSame { display: grid; grid-auto-rows: 1fr; gap: inherit; }
.dkSame > .deckCard { height: 100%; box-sizing: border-box; }
.dkBtns .bS { display: none; }
.deckCard { --dk: var(--grass-dark); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pic main stats" "pic btns stats";
  align-items: center; column-gap: 20px; row-gap: 12px; padding: 18px 22px 18px 18px; border-radius: 20px;
  background-image: var(--grain); background-color: var(--cream); box-shadow: var(--mdShadow);
  animation: btnUp .4s var(--ease-out) backwards; }
.deckCard:nth-child(2) { animation-delay: .06s; } .deckCard:nth-child(3) { animation-delay: .12s; }
.dkPic { grid-area: pic; position: relative; width: 92px; height: 92px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--dk) 14%, transparent); }
.dkArt { width: 74px; height: 74px; overflow: visible; }
.dkMain { grid-area: main; min-width: 0; }
.dkMain h3 { margin: 0 0 4px; font-size: 21px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.dkMain p { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--ink-soft); }
.dkMain .mdStats { margin-top: 8px; }
.dkBtns .dkLast { display: inline-flex; flex: 0 1 auto; width: auto; margin: 0 !important; }
.dkBtns .dkLast .mdStat { font-size: 11.5px; padding: 3px 9px; } /* (la última partida, junto a sus botones) */
.dkBtns { grid-area: btns; display: flex; flex-wrap: wrap; gap: 8px 6px; align-items: center; }
.dkStats { grid-area: stats; display: grid; grid-template-columns: repeat(3, auto); gap: 4px; margin: 0; padding: 10px 6px; border-radius: 14px;
  background: color-mix(in srgb, var(--dk) 9%, transparent); align-self: stretch; align-content: center; }
.dkStats div { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 0 6px; }
.dkStats div + div { border-left: 1px solid color-mix(in srgb, var(--dk) 22%, transparent); }
.dkStats dt { order: 2; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); margin-top: 3px; }
.dkStats dd { order: 1; margin: 0; font-size: 24px; font-weight: 600; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
/* bloqueada: apagada, con candado y "Próximamente" */
/* superficies de Modos (las mismas en las tres pestañas): la tarjeta crema, el recuadro interior blanco al 42 % con su
   filete, y el texto secundario un punto más oscuro que --ink-soft para llegar a AA sobre el crema (4,9:1) */
#modesGrid { --surface: var(--cream); --surface-2: rgba(255,255,255,.42); --surface-line: var(--cream-line);
  --surface-ink: var(--ink); --surface-ink-2: #5F6B58; }
/* cada baraja: tarjeta crema, como las de Eventos, y su color solo de acento: el recuadro de la ilustración lleva el
   césped de su partida en pequeño (su color y sus rayas a dos tonos: el agua, el minigolf, las vías, las estaciones, el
   espacio con estrellas, el tapete del casino). Las cifras, en un recuadro neutro igual para todas; un solo botón
   principal por tarjeta, del color de la pestaña (--deck-cta), los demás en contorno; "Continuar", naranja con texto
   oscuro (el blanco sobre naranja no llega a AA). (Ultimate tiene su propia tarjeta: ultimate.css) */
.deckCard[data-deck="classic"] { --deck-scene: repeating-linear-gradient(135deg, #8BBE7A 0 64px, #94C584 64px 128px); --deck-base: #8BBE7A; }
.deckCard[data-deck="water"] { --deck-scene: repeating-linear-gradient(135deg, #3F8C9C 0 64px, #4796A6 64px 128px); --deck-base: #3F8C9C; }
.deckCard[data-deck="minigolf"] { --deck-scene: repeating-linear-gradient(135deg, #5FA94F 0 64px, #67B157 64px 128px); --deck-base: #5FA94F; }
.deckCard[data-deck="train"] { --deck-scene: repeating-linear-gradient(90deg, rgba(120,96,52,.08) 0 3px, transparent 3px 34px),
    repeating-linear-gradient(135deg, #C9C98E 0 64px, #D1D098 64px 128px); --deck-base: #C9C98E; }
.deckCard[data-deck="seasons"] { --deck-scene: repeating-linear-gradient(135deg, #CDE5BE 0 64px, #EDE2B2 64px 128px, #EBCDAB 128px 192px, #E9F0F3 192px 256px); --deck-base: #EDE2B2; }
.deckCard[data-deck="multiverse"] { --deck-scene: radial-gradient(1.6px 1.6px at 12% 22%, #fff 98%, transparent), radial-gradient(1.2px 1.2px at 33% 70%, #fff 98%, transparent),
    radial-gradient(1.8px 1.8px at 58% 18%, #fff 98%, transparent), radial-gradient(1.2px 1.2px at 74% 62%, #fff 98%, transparent), radial-gradient(1.5px 1.5px at 88% 30%, #fff 98%, transparent),
    radial-gradient(1.2px 1.2px at 46% 88%, #fff 98%, transparent), radial-gradient(1.4px 1.4px at 95% 85%, #fff 98%, transparent),
    repeating-linear-gradient(135deg, #1B1545 0 64px, #211A52 64px 128px); --deck-base: #1B1545; }
.deckCard[data-deck="gambling"] { --deck-scene: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 2px, transparent 2px 44px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.04) 0 2px, transparent 2px 44px); --deck-base: #145C3E; }
.deckCard[data-deck] { --deck-cta: var(--mode-quick); }
.deckCard[data-deck]:not(.ultimate) { background-color: var(--surface); background-image: var(--grain); border: none; }
.deckCard[data-deck]:not(.ultimate) .dkPic { background-color: var(--deck-base); background-image: var(--deck-scene); overflow: hidden; }
.deckCard[data-deck]:not(.ultimate) .dkStats { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-line); }
.deckCard[data-deck]:not(.ultimate) .dkStats div + div { border-left-color: var(--surface-line); }
.deckCard[data-deck] :is(.dkMain p, .dkStats dt) { color: var(--surface-ink-2); }
.deckCard[data-deck] .dkBtns .btn-primary { --b-bg: var(--deck-cta); --b-line: var(--deck-cta); --b-fg: var(--cream); box-shadow: none; }
.deckCard[data-deck] .dkBtns .btn-primary:hover { background-color: color-mix(in srgb, var(--deck-cta) 82%, #000); }
.deckCard[data-deck] .dkBtns .btn-light { --b-bg: transparent; --b-line: var(--ink-line); }
.deckCard[data-deck] .dkBtns .btn-light:hover { background-color: var(--surface-2); }
.deckCard[data-deck] .dkBtns .btn-continue { --b-fg: var(--ink); }
.deckCard[data-deck] .dkCards { color: var(--surface-ink-2); }
.deckCard.locked { background-color: #E6E6D0; }
.deckCard.locked .dkArt { filter: grayscale(.55); opacity: .7; }
.deckCard.locked .dkMain h3, .deckCard.locked .dkStats dd { color: var(--ink-soft); }
.dkLock { position: absolute; right: -6px; bottom: -6px; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--cream); border: 3px solid #E6E6D0; }
.dkLock .i { width: 15px; height: 15px; }
.dkSoon { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--dk); background: color-mix(in srgb, var(--dk) 14%, transparent); }
.dkSoon .i { width: 14px; height: 14px; }
/* nombre de la baraja arriba de la configuración de la partida */
.pveDeckTag { display: inline-flex; margin-bottom: 8px; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--cream); background: var(--dk, var(--grass-dark)); }
.pveDeckTag:empty { display: none; }
@media (max-width: 640px) {
  #modesGrid { --mdGap: 24px; }
  .mdTabs button { font-size: 13px; padding: 10px 4px; gap: 5px; }
  .mdTabs button .i { width: 15px; height: 15px; }
  .deckCard { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "pic main" "stats stats" "btns btns"; column-gap: 14px; padding: 14px 14px 14px 12px; }
  .dkPic { width: 64px; height: 64px; border-radius: 14px; align-self: start; }
  .dkArt { width: 52px; height: 52px; }
  .dkMain h3 { font-size: 18px; }
  .dkMain p { font-size: 12.5px; }
  .dkStats { grid-template-columns: repeat(3, 1fr); padding: 8px 4px; }
  .dkStats dd { font-size: 20px; }
  .dkBtns { flex-wrap: nowrap; }
  .dkBtns .bL { display: none; } .dkBtns .bS { display: inline; } /* (en el móvil, los nombres cortos: una sola fila) */
  .deckCard { grid-template-rows: auto auto 1fr; }
  .deckCard .dkBtns { align-self: end; } /* (con el alto común, los botones abajo del todo) */
}

/* ---------- configuración de la partida rápida: en horizontal (cabe en pantalla en PC) ----------
   cabecera · tres columnas (quién juega · la mesa · rivales) · barra inferior con Volver y Jugar */
@media (min-width: 901px) {
  #pveScreen { align-items: center; padding: 20px 24px 70px; }
  #pveCard { width: min(1160px, 96vw); padding: 24px 28px 18px; margin: auto; }
  .pveHead { display: grid; grid-template-columns: auto 1fr; align-items: end; column-gap: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--cream-line); }
  .pveHead .pveDeckTag { grid-column: 1 / -1; justify-self: start; }
  .pveHead h2 { margin: 0; }
  #pveCard .pveHead .sub { margin: 0 0 3px; max-width: 62ch; }
  .pveCols { display: grid; grid-template-columns: 1.05fr 1fr 1fr; gap: 0; }
  .pveCols:has(#pveRivalsRow[hidden]) { grid-template-columns: 1fr 1fr; }
  .pveCols:has(#pveRivalsRow[hidden]) .rivalsCol { display: none; }
  .pveCol { min-width: 0; padding: 4px 24px 6px; }
  .pveCol:first-child { padding-left: 0; }
  .pveCol:last-child { padding-right: 0; }
  .pveCol + .pveCol { border-left: 1px solid var(--cream-line); }
  #pveCard .pveCol > h4:first-child, #pveCard .pveCol > div:first-child > h4:first-child { margin-top: 14px; }
  .pveCol.who .pveKind { margin-top: 14px; }
  #pveCard .pveOpts { flex-wrap: nowrap; gap: 8px; }
  #pveCard .pveOpts .pveOpt { flex: 1 1 0; min-width: 0; }
  #pveCard #pveColors { flex-wrap: wrap; }
  #pveCard #pveColors .pveColor { flex: 0 0 auto; }
  /* rivales: uno por fila (cara, nombre y personalidad en línea; flechas a los lados) */
  #pveCard #pveRivals { flex-direction: column; gap: 6px; }
  #pveCard .pveOpt.rival { flex: 0 0 auto; min-width: 0; padding: 5px 6px; }
  #pveCard .rivalBody { flex-direction: row; justify-content: flex-start; gap: 10px; text-align: left; padding: 0 4px; }
  #pveCard .rivalBody .avatar { width: 32px; height: 32px; flex: 0 0 auto; }
  #pveCard .rivalBody b { font-size: 14px; }
  #pveCard .rivalBody small { margin-left: auto; font-size: 11.5px; }
  #pveCard .rivalBody .rvRec, #pveCard .rivalBody .rvNemesis { flex: 0 0 auto; }
  #pveCard .rivalArrow { width: 28px; height: 28px; }
  /* barra inferior */
  .pveFoot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--cream-line); }
  #pveCard #pveBack { width: auto; margin: 0; }
  .pveFootMain { display: flex; align-items: center; gap: 10px; }
  #pveCard #pveContinue { width: auto; margin: 0; min-width: 240px; }
  #pveCard #pvePlay { width: auto; min-width: 220px; margin: 0; padding: 12px 26px; }
}
@media (min-width: 901px) {
  #pveCard .optBots { gap: 2px; max-width: 100%; }
  #pveCard .optBots i { width: 8px; height: 8px; flex: 0 0 auto; box-shadow: 0 1px 2px var(--shadow); }
}
@media (min-width: 901px) { #pveCard .pveOpt.opp, #pveCard .pveOpt.hum { padding-inline: 4px; } }

/* ---------- mini estadísticas (contrarreloj y desafíos): jugadas · victorias · % en una línea ---------- */
.miniSt { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 8px; font-size: 11px; color: var(--ink-soft); line-height: 1.3; }
.miniSt b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.miniSt > span + span::before { content: '·'; margin-right: 8px; color: var(--cream-line); font-weight: 700; }
.chTxt .miniSt { margin-top: 4px; }
.mdStats .miniSt { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: rgba(45,79,124,.08); }

/* ---------- compartir la jugada final ---------- */
.winShare { gap: 7px; }
.winShare .i { width: 15px; height: 15px; }
#dialog:has(.shareBox) { width: min(460px, 94vw); }
.shareBox { align-items: center; text-align: center; }
.sharePreview { display: block; width: 100%; max-height: min(56vh, 520px); object-fit: contain; border-radius: 14px; box-shadow: 0 12px 30px rgba(10,25,10,.25); }
.shareBtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.shareBtns button { flex: 1 1 auto; }
.shareBox .dlgBtns { justify-content: center; }

/* ---------- escena de lago (baraja de agua): el campo es una isla en un lago ---------- */
#gameDecor .dWater { display: none; }
/* probar un nivel del creador: la alfombrilla de corte gris azulada del taller (como el editor) */
#gameScreen[data-scene="mat"] #game {
  --mat-line: rgba(226,236,240,.075); --mat-line2: rgba(226,236,240,.15); --mat-ink: rgba(226,236,240,.66);
  background-color: #3C4A55;
  background-image:
    repeating-linear-gradient(90deg, var(--mat-ink) 0 1px, transparent 1px 50px), repeating-linear-gradient(90deg, var(--mat-line2) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(var(--mat-ink) 0 1px, transparent 1px 50px), repeating-linear-gradient(var(--mat-line2) 0 1px, transparent 1px 10px),
    linear-gradient(var(--mat-line2) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line2) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 100% 9px, 100% 5px, 9px 100%, 5px 100%, 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 0 0, 0 0, -1px -1px, -1px -1px, -1px -1px, -1px -1px;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, repeat, repeat;
}
#gameScreen[data-scene="mat"] #gameDecor > * { display: none; }
#gameScreen[data-scene="lake"] #game {
  background-color: #3F8C9C;
  background-image: var(--grain),
    radial-gradient(ellipse 55% 45% at 50% 48%, rgba(120,200,210,.35), transparent 75%),
    linear-gradient(170deg, #4E9FAE, #357C8D 70%, #2E6F80);
}
/* el oleaje: antes se animaba background-position de toda la partida (repintaba la pantalla entera en cada
   fotograma); ahora es una capa propia, 160px más ancha, que se desplaza con transform (sin repintar) */
#gameDecor .dWaves { display: none; }
#gameScreen[data-scene="lake"] #gameDecor { overflow: hidden; }
#gameScreen[data-scene="lake"] #gameDecor .dWaves { display: block; position: absolute; top: 0; bottom: 0; left: -160px; right: 0; will-change: transform;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='60'><path d='M0 30 Q20 22 40 30 T80 30 T120 30 T160 30' fill='none' stroke='white' stroke-opacity='.10' stroke-width='2'/><path d='M-20 52 Q0 46 20 52 T60 52 T100 52 T140 52 T180 52' fill='none' stroke='white' stroke-opacity='.06' stroke-width='2'/></svg>") 0 0 / 160px 60px repeat;
  animation: lakeDrift 40s linear infinite; }
@keyframes lakeDrift { to { transform: translateX(160px); } }
@media (max-width: 760px) { /* (ventana estrecha: sin decoración, pero con el agua) */
  #gameScreen[data-scene="lake"] #gameDecor { display: block; }
  #gameScreen[data-scene="lake"] #gameDecor > :not(.dWaves) { display: none; }
}
#gameScreen[data-scene="lake"] #gameDecor .dBunker, #gameScreen[data-scene="lake"] #gameDecor .dTree { display: none; }
#gameScreen[data-scene="lake"] #gameDecor .dWater { display: block; position: absolute; }
#gameDecor .dPads.a { width: 240px; left: -30px; top: 16%; animation: padBob 7s ease-in-out infinite; }
#gameDecor .dPads.b { width: 200px; right: -20px; bottom: 22%; animation: padBob 8s ease-in-out -3s infinite; }
#gameDecor .dReeds.a { width: 150px; left: -10px; bottom: 2%; }
#gameDecor .dReeds.b { width: 120px; right: 10px; top: 4%; transform: scaleX(-1); }
#gameDecor .dStones { width: 170px; right: -30px; top: 40%; }
#gameDecor .dRipple.a { width: 160px; left: 12%; top: 58%; animation: ripple 5.5s ease-out infinite; }
#gameDecor .dRipple.b { width: 120px; right: 16%; top: 12%; animation: ripple 6.5s ease-out -2.5s infinite; }
@keyframes padBob { 50% { transform: translateY(6px) rotate(2deg); } }
@keyframes ripple { 0% { transform: scale(.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
/* orilla de arena alrededor del tablero */
#gameScreen[data-scene="lake"] #boardWrap { box-shadow: 0 0 0 7px #E6D9A8, 0 0 0 16px rgba(230,217,168,.35), 0 8.4px 25.2px 8px rgba(20,50,60,.18); }
html.reduceMotion #gameDecor .dWaves, html.reduceMotion #gameDecor .dWater { animation: none !important; }
@media (prefers-reduced-motion: reduce) { #gameDecor .dWaves, #gameDecor .dWater { animation: none !important; } }

/* botón de Lo básico en el menú: progreso ("3/8") o, con todo hecho, tic gris */
.storyProg { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; background: rgba(241,241,220,.16); color: var(--cream); }
.storyProg:empty { display: none; }
.storyProg.all { min-width: 0; width: 22px; height: 22px; padding: 0; background: #9A9A8C; color: #fff; }
.storyProg.all .i { width: 13px; height: 13px; stroke-width: 3; }

/* ---------- presentación de las cartas nuevas de una baraja ---------- */
#dialog:has(.deckIntro) { width: min(760px, 94vw); }
.dlgBox.deckIntro { align-items: center; text-align: center; }
.dmTag { display: inline-flex; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--cream); background: var(--dk); }
.dmLead { margin: -4px 0 4px; font-size: 13.5px; color: var(--ink-soft); max-width: 52ch; }
.dmGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; width: 100%; }
.dmCard { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--cream-line); background: rgba(255,255,255,.35); }
.dmHead { display: flex; align-items: center; gap: 10px; align-self: stretch; }
.dmHead .hintCard { width: 34px; height: 46px; }
.dmHead b { font-size: 17px; font-weight: 600; }
.dmBoard { width: 100%; max-width: 230px; height: auto; display: block; filter: drop-shadow(0 8px 16px rgba(10,25,10,.18)); }
.dmCard p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink); text-align: left; }
.dmLbl { font: 600 9px Outfit, sans-serif; fill: rgba(241,241,220,.85); letter-spacing: .08em; text-transform: uppercase; }
.dmFlow { animation: dmFlow 1.4s linear infinite; }
@keyframes dmFlow { from { transform: translateY(-6px); opacity: .4; } 50% { opacity: 1; } to { transform: translateY(6px); opacity: .4; } }
.deckIntro .dlgBtns { justify-content: center; }
.deckIntro .dlgBtns button { min-width: 180px; }
.dkCards { gap: 5px; }
.dkCards .i { width: 14px; height: 14px; }
html.reduceMotion .dmFlow { animation: none; }
/* vista previa: tras un túnel no se sabe por dónde saldrá */
#previewSvg .pvUnknown circle { fill: rgba(36,36,36,.55); stroke: #F6E2BE; stroke-width: 2; }
#previewSvg .pvUnknown text { fill: #F6E2BE; font: 700 15px Outfit, sans-serif; text-anchor: middle; }

/* (la tarjeta de Ultimate, el combinador: styles/ultimate.css) */
@keyframes iriShift { to { background-position: 300% 0; } }

/* ---------- escena de minigolf: césped artificial y un marco de madera alrededor del campo ---------- */
#gameScreen[data-scene="mini"] #game {
  background-color: #5FA94F;
  background-image: var(--grain),
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.06) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 80%, rgba(0,0,0,.05) 0 2px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 60px, transparent 60px 120px);
  background-size: auto, 26px 26px, 32px 32px, auto;
}
#gameScreen[data-scene="mini"] #gameDecor .dBunker, #gameScreen[data-scene="mini"] #gameDecor .dTree { display: none; }
#gameScreen[data-scene="mini"] #boardWrap { background-color: #C99257;
  background-image: var(--grain), repeating-linear-gradient(90deg, rgba(122,82,48,.18) 0 2px, transparent 2px 38px);
  box-shadow: inset 0 0 0 3px #A8743F, 0 0 0 4px #7A5230, 0 8.4px 25.2px 2px rgba(20,40,20,.22); }

/* ---------- escena Ultimate: el foil holográfico contenido (.dHolo.holo.holo--subtle, styles/holo.css) ---------- */
/* (debajo, el verde de los menús: el foil entra con un fundido de 400 ms al empezar la partida) */
#gameScreen[data-scene="prism"] #game { background: var(--bg-base); }
#gameDecor .dHolo { display: none; position: absolute; inset: 0; }
#gameScreen[data-scene="prism"] #gameDecor { display: block; }
#gameScreen[data-scene="prism"] #gameDecor .dHolo { display: block; animation: holoIn .4s ease-out both; }
@keyframes holoIn { from { opacity: 0; } }
#gameScreen[data-scene="prism"] #gameDecor .dBunker, #gameScreen[data-scene="prism"] #gameDecor .dTree { display: none; }
#gameScreen[data-scene="prism"] #boardWrap { box-shadow: 0 0 0 3px rgba(255,255,255,.8), 0 0 0 7px #C39BFF, 0 0 40px 8px rgba(160,130,255,.45), 0 8.4px 25.2px 3.5px rgba(60,40,120,.18); }
.dmAlso { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.dmChip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; border: 1px solid var(--cream-line); color: var(--ink); font-weight: 500; }
.dmChip .hintCard { width: 20px; height: 27px; }
.dmQ { font: 700 12px Outfit, sans-serif; fill: #F6E2BE; letter-spacing: .1em; }
@media (min-width: 900px) { #dialog:has(.deckIntro) { width: min(980px, 94vw); } .dmGrid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } }
/* barajas en el ordenador: una por fila, con aire (la pantalla se desplaza: ya no se aprietan para caber) */
@media (min-width: 641px) {
  .deckList { gap: 18px; }
  .deckCard { padding: 18px 22px 18px 18px; row-gap: 10px; column-gap: 20px; }
  .dkPic { width: 84px; height: 84px; border-radius: 18px; }
  .dkArt { width: 66px; height: 66px; }
  .dkMain h3 { font-size: 20px; margin-bottom: 3px; }
  .dkMain p { font-size: 13.5px; line-height: 1.4; }
  .dkMain .mdStats { margin-top: 6px; }
  .dkStats { padding: 10px 6px; }
  .dkStats dd { font-size: 22px; }
}
/* Ultimate: sobre el fondo claro, la barra de la partida y las etiquetas en tinta oscura */
#gameScreen[data-scene="prism"] #gameBar .btn-ghost,
body[data-screen="game"]:has(#gameScreen[data-scene="prism"]) #sfxBtn,
body[data-screen="game"]:has(#gameScreen[data-scene="prism"]) #sndCfgBtn { --b-fg: #3B2C63; --b-line: rgba(59,44,99,.35); --b-bg: rgba(255,255,255,.5); }
#gameScreen[data-scene="prism"] #piles .pile, #gameScreen[data-scene="prism"] #lastPlay, #gameScreen[data-scene="prism"] .pileLbl { color: #3B2C63; }
#gameScreen[data-scene="prism"] .pileLbl b { border-color: rgba(59,44,99,.35); }
#gameScreen[data-scene="prism"] #discardTop.empty { border-color: rgba(59,44,99,.35); }
#boardWrap.zoomed { cursor: grab; } #boardWrap.zoomed:active { cursor: grabbing; }

/* ---------- Modos de juego: todo compacto ---------- */
/* desafíos (y el semanal): toda la tarjeta es el botón; a la derecha, jugar / continuar / superado */
.chGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
button.chCard { --b-bg: transparent; --b-line: var(--cream-line); width: 100%; flex-wrap: nowrap; justify-content: flex-start; align-items: center;
  gap: 10px; padding: 9px 10px 9px 9px; border-radius: 14px; text-align: left; font-weight: 400; letter-spacing: 0; line-height: 1.25; }
button.chCard:hover { background-color: rgba(181,71,63,.06); border-color: rgba(181,71,63,.35); }
button.chCard:hover .chGo:not(.ok) { transform: scale(1.08); }
.chCard .mdIco { width: 34px; height: 34px; border-radius: 10px; }
.chCard .mdIco .i { width: 18px; height: 18px; }
.chTxt { flex: 1 1 auto; }
.chTxt b { font-size: 13.5px; }
.chTxt small { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chEnd { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px; margin-left: 4px; }
.chGo { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--cream); transition: transform .15s var(--ease-out); }
.chGo .i { width: 13px; height: 13px; }
.chGo.ok { background: var(--mode-challenge); }
.chCont { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--accent); color: #fff; white-space: nowrap; }
.chSt { font-size: 10.5px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chCard.saved { border-color: var(--accent); }
.chCard.weekly { margin-bottom: 4px; padding: 10px 12px 10px 10px; }
.chCard.weekly .mdIco { width: 38px; height: 38px; }
.chCard.weekly .chTxt b { font-size: 15px; }
.chCard.weekly .wkTag { display: block; -webkit-line-clamp: unset; font-size: 10px; letter-spacing: .1em; margin-bottom: 1px; }
/* contrarreloj: una fila (icono, título con récord y botón) */
.mdPanel > .modeCard.rush { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
.modeCard.rush .mdHead { flex: 1 1 240px; }
.modeCard.rush .mdHead h3 { font-size: 19px; }
.modeCard.rush .mdBtns { margin: 0; }
/* secciones con menos aire */
#modesGrid .mdSection, #modesGrid .lvlSection { padding: 16px 16px 18px; }
#modesGrid .mdSection > h3, #modesGrid .lvlSection h3 { margin-bottom: 10px; }
#modesGrid .lvlGroup { margin: 12px 2px 7px; }
#modesGrid .lvlGroup:first-of-type { margin-top: 2px; }
.mdPanel { gap: 14px; }
/* puzles y tus niveles: tarjetas pequeñas en una rejilla que llena todo el ancho (y queda centrada) */
#modesGrid .lvlRow { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; } /* (9 por grupo: una fila) */
/* desafíos: con un número impar en el grupo, el último ocupa la fila entera (como destacado) */
.chGrid > .chCard:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
#modesGrid .lvlCard, #modesGrid .lvlWrap { width: auto; min-width: 0; }
#modesGrid .lvlCard { padding: 6px 6px 8px; gap: 5px; border-radius: 13px; }
#modesGrid .lvlPreview { height: 78px; padding: 6px; border-radius: 9px; }
#modesGrid .lvlName { font-size: 12.5px; min-height: 0; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#modesGrid .lvlNum { top: 10px; left: 10px; min-width: 19px; height: 19px; font-size: 10px; padding: 0 5px; }
#modesGrid .lvlFoot { margin: 0 2px; }
#modesGrid .lvlState { font-size: 10.5px; padding: 2px 8px; margin: 0; }
#modesGrid .lvlCard.done .lsTxt { display: none; } /* completado: solo el tic */
#modesGrid .lvlCard.done .lvlState { padding: 3px 6px; }
#modesGrid .lvlSaved { top: 10px; right: 10px; font-size: 9.5px; padding: 1px 6px; }
#modesGrid .lvlActs { top: 9px; right: 9px; gap: 3px; }
#modesGrid .lvlActs button { width: 26px; height: 26px; }
#modesGrid .lvlActs .i { width: 13px; height: 13px; }
#modesGrid .lvlWrap > .lvlTag { position: absolute; z-index: 2; left: 10px; right: auto; top: 64px; font-size: 9.5px; padding: 1px 6px; }
#modesGrid .noLevels { padding: 12px 16px; font-size: 13px; }
/* El taller: las tarjetas, más grandes (5 por fila; en pantallas medianas, 4; en el móvil, 3) */
#modesGrid #mdPanel-workshop .lvlRow { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
#modesGrid #mdPanel-workshop .lvlCard { padding: 8px 8px 10px; gap: 7px; }
#modesGrid #mdPanel-workshop .lvlPreview { height: 132px; }
#modesGrid #mdPanel-workshop .lvlName { font-size: 13.5px; }
#modesGrid #mdPanel-workshop .lvlWrap > .lvlTag { top: 116px; left: 12px; font-size: 10.5px; }
#modesGrid #mdPanel-workshop .lvlActs button { width: 30px; height: 30px; }
@media (max-width: 820px) { #modesGrid #mdPanel-workshop .lvlRow { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  #modesGrid #mdPanel-workshop .lvlPreview { height: 104px; } #modesGrid #mdPanel-workshop .lvlWrap > .lvlTag { top: 88px; } }
@media (max-width: 560px) { #modesGrid #mdPanel-workshop .lvlRow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  #modesGrid #mdPanel-workshop .lvlPreview { height: 84px; } #modesGrid #mdPanel-workshop .lvlWrap > .lvlTag { top: 68px; } }
@media (max-width: 820px) { .chGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chGrid > .chCard:last-child:nth-child(3n + 1) { grid-column: auto; } .chGrid > .chCard:last-child:nth-child(2n + 1) { grid-column: 1 / -1; }
  #modesGrid .lvlRow { grid-template-columns: repeat(3, minmax(0, 1fr)); } } /* (9 por grupo: 3 × 3) */
@media (max-width: 560px) {
  .chGrid { grid-template-columns: 1fr; gap: 6px; }
  #modesGrid .lvlRow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #modesGrid .lvlPreview { height: 62px; padding: 4px; }
  #modesGrid .lvlName { font-size: 11.5px; }
  #modesGrid .lvlWrap > .lvlTag { top: 48px; }
  .lvlHeadActs { margin-left: 0; width: 100%; }
}

/* =========================================================
   Final de partida compacto: todo cabe en pantalla sin desplazarse (ordenador, móvil y horizontal)
     cabecera   estilo de la victoria · mensaje · fichas (ganador, récord, racha)
     cuerpo     las 5 cifras en una fila · recorrido | resumen, lado a lado (o "¿por qué he perdido?" en su sitio)
     botones
   ========================================================= */
#winOverlay { padding: 34px 12px 12px; }
#winOverlay .box { width: min(640px, 100%); min-width: 0; max-width: 100%; padding: 42px 26px 20px; display: flex; flex-direction: column; gap: 14px; }
#winOverlay .winIcon { width: 60px; height: 60px; }
#winOverlay .winIcon .i { width: 28px; height: 28px; }
#winOverlay .winHead { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#winOverlay #winStyle { margin: 0; }
#winOverlay .msg { font-size: clamp(22px, 3.4vw, 27px); margin: 0; text-wrap: balance; }
#winOverlay #winChips { margin: 0; gap: 6px; }
#winOverlay .winChip { font-size: 13px; padding: 4px 13px; }
#winOverlay .winRec { font-size: 13px; padding: 4px 12px; }
#winOverlay .winRec.streakGoal { font-size: 14.5px; padding: 6px 15px; }
/* cuerpo: cifras arriba; debajo, recorrido y resumen lado a lado */
#winOverlay .winBody { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "stats stats" "route sum" "why why"; gap: 12px 14px; align-items: start; }
#winOverlay .winBody:empty, #winOverlay .winBody:not(:has(> :not(:empty))) { display: none; }
#winOverlay #winStats { grid-area: stats; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; }
#winOverlay #winStats .st { padding: 6px 2px 5px; border-radius: 12px; font-size: 10.5px; gap: 1px; line-height: 1.15; }
#winOverlay #winStats .st .i { width: 15px; height: 15px; }
#winOverlay #winStats .st b { font-size: 17px; }
#winOverlay #winSummary { grid-area: sum; grid-template-columns: 1fr; gap: 6px; margin: 0; }
#winOverlay .sumTile { padding: 7px 10px; border-radius: 12px; gap: 8px; }
#winOverlay .sumTile .i { width: 16px; height: 16px; }
#winOverlay .sumTile small { font-size: 10.5px; }
#winOverlay .sumTile b { font-size: 12.5px; }
#winOverlay #winRoute { grid-area: route; margin: 0; }
#winOverlay #winRoute h4 { margin: 0 0 6px; }
#winOverlay .rtWrap { gap: 10px; align-items: center; }
#winOverlay .rtMap { height: 124px; max-width: 58%; }
#winOverlay .rtLegend { gap: 3px; font-size: 11.5px; }
#winOverlay .rtSw { width: 16px; height: 16px; }
/* sin recorrido (o sin resumen), lo otro ocupa todo el ancho */
#winOverlay .winBody:not(:has(#winRoute:not(:empty))) #winSummary { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#winOverlay .winBody:not(:has(#winSummary:not(:empty))) #winRoute { grid-column: 1 / -1; }
/* "¿por qué he perdido?": el momento clave ocupa el sitio del resumen y del recorrido (no alarga el final) */
#winOverlay #winWhy { grid-area: why; margin: -4px 0 0; }
#winOverlay .box.whyOpen #winSummary, #winOverlay .box.whyOpen #winRoute { display: none; }
#winOverlay .box.whyOpen #winWhy { grid-row: 2; margin: 0; }
#winOverlay .whyPanel { margin-top: 6px; padding: 10px 12px; }
#winOverlay .whyBoards { margin: 6px 0; }
#winOverlay .whyBoards figure svg { width: auto; height: 118px; max-height: none; max-width: 30vw; }
#winOverlay .whyHead p, #winOverlay .whyTip { font-size: 12.5px; }
#winOverlay #winBtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#winOverlay #winBtns .btn-lg { padding: 10px 22px; }

/* móvil en vertical (estrecho): el resumen, en una columna bajo el recorrido */
@media (max-width: 560px) {
  #winOverlay { padding: 30px 10px 10px; }
  #winOverlay .box { padding: 36px 14px 14px; gap: 11px; border-radius: 18px; }
  #winOverlay .winIcon { width: 52px; height: 52px; }
  #winOverlay .winIcon .i { width: 24px; height: 24px; }
  #winOverlay .msg { font-size: 22px; }
  #winOverlay .winBody { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stats" "route" "sum" "why"; gap: 10px; }
  #winOverlay .box.whyOpen #winWhy { grid-row: 2; }
  #winOverlay #winStats .st { font-size: 9.5px; padding: 5px 1px 4px; }
  #winOverlay #winStats .st b { font-size: 16px; }
  #winOverlay .rtMap { height: 96px; }
  #winOverlay .rtLegend { flex-direction: row; flex-wrap: wrap; gap: 3px 10px; font-size: 11px; }
  #winOverlay .sumTile { padding: 5px 9px; }
  #winOverlay .sumTile span { flex-direction: row; align-items: baseline; gap: 6px; flex-wrap: wrap; } /* (una línea: «Jugada más larga  7 casillas · Tú») */
  #winOverlay .whyBoards figure svg { height: 100px; }
  #winOverlay #winBtns button { padding: 9px 16px; }
}
/* poca altura (móvil en horizontal, ventanas bajas): dos columnas, qué ha pasado y los botones a la izquierda */
@media (max-height: 560px) and (min-width: 600px) {
  #winOverlay { padding: 10px; }
  #winOverlay .box { width: min(860px, 100%); padding: 16px 18px; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    grid-template-areas: "head body" "btns body"; grid-template-rows: 1fr auto; gap: 12px 20px; align-items: center; }
  #winOverlay .winIcon { position: static; transform: none; width: 44px; height: 44px; grid-area: head; align-self: start; justify-self: center; margin-top: 0; }
  #winOverlay .winIcon .i { width: 22px; height: 22px; }
  #winOverlay .winHead { grid-area: head; padding-top: 52px; }
  #winOverlay .msg { font-size: 21px; }
  #winOverlay .winBody { grid-area: body; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stats" "route" "sum" "why"; gap: 8px; }
  #winOverlay .winBody:has(#winRoute:not(:empty)):has(#winSummary:not(:empty)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "stats stats" "route sum" "why why"; }
  #winOverlay .box.whyOpen #winWhy { grid-row: 2; grid-column: 1 / -1; }
  #winOverlay #winBtns { grid-area: btns; }
  #winOverlay .rtMap { height: 92px; }
  #winOverlay .rtLegend { font-size: 10.5px; }
  #winOverlay .whyBoards figure svg { height: 86px; }
  #winOverlay .whyHead p, #winOverlay .whyTip { font-size: 11.5px; }
  #winOverlay #winBtns button { padding: 8px 14px; }
}

/* =========================================================
   Quién juega y cuál es tu color (ordenador y móvil)
     · lo que no juega ahora pierde opacidad: los rivales en espera y tu mano fuera de tu turno
       (salvo las naranjas: se pueden jugar aunque no sea tu turno)
     · tu bandeja de abajo, teñida suavemente de tu color de bola; en tu turno, con el borde de tu color
     · la píldora del turno y el marcador sobre la pelota que juega, del color de quien juega
   ========================================================= */
#dock { --dock-bg: color-mix(in srgb, var(--pc) 11%, var(--cream)); }
#dockRow { background-color: var(--dock-bg); }
#dock.myTurn #dockRow { border-color: var(--pc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 20%, transparent), var(--shadow-soft), 0 6px 18px rgba(20,40,20,.18); }
#dock.cta #dockRow { border-color: var(--accent-deep); box-shadow: 0 0 0 4px rgba(217,96,58,.2), var(--shadow-soft); }
#dock.myTurn .ownerTxt small { color: color-mix(in srgb, var(--pc) 70%, var(--ink)); }
#dock.waiting:not(.cta) #hands .card:not(.orange) { opacity: .55; }
.seat { opacity: .5; }
.seat.active, .seat.cta, .seat.won { opacity: 1; }
.seat.active { background-color: color-mix(in srgb, var(--pc) 9%, var(--cream)); }
html.hiContrast .seat { opacity: .75; } html.hiContrast .seat.active, html.hiContrast .seat.cta, html.hiContrast .seat.won { opacity: 1; }
#turnPill { border-color: color-mix(in srgb, var(--pc) 60%, transparent); background-color: color-mix(in srgb, var(--pc) 10%, var(--cream)); }
#turnPill.mine { border-color: var(--pc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 24%, transparent), var(--shadow-soft); }
.piece.isTurn .turnMark { background: var(--pc); box-shadow: 0 0 0 1.5px var(--cream), 0 1.2px 3.6px var(--shadow); }

/* compartir el reto diario: copiado (se queda así) */
#winBtns .winShare.done, #winBtns .winShare.done:hover { --b-bg: var(--grass-dark); --b-fg: var(--cream); --b-line: var(--grass-dark); background-color: var(--grass-dark); animation: none; }

/* iconos de las barajas: al pasar por la tarjeta, la escena se anima (quietos en reposo: sin gasto) */
.dkArt .dkSpin { transform-box: view-box; transform-origin: 30px 24px; }
.dkArt .dkWave { transform-box: view-box; }
.dkArt .dkRipple { transform-box: fill-box; transform-origin: center; }
.deckCard:hover .dkArt .dkSpin, .deckCard:focus-within .dkArt .dkSpin { animation: dkSpin 2.4s linear infinite; }
.deckCard:hover .dkArt .dkWave, .deckCard:focus-within .dkArt .dkWave { animation: dkWave 1.6s ease-in-out infinite alternate; }
.deckCard:hover .dkArt .dkRipple, .deckCard:focus-within .dkArt .dkRipple { animation: dkRipple 1.6s ease-out infinite; }
.deckCard:hover .dkArt .dkTw, .deckCard:focus-within .dkArt .dkTw { animation: dkTw 1.2s ease-in-out infinite; }
.dkArt .dkTw { transform-box: fill-box; transform-origin: center; }
.deckCard:hover .dkArt, .deckCard:focus-within .dkArt { transform: rotate(-4deg) scale(1.06); }
.dkArt { transition: transform .35s cubic-bezier(.3,1.4,.5,1); filter: drop-shadow(0 4px 8px rgba(20,40,20,.25)); }
@keyframes dkSpin { to { transform: rotate(360deg); } }
@keyframes dkWave { to { transform: translateX(-6px); } }
@keyframes dkRipple { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes dkTw { 50% { transform: scale(.4) rotate(45deg); opacity: .4; } }
html.reduceMotion .deckCard .dkArt * { animation: none !important; }

/* =========================================================
   Juegos especiales: iconos ilustrados (src/ui/mode-art.js), cabeceras con progreso y grupos por dificultad
   ========================================================= */
/* cabecera de sección: icono, título grande, su barra de progreso y el número */
#modesGrid .spHead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; font-size: inherit; text-transform: none; letter-spacing: 0; color: var(--ink); }
.spArt { flex: 0 0 auto; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: rgba(36,36,36,.05); }
.spArt .mdArt { width: 46px; height: 46px; overflow: visible; filter: drop-shadow(0 3px 6px rgba(20,40,20,.22)); transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
.spTitle { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 180px; }
.spTitle b { font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.spTitle small { font-size: 12.5px; color: var(--ink-soft); font-weight: 400; }
.spBar { display: block; width: min(240px, 100%); height: 6px; border-radius: 999px; background: rgba(36,36,36,.08); overflow: hidden; margin-top: 3px; }
.spBar i { display: block; height: 100%; border-radius: inherit; background: var(--sp, var(--grass-dark)); }
#storyProgress .spBar { width: 100%; height: 8px; margin-top: 0; background: rgba(241,241,220,.25); } /* (Lo básico: la barra, del ancho del bloque, bajo el texto centrado) */
#modesGrid .spHead .lvlCount { font-size: 12px; padding: 3px 10px; background: var(--sp, var(--grass-dark)); }
#modesGrid .spHead .lvlHeadActs { margin-left: auto; }
.mdSection.challenges { --sp: var(--mode-challenge); }
.lvlSection.yours { --sp: var(--mode-workshop); }
.mdSection:hover .spArt .mdArt, .lvlSection:hover .spArt .mdArt { transform: rotate(-5deg) scale(1.07); }
/* al pasar: el trofeo destella, la pieza encaja, el lápiz dibuja */
.mdArt .mdShine, .mdArt .mdPiece, .mdArt .mdPencil, .dkArt .mdHand { transform-box: view-box; }
.dkArt .mdHand { transform-origin: 30px 32px; }
.mdSection:hover .mdArt .mdShine { animation: mdShine 1.4s ease-in-out infinite; }
.lvlSection:hover .mdArt .mdPiece { animation: mdPiece 1.4s ease-in-out infinite; }
.lvlSection:hover .mdArt .mdPencil { animation: mdPencil 1.2s ease-in-out infinite; transform-origin: 32px 36px; }
.rushCard:hover .dkArt .mdHand, .rushCard:focus-within .dkArt .mdHand { animation: dkSpin 1.6s linear infinite; }
@keyframes mdShine { 50% { opacity: .1; transform: translateX(10px); } }
@keyframes mdPiece { 0%, 100% { transform: translate(3px, -3px); } 50% { transform: none; } }
@keyframes mdPencil { 50% { transform: rotate(-7deg) translate(-1px, 1px); } }
html.reduceMotion .mdArt *, html.reduceMotion .rushCard .dkArt * { animation: none !important; }

/* grupos de dificultad: marcas (1, 2 o 3), nombre, x/y y su barra */
#modesGrid .lvlGroup { align-items: center; gap: 8px; }
.gPips { display: inline-flex; gap: 3px; }
.gPips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(36,36,36,.14); }
.gPips i.on { background: var(--gc, var(--sp, var(--grass-dark))); }
.lvlGroup.g-warmup { --gc: #E8867A; } .lvlGroup.g-mid { --gc: #C9594E; } .lvlGroup.g-expert { --gc: #8E2E28; }
.gBar { flex: 0 1 120px; height: 4px; border-radius: 999px; background: rgba(36,36,36,.08); overflow: hidden; margin-left: 4px; }
.gBar i { display: block; height: 100%; border-radius: inherit; background: var(--gc); }

/* iconos de los desafíos: con relieve y un tono por dificultad */
.chCard .mdIco { background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.12); position: relative; overflow: hidden; }
.chCard .mdIco::after { content: ''; position: absolute; left: -30%; top: -60%; width: 90%; height: 90%; border-radius: 50%; background: rgba(255,255,255,.18); }
.chCard .mdIco .i { position: relative; z-index: 1; transition: transform .3s cubic-bezier(.3,1.5,.5,1); }
button.chCard:hover .mdIco .i { transform: scale(1.15) rotate(-8deg); }
.chCard.g-warmup { --c1: #EE8C80; --c2: #CC5A4E; }
.chCard.g-mid { --c1: #D2574B; --c2: #A13A31; }
.chCard.g-expert { --c1: #A83830; --c2: #6C1F1A; }
/* desafío semanal: su calendario ilustrado */
.wkArt { flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; }
.wkArt .mdArt { width: 46px; height: 46px; filter: drop-shadow(0 3px 6px rgba(120,30,20,.25)); transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
button.chCard.weekly:hover .wkArt .mdArt { transform: rotate(-6deg) scale(1.08); }

/* contrarreloj: tarjeta de baraja (styles de .deckCard) con su azul */
.rushCard .dkPic { background: color-mix(in srgb, var(--mode-rush) 14%, transparent); }
.rushCard .dkStats { background: color-mix(in srgb, var(--mode-rush) 9%, transparent); }
@media (max-width: 560px) {
  .spArt { width: 44px; height: 44px; } .spArt .mdArt { width: 40px; height: 40px; }
  .spTitle b { font-size: 17px; }
  .gBar { display: none; }
}

/* "Crear nivel" (Tus niveles) es la entrada al creador: con el gris azulado de su alfombrilla y letra blanca */
.lvlCreate { --b-bg: #3C4A55; --b-fg: #fff; --b-line: #3C4A55; font-weight: 600; }
.lvlCreate:hover { background-color: #4B5C68; }

/* ---------- regalo de early tester (src/ui/gift.js): un aviso pequeño en el menú y la ventana del regalo ---------- */
#giftPop { position: fixed; left: 50%; bottom: 22px; z-index: 60; display: flex; align-items: center; gap: 10px;
  padding: 7px 18px 7px 8px; border-radius: 999px; border: 0; cursor: pointer; text-align: left;
  background-image: var(--grain); background-color: var(--cream); color: var(--ink); box-shadow: 0 10px 28px rgba(10,25,10,.3);
  transform: translateX(-50%); animation: giftIn .55s cubic-bezier(.3,1.5,.5,1) both, giftBob 3.2s ease-in-out .8s infinite; }
#giftPop:hover { background-color: #fff; }
#giftPop .giftSvg { width: 40px; height: 40px; flex: 0 0 auto; animation: giftWiggle 2.6s ease-in-out 1.2s infinite; transform-origin: 50% 90%; }
#giftPop b { display: block; font-size: 14.5px; font-weight: 600; }
#giftPop small { display: block; font-size: 12px; color: var(--ink-soft); }
@keyframes giftIn { from { transform: translate(-50%, 30px) scale(.7); opacity: 0; } }
@keyframes giftBob { 50% { transform: translate(-50%, -4px); } }
@keyframes giftWiggle { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-9deg); } 84% { transform: rotate(8deg); } 92% { transform: rotate(-4deg); } }
html.phone #giftPop { bottom: calc(14px + env(safe-area-inset-bottom)); }
.dlgBox.giftBox { align-items: center; text-align: center; }
.giftBox .giftSvg { width: 96px; height: 96px; overflow: visible; }
.giftBox .giftLid { transform-box: view-box; transform-origin: 12px 26px; animation: giftLid .6s cubic-bezier(.3,1.6,.5,1) .15s both; }
.giftBox .giftOut { transform-box: fill-box; transform-origin: center; animation: giftOut .7s cubic-bezier(.3,1.5,.5,1) .35s both; }
@keyframes giftLid { from { transform: none; } to { transform: translate(-6px, -9px) rotate(-22deg); } }
@keyframes giftOut { from { transform: translateY(18px) scale(.2); opacity: 0; } }
.giftBox p { max-width: 36ch; margin: 0 auto; }
.giftBox .dlgBtns { justify-content: center; }
/* la racha congelada: la llama en azul hielo */
.dFlame.frozen { background: #3E6E8E; }
.dFlame.frozen .i { color: #CFE8F5; }
html.reduceMotion #giftPop, html.reduceMotion #giftPop .giftSvg, html.reduceMotion .giftBox .giftLid, html.reduceMotion .giftBox .giftOut { animation: none; }

/* ---------- presentación de la mesa (antes de empezar: quién eres, rivales y orden de juego) ---------- */
#lineup {
  --lu: var(--grass-dark); --lu-fg: var(--cream);
  position: fixed; inset: 0; z-index: 47; display: none; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20,40,20,.42); backdrop-filter: blur(2px);
}
#lineup.v-daily { --lu: var(--mode-daily); --lu-fg: var(--ink); }
#lineup.v-challenge, #lineup.v-weekly { --lu: var(--mode-challenge); }
#lineup.visible { display: flex; animation: fadeIn .25s var(--ease-out); }
.luBox {
  width: min(540px, 100%); max-height: 100%; text-align: center; padding: 24px 22px 20px; border-radius: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background-image: var(--grain); background-color: var(--cream); box-shadow: 0 30px 70px rgba(10,25,10,.35);
  animation: winPop .35s var(--ease-out);
}
.luTag { padding: 4px 12px; border-radius: 999px; background: var(--lu); color: var(--lu-fg);
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.luBox > * { flex-shrink: 0; }
.luHero { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.luMe { position: relative; display: grid; place-items: center; margin: 8px 0 2px; }
.luMe .skBall { --bs: 64px !important; animation: luBob 2.6s ease-in-out infinite; }
.luMe::before { content: ''; position: absolute; width: 64px; height: 64px; border-radius: 50%; border: 2.5px solid var(--lu);
  animation: luRing 2.2s var(--ease-out) .5s infinite; opacity: 0; }
.luBox h2 { font-size: 28px; font-weight: 500; letter-spacing: -.035em; line-height: 1.05; }
.luSub { font-size: 15px; color: var(--ink-soft); margin-top: 6px; }
.luSub.mine { color: var(--accent-deep); font-weight: 600; }
.luOrder { width: 100%; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--cream-line); }
.luH { display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.luTrack { list-style: none; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; padding: 26px 0 0; margin: 0; }
.luSeat { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 3px 9px; border-radius: 16px;
  transition: background-color .2s, transform .25s var(--ease-out); animation: luIn .45s var(--ease-out) calc(var(--i) * 70ms + 150ms) both; }
/* (el camino de los turnos: de cada uno al siguiente) */
.luSeat:not(:last-child)::after { content: ''; position: absolute; top: 49px; left: calc(50% + 28px); right: calc(-50% + 26px);
  border-top: 2px dotted color-mix(in srgb, var(--ink-soft) 55%, transparent); }
.luN { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
  background: var(--cream-deep); color: var(--ink-soft); }
.luSeat .avatar { width: 46px; height: 46px; font-size: 15px; transition: transform .25s var(--ease-out), box-shadow .25s; }
.luSeat b { max-width: 100%; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.luSeat small { max-width: 100%; font-size: 11.5px; color: var(--ink-soft); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.luSeat.me small { padding: 1px 8px; border-radius: 999px; background: var(--ink); color: var(--cream); font-weight: 600; }
.luSeat.on { background-color: color-mix(in srgb, var(--pc) 16%, transparent); transform: translateY(-3px); }
.luSeat.on .avatar { transform: scale(1.1); box-shadow: 0 0 0 3px var(--cream), 0 0 0 5.5px var(--pc), 0 6px 14px var(--shadow); }
.luSeat.on .luN { background: var(--ink); color: var(--cream); }
.luFirst { position: absolute; left: 50%; top: -22px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 7px; border-radius: 999px;
  background: var(--accent); color: var(--ink); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  transform: translateX(-50%) translateY(6px) scale(.6); opacity: 0; transition: transform .35s cubic-bezier(.3,1.6,.5,1), opacity .2s; }
.luFirst .i { width: 12px; height: 12px; }
#lineup.lit .luFirst { transform: translateX(-50%); opacity: 1; }
.luBox .btn-primary { margin-top: 12px; min-width: min(240px, 100%); }
@keyframes luIn { from { opacity: 0; transform: translateY(14px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes luBob { 50% { transform: translateY(-5px); } }
@keyframes luRing { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
#lineup.still .luBox, #lineup.still .luSeat, #lineup.still .luMe .skBall, #lineup.still .luMe::before { animation: none; }
#lineup.still .luFirst { transition: none; }
@media (max-width: 480px) {
  .luBox { padding: 20px 14px 16px; }
  .luBox h2 { font-size: 24px; }
  .luTrack { gap: 2px; }
  .luSeat { padding: 7px 1px 8px; }
  .luSeat .avatar { width: 38px; height: 38px; font-size: 13px; }
  .luSeat:not(:last-child)::after { top: 45px; left: calc(50% + 23px); right: calc(-50% + 21px); }
  .luSeat b { font-size: 12px; }
  .luSeat small { font-size: 10.5px; }
  .luSeat.me small { padding: 1px 6px; }
  .luFirst { left: 2px; transform: translateY(6px) scale(.6); transform-origin: left center; font-size: 9.5px; padding: 3px 8px 3px 6px; }
  #lineup.lit .luFirst { transform: none; }
}
@media (max-height: 540px) {
  .luBox { padding: 14px 18px 14px; gap: 4px; }
  .luHero { flex-direction: row; gap: 14px; text-align: left; }
  .luMe { margin: 0; }
  .luMe .skBall { --bs: 44px !important; }
  .luMe::before { width: 44px; height: 44px; }
  .luBox h2 { font-size: 22px; }
  .luSub { font-size: 13.5px; margin-top: 2px; }
  .luOrder { margin-top: 4px; padding-top: 6px; }
  .luH { display: none; }
  .luBox .btn-primary { margin-top: 6px; padding-top: 9px; padding-bottom: 9px; }
}

/* ---------- estadísticas del reto diario (ventana): números, insignias de la racha y turnos para ganar ---------- */
#dialog:has(.dsBox) { width: min(440px, 94vw); }
.dlgBox.dsBox { gap: 10px; padding: 22px 24px 18px; }
.dsHead { display: flex; align-items: center; gap: 10px; }
.dsIco { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 11px; background: var(--mode-daily); color: var(--ink); }
.dsIco .i { width: 18px; height: 18px; }
.dsBox h4 { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: 6px; }
.dsNums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.dsNum b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.dsNum small { display: block; font-size: 11.5px; line-height: 1.2; color: var(--ink-soft); }
.dsBadges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.dsBadge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px; background: rgba(36,36,36,.05); }
.dsBadge.got { background: rgba(232,115,58,.13); }
.dsBall { position: relative; display: inline-flex; height: 52px; align-items: center; }
.dsBadge:not(.got) .dsBall .skBall { filter: grayscale(1); opacity: .35; }
.dsLock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.dsLock .i { width: 16px; height: 16px; }
.dsBadge small { font-size: 12px; font-weight: 600; }
.dsBadge:not(.got) small { color: var(--ink-soft); font-weight: 500; }
.dsBar { width: 70%; height: 4px; border-radius: 999px; background: rgba(36,36,36,.12); overflow: hidden; }
.dsBar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.dsDist { display: flex; align-items: flex-end; gap: 6px; height: 118px; padding-top: 4px; }
.dsCol { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.dsBarV { position: relative; width: 100%; max-width: 30px; height: max(6px, calc(var(--h) * 78px)); border-radius: 7px; background: var(--grass-dark);
  transform-origin: bottom; animation: dsGrow .5s var(--ease-out) both; }
.dsCol.zero .dsBarV { background: rgba(36,36,36,.12); }
.dsCol.today .dsBarV { background: var(--accent); }
.dsBarV em { position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 2px; font-style: normal; font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.dsCol.zero em { display: none; }
.dsCol small { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dsCol.today small { color: var(--ink); font-weight: 700; }
@keyframes dsGrow { from { transform: scaleY(0); } }
html.reduceMotion .dsBarV { animation: none; }
.dsNone { font-size: 13px !important; color: var(--ink-soft); }
.dsBox .dlgBtns { justify-content: stretch; }
.dsBox .dlgBtns button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.dsBox .dlgBtns .i { width: 16px; height: 16px; }
.dsShare.done { --b-bg: var(--grass-dark); --b-line: var(--grass-dark); }
@media (max-width: 380px) { .dlgBox.dsBox { padding: 18px 16px 14px; } .dsNum b { font-size: 25px; } .dsNum small { font-size: 10.5px; } }

/* =========================================================
   Desafíos de la semana (crowns.js): la cabecera con tus coronas (plana, como el menú: rojo con rayas diagonales a dos
   tonos, la corona que flota y la cuenta atrás; compartir arriba a la derecha) y las 5 tarjetas, una por fila. Sin hacer:
   blancas, con la corona en silueta y "Jugar"; ganadas: doradas, con la corona de oro. En la sección estrecha (móvil), más
   compacto (container query)
   ========================================================= */
.mdSection.crowns { padding: 0 !important; overflow: hidden; container-type: inline-size; }
.crHead { position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px;
  padding: 20px 64px 20px 22px; overflow: hidden; color: #FFF4D6;
  background-color: #B5473F; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.045) 0 64px, transparent 64px 128px); }


.crMain { display: flex; align-items: center; gap: 16px; min-width: 0; }
.crBadge { flex: 0 0 auto; width: 96px; height: 96px; display: grid; place-items: center; }
.crBig { width: 90px; height: 73px; overflow: visible; animation: crBob 3.4s ease-in-out infinite; }
@keyframes crBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }


.crInfo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.crTitle { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; } /* (opacas: al 85 % no llegaban a AA) */
.crTotal { display: flex; align-items: baseline; gap: 8px; line-height: 1; }
.crTotal b { font-size: 62px; font-weight: 700; letter-spacing: -.02em; color: #FFE7A6; font-variant-numeric: tabular-nums; }
.crTotal small { font-size: 18px; font-weight: 500; opacity: .9; }
/* el reloj: tres casillas grandes (la que cambia da un salto), con la etiqueta encima, alineada con la primera; los dos
   puntos, quietos y a media altura de las cifras */
.crClock { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-left: auto; }
.crClockLbl { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; padding-left: 2px; }
.crTimer { display: flex; align-items: flex-start; gap: 7px; }
.crT { --pt: 11px; --fs: 42px; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 78px; padding: var(--pt) 10px 8px; border-radius: 16px;
  background: rgba(70,12,8,.28); }
.crT b { font-size: var(--fs); font-weight: 700; line-height: 1; color: #FFE7A6; font-variant-numeric: tabular-nums; }
.crT small { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.crT.flip b { animation: crFlip .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes crFlip { from { transform: translateY(-40%) scale(.85); opacity: .2; } }
.crColon { --pt: 11px; --fs: 42px; flex: 0 0 auto; width: 6px; height: calc(var(--fs) * .5); margin-top: calc(var(--pt) + 1px + var(--fs) * .27);
  background: radial-gradient(circle 3px at 50% 3px, rgba(255,231,166,.8) 98%, transparent) top / 6px 6px no-repeat,
              radial-gradient(circle 3px at 50% 3px, rgba(255,231,166,.8) 98%, transparent) bottom / 6px 6px no-repeat; }
@keyframes crPop { from { transform: scale(.3); opacity: 0; } }
.crShare { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  --b-bg: rgba(255,244,214,.14); --b-fg: #FFF4D6; --b-line: rgba(255,244,214,.38); box-shadow: none; }
.crShare:hover { background-color: rgba(255,244,214,.26); transform: scale(1.06); }
.crShare .i { width: 15px; height: 15px; }
/* (al copiar: "¡Copiado!" con un tic, un momento; crece hacia la izquierda) */
.crShare.done, .crShare.done:hover { width: auto; padding: 0 12px; gap: 6px; display: flex; align-items: center; border-radius: 17px;
  font-size: 13px; font-weight: 600; white-space: nowrap; transform: none; animation: crPop .2s ease-out;
  --b-bg: #FFF4D6; --b-fg: #8E3A2F; --b-line: #FFF4D6; background-color: #FFF4D6; }
.rwHead .crShare.done, .rwHead .crShare.done:hover { --b-bg: #F4F8FF; --b-fg: #233F6E; --b-line: #F4F8FF; background-color: #F4F8FF; }

.crList { display: grid; gap: 8px; padding: 12px; }
button.crCard { --b-bg: rgba(255,255,255,.42); --b-line: var(--cream-line); --gc: var(--mode-challenge);
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 10px 12px; min-width: 0; text-align: left;
  border-radius: 16px; position: relative; overflow: hidden; color: var(--ink); white-space: normal; font-weight: 400;
  animation: crIn .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--n) * 55ms); transition: transform .2s, border-color .2s, background-color .2s; }
@keyframes crIn { from { opacity: 0; transform: translateY(10px); } }
button.crCard:hover { transform: translateY(-2px); background-color: #FBE3DE; border-color: #E9A398; } /* (el rojo claro de la ilustración del desafío) */
.crPic { position: relative; flex: 0 0 auto; display: flex; align-items: center; }
.crPic .crDk { display: grid; width: 50px; height: 50px; }
.crPic .crDk .dkArt { width: 100%; height: 100%; }
.crPic.two .crDk + .crDk { margin-left: -20px; transform: rotate(9deg) translateY(2px); }
.crPic.two .crDk:first-child { transform: rotate(-6deg); }
.crChIco { position: absolute; left: 32px; bottom: -4px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #fff;
  background: var(--c2); border: 2px solid var(--cream); }
.crPic.two .crChIco { left: 64px; }
.crChIco .i { width: 14px; height: 14px; }
.crCard.g-warmup { --c1: #EE8C80; --c2: #CC5A4E; } .crCard.g-mid { --c1: #D2574B; --c2: #A13A31; } .crCard.g-expert { --c1: #A83830; --c2: #6C1F1A; }
.crBody { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.crTag { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 7px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.crName { font-size: 16px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
.crDesc { font-size: 12.5px; line-height: 1.3; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crMeta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; margin-top: 2px; }
.crM { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.crM .i { width: 13px; height: 13px; color: var(--ink-soft); }
.crFaces { display: inline-flex; margin-right: 2px; }
.crFaces .avatar { width: 21px; height: 21px; box-shadow: none; border: 1.5px solid var(--cream); }
.crFaces .avatar + .avatar { margin-left: -7px; }
.crEnd { flex: 0 0 auto; }
.crSlot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 64px; }
.crSlotIc { width: 38px; height: 31px; flex: 0 0 auto; overflow: visible; }
.crSlotIc.empty { color: rgba(36,36,36,.3); }
.crPlay { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px 7px 11px; border-radius: 999px; background: var(--mode-challenge); color: var(--cream); font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: transform .2s; }
.crPlay .i { width: 12px; height: 12px; }
button.crCard:hover .crPlay { transform: scale(1.06); }
/* ganada: dorada, con la corona de oro (aparece con un salto y brilla) */
button.crCard.won { --b-bg: #FBEDC4; --b-line: #E3BE5C; }
button.crCard.won:hover { background-color: #F8E5AE; border-color: #D9A93C; }


.crSlot.won .crSlotIc { animation: crPop .6s .3s cubic-bezier(.3,1.6,.5,1) both; }
.crSlot.won small { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8C5E17; }
.crCard.won .crTag, .crCard.won .crDesc { color: #7A6534; }
.crCard.saved { --b-line: var(--accent); }
@container (max-width: 640px) {
  .crHead { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 14px 16px; }
  .crMain { padding-right: 40px; }
  .crBadge { width: 80px; height: 80px; }
  .crBig { width: 70px; height: 57px; }
  .crTotal b { font-size: 48px; }
  .crTotal small { font-size: 15px; }
  .crClock { margin: 0; align-self: center; }
  .crT, .crColon { --pt: 8px; --fs: 34px; }
  .crT { min-width: 64px; padding-left: 6px; padding-right: 6px; }
  .crShare { top: 14px; right: 14px; }
  .crPic .crDk { width: 42px; height: 42px; }
  .crChIco { left: 26px; width: 22px; height: 22px; }
  .crPic.two .crChIco { left: 50px; }
  .crPic.two .crDk + .crDk { margin-left: -18px; }
  .crName { font-size: 15px; }
  .crDesc { font-size: 12px; }
  .crSt { display: none; }
  .crSlot { min-width: 0; }
  .crPlay { padding: 6px 10px; font-size: 12px; }
  .crPlay .i { display: none; }
  .crSlot.won small { font-size: 10.5px; }
}
/* el aviso del cambio */
#dialog:has(.crIntro) { width: min(420px, 92vw); }
.dlgBox.crIntro { align-items: center; text-align: center; }
.crIntro .dlgBtns { align-self: stretch; justify-content: center; }
.crIntroArt { display: grid; place-items: center; height: 88px; margin: -4px auto 4px; width: 120px; }
.crIntro h3 { margin: 4px 0 12px; }
.crIntro ul { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.crIntro li { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.3; }
.crIntro li > .i, .crIntro li > .crLi { flex: 0 0 auto; width: 22px; height: 22px; color: var(--mode-challenge); }
.crIntro li.gift { padding: 9px 11px; border-radius: 12px; background: rgba(242,194,78,.22); font-weight: 600; }
.crIntro li.gift .i { color: #8C5E17; }
/* fin de partida: la corona ganada */
.winRec.new.crownChip { background: #F2C24E; border-color: #F2C24E; color: #4A2F06; }
.winRec.crownChip .i { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) {
  .crBig, button.crCard, .crSlot.won .crSlotIc, .crT.flip b { animation: none !important; }
}

/* =========================================================
   Contrarreloj de la semana (rush-week.js): la misma cabecera que los desafíos, en azul (tus medallas de siempre, la cuenta
   atrás y compartir), y la tarjeta de la serie: sus 5 hoyos y las tres medallas sobre su barra. Con medalla esta semana, la
   tarjeta toma su color (oro, plata o bronce)
   ========================================================= */
.mdSection.rushWeek { padding: 0 !important; overflow: hidden; container-type: inline-size; }
.rwHead { color: #F4F8FF; background-color: #3F6FA8; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 64px, transparent 64px 128px); }


.rwHead .crT { background: rgba(10,26,52,.32); }
.rwHead .crShare { --b-bg: rgba(230,240,255,.14); --b-fg: #F4F8FF; --b-line: rgba(230,240,255,.4); }
.rwHead .crShare:hover { background-color: rgba(230,240,255,.26); }
.rwBig { width: 66px; height: 82px; overflow: visible; animation: crBob 3.4s ease-in-out infinite; }
.rwTallies { display: flex; gap: 14px; margin-top: 2px; }
.rwTally { display: inline-flex; align-items: center; gap: 5px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rwMini { width: 18px; height: 23px; }

.rwBody { padding: 12px; }
.rwCard { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 16px; border-radius: 16px; border: 1px solid var(--cream-line); background: rgba(255,255,255,.42); }
.rwCard.m-gold { background: #FBEDC4; border-color: #E3BE5C; }
.rwCard.m-silver { background: #ECEFF2; border-color: #BCC4CA; }
.rwCard.m-bronze { background: #F6E0CC; border-color: #DDA273; }
.rwTop { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rwInfo { min-width: 0; }
.rwInfo h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.rwInfo p { margin: 3px 0 7px; font-size: 12.5px; line-height: 1.3; color: var(--ink-soft); }
.rwBest { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.rwBest .i { width: 15px; height: 15px; color: var(--mode-rush); }
.rwBtns { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
button.rwPlay { --b-bg: var(--mode-rush); --b-fg: var(--cream); --b-line: var(--mode-rush); padding: 9px 18px 9px 14px; font-size: 14px; font-weight: 600; gap: 6px; }
button.rwPlay:hover { background-color: #2D4F7C; transform: scale(1.04); }
.rwPlay .i { width: 13px; height: 13px; }
.rwTrack { padding: 0 4px; }
.rwMarks { position: relative; height: 104px; }
.rwMark { position: absolute; left: var(--x); bottom: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; text-align: center; white-space: nowrap; }
.rwMark .rwMedal { width: 46px; height: 58px; overflow: visible; color: rgba(36,36,36,.28); margin-bottom: 2px; }
.rwMark.got .rwMedal { filter: drop-shadow(0 3px 6px rgba(20,30,40,.22)); animation: crPop .6s .2s cubic-bezier(.3,1.6,.5,1) both; }
.rwMark b { font-size: 13px; font-weight: 700; }
.rwMark small { font-size: 11px; color: var(--ink-soft); }
.rwMark:not(.got) b { color: var(--ink-soft); }
.rwBar { height: 10px; margin-top: 8px; border-radius: 999px; background: rgba(36,36,36,.08); overflow: hidden; }
.rwBar i { display: block; height: 100%; border-radius: inherit; background: #D98F57; transition: width .6s var(--ease-out); }
.rwBar.b-bronze i { background: #D98F57; }
.rwBar.b-silver i { background: #A9B2B9; }
.rwBar.b-gold i { background: #E8B53E; }
@container (max-width: 640px) {
  .rwBig { width: 54px; height: 67px; }
  .rwTally { font-size: 14px; }
  .rwTop { flex-direction: column; align-items: stretch; }
  .rwBtns { flex-direction: row; align-items: center; justify-content: flex-start; }
  .rwMark .rwMedal { width: 38px; height: 48px; }
  .rwMarks { height: 92px; }
}
/* fin de la serie: la medalla de la semana */
.winRec.medalChip .wrMedal { width: 16px; height: 20px; }
.winRec.new.medalChip.m-gold { background: #F2C24E; border-color: #F2C24E; color: #4A2F06; }
.winRec.new.medalChip.m-silver { background: #CFD5DA; border-color: #CFD5DA; color: #2F3940; }
.winRec.new.medalChip.m-bronze { background: #D98F57; border-color: #D98F57; color: #3E2210; }
@media (prefers-reduced-motion: reduce) { .rwBig, .rwMark.got .rwMedal { animation: none !important; } }

/* =========================================================
   El taller (screen-story.js: yoursSectionHTML): la cabecera es la alfombrilla de corte del creador (gris azulada, su
   cuadrícula y la regla del borde) con el taller ilustrado y el título; debajo, tus niveles y, en el sitio del siguiente,
   una casilla vacía con un + que abre el creador con un nivel nuevo
   ========================================================= */
#modesGrid .lvlSection.workshop { padding: 0 !important; overflow: hidden; }
.wsHead { --mat: #3C4A55; --mat-line: rgba(226,236,240,.075); --mat-line2: rgba(226,236,240,.15); --mat-ink: rgba(226,236,240,.66);
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 20px 14px 24px; color: var(--cream);
  background-color: var(--mat);
  background-image: linear-gradient(var(--mat-line2) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line2) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px; background-position: -1px -1px; }
.wsHead::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 9px; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--mat-ink) 0 1px, transparent 1px 50px) 0 0 / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--mat-line2) 0 1px, transparent 1px 10px) 0 0 / 100% 5px no-repeat; }
.wsHead::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 9px; pointer-events: none;
  background: repeating-linear-gradient(var(--mat-ink) 0 1px, transparent 1px 50px) 0 0 / 9px 100% no-repeat,
    repeating-linear-gradient(var(--mat-line2) 0 1px, transparent 1px 10px) 0 0 / 5px 100% no-repeat; }
.wsArt { display: grid; width: 54px; height: 54px; flex: 0 0 auto; transition: transform .3s cubic-bezier(.3,1.5,.5,1); }
.wsArt .mdArt { width: 100%; height: 100%; }
.lvlSection.workshop:hover .wsArt { transform: rotate(-5deg) scale(1.07); }
#modesGrid .wsHead h3 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--cream); }
button.wsCode { margin-left: auto; position: relative; z-index: 1; box-shadow: none; }
.wsBody { padding: 14px 16px 16px; }
/* la casilla del siguiente nivel: del tamaño de una tarjeta, con borde discontinuo y un + */
button.lvlNew { --b-bg: transparent; --b-line: transparent; display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 6px 6px 8px;
  border-radius: 13px; min-width: 0; color: var(--ink-soft); }
.lvlNewBox { flex: 1 1 auto; min-height: 40px; display: grid; place-items: center; border-radius: 10px;
  border: 2px dashed rgba(78,94,106,.45); background: rgba(78,94,106,.06); transition: background-color .2s, border-color .2s, transform .2s; }
.lvlNewBox .i { width: 34px; height: 34px; color: var(--mode-workshop); }
button.lvlNew small { font-size: 11.5px; font-weight: 600; text-align: center; }
.lvlRow > .lvlNew:only-child .lvlNewBox { min-height: 110px; } /* (sin niveles: la casilla, con su tamaño) */
.lvlRow > .lvlNew:only-child { width: 150px; }
button.lvlNew:hover { background-color: transparent; color: var(--ink); }
button.lvlNew:hover .lvlNewBox { background: color-mix(in srgb, var(--mode-workshop) 14%, transparent); border-color: var(--mode-workshop); transform: scale(1.03); }
@media (max-width: 560px) { .wsHead { padding: 13px 16px 11px 20px; } .wsArt { width: 44px; height: 44px; } #modesGrid .wsHead h3 { font-size: 19px; } }

/* ---------- menú de depuración del fondo (bg-debug.js: …/#fondo o Alt+Mayús+B) ---------- */
#bgDebug { position: fixed; z-index: 400; right: 16px; bottom: 64px; width: min(300px, calc(100vw - 32px)); padding: 12px 14px 12px;
  border-radius: 16px; background-image: var(--grain); background-color: var(--cream); color: var(--ink); box-shadow: var(--mdShadow);
  display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
#bgDebug header { display: flex; align-items: baseline; gap: 6px; }
#bgDebug header b { font-size: 15px; font-weight: 600; }
#bgDebug header small { color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
#bgDebug header button { margin-left: auto; padding: 0; width: 26px; height: 26px; border-radius: 50%; --b-line: var(--cream-line); font-size: 12px; }
#bgDebug label { display: grid; grid-template-columns: 70px minmax(0, 1fr) 62px; align-items: center; gap: 8px; }
#bgDebug label span { font-weight: 500; }
#bgDebug input[type="range"] { width: 100%; accent-color: var(--grass-dark); }
#bgDebug input[type="color"] { width: 100%; height: 28px; padding: 0; border: 1px solid var(--cream-line); border-radius: 8px; background: none; cursor: pointer; }
#bgDebug code { font-size: 11.5px; color: var(--ink-soft); text-align: right; white-space: nowrap; }
#bgDebug footer { display: flex; align-items: center; gap: 8px; }
