/* Blockout en el celular, el AR y lo que se ve en vivo entre dispositivos. Mismos tokens que app.css. */

/* ---------- login (Google propio del Blockout) ---------- */
#login-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% 0%, rgba(140,17,228,0.35), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(221,0,93,0.25), transparent 60%), var(--bg); }
#login-gate .lg-card { width: min(420px, 100%); padding: 28px 24px; border-radius: var(--r); border: 1px solid var(--hair); background: rgba(20,14,34,0.7); text-align: center; color: var(--ink); font-family: var(--fb); }
#login-gate img { height: 34px; }
#login-gate h1 { margin: 14px 0 6px; font: 800 30px var(--fd); }
#login-gate p { margin: 0 0 18px; color: var(--body); font-size: 14px; line-height: 1.45; }
#login-gate #lg-btn { display: flex; justify-content: center; min-height: 44px; }
#login-gate .lg-err { margin-top: 14px; color: var(--mg-t); font-weight: 600; }

/* ---------- cartel "en vivo" en la PC ---------- */
.live-banner { position: fixed; top: 150px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 60; max-width: min(640px, calc(100vw - 32px)); padding: 8px 16px; border-radius: 999px; font: 600 13px var(--fb); color: #fff; background: linear-gradient(135deg, rgba(51,245,255,0.28), rgba(140,17,228,0.55)); border: 1px solid rgba(51,245,255,0.5); box-shadow: 0 10px 30px rgba(0,0,0,0.35); opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-banner.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.live-banner.soft { background: rgba(20,14,34,0.75); border-color: var(--hair); color: var(--body); }
.live-banner.rec { background: linear-gradient(135deg, rgba(255,45,74,0.85), rgba(221,0,93,0.85)); border-color: rgba(255,120,140,0.7); }
body[data-view="home"] .live-banner, body.phone .live-banner { display: none; }

/* ---------- vista móvil ---------- */
body[data-view="mobile"] #app, body[data-view="mobile"] #editor-view { display: none !important; }
body[data-view="mobile"] { overflow: hidden; }
body.phone #toast { bottom: calc(150px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); white-space: normal; text-align: center; }

#mobile { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); color: var(--ink); font-family: var(--fb); background: radial-gradient(800px 400px at 0% 0%, rgba(140,17,228,0.28), transparent 60%), radial-gradient(700px 380px at 100% 100%, rgba(221,0,93,0.18), transparent 60%), var(--bg); }
#mobile svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.m-top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.m-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-name { font: 700 17px var(--fd); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub { font: 500 12px var(--fm); color: var(--muted); }
.m-save { font: 600 11.5px var(--fb); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--hair); color: var(--body); white-space: nowrap; }
.m-save.ok { color: var(--gr); border-color: rgba(115,238,27,0.4); }
.m-save.pending { color: var(--cy); border-color: rgba(51,245,255,0.4); }
.m-save.err { color: var(--mg-t); border-color: rgba(221,0,93,0.5); }
.m-ibtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--field-bd); background: rgba(255,255,255,0.05); color: var(--ink); flex: none; }
.m-ibtn:active, .m-big:active, .m-play:active { transform: scale(.97); }

.m-live { display: none; font: 600 12.5px var(--fb); padding: 8px 12px; border-radius: 12px; background: rgba(51,245,255,0.1); border: 1px solid rgba(51,245,255,0.35); color: var(--cy); }
.m-live.on { display: block; }

.m-stage { position: relative; flex: 1; min-height: 160px; display: grid; place-items: center; }
.m-frame { position: relative; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 18px 50px rgba(0,0,0,0.55); }
.m-frame canvas, .m-frame video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m-frame video { object-fit: cover; opacity: 0; pointer-events: none; }
.m-frame.show-video video { opacity: 1; }
.m-modes { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: rgba(5,3,12,0.7); }
.m-modes button { height: 34px; }

.m-shots { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: none; }
.m-shots::-webkit-scrollbar { display: none; }
.m-shot { min-width: 96px; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--hair); background: rgba(255,255,255,0.04); color: var(--body); text-align: left; }
.m-shot b { font: 700 13px var(--fd); color: var(--ink); }
.m-shot span { font: 500 10.5px var(--fm); white-space: nowrap; }
.m-shot.on { border-color: rgba(221,0,93,0.8); background: linear-gradient(135deg, rgba(221,0,93,0.35), rgba(140,17,228,0.35)); color: #fff; }

.m-transport { display: flex; align-items: center; gap: 8px; flex: none; }
.m-play { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; border: 0; color: #fff; background: linear-gradient(135deg, var(--mg), var(--pu)); box-shadow: 0 8px 24px rgba(221,0,93,0.4); flex: none; }
#mobile .m-play svg { fill: currentColor; stroke: none; width: 24px; height: 24px; }
.m-scrub { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-scrub input { width: 100%; height: 28px; accent-color: var(--mg); }
.m-time { font: 500 12px var(--fm); color: var(--muted); text-align: right; }

.m-lock { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(221,0,93,0.12); border: 1px solid rgba(221,0,93,0.4); font-size: 12.5px; color: var(--body); flex: none; }
.m-lock span { flex: 1; }
.m-btn { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.28); background: linear-gradient(135deg, var(--mg), var(--pu)); color: #fff; font: 700 12.5px var(--fd); white-space: nowrap; }

.m-actions { display: flex; flex-direction: column; gap: 8px; flex: none; }
.m-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-big { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--field-bd); background: rgba(255,255,255,0.05); color: var(--ink); text-align: left; }
.m-big span { display: flex; flex-direction: column; min-width: 0; }
.m-big b { font: 700 15px var(--fd); }
.m-big small { font: 500 11.5px var(--fb); color: var(--muted); }
.m-big.primary { min-height: 64px; border-color: rgba(255,255,255,0.28); background: linear-gradient(135deg, var(--mg), var(--pu)); box-shadow: 0 10px 30px rgba(221,0,93,0.35); }
.m-big.primary small { color: rgba(255,255,255,0.85); }
.m-big.dim { opacity: .5; }

/* en pantallas bajas (celular acostado) los botones van en fila */
@media (max-height: 560px) {
  #mobile { gap: 6px; }
  .m-actions { flex-direction: row; }
  .m-actions .m-big.primary { flex: 1.3; min-height: 52px; }
  .m-row { flex: 2; }
  .m-big { min-height: 48px; }
  .m-big small { display: none; }
}

/* ---------- AR ---------- */
.ar-gl { position: fixed; inset: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#ar-overlay { position: fixed; inset: 0; z-index: 2000; color: #fff; font-family: var(--fb); pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
#ar-overlay button { touch-action: manipulation; }
.ar-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 0; }
.ar-btn { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.3); background: rgba(10,6,20,0.55); color: #fff; font: 700 17px var(--fd); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); flex: none; }
.ar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; border-radius: 12px; background: rgba(10,6,20,0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ar-info b { font: 700 15px var(--fd); }
.ar-time { font: 500 12px var(--fm); color: rgba(255,255,255,0.85); }
.ar-pip { position: relative; width: 96px; border-radius: 10px; overflow: hidden; border: 2px solid rgba(255,255,255,0.75); background: #000; flex: none; }
.ar-pip canvas { display: block; width: 100%; height: 100%; }
.ar-pip-tag { position: absolute; top: 4px; left: 4px; font: 700 9px var(--fm); letter-spacing: 1px; padding: 2px 5px; border-radius: 4px; background: rgba(221,0,93,0.85); }
#ar-overlay[data-rec="rec"] .ar-pip { border-color: #ff2d4a; }

.ar-frame { position: absolute; border: 2px solid rgba(255,255,255,0.85); box-shadow: 0 0 0 4000px rgba(0,0,0,0.38); pointer-events: none; border-radius: 2px; }
.ar-frame.wide { border-style: dashed; box-shadow: none; }
#ar-overlay[data-rec="rec"] .ar-frame { border-color: #ff2d4a; }
.ar-frame i { position: absolute; width: 33.33%; height: 33.33%; border: 1px solid rgba(255,255,255,0.18); }
.ar-frame i:nth-child(1) { left: 0; top: 0; border-width: 0 1px 1px 0; }
.ar-frame i:nth-child(2) { right: 0; top: 0; border-width: 0 0 1px 1px; }
.ar-frame i:nth-child(3) { left: 0; bottom: 0; border-width: 1px 1px 0 0; }
.ar-frame i:nth-child(4) { right: 0; bottom: 0; border-width: 1px 0 0 1px; }

.ar-count { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font: 800 120px var(--fd); text-shadow: 0 6px 30px rgba(0,0,0,0.6); pointer-events: none; }
.ar-msg { position: absolute; left: 16px; right: 16px; top: calc(80px + env(safe-area-inset-top)); padding: 10px 14px; border-radius: 12px; background: rgba(10,6,20,0.72); font: 600 14px var(--fb); line-height: 1.4; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
.ar-msg.on { opacity: 1; }
#ar-overlay[data-phase="place"] .ar-msg { top: calc(160px + env(safe-area-inset-top)); }

.ar-place { position: absolute; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom)); display: none; flex-direction: column; align-items: center; gap: 8px; }
#ar-overlay[data-phase="place"] .ar-place { display: flex; }
#ar-overlay[data-phase="place"] .ar-panel, #ar-overlay[data-phase="place"] .ar-pip { display: none; }
.ar-seg { background: rgba(10,6,20,0.7); }
.ar-seg button { height: 42px; font-size: 14px; padding: 0 16px; }
.ar-scale { font: 600 12px var(--fm); padding: 4px 10px; border-radius: 999px; background: rgba(10,6,20,0.6); }

.ar-panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(5,3,12,0.75), rgba(5,3,12,0)); display: flex; flex-direction: column; gap: 10px; }
.ar-lens { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.ar-mm { width: 62px; font: 700 14px var(--fm); }
.ar-lens input { flex: 1; height: 32px; accent-color: var(--cy); }
.ar-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.ar-rec { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: rgba(0,0,0,0.25); display: grid; place-items: center; flex: none; }
.ar-rec span { width: 52px; height: 52px; border-radius: 50%; background: #ff2d4a; transition: .15s; }
#ar-overlay[data-rec="rec"] .ar-rec span, #ar-overlay[data-rec="count"] .ar-rec span { width: 28px; height: 28px; border-radius: 6px; }
#ar-overlay.ro .ar-rec, #ar-overlay.ro [data-a="key"], #ar-overlay.ro [data-a="undo"] { opacity: .4; }
.ar-more { display: flex; flex-direction: column; gap: 6px; }
.ar-more button { min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.25); background: rgba(10,6,20,0.75); color: #fff; font: 600 13.5px var(--fb); text-align: left; }
.ar-pill { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.35); background: rgba(10,6,20,0.7); color: #fff; font: 600 13.5px var(--fb); }

/* ---------- Generar con Seedance (PC y celular) ---------- */
#gen-sheet { position: fixed; inset: 0; z-index: 900; display: grid; place-items: end center; background: rgba(4,2,10,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-family: var(--fb); color: var(--ink); }
@media (min-width: 760px) { #gen-sheet { place-items: center; } }
.gs-card { width: min(720px, 100%); max-height: 92vh; max-height: 92dvh; overflow: hidden; display: flex; flex-direction: column; border-radius: 20px 20px 0 0; border: 1px solid var(--hair); background: #120c1f; box-shadow: 0 -20px 60px rgba(0,0,0,0.5); }
@media (min-width: 760px) { .gs-card { border-radius: 20px; } }
.gs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 8px; }
.gs-head b { display: block; font: 800 20px var(--fd); }
.gs-head span { font-size: 12px; color: var(--muted); }
.gs-x { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--field-bd); background: rgba(255,255,255,0.05); color: var(--ink); font-size: 16px; flex: none; }
.gs-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.gs-cap { font: 700 11px var(--fm); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.gs-models { align-self: flex-start; }
.gs-models button { height: 38px; }
.gs-note { margin: 0; font-size: 12.5px; color: var(--body); line-height: 1.45; }
.gs-note.warn, .gs-cost .warn { color: #ffcf6e; }
.gs-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.gs-ref { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,0.04); color: var(--body); text-align: left; opacity: .5; }
.gs-ref.on { border-color: var(--mg); opacity: 1; }
.gs-ref img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.gs-ref span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-prompt { width: 100%; min-height: 140px; height: 26vh; flex: none; resize: vertical; padding: 10px; border-radius: 12px; border: 1px solid var(--field-bd); background: var(--field); color: var(--ink); font: 12px/1.5 var(--fm); }
.gs-link { align-self: flex-start; border: 0; background: none; color: var(--cy); font: 600 12.5px var(--fb); padding: 4px 0; }
.gs-foot { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); }
.gs-cost { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--body); }
.gs-cost b { font: 800 18px var(--fd); color: #fff; }
.gs-prog { position: relative; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); overflow: hidden; font-size: 13px; font-weight: 600; }
.gs-prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(221,0,93,0.45), rgba(140,17,228,0.45)); transition: width .3s; }
.gs-prog span { position: relative; }
.gs-actions { display: flex; justify-content: flex-end; gap: 8px; }
.gs-go { height: 44px; padding: 0 18px; font-size: 14px; }
.gs-go:disabled { opacity: .45; }
