:root{
  --bg:#0f141a;
  --bg2:#161d26;
  --bg3:#1e2733;
  --line:#2b3645;
  --tx:#e8edf3;
  --tx2:#9fb0c3;
  --acc:#4ea3ff;
  --l1:#16a34a;
  --l2:#dc2626;
  --l3:#8b95a3;
  --l4:#2563eb;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;height:100%}
body{
  background:var(--bg);color:var(--tx);
  font-family:-apple-system,"Roboto","Segoe UI",sans-serif;
  font-size:16px;line-height:1.45;overflow:hidden;
}

/* ---- barra superior ---- */
#bar{
  position:fixed;top:0;left:0;right:0;height:58px;z-index:30;
  display:flex;align-items:center;gap:8px;padding:0 10px;
  background:#0b0f14;border-bottom:1px solid var(--line);
}
#titles{flex:1;min-width:0}
#t1{font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#t2{font-size:12px;color:var(--tx2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.iconbtn{
  background:var(--bg3);color:var(--tx);border:1px solid var(--line);
  border-radius:10px;min-width:40px;height:38px;font-size:18px;padding:0 10px;
}
.iconbtn.wide{font-size:13px;min-width:66px}
.iconbtn.on{background:var(--acc);border-color:var(--acc);color:#04121f;font-weight:600}
#back{visibility:hidden}
#marks{display:none}

/* ---- contenido ---- */
#view{
  position:absolute;top:58px;left:0;right:0;bottom:0;
  overflow-y:auto;-webkit-overflow-scrolling:touch;
}
.pad{padding:14px 14px 40px}

.hero{
  background:linear-gradient(140deg,#17212e,#101722);
  border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:16px;
}
.hero h1{margin:0 0 6px;font-size:19px}
.hero p{margin:0;color:var(--tx2);font-size:14px}

.sec{margin:20px 0 8px;font-size:13px;letter-spacing:.09em;text-transform:uppercase;color:var(--tx2)}

.card{
  display:flex;align-items:center;gap:12px;width:100%;text-align:left;
  background:var(--bg2);border:1px solid var(--line);border-radius:12px;
  padding:13px 14px;margin-bottom:9px;color:var(--tx);font-size:15px;
}
.card .chev{margin-left:auto;color:var(--tx2);font-size:20px}
.card .sub{display:block;color:var(--tx2);font-size:12.5px;margin-top:2px}
.card .nm{min-width:0}
.dot{width:12px;height:12px;border-radius:50%;flex:none}
.pill{
  flex:none;border-radius:8px;padding:3px 9px;font-size:12px;font-weight:700;color:#04121f;
}

.linehdr{display:flex;align-items:center;gap:9px;margin:22px 0 9px}
.linehdr .nm{font-size:15px;font-weight:600}
.linehdr .tag{font-size:12px;color:var(--tx2)}

/* ---- visor de pantalla ---- */
#stage{
  position:relative;width:100%;background:#000;overflow:hidden;touch-action:none;
}
#canvas{position:relative;transform-origin:0 0;will-change:transform}
#canvas img{display:block;width:100%;height:auto;user-select:none;pointer-events:none}
.spot{
  position:absolute;border:2px solid rgba(78,163,255,.95);
  border-radius:4px;background:rgba(78,163,255,.14);
}
.spot .num{
  position:absolute;top:-11px;left:-11px;min-width:22px;height:22px;
  border-radius:11px;background:var(--acc);color:#04121f;
  font-size:12px;font-weight:700;line-height:22px;text-align:center;
  border:2px solid #04121f;padding:0 2px;
}
.spot.sel{border-color:#ffd54a;background:rgba(255,213,74,.22);z-index:8}
.spot.sel .num{background:#ffd54a}
#stage.clean .spot{border-color:transparent;background:transparent}
#stage.clean .spot .num{display:none}

.hint{padding:10px 14px;color:var(--tx2);font-size:13px;border-bottom:1px solid var(--line);background:#0b0f14}

.listhdr{padding:16px 14px 6px;font-size:13px;letter-spacing:.09em;text-transform:uppercase;color:var(--tx2)}
.row{
  display:flex;gap:11px;align-items:flex-start;width:100%;text-align:left;
  background:var(--bg2);border:1px solid var(--line);border-left-width:4px;
  border-radius:10px;padding:11px 12px;margin:0 14px 8px;width:calc(100% - 28px);
  color:var(--tx);font-size:14.5px;
}
.row .idx{
  flex:none;min-width:24px;height:24px;border-radius:12px;background:var(--bg3);
  color:var(--tx2);font-size:12px;font-weight:700;line-height:24px;text-align:center;
}
.row .nm{min-width:0}
.row .ct{display:block;font-size:12px;color:var(--tx2);margin-top:2px}

/* ---- ficha inferior ---- */
#scrim{
  position:fixed;inset:0;background:rgba(0,0,0,.55);opacity:0;pointer-events:none;
  transition:opacity .18s;z-index:40;
}
#scrim.on{opacity:1;pointer-events:auto}
.sheet{
  position:fixed;left:0;right:0;bottom:0;z-index:50;
  transform:translateY(110%);transition:transform .22s cubic-bezier(.2,.8,.3,1);
  max-height:82%;display:flex;
}
.sheet.on{transform:translateY(0)}
.sheet-inner{
  background:var(--bg2);border-top:1px solid var(--line);
  border-radius:18px 18px 0 0;padding:8px 16px 28px;width:100%;
  overflow-y:auto;-webkit-overflow-scrolling:touch;
}
.grab{width:42px;height:4px;border-radius:2px;background:#44546a;margin:4px auto 12px}
.sh-cat{display:inline-block;border-radius:7px;padding:3px 10px;font-size:12px;font-weight:700;color:#fff}
.sh-t{font-size:19px;font-weight:650;margin:10px 0 2px;line-height:1.3}
.sh-d{margin:10px 0 0;color:#dde5ee}
.note{
  border-radius:10px;padding:11px 12px;margin-top:13px;font-size:14.5px;
  border:1px solid;
}
.note b{display:block;font-size:12px;letter-spacing:.07em;text-transform:uppercase;margin-bottom:4px}
.note.tip{background:rgba(22,163,74,.12);border-color:rgba(22,163,74,.5)}
.note.tip b{color:#5fd68a}
.note.warn{background:rgba(220,38,38,.13);border-color:rgba(220,38,38,.55)}
.note.warn b{color:#ff8d8d}
.note.ver{background:rgba(245,158,11,.12);border-color:rgba(245,158,11,.5)}
.note.ver b{color:#fbbf24}
.sh-where{margin-top:14px;font-size:12.5px;color:var(--tx2)}

.block{background:var(--bg2);border:1px solid var(--line);border-radius:12px;padding:13px 14px;margin-bottom:10px}
.block h3{margin:0 0 6px;font-size:15.5px}
.block p{margin:0;color:#cfdae6;font-size:14.5px}
.legend{display:flex;gap:12px;align-items:flex-start}
.legend .sw{width:20px;height:20px;border-radius:6px;flex:none;margin-top:2px;border:1px solid #475569}

.search{
  width:100%;background:var(--bg3);border:1px solid var(--line);border-radius:11px;
  color:var(--tx);padding:12px 13px;font-size:16px;margin-bottom:12px;
}
.empty{color:var(--tx2);font-size:14px;padding:6px 2px}
.foot{color:#64748b;font-size:12px;text-align:center;padding:22px 10px 8px;line-height:1.6}

body.editing #view{right:400px}
body.editing #editor{display:flex}
#editor{
  display:none;position:fixed;top:58px;right:0;bottom:0;width:400px;z-index:35;
  flex-direction:column;gap:8px;padding:14px 14px 24px;overflow:auto;
  background:#121920;border-left:1px solid var(--line);
}
.ed-top{display:flex;flex-direction:column;gap:2px}
.ed-top strong{font-size:16px}
#editstate{color:#5fd68a;font-size:12px;min-height:16px}
.ed-actions{display:flex;flex-wrap:wrap;gap:6px}
.ed-help{margin:0;color:var(--tx2);font-size:13px}
#ed-form{display:flex;flex-direction:column;gap:8px}
#ed-form[hidden]{display:none}
#ed-form label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--tx2)}
#ed-form input[type="text"],#ed-form textarea,#ed-form select{
  background:var(--bg3);color:var(--tx);border:1px solid var(--line);
  border-radius:8px;padding:8px 10px;font-size:14px;font-family:inherit;
}
#ed-form label.chk{flex-direction:row;align-items:center;gap:8px;font-size:14px;color:var(--tx)}
.ed-share{margin:0;font-size:12.5px;color:#fbbf24}
.spot.off{border-style:dashed;opacity:.55}
body.editing .spot{cursor:move}
.rh{
  position:absolute;right:-7px;bottom:-7px;width:14px;height:14px;border-radius:3px;
  background:#ffd54a;border:2px solid #04121f;cursor:nwse-resize;
}
#edit.on{background:#ffd54a;border-color:#ffd54a;color:#04121f;font-weight:600}
.install-note{
  position:fixed;top:58px;left:12px;right:12px;z-index:40;
  margin:0;padding:10px 12px;border-radius:10px;
  background:#121920;border:1px solid var(--line);color:#fbbf24;font-size:13px;
}
@media (max-width: 900px){
  body.editing #view{right:0;bottom:46vh}
  #editor{width:auto;left:0;top:auto;height:46vh;border-left:0;border-top:1px solid var(--line)}
}
