/* KlipTok v22 · menú móvil, scroll de barras laterales y DADO 3D */

/* ---------- Barras laterales y páginas del modo libro: scroll visible, suave e independiente ---------- */
html aside.kt-aside, html aside.no-scrollbar {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  scrollbar-width: thin; scrollbar-color: #a78bfa transparent; scroll-behavior: smooth;
}
html aside.kt-aside::-webkit-scrollbar, html aside.no-scrollbar::-webkit-scrollbar, html .kt-pg::-webkit-scrollbar { display: block; width: 8px; }
html aside.kt-aside::-webkit-scrollbar-thumb, html aside.no-scrollbar::-webkit-scrollbar-thumb, html .kt-pg::-webkit-scrollbar-thumb { background: #a78bfa; border-radius: 8px; }
html aside.kt-aside::-webkit-scrollbar-track, html aside.no-scrollbar::-webkit-scrollbar-track, html .kt-pg::-webkit-scrollbar-track { background: transparent; }
html .kt-pg { scrollbar-width: thin; scrollbar-color: #a78bfa transparent; overscroll-behavior: contain; touch-action: pan-y; scroll-behavior: smooth; }
/* botones sutiles ▲ ▼ (los crea kt-v22-dice.js junto a cada barra con scroll) */
.k22-sa { position: fixed; z-index: 90; display: none; flex-direction: column; gap: 6px; }
.k22-sa.on { display: flex; }
.k22-sa button { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; font-size: 12px; line-height: 1; color: #fff; background: rgba(109,40,217,.78); box-shadow: 0 3px 10px rgba(0,0,0,.25); opacity: .85; }
.k22-sa button:hover, .k22-sa button:focus-visible { opacity: 1; background: #7c3aed; }
.k22-sa button:disabled { opacity: .3; cursor: default; }

/* ---------- Móvil: ☰ abre el cajón lateral; segundo botón muestra la barra superior ---------- */
.k22-barsbtn { display: none; }
@media (max-width: 767px) {
  .k22-barsbtn { display: block; position: fixed; z-index: 70; top: 56px; inset-inline-start: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 16px; }
  .k22-close { position: sticky; top: 0; align-self: flex-end; margin: -.25rem -.25rem 0 0; z-index: 3; width: 36px; height: 36px; border-radius: 50%; border: 0; font-size: 16px; background: rgba(124,58,237,.15); color: inherit; flex: 0 0 auto; cursor: pointer; }
}
@media (min-width: 768px) { .k22-close { display: none; } }

/* ---------- DADO 3D ---------- */
#v3d-dice { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; width: 100%; max-height: 100%; padding: 8px 12px; position: relative; z-index: 4; }
#v3d-dice.on { display: flex; }
.dc-stage { --ds: min(210px, 42vw, 27vh); width: var(--ds); height: var(--ds); position: relative; perspective: 1000px; margin: calc(var(--ds) * .2) 0 calc(var(--ds) * .34); }
.dc-hop { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.dc-tilt { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(-38deg); }
.dc-cube { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.dc-face { position: absolute; inset: 0; border-radius: 18%; overflow: hidden; border: 3px solid rgba(255,255,255,.75); backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; text-align: center; box-shadow: inset 0 0 28px rgba(255,255,255,.28), inset 0 -14px 30px rgba(0,0,0,.16); }
.dc-face:nth-child(1) { transform: translateZ(calc(var(--ds) / 2)); }
.dc-face:nth-child(2) { transform: rotateY(90deg) translateZ(calc(var(--ds) / 2)); }
.dc-face:nth-child(3) { transform: rotateY(180deg) translateZ(calc(var(--ds) / 2)); }
.dc-face:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--ds) / 2)); }
.dc-face:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--ds) / 2)); }
.dc-face:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--ds) / 2)); }
.dc-face video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.dc-face .dc-e { font-size: calc(var(--ds) * .3); filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); position: relative; }
.dc-face .dc-k { font-size: calc(var(--ds) * .075); font-weight: 800; letter-spacing: .08em; background: rgba(255,255,255,.28); padding: 2px 10px; border-radius: 999px; position: relative; }
.dc-face .dc-t { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px 7px; font-size: calc(var(--ds) * .068); font-weight: 700; background: linear-gradient(transparent, rgba(0,0,0,.55)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-face .dc-eq { display: none; position: absolute; left: 0; right: 0; top: 14%; justify-content: center; align-items: flex-end; gap: 4px; height: 22%; }
.dc-face.playing .dc-eq { display: flex; }
.dc-eq i { width: 6px; background: #fff; border-radius: 3px; animation: dcEq .8s ease-in-out infinite alternate; height: 30%; }
.dc-eq i:nth-child(2) { animation-delay: .15s } .dc-eq i:nth-child(3) { animation-delay: .3s } .dc-eq i:nth-child(4) { animation-delay: .1s } .dc-eq i:nth-child(5) { animation-delay: .25s }
@keyframes dcEq { to { height: 100%; } }
.dc-shadow { position: absolute; left: 8%; right: 8%; bottom: -26px; height: 18px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.45), transparent 70%); transform-origin: center; }
.dc-ui { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.dc-roll { padding: 12px 24px; font-size: 16px; font-weight: 800; color: #fff; border: 0; border-radius: 999px; cursor: pointer; background: linear-gradient(90deg,#ff6b6b,#feca57 45%,#1dd1a1); box-shadow: 0 8px 22px rgba(255,107,107,.45); transition: transform .15s; }
.dc-roll:hover { transform: translateY(-2px) scale(1.03); } .dc-roll:active { transform: scale(.97); } .dc-roll:disabled { opacity: .6; cursor: default; transform: none; }
.dc-snd { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; font-size: 18px; cursor: pointer; }
.dc-snd[aria-pressed="false"] { opacity: .55; }
.dc-now { display: flex; align-items: center; gap: 10px; max-width: min(92vw, 420px); padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; font-size: 13px; backdrop-filter: blur(6px); }
.dc-now[hidden] { display: none; }
.dc-now b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-now button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; cursor: pointer; flex: 0 0 auto; }
.dc-hint { color: #cbd5e1; font-size: 12px; text-align: center; max-width: 320px; }
@media (prefers-reduced-motion: reduce) { .dc-eq i { animation: none; height: 60%; } }
.dc-face.vplay .dc-e, .dc-face.vplay .dc-k { opacity: 0; transition: opacity .3s; }
#v3d.dice-mode .v3d-nav, #v3d.dice-mode #v3d-bar { display: none !important; }
