html,
body{
  margin:0;
  padding:0;
  background:#0f1115;
  color:#e9eef5;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-text-size-adjust:100%;
  touch-action:manipulation;
  padding-top:env(safe-area-inset-top);
  padding-bottom:env(safe-area-inset-bottom);
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}

.wrap{
  max-width:1000px;
  margin:0 auto;
  padding:12px;
}

.board{
  position:relative;
  background:#0b0d14;
  border:1px dashed #2b2f43;
  border-radius:14px;
  padding:10px;
}

.stage{
  position:relative;
  margin:10px auto;
  background:#000;
  border-radius:8px;
  width:100%;
  max-width:1000px;
}

#cvs{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

.frame{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  background-repeat:no-repeat;
  background-position:0 0;
  background-size:100% 100%;
  pointer-events:none;
  opacity:.999;
}

.slot{
  position:absolute;
  border:2px dashed rgba(255,255,255,.18);
  border-radius:10px;
  cursor:pointer;
}

.slot.active{
  border-color:#4ea1ff;
}

.slot::before{
  content:"📷 TAP";
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.08);
  color:rgba(255,255,255,.85);
  font-size:22px;
  font-weight:700;
  letter-spacing:.5px;
  text-shadow:0 2px 8px rgba(0,0,0,.45);
  pointer-events:none;
}

.slot.filled::before{
  display:none;
}

.nudgeBar{
  display:flex;
  gap:16px;
  justify-content:center;
  align-items:center;
  margin:12px 0 4px;
}

.nbtn{
  min-width:72px;
  height:36px;
  border-radius:14px;
  border:1px solid #2a3350;
  background:#141a2a;
  color:#e9eef5;
  font-weight:800;
  font-size:22px;
  box-shadow:0 6px 16px rgba(0,0,0,.45);
  cursor:pointer;
}

.nbtn:active{
  transform:translateY(1px);
}

.footerBtns{
  display:none;
}

.toolbar{
  position:sticky;
  bottom:0;
  z-index:10;
  display:flex;
  gap:10px;
  justify-content:center;
  align-items:center;
  background:#141824;
  border:1px solid #22283a;
  border-radius:14px;
  padding:10px;
}

.icon{
  -webkit-appearance:none;
  appearance:none;
  width:54px;
  height:54px;
  border-radius:14px;
  border:1px solid #2a3350;
  background:#1a2033;
  color:#e9eef5;
  display:grid;
  place-items:center;
  cursor:pointer;
  transition:transform .06s ease, opacity .2s ease, background .2s ease;
}

.icon svg{
  width:24px;
  height:24px;
  display:block;
}

.icon:disabled{
  opacity:.35;
  cursor:default;
}

.icon:not(:disabled):active{
  transform:scale(.97);
}

.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.75);
  z-index:20;
}

.modal .card{
  background:#fff;
  border-radius:20px;
  padding:20px;
  box-shadow:0 8px 30px rgba(0,0,0,.5);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  max-width:90vw;
}

.modal .qrwrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
}

.modal img{
  display:block;
  background:#fff;
  border-radius:12px;
  max-width:80vw;
  height:auto;
}

.modal .btn{
  padding:12px 18px;
  font-size:16px;
  font-weight:700;
  border:none;
  border-radius:12px;
  background:#0f62fe;
  color:#fff;
  cursor:pointer;
  box-shadow:0 4px 12px rgba(0,0,0,.3);
}

.modal .btn:active{
  transform:translateY(1px);
}

.modal .btn.secondary{
  background:#555;
}

.fab-back,
.fab-gallery{
  position:fixed;
  top:calc(env(safe-area-inset-top) + 10px);
  z-index:9999;
  width:48px;
  height:48px;
  border-radius:14px;
  display:grid;
  place-items:center;
  border:1px solid #2a3350;
  background:rgba(0,0,0,.4);
  color:#e9eef5;
  box-shadow:0 6px 20px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.06);
  transition:transform .06s ease, opacity .2s ease, background .2s ease;
}

.fab-back{
  left:calc(env(safe-area-inset-left) + 10px);
}

.fab-gallery{
  right:calc(env(safe-area-inset-right) + 10px);
}

.fab-back:active,
.fab-gallery:active{
  transform:scale(.97);
}

.fab-back svg,
.fab-gallery svg{
  width:22px;
  height:22px;
  display:block;
}

@media (max-width:820px){

  .toolbar{
    padding:8px;
    gap:8px;
  }

  .icon{
    width:56px;
    height:56px;
    border-radius:16px;
  }

  .icon svg{
    width:26px;
    height:26px;
  }

  .fab-back,
  .fab-gallery{
    width:56px;
    height:56px;
    border-radius:16px;
  }

  .fab-back svg,
  .fab-gallery svg{
    width:24px;
    height:24px;
  }
}