/* CamLink — hoja de estilos propia (sin CDN) */
:root {
  --bg: #070b16; --bg2: #0c1222; --panel: #111a2e; --line: #22304b; --line2: #2f4062;
  --text: #e6ebf5; --muted: #93a1bb; --dim: #65748f;
  --brand1: #e040fb; --brand2: #7c4dff; --green: #16c784; --amber: #f5a524; --red: #ef4444; --sky: #38bdf8;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: radial-gradient(1200px 600px at 80% -10%, rgba(124,77,255,.18), transparent 60%), var(--bg); color: var(--text); font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; min-height: 100vh; }
a { color: inherit; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; color: #fff; }
p { margin: 0 0 .6rem; }
code { background: #1b2740; color: #f0abfc; padding: .1rem .4rem; border-radius: 5px; font-size: .9em; }
.hidden { display: none !important; }
.ico { width: 1em; height: 1em; fill: currentColor; vertical-align: -.15em; display: inline-block; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(7,11,22,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar nav { max-width: 1100px; margin: 0 auto; padding: 0 16px; height: 58px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: #fff; text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand1), var(--brand2)); display: grid; place-items: center; color: #fff; }
.brand-logo .ico { width: 18px; height: 18px; }
.navlinks { display: flex; gap: 4px; }
.navlinks a { text-decoration: none; color: var(--muted); font-size: .92rem; padding: 7px 12px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.navlinks a:hover { color: #fff; background: var(--panel); }
.navlinks a.active { color: #fff; background: var(--panel); border: 1px solid var(--line); }
@media (max-width: 520px) { .navlinks a span { display: none; } .navlinks a { padding: 8px 10px; font-size: 1.1rem; } }

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 16px; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 36px 16px; }
.container-phone { max-width: 460px; margin: 0 auto; padding: 20px 16px; }

/* Home */
.hero { text-align: center; padding: 30px 0 36px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 900; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 720px; margin: 14px auto 0; }
.hero strong { color: #fff; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 28px; }
.step-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px 22px; display: flex; flex-direction: column; }
.step-card h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.step-card p { color: var(--muted); flex: 1; font-size: .96rem; }
.step-num { position: absolute; top: -14px; right: 18px; width: 30px; height: 30px; border-radius: 999px; background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .9rem; box-shadow: 0 6px 16px rgba(124,77,255,.4); }
.c-violet { color: #a78bfa; } .c-pink { color: #f472b6; } .c-green { color: var(--green); } .c-sky { color: var(--sky); } .c-amber { color: var(--amber); }

.note-box { border: 1px solid rgba(245,165,36,.35); background: rgba(245,165,36,.07); border-radius: var(--radius); padding: 18px 20px; font-size: .95rem; color: #fde8bf; }
.note-box h2 { color: var(--amber); font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.note-box ul { margin: 8px 0 0; padding-left: 20px; } .note-box li { margin: 4px 0; } .note-box strong { color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: .96rem; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: .15s; line-height: 1.2; }
.btn-primary { background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; box-shadow: 0 6px 18px rgba(124,77,255,.35); }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-secondary { background: #182540; color: var(--text); border-color: var(--line2); }
.btn-secondary:hover { background: #1f2f50; }
.btn-danger { background: #b91c1c; color: #fff; } .btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; } .btn-lg { padding: 15px 20px; font-size: 1.1rem; }
.btn-icon { padding: 10px 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none !important; transform: none !important; }
.mt { margin-top: 14px; }

/* Inputs */
.input { background: #060a14; border: 1px solid var(--line2); color: #fff; border-radius: 10px; padding: 10px 12px; outline: none; font: inherit; width: 100%; }
.input:focus { border-color: var(--brand1); box-shadow: 0 0 0 3px rgba(224,64,251,.2); }
.input-code { font-family: ui-monospace, Consolas, monospace; font-size: 1.7rem; letter-spacing: .3em; text-align: center; text-transform: uppercase; padding: 12px; }
.input-mono { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.label { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 5px; }
.check { display: flex; align-items: center; gap: 10px; font-size: .95rem; color: var(--text); padding: 2px 4px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand1); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flex { display: flex; gap: 8px; align-items: center; }
.link { color: #f0abfc; text-decoration: underline; text-underline-offset: 3px; }
.small { font-size: .82rem; color: var(--muted); } .tiny { font-size: .78rem; color: var(--dim); } .center { text-align: center; }

/* PC page */
.pc-grid { display: grid; grid-template-columns: 1fr 360px; gap: 22px; }
@media (max-width: 900px) { .pc-grid { grid-template-columns: 1fr; } }
.video-box { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.video-box video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.video-overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: rgba(7,11,22,.6); }
.video-overlay p { margin: 0; } .video-overlay .t1 { color: #fff; font-weight: 600; } .video-overlay .t2 { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.spinner { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 50%; border: 4px solid #22304b; border-top-color: var(--brand1); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; backdrop-filter: blur(6px); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-gray { background: rgba(51,65,85,.85); color: #cbd5e1; }
.badge-amber { background: rgba(217,119,6,.9); color: #fff; }
.badge-green { background: rgba(22,163,74,.92); color: #fff; }
.badge-red { background: rgba(220,38,38,.92); color: #fff; }
.badge-plain::before { display: none; }
.video-ctrls { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; background: rgba(7,11,22,.8); color: #fff; border: 1px solid var(--line2); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: #1f2f50; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel-title { font-weight: 700; color: #fff; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.code-display { font-family: ui-monospace, Consolas, monospace; font-size: 2.4rem; letter-spacing: .3em; text-align: center; padding: 10px 0 6px; color: #fff; user-select: all; }
.qr-wrap { display: flex; justify-content: center; margin: 8px 0 10px; }
.qr-wrap canvas { background: #fff; padding: 8px; border-radius: 10px; width: 196px; height: 196px; }
.status-list { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.status-list li { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #3b4a66; flex: none; }
.dot-on { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot-warn { background: var(--amber); }

/* Phone page */
.cam-box { position: relative; aspect-ratio: 9/16; max-height: 54vh; margin: 0 auto; background: #000; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); }
.cam-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.cam-placeholder .ico { width: 44px; height: 44px; color: #334155; margin-bottom: 10px; }
.cam-badge { position: absolute; top: 12px; left: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.msg { min-height: 1.5em; text-align: center; font-size: .92rem; color: var(--muted); }
.msg.err { color: #f87171; }
.tips { margin-top: 22px; font-size: .82rem; color: var(--dim); display: flex; flex-direction: column; gap: 5px; }
.tips p { display: flex; gap: 8px; align-items: flex-start; margin: 0; }

/* Guide */
.guide h1 { font-size: 2rem; font-weight: 800; }
.guide .lead { color: var(--muted); margin-bottom: 32px; }
.guide-step { border-left: 3px solid var(--brand2); padding-left: 20px; margin-bottom: 38px; }
.guide-step h2 { font-size: 1.3rem; font-weight: 700; }
.guide-step ol, .guide-step ul { padding-left: 20px; color: #c9d3e6; margin: 6px 0; }
.guide-step li { margin: 5px 0; }
.guide-step p { color: #c9d3e6; }
.note { margin-top: 12px; font-size: .9rem; color: #fcd34d; background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25); padding: 10px 12px; border-radius: 8px; }
.cmp { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 10px 0; color: #c9d3e6; }
.cmp th, .cmp td { border: 1px solid var(--line2); padding: 8px 10px; text-align: left; vertical-align: top; }
.cmp th { background: #182540; color: #fff; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; font-size: .9rem; background: #0c1222; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: #fff; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

/* Celular: flujo simple */
.cam-flip { position: absolute; bottom: 12px; right: 12px; }
.linkbtn { background: none; border: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; font-size: .88rem; padding: 4px; }
.linkbtn:hover { color: #fff; }
.advanced { display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* ===== Auth (setup / login) ===== */
.auth-body { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; margin: auto; }
@media (min-height: 700px) { .auth-card { min-height: 520px; } }
.auth-card h1 { font-size: 1.5rem; }
.auth-card #auth-input { width: 100%; }
.brand-logo.big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 4px; } .brand-logo.big .ico { width: 28px; height: 28px; }
.seg { display: flex; background: #0c1222; border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 3px; width: 100%; }
.seg button { flex: 1; background: none; border: none; color: var(--muted); padding: 8px; border-radius: 8px; font: inherit; font-size: .9rem; cursor: pointer; }
.seg button.on { background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; font-weight: 600; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 10px 0 14px; min-height: 16px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line2); }
.pin-dot.on { background: var(--brand1); border-color: var(--brand1); box-shadow: 0 0 10px var(--brand1); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 280px; margin: 0 auto; }
.pin-key { height: 60px; border-radius: 14px; background: #182540; border: 1px solid var(--line2); color: #fff; font-size: 1.4rem; font-weight: 600; cursor: pointer; }
.pin-key:active { background: #1f2f50; transform: scale(.97); }
.pin-key.ok { background: linear-gradient(135deg, var(--brand1), var(--brand2)); font-size: 1rem; }
.pin-key.del { color: var(--muted); }
.pattern { touch-action: none; border-radius: 16px; background: #0c1222; border: 1px solid var(--line); display: block; margin: 0 auto; }
.pw-wrap { position: relative; width: 100%; } .pw-input { padding-right: 44px; font-size: 1.05rem; }
.pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }

/* ===== PC dashboard sin scroll ===== */
.pc-body { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.topbar.compact nav { height: 50px; }
.pc-dash { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; gap: 14px; padding: 14px; max-width: 1500px; width: 100%; margin: 0 auto; }
.pc-video { min-height: 0; display: flex; }
.video-box.fill { aspect-ratio: auto; flex: 1; min-height: 0; }
.pc-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; }
.pc-side .panel { margin: 0; padding: 14px; } .pc-side .panel.grow { flex: 1; }
.pc-side .panel-title { font-size: .95rem; margin-bottom: 8px; }
.qr-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.qr-row canvas { width: 120px !important; height: 120px !important; background: #fff; padding: 5px; border-radius: 10px; }
.qr-row .code-display { font-size: 1.6rem; letter-spacing: .2em; text-align: left; padding: 2px 0; }
.pc-side details summary { cursor: pointer; color: var(--muted); }
.icon-btn.on { background: var(--brand2); border-color: var(--brand2); }
@media (max-width: 900px) { .pc-body { height: auto; overflow: auto; } .pc-dash { grid-template-columns: 1fr; } .video-box.fill { aspect-ratio: 16/9; } }

/* ===== Celular pantalla completa ===== */
.phone-body { height: 100vh; height: 100dvh; overflow: hidden; background: #000; }
.phone-stage { position: relative; height: 100%; width: 100%; max-width: 560px; margin: 0 auto; background: #000; overflow: hidden; }
.phone-stage video, .phone-stage #beauty-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.phone-stage .cam-placeholder { position: absolute; inset: 0; z-index: 1; }
.phone-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.phone-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.75)); display: flex; flex-direction: column; gap: 10px; }
#connect-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#connect-row .input-code { font-size: 1.3rem; letter-spacing: .25em; padding: 10px; }
.phone-bottom .msg { text-align: center; text-shadow: 0 1px 4px #000; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: rgba(12,18,34,.97); border-top: 1px solid var(--line2); border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; max-height: 78%; overflow: auto; backdrop-filter: blur(10px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; } .sheet-head h2 { font-size: 1.05rem; display: flex; gap: 6px; align-items: center; margin: 0; }
.slider { display: grid; grid-template-columns: 110px 1fr 34px; align-items: center; gap: 10px; font-size: .9rem; }
.slider input[type=range] { width: 100%; accent-color: var(--brand1); } .slider b { text-align: right; color: var(--muted); font-weight: 500; font-size: .8rem; }
.presets { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .presets::-webkit-scrollbar { display: none; }
.preset { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; color: var(--muted); font: inherit; font-size: .72rem; cursor: pointer; }
.preset span { width: 54px; height: 54px; border-radius: 12px; border: 2px solid transparent; background: linear-gradient(135deg, #f7c6a5, #c9865f); }
.preset.on { color: #fff; } .preset.on span { border-color: var(--brand1); box-shadow: 0 0 10px var(--brand1); }
.lut-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lut-row .btn { padding: 8px 12px; font-size: .85rem; }

/* ===== Configuración ===== */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.cfg-grid .panel { margin: 0; }

/* ===== Controles rápidos (celular y PC) ===== */
.quick-bar { display: flex; justify-content: center; gap: 10px; }
.remote-row { display: flex; gap: 8px; }
.qbtn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 12px; background: rgba(15,23,42,.85); border: 1px solid var(--line2); color: var(--muted); font: inherit; font-size: .7rem; cursor: pointer; min-width: 64px; backdrop-filter: blur(6px); }
.qbtn .ico { width: 1.3em; height: 1.3em; }
.qbtn.on { color: #fff; border-color: var(--brand1); background: rgba(124,77,255,.35); }
.qbtn.off { color: #f87171; border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.15); }
.cam-off-overlay { position: absolute; inset: 0; z-index: 2; background: #000; display: grid; place-items: center; color: var(--muted); text-align: center; }
.cam-off-overlay .ico { width: 48px; height: 48px; color: #334155; }
