:root{
  --logoPurple:#6D28D9;
  --bg0:#070A10;
  --bg1:#0B0F17;
  --stroke:rgba(255,255,255,0.10);
  --stroke2:rgba(255,255,255,0.14);
  --text:#EAF0FF;
  --muted:rgba(234,240,255,0.66);
  --brand:#2B79FF;
  --brand2:#1D56C2;
  --shadow:0 18px 55px rgba(0,0,0,0.55);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1100px 700px at 20% -10%, rgba(43,121,255,0.18), transparent 60%),
    radial-gradient(900px 650px at 90% 10%, rgba(145,70,255,0.14), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  backdrop-filter:blur(10px);
  background:linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.00));
  border-bottom:1px solid var(--stroke);
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.mark{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,0.04);
}

.mark svg{
  width:32px;
  height:32px;
  display:block;
}

.brand-title{
  font-weight:850;
}

.shell{
  max-width:980px;
  margin:0 auto;
  padding:18px 16px 40px;
}

.panel{
  border-radius:18px;
  border:1px solid var(--stroke);
  background:rgba(15,21,33,0.65);
  box-shadow:var(--shadow);
  padding:16px;
}

.grid{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.card{
  border-radius:16px;
  border:1px solid var(--stroke);
  background:linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  padding:12px;
}

.card-h{
  font-weight:800;
  font-size:13px;
  margin-bottom:10px;
  letter-spacing:0.2px;
}

.split{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.label{
  color:var(--muted);
  font-size:12px;
  font-weight:650;
  letter-spacing:0.2px;
}

.control{
  height:42px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(11,15,23,0.55);
  color:var(--text);
  outline:none;
}

.control:focus{
  border-color:rgba(43,121,255,0.70);
  box-shadow:0 0 0 4px rgba(43,121,255,0.18);
}

input[type="range"]{
  width:100%;
}

.btn{
  height:42px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,0.04);
  color:var(--text);
  font-weight:750;
  cursor:pointer;
}

.btn:hover{
  background:rgba(255,255,255,0.07);
}

.btn:disabled{
  opacity:0.45;
  cursor:not-allowed;
}

.btn.primary{
  background:linear-gradient(180deg, var(--brand), var(--brand2));
  border-color:rgba(255,255,255,0);
}

.btn.ghost{
  background:transparent;
}

.button-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.muted{ color:var(--muted); }
.small{ font-size:12px; }
.mono{ font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace; }

.status{
  margin-top:10px;
  min-height:16px;
}

.note{
  margin-top:10px;
  padding:10px 10px;
  border-radius:14px;
  border:1px dashed rgba(255,255,255,0.18);
  background:rgba(0,0,0,0.22);
  line-height:1.45;
}

.meta-row{
  margin-top:10px;
}

.pick-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.pick-left{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.pick-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.file-native{
  width:min(520px, 100%);
  height:42px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(11,15,23,0.55);
  color:var(--text);
  padding:6px 10px;
}

.file-native:focus{
  outline:none;
  border-color:rgba(43,121,255,0.70);
  box-shadow:0 0 0 4px rgba(43,121,255,0.18);
}

.file-native::file-selector-button{
  height:30px;
  margin-right:12px;
  border-radius:10px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  font-weight:800;
  cursor:pointer;
  padding:0 12px;
}

.file-native::file-selector-button:hover{
  background:rgba(255,255,255,0.10);
}

/* Modal */
.modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:50;
}

.modal[aria-hidden="false"]{
  display:block;
}

.overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.65);
  backdrop-filter:blur(8px);
}

.modal-card{
  position:relative;
  max-width:1120px;
  margin:5vh auto 0;
  width:calc(100% - 24px);
  max-height:90vh;
  border-radius:22px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(12,16,24,0.86);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.modal-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border-bottom:1px solid rgba(255,255,255,0.10);
}

.modal-title{
  font-weight:900;
  letter-spacing:-0.2px;
}

.modal-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.modal-body{
  padding:12px;
  overflow:hidden;
}

.preview-stage{
  border-radius:18px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(0,0,0,0.30);
  padding:12px;
  overflow:auto;
  max-height:72vh;
}

.preview-stage canvas{
  display:block;
  width:100%;
  height:auto;
  image-rendering:pixelated;
}

@media (max-width: 720px){
  .pick-actions{ width:100%; }
}

@media (max-width: 560px){
  .split{ grid-template-columns:1fr; }
  .topbar{ flex-wrap:wrap; }
  .modal-top{ align-items:flex-start; }
}