:root{
  --bg:#0b1117;
  --panel:#0e141a;
  --panel2:#111a22;
  --text:#dbe7f3;
  --muted:#8aa0b6;
  --line:#233444;
  --accent:#2dd4bf;
  --accent-ink:#04201b;
  --scanline:#1748d8;
  --corner:#ffffff;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
code{background:#0f1821;border-radius:6px;padding:2px 6px}
.app{display:flex;min-height:100vh;gap:12px;padding:12px;align-items:flex-start}

/* panels */
.side{
  flex:0 0 390px;display:flex;flex-direction:column;gap:12px;min-width:320px;
  max-height:calc(100vh - 24px);overflow:auto;position:relative;z-index:1;
}
.main{flex:1 1 auto;display:flex;flex-direction:column;gap:12px;min-width:0;position:relative;z-index:0}
.card{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:12px}
.h{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.h h2{margin:0;font-size:16px}
.row{display:flex;gap:10px;align-items:center;margin:8px 0;flex-wrap:wrap}
.row label{flex:0 0 170px;color:var(--muted);font-size:13px}
.row input[type="text"],.row input[type="url"],.row input[type="color"]{
  flex:1 1 160px;background:var(--panel2);border:1px solid var(--line);border-radius:8px;color:var(--text);padding:8px
}
.row input[type="file"]{flex:1 1 160px}
.file{display:flex;gap:8px;align-items:center}
.btn{background:var(--accent);color:var(--accent-ink);border:0;border-radius:10px;padding:8px 12px;cursor:pointer;font-weight:600}
.btn.sec{background:#213244;color:var(--text)}
.btn:disabled{opacity:.5;cursor:not-allowed}
small{color:var(--muted)}
.hr{height:1px;background:#223042;margin:10px 0}
.badge{
  font-size:12px;color:#9ab0c6;background:#12202c;border:1px solid #1e3143;padding:3px 6px;border-radius:8px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;display:block
}
.badge.ok{background:#0f2a22;color:#a8ffdf;border-color:#1d4d40}

/* preview layout */
.preview-wrap{display:flex;gap:12px;align-items:flex-start}
.phone{flex:0 0 390px;background:#000;border:1px solid #1d2a38;border-radius:20px;overflow:hidden;display:flex;flex-direction:column}
.phone .bar{height:36px;background:#0c1218;display:flex;align-items:center;justify-content:center;color:#6c8298;font-size:12px;border-bottom:1px solid #1d2a38}

/* Phone stage height */
.phone .stage{ position:relative;background:#000;overflow:hidden;height:720px; }

/* HUD */
.hudTop{ position:absolute;left:0;right:0;top:0;display:flex;align-items:flex-start;justify-content:center;padding:18px 10px 0;z-index:5 }
.hudTop img{ width:min(80vw,320px);height:auto;display:block }

/* footer preview */
.footerPrev{position:absolute;left:0;right:0;bottom:0;z-index:5}
.footerPrev img{width:100%;height:auto;display:block}

/* permission preview (sobre HUD) */
.perm{position:absolute;inset:0;background:rgba(0,0,0,.9);display:flex;align-items:center;justify-content:center;padding:20px;z-index:10}
.perm .box{width:85%;max-width:340px;display:flex;flex-direction:column;gap:18px}
.img{width:100%;height:auto;display:block;border-radius:8px}
.btnimg{width:70%;max-width:220px;align-self:flex-start}
.tcimg{width:100%;max-width:260px;align-self:flex-start}
.ph{width:100%;height:80px;border:1px dashed #2a3a4c;border-radius:10px;background:#0e141a;display:flex;align-items:center;justify-content:center;color:#7d90a6}

/* language preview (sobre HUD) */
.lang{position:absolute;inset:0;background:rgba(0,0,0,.88);display:flex;align-items:center;justify-content:center;padding:20px;z-index:10}
.lang .box{width:85%;max-width:340px;display:flex;flex-direction:column;gap:16px}
.lang .btns{display:flex;gap:12px;flex-wrap:wrap;justify-content:flex-start}
.lang .btns img{width:46%;max-width:160px}

/* scanner preview */
.scan{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:3}
.scan .frame{position:relative;width:72%;max-width:300px;aspect-ratio:1/1}
.corner{position:absolute;width:28px;height:28px;border-color:var(--corner);border-style:solid;border-width:0}
.corner.tl{top:0;left:0;border-top-width:3px;border-left-width:3px;border-radius:10px 0 0 0}
.corner.tr{top:0;right:0;border-top-width:3px;border-right-width:3px;border-radius:0 10px 0 0}
.corner.bl{bottom:0;left:0;border-bottom-width:3px;border-left-width:3px;border-radius:0 0 0 10px}
.corner.br{bottom:0;right:0;border-bottom-width:3px;border-right-width:3px;border-radius:0 0 10px 0}
.scanline{position:absolute;left:6px;right:6px;height:2px;background:linear-gradient(90deg, transparent, var(--scanline), transparent);filter:drop-shadow(0 0 6px var(--scanline));animation:scanY 2.4s ease-in-out;border-radius:2px}
@keyframes scanY{0%{top:6%;opacity:.9}50%{top:94%;opacity:1}100%{top:6%;opacity:.9}}

/* hand preview */
.hand{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;z-index:2}
.hand .ph{width:36%;height:36%}

/* pc overlay preview (simple) */
.pc{flex:1 1 auto;background:#fff;border:1px solid #dbe2ea;border-radius:12px;overflow:hidden;min-height:520px}
.pc .area{display:flex;align-items:center;justify-content:center;padding:20px;height:100%}
.pc .wrap{width:min(1200px,95%);display:flex;gap:20px;align-items:center}
.pc .left{flex:0 0 35%;min-width:420px;display:flex;flex-direction:column;gap:14px}
.pc .left img{width:100%;height:auto;display:block;object-fit:contain}
.pc .right{flex:1 1 auto;display:flex;gap:16px;min-height:360px;align-items:center;justify-content:center}
.pc .right img{max-height:80vh;width:auto;height:auto;display:block;object-fit:contain}

/* toolbar */
.tools{display:flex;gap:10px;align-items:center;justify-content:space-between}
.notice{color:var(--muted);font-size:12px}

/* details */
details summary{cursor:pointer;color:#b9cde1}
details > *:not(summary){margin-top:8px}

/* responsive */
@media (max-width:1200px){
  .phone .stage{ height:640px; }
}
@media (max-width:980px){
  .preview-wrap{flex-direction:column}
  .pc{min-height:400px}
  .phone .stage{ height:600px; }
}
@media (max-width:480px){
  .phone{flex:1 1 auto}
  .phone .stage{ height:520px; }
}
