/* Portada: muestra de las mecánicas (muestra.js). Tres colores, uno por cada uso de las cartas:
   invocar piezas (oro), dados y movimiento (azul) y habilidades de las figuras (violeta). */
#muestra {
  --ms-inv: #e3a94b; --ms-dad: #6fa8dc; --ms-hab: #c38ad6; --ms-atk: #d9583e;
  --ms-light: #ebe3d1; --ms-dark: #b7bf9b; --ms-card: #f3ecdd; --ms-red: #a8452c;
  --ms-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --ms-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ms-glyph: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", "Apple Symbols", serif;
  padding: 88px 16px 96px; background: var(--noche, #14110E); color: var(--pergamino, #F5EEDC);
}
/* título y lead: el H1 (72/1) y el lead (18) de la guía de estilo; el resto de la muestra conserva su diseño */
#muestra h2 { margin: 0; text-align: center; font: 400 clamp(44px, 6vw, 72px)/1 var(--ms-serif); letter-spacing: -.02em; text-wrap: balance; }
#muestra h2 span, #muestra h2 em { display: block; }
#muestra h2 em { color: var(--ambar, #F0A93C); font-style: italic; }
.ms-lead { max-width: 600px; margin: 24px auto 0; text-align: center; font-size: 18px; line-height: 1.5; color: var(--ceniza, #B4B4AB); text-wrap: pretty; }
.ms-panel {
  display: grid; grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); grid-template-areas: "hand board";
  align-items: center;
  gap: 40px; max-width: 1320px; margin: 56px auto 0; padding: 48px 40px; background: #1c1915; border: 1px solid #2c2822; border-radius: 40px;
}
.ms-label { font: 500 13px var(--ms-mono); letter-spacing: .16em; text-transform: uppercase; color: #b4a993; text-align: center; }

/* ---------- mano y cajas ---------- */
.ms-hand { position: relative; display: grid; gap: 34px; }
.ms-mano { display: grid; justify-items: start; gap: 4px; margin-top: 14px; }   /* la etiqueta a la izquierda: las flechas que bajan salen de la derecha */
.ms-mano .ms-label { margin: 8px 0 0 4px; }
.ms-cards { display: flex; padding: 4px 0; }
.ms-card {
  position: relative; width: 92px; height: 132px; flex: none; display: grid; place-items: center;
  background: var(--ms-card); border: 1px solid #cfc3aa; border-radius: 10px; color: #1d1a16;
  box-shadow: -4px 3px 10px rgba(0, 0, 0, .35); outline: 2px solid transparent; outline-offset: 1px;
  transition: transform .6s cubic-bezier(.2, .9, .3, 1.15), opacity .45s, filter .45s, box-shadow .3s, outline-color .3s;
}
/* carta gastada: vuela hacia su caja (--fx/--fy, que pone muestra.js), gira, se achica y se desvanece con un destello */
.ms-card.gone {
  transform: translate(var(--fx, 0), var(--fy, -40px)) rotate(var(--fr, -12deg)) scale(.5); opacity: 0; filter: blur(3px) brightness(1.5);
  outline-color: transparent; box-shadow: 0 0 28px var(--uc, #fff); pointer-events: none;
  transition: transform .55s cubic-bezier(.5, 0, .7, .4), opacity .5s ease-in .05s, filter .5s, box-shadow .2s;
}
.ms-card + .ms-card { margin-left: -36px; }
.ms-ants { display: none; position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); overflow: visible; pointer-events: none; }
.ms-ants rect { fill: none; stroke: var(--c); stroke-width: 2; stroke-dasharray: 6 5; animation: ms-flow .9s linear infinite; }
.ms-card.gone .ms-ants { display: none !important; }
/* índice arriba a la izquierda (lo que queda a la vista con las cartas encimadas) y el palo grande en el centro */
.ms-card .ix { position: absolute; top: 7px; left: 9px; display: grid; justify-items: center; gap: 2px; }
.ms-card .rk { font: 400 38px/.9 var(--ms-serif); }
.ms-card .su { font-size: 19px; line-height: 1; font-family: var(--ms-glyph); }
.ms-card .big { font-size: 38px; line-height: 1; font-family: var(--ms-glyph); margin: 32px 0 0 22px; opacity: .9; }
.ms-card.red { color: var(--ms-red); }
/* una carta puede tener varios usos (data-k="inv dad hab"): el contorno toma el color del grupo destacado */
.ms-hand.focus-inv .ms-card[data-k~="inv"] { --c: var(--ms-inv); } .ms-hand.focus-dad .ms-card[data-k~="dad"] { --c: var(--ms-dad); }
.ms-hand.focus-hab .ms-card[data-k~="hab"] { --c: var(--ms-hab); } .ms-hand.all .ms-card { --c: #b4a993; }
.ms-hand.focus-inv .ms-card[data-k~="inv"], .ms-hand.focus-dad .ms-card[data-k~="dad"], .ms-hand.focus-hab .ms-card[data-k~="hab"], .ms-hand.all .ms-card {
  outline-color: var(--c); box-shadow: -4px 3px 10px rgba(0, 0, 0, .35), 0 0 16px color-mix(in srgb, var(--c) 55%, transparent);
}

.ms-box { --c: var(--ms-inv); position: relative; z-index: 1; padding: 14px 16px 12px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 14px;
  background: color-mix(in srgb, var(--c) 7%, #1c1915); transition: opacity .3s, border-color .3s; }
.ms-box[data-k="dad"] { --c: var(--ms-dad); margin-right: 30px; }   /* a la derecha queda el carril de las flechas violetas */
.ms-box[data-k="hab"] { --c: var(--ms-hab); margin-right: 30px; }
.ms-hand.focus-inv .ms-box:not([data-k="inv"]), .ms-hand.focus-dad .ms-box:not([data-k="dad"]), .ms-hand.focus-hab .ms-box:not([data-k="hab"]) { opacity: .5; }
.ms-hand.focus-inv .ms-box[data-k="inv"], .ms-hand.focus-dad .ms-box[data-k="dad"], .ms-hand.focus-hab .ms-box[data-k="hab"] { border-color: var(--c); }
.ms-box h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font: 500 12px var(--ms-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--c); }
.ms-box > p { margin: 4px 0 8px; font-size: 13.5px; line-height: 1.4; color: #d8cfbf; }
.ms-items { display: grid; gap: 2px; }
.ms-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 28px; padding: 3px 6px; margin: 0; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; }
button.ms-item { cursor: pointer; }
button.ms-item:hover:not(:disabled), button.ms-item:focus-visible, button.ms-item.on { background: color-mix(in srgb, var(--c) 18%, transparent); }
button.ms-item:disabled, button.ms-item.spent { cursor: default; opacity: .55; }
button.ms-item.spent:hover { background: none; }
.ms-ic { width: 22px; flex: none; text-align: center; font: 18px/1 var(--ms-glyph); color: #e9e0cf; }
.ms-ic.red { color: #e0715a; }
.ms-ic.fig { font: 400 21px/1 var(--ms-serif); color: var(--c); }
.ms-ic.pc { font-size: 21px; }
.ms-nm { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.25; }
.ms-nm b { font-weight: 600; }
.ms-nm small { color: #a99e8a; font-size: 12px; }
.ms-nm small .cs { color: var(--c); font-weight: 700; }
.ms-nm small .cs.r { color: #e0715a; }
/* lo que esta mano puede pagar va resaltado (marca y fondo del color de su caja); lo que no, en un tono más apagado
   que sigue siendo legible (contraste AA sobre la caja) */
.ms-item.ok:not(.off):not(.spent) { background: color-mix(in srgb, var(--c) 10%, transparent); box-shadow: inset 3px 0 0 var(--c); }
button.ms-item.ok:not(.off):not(.spent):hover, button.ms-item.ok.on { background: color-mix(in srgb, var(--c) 22%, transparent); }
.ms-item.no .ms-nm b, .ms-item.no .ms-ic, .ms-item.no .ms-ic.red { color: #a99e8a; font-weight: 500; }
.ms-item.no .ms-nm small { color: #958a76; }
.ms-pm { display: flex; gap: 4px; flex: none; }
.ms-pm button { width: 26px; height: 26px; padding: 0; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); border-radius: 7px; background: #26221c; color: #efe6d2; font: 600 15px/1 system-ui, sans-serif; cursor: pointer; }
.ms-pm button:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 28%, #26221c); }
.ms-pm button:disabled { opacity: .35; cursor: default; }

.ms-arrows { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.ms-arrows path { fill: none; stroke-width: 2; stroke-linecap: round; transition: opacity .3s; }
.ms-arrows path.gone { opacity: 0 !important; }
.ms-arrows path.a-inv { stroke: var(--ms-inv); } .ms-arrows path.a-dad { stroke: var(--ms-dad); } .ms-arrows path.a-hab { stroke: var(--ms-hab); }
.ms-hand.focus-inv path:not(.a-inv), .ms-hand.focus-dad path:not(.a-dad), .ms-hand.focus-hab path:not(.a-hab) { opacity: .18; }
.ms-hand.focus-inv path.a-inv, .ms-hand.focus-dad path.a-dad, .ms-hand.focus-hab path.a-hab { stroke-dasharray: 6 5; animation: ms-flow .9s linear infinite; }
@keyframes ms-flow { to { stroke-dashoffset: -11; } }

/* ---------- tablero ---------- */
.ms-center { grid-area: board; display: grid; gap: 12px; }
.ms-board { display: grid; grid-template-columns: repeat(8, 1fr); padding: 16px; background: #2a2620; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.ms-sq { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: var(--ms-light); }
.ms-sq.dk { background: var(--ms-dark); }
.ms-sq.sel { background: var(--ms-inv); }
.ms-sq.elig { cursor: pointer; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ms-inv) 80%, transparent); }
.ms-sq.elig:hover { box-shadow: inset 0 0 0 4px var(--ms-inv); }
.ms-board { container-type: inline-size; }
.ms-pc { position: relative; z-index: 1; font-family: var(--ms-glyph); font-size: clamp(18px, 9.4cqi, 76px); line-height: 1; font-variant-emoji: text; pointer-events: none; }
.ms-pc.w { color: #fbf7ee; text-shadow: 0 0 1px #2a2620, 1px 1px 0 #2a2620, -1px -1px 0 #2a2620, 1px -1px 0 #2a2620, -1px 1px 0 #2a2620; }
.ms-pc.b { color: #1b1813; }
.ms-pc.ghost { color: var(--ms-inv); opacity: .75; text-shadow: none; }
.ms-dot { position: absolute; width: 26%; height: 26%; border-radius: 50%; background: var(--ms-inv); animation: ms-pop .25s ease-out both; }
.ms-dot.x { width: 40%; height: 40%; display: grid; place-items: center; background: var(--ms-dad); }
.ms-dot.x svg { width: 80%; height: 80%; fill: #12100d; }
.ms-dot.h { background: var(--ms-hab); }
.ms-sq.atk::after, .ms-sq.inv::after { content: ""; position: absolute; inset: 7%; border-radius: 50%; border: 3px solid var(--ms-atk); animation: ms-pop .25s ease-out both; }
/* el círculo del relevo y del empujón: se dibuja en una vuelta */
/* mover y atacar de muestra (muestra.js): se tocan; al llegar, la marca ✓ (podía ir, o capturó) o ✗ (la defensa aguantó) */
.ms-sq.go, .ms-sq.atk { cursor: pointer; }
.ms-tick { position: absolute; z-index: 4; top: 4%; right: 4%; width: 42%; height: 42%; border-radius: 50%; display: grid; place-items: center; background: #3f8f4e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45); pointer-events: none; animation: ms-pop .3s cubic-bezier(.2, 1.6, .4, 1) both; }
.ms-tick svg { width: 68%; height: 68%; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ms-tick.no { background: var(--ms-atk); }
.ms-ring { position: absolute; inset: 3%; width: 94%; height: 94%; pointer-events: none; overflow: visible; }
.ms-ring circle { fill: none; stroke: var(--ms-hab); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100; animation: ms-draw .7s cubic-bezier(.45, 0, .2, 1) both; }
@keyframes ms-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
.ms-sq.inv::after { border: 2px dashed var(--ms-inv); }
@keyframes ms-pop { from { transform: scale(.4); opacity: 0; } }
.ms-hint { min-height: 1.4em; margin: 0; text-align: center; font-size: 14px; color: #b9ae99; }

/* ---------- dados ---------- */
.ms-hand { grid-area: hand; }
/* el recuadro tiene alto fijo y su contenido va centrado en vertical: cuando la leyenda crece (su alto se anima), lo
   demás se corre de a poco hacia arriba para hacerle lugar, sin que nada salte */
.ms-dice { grid-area: dice; box-sizing: border-box; height: var(--dh, 420px); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; text-align: center; }
.ms-dpair { display: flex; align-items: flex-start; gap: 34px; }
.ms-die { display: grid; justify-items: center; gap: 8px; }
.ms-die > span { max-width: 104px; font: 500 11px/1.35 var(--ms-mono); letter-spacing: .12em; text-transform: uppercase; color: #a99e8a; text-wrap: balance; }
/* .ms-face es el marco (gira, cae y recorta); adentro, la cara de puntos y, en el dado de pieza, encima la del juego */
.ms-face { --s: 100px; position: relative; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .18); overflow: hidden; background: #f3ecdd;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .4); transform: rotate(var(--rot, -4deg)); transition: opacity .3s; }
.ms-die + .ms-die .ms-face { --rot: 5deg; }
.ms-pips, .ms-pzf { position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 calc(var(--s) * -.06) 0 rgba(0, 0, 0, .18); }
.ms-pips { padding: 15%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center; background: #f3ecdd; }
.ms-pips i { width: 62%; height: 62%; border-radius: 50%; background: #1b1813; visibility: hidden; }
.ms-pips i.on { visibility: visible; }
/* el dado de pieza del juego (style.css, .dface.mando): la pieza en el medio y el número abajo a la derecha */
.ms-pzf { background: #8a3a12; color: #fff; transition: opacity .35s ease; }
.ms-pzf .g { position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 6%; font: calc(var(--s) * .62)/1 var(--ms-glyph); font-variant-emoji: text; }
.ms-pzf .g svg { width: 56%; height: 56%; }
.ms-pzf .n { position: absolute; right: 8%; bottom: 5%; font: 900 calc(var(--s) * .24)/1 system-ui, sans-serif; }
/* con el ratón encima, se funde en el dado de puntos; la primera vez, el de puntos se asoma de costado (vaivén senoidal) */
.ms-face.pz:hover .ms-pzf { opacity: 0; }
.ms-face.pz.peek .ms-pips { z-index: 1; animation: ms-peek 1.5s cubic-bezier(.37, 0, .63, 1) both; }
@keyframes ms-peek { 0%, 100% { transform: translateX(-100%); } 35%, 65% { transform: translateX(0); } }
.ms-face.idle { opacity: .45; }
/* el mismo dado que en el juego (style.css: .dface.tumble / .landed) */
.ms-face.tumble { animation: ms-tumble .14s linear infinite; }
.ms-face.landed { animation: ms-land .26s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes ms-tumble { 0%, 100% { transform: rotate(-14deg) translateY(-4px) scale(.96); } 50% { transform: rotate(12deg) translateY(4px) scale(1.03); } }
@keyframes ms-land { from { transform: scale(1.25) rotate(8deg); } to { transform: rotate(var(--rot, -4deg)); } }
/* el dado de defensa (muestra.js): solo al atacar de muestra; con tres dados, todos más chicos para que quepan */
.ms-die[hidden] { display: none; }
.ms-def:not([hidden]) { animation: ms-pop .25s ease-out both; }
.ms-def .ms-face { --rot: -2deg; }
/* azul como el del defensor en el juego y las replays (style.css, .dface.def) */
.ms-def .ms-face, .ms-def .ms-pips { background: #2f4858; }
.ms-def .ms-pips i { background: #fff; }
.ms-def .ms-mod { color: var(--ms-atk); }
@media (min-width: 1181px) {
  .ms-dpair.three { gap: 14px; }
  .ms-dpair.three .ms-face { --s: 62px; }
  .ms-dpair.three .ms-die > span { max-width: 68px; font-size: 9.5px; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .ms-dpair.three { gap: 8px; }
  .ms-dpair.three .ms-face { --s: 40px; }
  .ms-dpair.three .ms-die > span { max-width: 44px; font-size: 8px; letter-spacing: .06em; }
}
/* lo que la arenga, el soborno o la vindicación le cambiaron al dado */
.ms-mod { min-height: 22px; font: 600 15px/22px var(--ms-mono); color: var(--ms-dad); }
.ms-mod:not(:empty) { animation: ms-pop .25s ease-out both; }
.ms-mod .re { display: inline-block; font-size: 28px; line-height: 22px; vertical-align: -3px; color: var(--ms-hab); margin-right: 4px; }
.ms-roll { padding: 13px 30px; border: 2px solid var(--ms-inv); border-radius: 999px; background: #f6efe0; color: #1b1813; font: 600 16px system-ui, sans-serif; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.ms-roll:hover { background: #fff; }
.ms-roll:focus-visible { outline: 3px solid var(--ms-dad); outline-offset: 2px; }
.ms-cap { flex: none; width: 100%; height: 0; max-height: 8.6em; overflow-y: auto; transition: height .3s ease; scrollbar-width: thin; font-size: 14.5px; line-height: 1.5; color: #d8cfbf; }
/* el texto nuevo entra deslizándose */
.ms-cap .in { animation: ms-capin .3s ease-out both; }
.ms-cap .in > :first-child { margin-top: 0; }
@keyframes ms-capin { from { opacity: 0; transform: translateY(8px); } }
.ms-mod { white-space: nowrap; }
.ms-cap .k { color: #a99e8a; }
.ms-cap b { color: var(--ms-inv); font-weight: 600; }
.ms-cap .nt { display: block; margin-top: 6px; font-size: 13px; color: #a99e8a; }

@media (prefers-reduced-motion: reduce) {
  .ms-arrows path, .ms-ants rect, .ms-face, .ms-pips, .ms-dot, .ms-sq::after, .ms-mod, .ms-ring circle, .ms-cap .in, .ms-tick, .ms-def { animation: none !important; }
  .ms-cap { transition: none; }
  .ms-card, .ms-card.gone { transition: opacity .2s; }
}
/* Escritorio y tablet (≥768): la mano a la izquierda, el tablero en todo el resto y los dados en un recuadro que sale
   del borde derecho del panel, centrado sobre el tablero y apenas translúcido para que se vea detrás. En el móvil
   también va ahí, más chico (ver abajo). */
.ms-dice { grid-area: board; align-self: center; justify-self: end; position: relative; z-index: 3; width: 300px; --dh: 440px;
  margin-right: -40px; padding: 21px 30px 21px 44px; border: 1px solid #3a342b; border-right: 0;
  border-radius: 18px 0 0 18px; background: rgba(22, 20, 17, .9);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.ms-face { --s: 88px; }
/* tablet: lo mismo que el escritorio, achicado */
@media (min-width: 900px) and (max-width: 1180px) {
  .ms-panel { grid-template-columns: clamp(250px, 33vw, 310px) minmax(0, 1fr); gap: 24px; padding: 32px 24px; border-radius: 32px; }
  .ms-hand { gap: 26px; }
  .ms-box { padding: 12px 12px 10px; }
  .ms-box[data-k="dad"], .ms-box[data-k="hab"] { margin-right: 24px; }
  .ms-box > p { font-size: 12.5px; }
  .ms-nm { font-size: 12.5px; }
  .ms-nm small { font-size: 11px; }
  .ms-item { gap: 7px; padding: 3px 5px; }
  .ms-card { width: 70px; height: 100px; }
  .ms-card + .ms-card { margin-left: -26px; }
  .ms-card .rk { font-size: 29px; }
  .ms-card .su { font-size: 15px; }
  .ms-card .big { font-size: 29px; margin: 24px 0 0 16px; }
  .ms-dice { width: clamp(176px, 21vw, 240px); --dh: 370px; margin-right: -24px; padding: 16px 16px 16px 24px; gap: 12px; }
  .ms-face { --s: 60px; }
  .ms-dpair { gap: 18px; }
  .ms-die > span { max-width: 80px; font-size: 9.5px; }
  .ms-roll { padding: 10px 20px; font-size: 14px; }
  .ms-cap { font-size: 13px; }
}
/* Móvil y tablets chicas: una vista propia. El tablero ocupa el ancho y los dados siguen sobre su borde derecho, en una
   columna angosta; la leyenda de los dados pasa debajo del tablero (muestra.js la mueve). Debajo, la mano y las tres
   cajas, sin flechas: hasta 599, en un carrusel; de 600 a 899, en una grilla de 2 × 2. En «Invocar», el caballo (lo
   único que la mano paga) va primero y el peón, el alfil y la dama, en una fila. */
@media (max-width: 899px) {
  #muestra { padding: 56px 16px 72px; }
  .ms-panel { container-type: inline-size; grid-template-columns: minmax(0, 1fr); grid-template-areas: "board" "hand" "dots";
    gap: 22px; margin-top: 40px; padding: 14px; border-radius: 24px; }
  .ms-board { padding: 8px; }
  .ms-center { gap: 10px; }
  .ms-hint { font-size: 13px; }
  .ms-center .ms-cap { max-height: 7em; font-size: 13.5px; text-align: center; }
  .ms-dice { align-self: start; width: auto; height: auto; gap: 8px; margin: 50cqi -14px 0 0; transform: translateY(-50%);
    padding: 12px 12px 12px 14px; border-radius: 14px 0 0 14px; }
  .ms-dice .ms-label { font-size: 10px; letter-spacing: .14em; }
  .ms-dpair { flex-direction: column; align-items: center; gap: 6px; }
  .ms-die { gap: 2px; }
  .ms-die > span { display: none; }
  .ms-face { --s: 44px; }
  .ms-mod { min-height: 14px; font-size: 11px; line-height: 14px; }
  .ms-mod .re { font-size: 17px; line-height: 14px; }
  .ms-roll { padding: 7px 11px; font-size: 12px; border-width: 1.5px; }
  .ms-mano { grid-area: mano; margin: 0; }
  .ms-box { padding: 12px 12px 10px; }
  .ms-box[data-k="inv"] { grid-area: inv; } .ms-box[data-k="dad"] { grid-area: dad; } .ms-box[data-k="hab"] { grid-area: hab; }
  .ms-box[data-k="dad"], .ms-box[data-k="hab"] { margin-right: 0; }
  .ms-arrows { display: none; }
  /* sin flechas, las cartas destacadas llevan la misma línea punteada, girando a su alrededor */
  .ms-hand.focus-inv .ms-card[data-k~="inv"], .ms-hand.focus-dad .ms-card[data-k~="dad"], .ms-hand.focus-hab .ms-card[data-k~="hab"] { outline-color: transparent; }
  .ms-hand.focus-inv .ms-card[data-k~="inv"] .ms-ants, .ms-hand.focus-dad .ms-card[data-k~="dad"] .ms-ants, .ms-hand.focus-hab .ms-card[data-k~="hab"] .ms-ants { display: block; }
  .ms-card { width: 72px; height: 104px; }
  .ms-card + .ms-card { margin-left: -24px; }
  .ms-box[data-k="inv"] .ms-items { display: flex; flex-wrap: wrap; column-gap: 12px; }
  .ms-box[data-k="inv"] .ms-item.ok { order: -1; flex-basis: 100%; }
  .ms-box[data-k="inv"] .ms-item.no { width: auto; flex: none; padding-right: 2px; }
  .ms-box[data-k="inv"] .ms-item.no .ms-ic { width: auto; }
}
/* 600–899: las cartas a la izquierda y «Invocar piezas» a la derecha; debajo, las otras dos cajas, lado a lado. El
   destacado rota solo, como en escritorio. */
@media (min-width: 600px) and (max-width: 899px) {
  .ms-hand { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "mano inv" "dad hab"; gap: 14px 12px; }
  .ms-mano { align-self: center; justify-items: center; }
  .ms-mano .ms-label { margin: 6px 0 0; }
  .ms-card { width: clamp(72px, 13cqi, 96px); height: auto; aspect-ratio: 23 / 33; }
  .ms-card + .ms-card { margin-left: calc(clamp(72px, 13cqi, 96px) * -.4); }
  .ms-face { --s: 52px; }
}
.ms-dots { display: none; }
/* Hasta 599: la mano en una fila y las tres cajas en un carrusel que se desliza de a una, con tres
   puntos debajo (muestra.js los arma) que marcan la caja a la vista; esa caja destaca sus cartas. */
@media (max-width: 599px) {
  .ms-hand { grid-template-columns: repeat(3, 86cqi); grid-template-areas: "mano mano mano" "inv dad hab"; gap: 16px 10px;
    margin: 0 -14px; padding: 0 14px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 14px;
    overscroll-behavior-x: contain; scrollbar-width: none; }
  .ms-hand::-webkit-scrollbar { display: none; }
  .ms-mano { position: sticky; left: 14px; width: 100cqi; justify-items: center; }
  .ms-mano .ms-label { margin: 6px 0 0; }
  .ms-box { scroll-snap-align: start; }
  .ms-dots { grid-area: dots; display: flex; justify-content: center; gap: 6px; margin-top: -10px; }
  .ms-dots i { width: 6px; height: 6px; border-radius: 50%; background: #5a5247; cursor: pointer; transition: background .25s, transform .25s; }
  .ms-dots i.on { background: var(--ms-inv); transform: scale(1.25); }
  .ms-dots i.on[data-k="dad"] { background: var(--ms-dad); } .ms-dots i.on[data-k="hab"] { background: var(--ms-hab); }
  :root[data-theme="light"] .ms-dots i:not(.on) { background: #d3c6a8; }
}
/* Mobile XS y S (hasta 374): el tablero es más chico; los dados, más compactos para no taparlo */
@media (max-width: 374px) {
  .ms-dice { gap: 6px; padding: 9px 8px 9px 10px; }
  .ms-dice .ms-label { font-size: 9px; }
  .ms-face { --s: 34px; }
  .ms-roll { padding: 6px 8px; font-size: 11px; }
}
/* ---------- tema claro «Pergamino» ----------
   El panel pasa a la superficie clara de la guía; los tres colores de uso se oscurecen para leerse sobre papel
   (contraste AA) y el marco del tablero, los dados y las cajas toman tonos de pergamino con sombras suaves. */
:root[data-theme="light"] #muestra {
  --ms-inv: #b97516; --ms-dad: #2f6aa3; --ms-hab: #8c4aa3; --ms-atk: #b0492a;
  --ms-ink: #1a1a18; --ms-ink2: #4a4a45; --ms-mute: #6c6c64; --ms-paper: #fbf7ec;
}
:root[data-theme="light"] .ms-panel { background: var(--ms-paper); border-color: #e3d7bb; box-shadow: 0 24px 60px -30px rgba(80, 55, 20, .35); }
:root[data-theme="light"] .ms-label, :root[data-theme="light"] .ms-die > span { color: var(--ms-mute); }
:root[data-theme="light"] .ms-card { border-color: #d6c8a8; box-shadow: -4px 3px 10px rgba(80, 55, 20, .18); }
:root[data-theme="light"] .ms-hand.all .ms-card { --c: #9a9488; }
:root[data-theme="light"] :is(.ms-hand.focus-inv .ms-card[data-k~="inv"], .ms-hand.focus-dad .ms-card[data-k~="dad"], .ms-hand.focus-hab .ms-card[data-k~="hab"], .ms-hand.all .ms-card) {
  box-shadow: -4px 3px 10px rgba(80, 55, 20, .18), 0 0 14px color-mix(in srgb, var(--c) 40%, transparent);
}
:root[data-theme="light"] .ms-box { background: color-mix(in srgb, var(--c) 6%, #fff); }
:root[data-theme="light"] .ms-box > p, :root[data-theme="light"] .ms-cap { color: var(--ms-ink2); }
:root[data-theme="light"] .ms-ic { color: var(--ms-ink); }
:root[data-theme="light"] .ms-ic.red { color: var(--ms-red); }
:root[data-theme="light"] .ms-nm small .cs.r { color: var(--ms-red); }
:root[data-theme="light"] .ms-ic.fig { color: var(--c); }
:root[data-theme="light"] .ms-nm small, :root[data-theme="light"] .ms-cap .k, :root[data-theme="light"] .ms-cap .nt { color: var(--ms-mute); }
:root[data-theme="light"] .ms-item.no .ms-nm b, :root[data-theme="light"] .ms-item.no .ms-ic, :root[data-theme="light"] .ms-item.no .ms-ic.red { color: #807a6f; }
:root[data-theme="light"] .ms-item.no .ms-nm small { color: #8e887c; }
:root[data-theme="light"] .ms-pm button { background: #fff; color: var(--ms-ink); }
:root[data-theme="light"] .ms-pm button:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 16%, #fff); }
:root[data-theme="light"] .ms-board { background: #e4d8bc; box-shadow: inset 0 0 0 1px #d3c4a2, 0 18px 40px -18px rgba(80, 55, 20, .4); }
:root[data-theme="light"] .ms-sq.sel { background: color-mix(in srgb, var(--ms-inv) 70%, var(--ms-light)); }
:root[data-theme="light"] .ms-pc.w { text-shadow: 0 0 1px #3a3026, 1px 1px 0 #3a3026, -1px -1px 0 #3a3026, 1px -1px 0 #3a3026, -1px 1px 0 #3a3026; }
:root[data-theme="light"] .ms-hint { color: var(--ms-mute); }
:root[data-theme="light"] .ms-face { box-shadow: 0 6px 14px rgba(80, 55, 20, .25), 0 0 0 1px #ddd0b0; }
:root[data-theme="light"] .ms-roll { background: #fff; box-shadow: 0 4px 14px rgba(80, 55, 20, .18); }
:root[data-theme="light"] .ms-roll:hover { background: color-mix(in srgb, var(--ms-inv) 10%, #fff); }
:root[data-theme="light"] .ms-cap b { color: var(--ms-inv); }
:root[data-theme="light"] .ms-dice { border-color: #e3d7bb; background: rgba(255, 252, 245, .9); box-shadow: 0 12px 30px rgba(80, 55, 20, .16); }

/* ---------- guía paso a paso (muestra.js) ----------
   Un globo que vuela por encima de todo, con un halo ámbar que late detrás, y una flecha que apunta a lo que hay que
   tocar. Igual en los dos temas: oscuro con borde ámbar, para destacarse tanto sobre la noche como sobre el pergamino. */
.ms-guia {
  --g-amb: #F0A93C; --g-bg: #1f1a14; --g-ink: #F5EEDC; --g-mute: #c9bda5;
  position: fixed; left: 0; top: 0; z-index: 2147483000; width: min(270px, calc(100vw - 32px));
  pointer-events: none; transition: opacity .25s;
}
.ms-guia.off { opacity: 0; visibility: hidden; }
.ms-guia.fly { transition: transform .6s cubic-bezier(.5, 0, .2, 1), opacity .25s; }
.ms-guia-in {
  position: relative; pointer-events: auto; padding: 12px 14px 12px; border: 2px solid var(--g-amb); border-radius: 14px;
  background: var(--g-bg); color: var(--g-ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 22px rgba(240, 169, 60, .55);
  animation: ms-guia-glow 1.8s ease-in-out infinite, ms-guia-bob 1.2s ease-in-out infinite;
}
/* el halo de atrás */
.ms-guia-in::before { content: ""; position: absolute; inset: -14px; z-index: -1; border-radius: 26px;
  background: radial-gradient(closest-side, rgba(240, 169, 60, .45), transparent); filter: blur(10px); animation: ms-guia-halo 1.8s ease-in-out infinite; }
.ms-guia.pop .ms-guia-t, .ms-guia.pop .ms-guia-p { animation: ms-capin .35s ease-out both; }
@keyframes ms-guia-glow { 50% { box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 38px rgba(240, 169, 60, .9); } }
@keyframes ms-guia-halo { 50% { opacity: .55; transform: scale(1.06); } }
/* se mece hacia lo que señala */
.ms-guia[data-side="right"] { --bx: -7px; --by: 0px; } .ms-guia[data-side="left"] { --bx: 7px; --by: 0px; }
.ms-guia[data-side="below"] { --bx: 0px; --by: -7px; } .ms-guia[data-side="above"] { --bx: 0px; --by: 7px; }
@keyframes ms-guia-bob { 50% { translate: var(--bx, 0) var(--by, 0); } }
.ms-guia-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ms-guia-n { font: 600 12px var(--ms-mono, ui-monospace, Menlo, monospace); letter-spacing: .1em; color: var(--g-amb); }
.ms-guia-x { display: grid; place-items: center; width: 26px; height: 26px; margin: -4px -6px 0 0; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--g-mute); cursor: pointer; }
.ms-guia-x:hover, .ms-guia-x:focus-visible { background: rgba(240, 169, 60, .18); color: var(--g-ink); }
.ms-guia-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ms-guia-t { display: block; font-size: 16px; line-height: 1.3; font-weight: 700; color: var(--g-ink); text-wrap: balance; }
.ms-guia-p { margin: 4px 0 0; color: var(--g-mute); text-wrap: pretty; }
.ms-guia-skip { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--g-amb); font: 600 12.5px system-ui, sans-serif;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ms-guia.last .ms-guia-skip { padding: 7px 16px; border-radius: 999px; background: var(--g-amb); color: #1b1813; text-decoration: none; font-size: 13.5px; }
/* la flecha, fuera del globo, del lado de lo que señala; --ao = dónde cae a lo largo del borde */
.ms-guia-ar { position: absolute; width: 44px; height: 20px; overflow: visible; fill: none; stroke: var(--g-amb); stroke-width: 3.2;
  stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(240, 169, 60, .9)); }
.ms-guia[data-side="center"] .ms-guia-ar { display: none; }
.ms-guia[data-side="right"] .ms-guia-ar { left: -50px; top: calc(var(--ao) - 10px); }
.ms-guia[data-side="left"] .ms-guia-ar { right: -50px; top: calc(var(--ao) - 10px); transform: rotate(180deg); }
.ms-guia[data-side="below"] .ms-guia-ar { top: -36px; left: calc(var(--ao) - 22px); transform: rotate(90deg); }
.ms-guia[data-side="above"] .ms-guia-ar { bottom: -36px; left: calc(var(--ao) - 22px); transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) {
  .ms-guia-in, .ms-guia-in::before, .ms-guia.pop .ms-guia-t, .ms-guia.pop .ms-guia-p { animation: none; }
  .ms-guia.fly { transition: opacity .25s; }
}
