*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #120d1c;
  --bg2:      #1d1630;
  --bg3:      #2b2244;
  --oro:      #d4af5a;
  --oro2:     #f0d58c;
  --morado:   #6b3fa0;
  --texto:    #efeaf7;
  --tenue:    #9a90b3;
  --verde:    #3ecf8e;
  --amarillo: #ffc145;
  --rojo:     #ef5b5b;
  --radio:    16px;
  --tabbar-h: 64px;
  --seguro-abajo: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; background: var(--bg); color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }

#app { min-height: 100dvh; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column;
  position: relative;
  background: radial-gradient(120% 60% at 50% 0%, rgba(107,63,160,0.28), transparent 70%); }

header { text-align: center; padding: calc(28px + env(safe-area-inset-top, 0px)) 16px 8px; }
header h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: 0.5px;
  background: linear-gradient(180deg, var(--oro2), var(--oro)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { margin-top: 4px; font-size: 0.85rem; color: var(--tenue); }

.panel { flex: 1; padding: 8px 16px calc(var(--tabbar-h) + var(--seguro-abajo) + 24px);
  display: flex; flex-direction: column; gap: 18px; }
.panel-titulo { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--tenue); margin-top: 6px; }


.escucha { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 18px; }
.anillo { position: relative; width: 216px; height: 216px; }
.anillo-svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.anillo-fondo { fill: none; stroke: var(--bg3); stroke-width: 4; }
.anillo-progreso { fill: none; stroke: var(--oro); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 339.3; stroke-dashoffset: 339.3; transition: stroke-dashoffset 0.25s linear; }
.btn-escuchar { position: absolute; inset: 14px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #3a2a5c, var(--bg2) 70%); color: var(--oro2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 0 0 1px rgba(212,175,90,0.35), 0 12px 40px rgba(0,0,0,0.45); transition: transform 0.15s; }
.btn-escuchar:active { transform: scale(0.97); }
.icono-nota svg { width: 58px; height: 58px; }
.btn-texto { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.5px; }
.escuchando .btn-escuchar { animation: latido 1.4s ease-in-out infinite; }
@keyframes latido { 0%,100% { box-shadow: 0 0 0 1px rgba(212,175,90,0.35), 0 0 0 0 rgba(212,175,90,0.35); }
                    50% { box-shadow: 0 0 0 1px rgba(212,175,90,0.6), 0 0 0 18px rgba(212,175,90,0); } }
.estado { text-align: center; font-size: 0.95rem; min-height: 1.4em; }
.estado .sub { opacity: .7; font-size: .85em; }
.pista { text-align: center; font-size: 0.8rem; color: var(--tenue); max-width: 300px; }


#resultado { display: flex; flex-direction: column; gap: 12px; }
.tarjeta { background: var(--bg2); border-radius: var(--radio); padding: 18px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04); }
.tarjeta.texto p { font-size: 0.9rem; line-height: 1.5; color: var(--texto); }
.tarjeta.texto p + p { margin-top: 10px; }
.res-etiqueta { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--tenue); }
.res-titulo { font-size: 1.45rem; font-weight: 800; line-height: 1.2; margin-top: 6px; color: var(--oro2); overflow-wrap: anywhere; }
.res-autor { margin-top: 4px; font-size: 0.95rem; color: var(--texto); opacity: 0.85; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { font-size: 0.72rem; padding: 4px 10px; border-radius: 99px; background: var(--bg3); color: var(--texto); }
.conf-alta  { background: rgba(62,207,142,0.16); color: var(--verde); }
.conf-media { background: rgba(255,193,69,0.16); color: var(--amarillo); }
.conf-baja  { background: rgba(239,91,91,0.16);  color: var(--rojo); }

.opciones { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opcion { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg3); color: var(--texto); border: 1px solid transparent; border-radius: 12px; padding: 12px; }
.opcion:hover, .opcion:focus-visible { border-color: rgba(212,175,90,0.5); outline: none; }
.opcion-num { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 700; background: rgba(212,175,90,0.15); color: var(--oro); }
.opcion-texto { flex: 1; min-width: 0; }
.opcion-titulo { display: block; font-size: 0.92rem; font-weight: 600; overflow-wrap: anywhere; }
.opcion-sub { display: block; font-size: 0.75rem; color: var(--tenue); margin-top: 2px; overflow-wrap: anywhere; }

.acciones { display: flex; gap: 10px; margin-top: 16px; }
.acciones > * { flex: 1; }
.btn-principal, .btn-secundario { border: none; border-radius: 12px; padding: 13px 14px; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; }
.btn-principal { background: linear-gradient(180deg, var(--oro2), var(--oro)); color: #241a08; }
.btn-secundario { background: var(--bg3); color: var(--texto); }
.btn-principal:active, .btn-secundario:active { transform: scale(0.98); }

.feedback-titulo { font-size: 0.95rem; font-weight: 700; }
.buscador { width: 100%; margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--bg3);
  background: var(--bg); color: var(--texto); font-size: 1rem; }
.buscador:focus { outline: none; border-color: var(--oro); }
.enlace { background: none; border: none; color: var(--tenue); font-size: 0.85rem; text-decoration: underline;
  cursor: pointer; margin-top: 12px; }
.gracias { text-align: center; color: var(--verde); font-weight: 600; }
.meta { margin-top: 12px; font-size: 0.7rem; color: var(--tenue); text-align: right; }


.lista-historial { display: flex; flex-direction: column; gap: 8px; }
.item-historial { background: var(--bg2); border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.item-historial .opcion-texto { flex: 1; }
.item-hora { font-size: 0.72rem; color: var(--tenue); white-space: nowrap; }
.vacio { color: var(--tenue); font-size: 0.9rem; text-align: center; margin-top: 30px; }


.fila-ajuste { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.92rem; }
.fila-ajuste input { width: 22px; height: 22px; accent-color: var(--oro); flex-shrink: 0; }
.nota { margin-top: 10px; font-size: 0.78rem !important; color: var(--tenue) !important; }
.aviso-corto { margin: 0 0 12px; }
.version { text-align: center; font-size: 0.7rem; color: var(--tenue); }


.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 460px;
  height: calc(var(--tabbar-h) + var(--seguro-abajo)); padding-bottom: var(--seguro-abajo);
  background: rgba(18,13,28,0.94); backdrop-filter: blur(10px); border-top: 1px solid var(--bg3);
  display: flex; z-index: 10; }
.tab { flex: 1; background: none; border: none; color: var(--tenue); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; font-size: 0.7rem; cursor: pointer; }
.tab svg { width: 22px; height: 22px; }
.tab.activo { color: var(--oro); }


.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-caja { background: var(--bg2); border-radius: var(--radio); padding: 22px; max-width: 400px; width: 100%; }
.modal-caja h2 { font-size: 1.2rem; color: var(--oro2); }
.modal-caja p { margin-top: 10px; font-size: 0.9rem; line-height: 1.5; }
.modal-botones { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--seguro-abajo) + 14px);
  background: var(--bg3); color: var(--texto); padding: 10px 16px; border-radius: 99px; font-size: 0.85rem; z-index: 15;
  max-width: calc(100% - 32px); text-align: center; }

.cargando { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--bg3); border-top-color: var(--oro);
  border-radius: 50%; animation: gira 0.8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes gira { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .escuchando .btn-escuchar, .cargando { animation: none; }
}


.panel-juegos { position: fixed; inset: 0 0 calc(var(--tabbar-h) + var(--seguro-abajo)) 0; padding: 0; z-index: 5;
  background: #000; }
.panel-juegos iframe { width: 100%; height: 100%; border: 0; display: block; }
.volver-juegos { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 8px; z-index: 6;
  padding: 6px 12px; font-size: 0.8rem; opacity: 0.85; }
body.jugando .tabbar { display: none; }
body.jugando .panel-juegos { inset: 0; }
body.jugando .volver-juegos { padding: 4px 10px; font-size: 0.75rem; opacity: 0.6; }
body.juego-limpio .volver-juegos { display: none; }


.videos-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.bib-lista { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.bib-item { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--bg2); border: 0; border-radius: var(--radio);
  padding: 8px; color: var(--texto); font: inherit; cursor: pointer; }
.bib-item img, .bib-sin { width: 96px; height: 54px; object-fit: cover; border-radius: 10px; flex: none; background: var(--bg3);
  display: grid; place-items: center; font-size: 1.4rem; }
.bib-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bib-titulo { font-weight: 600; color: var(--oro2); }
.bib-texto .sub, .ficha-video .sub, .ver-video .sub { color: var(--tenue); font-size: 0.8rem; }
.grabadora { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; }
.grabadora video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.grab-arriba { position: relative; margin: max(env(safe-area-inset-top), 12px) auto 0; background: rgba(0,0,0,.45); color: #fff;
  padding: 4px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.grab-rec { color: var(--rojo); font-weight: 700; }
.grab-rotulo { position: relative; margin: 12px auto 0; max-width: 90%; background: rgba(18,13,28,.72); color: #fff; padding: 8px 14px;
  border-radius: 14px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.grab-rotulo strong { color: var(--oro2); font-size: 1.1rem; }
.grab-rotulo span { font-size: 0.8rem; color: #ddd; }
.grab-botones { position: relative; margin-top: auto; display: flex; align-items: center; justify-content: space-around;
  padding: 16px 16px max(calc(env(safe-area-inset-bottom) + 16px), 48px); }
.grab-parar { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: var(--rojo); cursor: pointer;
  box-shadow: 0 0 0 4px rgba(0,0,0,.35); }
.grab-parar::after { content: ''; display: block; width: 26px; height: 26px; margin: auto; background: #fff; border-radius: 6px; }
body.grabando-video .tabbar { display: none; }
.ficha-video { max-height: 90vh; overflow-y: auto; }
.ficha-mini { width: 100%; border-radius: 12px; margin-top: 10px; }
.ficha-tramos { margin: 4px 0 8px; padding-left: 18px; font-size: 0.9rem; } .ficha-tramos li { margin: 2px 0; }
.ficha-etq { display: block; margin-top: 14px; font-size: 0.8rem; color: var(--tenue); }
.ficha-marcha { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ficha-video input:not([type=checkbox]), .ficha-video textarea { width: 100%; margin-top: 4px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--bg3); background: var(--bg); color: var(--texto); font: inherit; }
.ficha-fila { display: flex; gap: 8px; align-items: stretch; } .ficha-fila input { flex: 1; }
.ficha-paso { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.ficha-paso button { padding: 9px; border-radius: 10px; border: 1px solid var(--bg3); background: transparent; color: var(--texto); font: inherit; cursor: pointer; }
.ficha-paso button.on { background: var(--morado); border-color: var(--oro); }
.ficha-alt { margin-top: 8px; }
.ver-video { max-height: 92vh; overflow-y: auto; }
.ver-video video { width: 100%; border-radius: 12px; background: #000; max-height: 50vh; }


#compartirVideo { z-index: 30; }
.marq-vista canvas { width: 100%; border-radius: 12px; margin-top: 12px; display: block; background: #000; }
.marq-barra { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.12); margin-top: 12px; overflow: hidden; }
.marq-barra span { display: block; height: 100%; width: 0; background: var(--oro); transition: width 0.3s; }
.grab-lienzo { position: absolute; left: 0; right: 0; top: calc(max(env(safe-area-inset-top), 12px) + 44px); width: 100%;
  height: calc(100% - max(env(safe-area-inset-top), 12px) - 44px - 130px - env(safe-area-inset-bottom)); object-fit: contain; }
.grabadora.con-lienzo video { opacity: 0; }   
.ficha-construye { margin-top: 10px; }
.ficha-construye .marq-vista canvas { margin-top: 0; }
.fila-ajuste.videos-rotulo { margin-top: 10px; }
.ficha-video input[type=date] { color-scheme: dark; }
.aviso-rotulo { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(212,160,23,.15); border: 1px solid rgba(212,160,23,.5);
  color: var(--oro2); font-size: 0.82rem; line-height: 1.35; }


:root {
  --bg: #120c1e; --bg2: rgba(255, 255, 255, .055); --bg3: rgba(255, 255, 255, .09);
  --oro: #d4a017; --oro2: #f0cf6a; --texto: #f4ecdf; --tenue: #b9aec6;
  --borde: rgba(255, 255, 255, .09); --radio: 20px;
}
html, body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { background: radial-gradient(120% 60% at 50% -10%, #3a2352 0%, #120c1e 60%) fixed, #120c1e; }
#app { background: none; }


.barra-app { display: flex; align-items: center; gap: 10px; text-align: left;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 4px; }
.barra-app img { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(240, 207, 106, .25); }
.barra-app h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; color: var(--texto);
  background: none; -webkit-background-clip: initial; background-clip: initial; }


.cab-panel { margin-top: 6px; }
.cab-panel .ante { font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--oro); margin-bottom: 4px; }
.cab-panel h2 { font-size: clamp(1.6rem, 7vw, 2rem); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; color: var(--texto); }
.cab-panel .sub { margin-top: 6px; color: var(--tenue); font-size: .92rem; }
.panel-titulo { font-size: 12px; font-weight: 700; letter-spacing: .18em; color: var(--oro); margin-top: 14px; }


.tarjeta, .modal-caja { background: var(--bg2); border: 1px solid var(--borde); box-shadow: none; border-radius: var(--radio); }
.modal-caja { background: #1e1430; }
.opcion, .item-historial, .bib-item { background: var(--bg2); border: 1px solid var(--borde); border-radius: 16px; }
.opcion:hover, .opcion:focus-visible { border-color: rgba(240, 207, 106, .35); background: rgba(255, 255, 255, .08); }
.opcion-num { background: linear-gradient(140deg, #f0b429, #b4531a); color: #1a1206; border-radius: 10px; }
.item-historial { padding: 10px 12px; }
.icono-tile { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; font-size: 22px;
  background: var(--g); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 14px rgba(0, 0, 0, .3); }
.chip { background: rgba(255, 255, 255, .08); font-weight: 700; }
.res-titulo { color: var(--texto); }
.res-etiqueta { color: var(--oro); font-weight: 700; letter-spacing: .14em; }


.btn-principal, .btn-secundario { border-radius: 999px; font-weight: 800; padding: 13px 18px; }
.btn-principal { background: var(--oro); color: #1a1206; box-shadow: 0 6px 18px rgba(212, 160, 23, .28); }
.btn-secundario { background: rgba(255, 255, 255, .07); color: var(--texto); border: 1px solid var(--borde); }
.buscador, .ficha-video input:not([type=checkbox]), .ficha-video textarea { border-radius: 14px; background: rgba(0, 0, 0, .25);
  border: 1px solid var(--borde); }


.fila-ajuste input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.fila-ajuste input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.fila-ajuste input[type=checkbox]:checked { background: var(--oro); }
.fila-ajuste input[type=checkbox]:checked::after { transform: translateX(18px); }
.fila-ajuste input[type=checkbox]:focus-visible { outline: 3px solid var(--oro2); outline-offset: 2px; }


.escucha { padding-top: 6px; }
.btn-escuchar { inset: auto; top: 14px; left: 14px; width: calc(100% - 28px); height: calc(100% - 28px);
  background: radial-gradient(circle at 50% 30%, #5a3a86, #241634 70%); color: var(--oro2);
  box-shadow: 0 0 0 1px rgba(240, 207, 106, .35), 0 18px 50px rgba(0, 0, 0, .5), 0 0 60px rgba(212, 160, 23, .12); }
.anillo-fondo { stroke: rgba(255, 255, 255, .1); }


.tabbar { background: rgba(18, 12, 30, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--borde); }
.tab { font-weight: 600; }
.tab svg { padding: 3px 14px; width: 50px; height: 28px; border-radius: 999px; box-sizing: border-box; transition: background .2s; }
.tab.activo { color: var(--oro2); }
.tab.activo svg { background: rgba(212, 160, 23, .18); }
.aviso { background: #2a1d3d; border: 1px solid var(--borde); }


.panel-juegos { background: #120c1e; }
.panel-juegos .volver-juegos { display: none; }
body.jugando .panel-juegos .volver-juegos { display: inline-flex; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 10px;
  padding: 6px 14px; font-size: .82rem; opacity: 1; }
body.jugando .panel-juegos iframe { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 44px);
  height: calc(100% - env(safe-area-inset-top, 0px) - 44px); }
body.jugando.juego-limpio .panel-juegos iframe { top: 0; height: 100%; }

.res-dedicatoria { margin-top: 8px; font-size: .88rem; color: var(--tenue); line-height: 1.4; }
.res-dedicatoria span { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--oro); margin-right: 6px; }
.creditos { font-size: .75rem; color: var(--tenue); text-align: center; margin-top: 4px; }
.creditos a { color: var(--tenue); }


.segmento { display: flex; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--borde); }
.segmento button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--tenue); font: 700 .92rem system-ui, sans-serif;
  padding: 10px 12px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.segmento button[aria-pressed="true"] { background: var(--oro); color: #1a1206; box-shadow: 0 4px 14px rgba(212,160,23,.3); }
#recoInfoEstado { margin-top: 10px; }
.reco-tarjeta { margin-top: 12px; }
#recoInfoTarjeta .reco-tarjeta { background: rgba(0,0,0,.18); }
.reco-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.reco-cab .ante { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--oro); }
.reco-cab h3 { font-size: 1.1rem; font-weight: 800; margin-top: 2px; }
.reco-ventajas { list-style: none; display: grid; gap: 6px; font-size: .9rem; line-height: 1.35; margin-bottom: 12px; }
.reco-ventajas b { color: var(--oro2); }
.reco-boton { width: 100%; }
.reco-barra { margin-top: 10px; }
.reco-barra span { display: block; height: 100%; width: 0; background: var(--oro); transition: width .3s; }
