:root{
  --text: rgba(255,255,255,.88);
  --muted: rgba(255,255,255,.62);
  --border: rgba(255,255,255,.10);
  --shadow-soft: 0 10px 18px rgba(0,0,0,.30);
  --radius: 18px;
  --accent: #ffb26b;
  --focus: 0 0 0 3px rgba(255,178,107,.35);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(255,178,107,.18), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(56,189,248,.18), transparent 60%),
    linear-gradient(180deg, #060814, #0b1020 45%, #080b17);
  color: var(--text);
  min-height:100vh;
}

.box{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

header{
  padding: 18px 18px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(11,16,32,.92), rgba(11,16,32,.55));
  border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
}

.header-inner{
  max-width: 1200px;
  margin: 0 auto;
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content:space-between;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.title{
  display:flex;
  align-items:baseline;
  gap:10px;
  padding: 10px 14px;
}

.title h1{
  margin:0;
  font-size: 20px;
  letter-spacing:.5px;
  color: var(--accent);
  text-shadow: 0 6px 18px rgba(255,178,107,.22);
}

.title small{
  color: var(--muted);
  font-weight:600;
}

.wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 18px 26px;
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}

@media (max-width: 980px){
  .wrap{ grid-template-columns: 1fr; }
  header{ position: static; }
}

.panel{ padding: 14px; }

.panel h2{
  margin: 0 0 10px;
  font-size: 14px;
  color: rgba(255,255,255,.88);
  letter-spacing:.4px;
  text-transform: uppercase;
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 520px){ .grid{ grid-template-columns: 1fr; } }

label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
}

input, select, textarea, button{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 18px rgba(0,0,0,.18);
}

input:focus, select:focus, textarea:focus, button:focus{
  box-shadow: var(--focus), inset 0 1px 0 rgba(255,255,255,.06), 0 10px 18px rgba(0,0,0,.18);
}

textarea{ min-height: 84px; resize: vertical; }

.hint{
  font-size: 12px;
  color: rgba(255,255,255,.55);
  line-height: 1.3;
  margin-top: 8px;
}

.actions{
  display:flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.actions button{
  cursor:pointer;
  font-weight: 700;
  letter-spacing:.2px;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  flex: 1 1 160px;
}
.actions button:active{ transform: translateY(1px); }

.btn-primary{
  background: linear-gradient(180deg, rgba(255,178,107,.22), rgba(255,178,107,.12));
  border-color: rgba(255,178,107,.35);
}
.btn-primary:hover{
  background: linear-gradient(180deg, rgba(255,178,107,.28), rgba(255,178,107,.14));
}

.btn-ghost{ background: rgba(255,255,255,.05); }
.btn-ghost:hover{ background: rgba(255,255,255,.07); }

.btn-danger{
  background: linear-gradient(180deg, rgba(255,77,109,.25), rgba(255,77,109,.12));
  border-color: rgba(255,77,109,.40);
}
.btn-danger:hover{
  background: linear-gradient(180deg, rgba(255,77,109,.30), rgba(255,77,109,.14));
}

.preview-shell{
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}

.preview-top{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

.badge{
  width: auto;
  display:inline-flex;
  gap:8px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  box-shadow: 0 10px 18px rgba(0,0,0,.18);
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 700;
}

.dot{
  width:8px; height:8px; border-radius: 99px; background: #2ee59d;
  box-shadow: 0 0 0 3px rgba(46,229,157,.12);
}

.canvas-wrap{
  display:grid;
  place-items:center;
  padding: 12px;
}

.canvas-frame{
  width: 100%;
  max-width: 720px;
  aspect-ratio: 1/1;
  display:grid;
  place-items:center;
  padding: 10px;
}

canvas{
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  background: #101426;
}

.footer-note{
  color: rgba(255,255,255,.55);
  font-size: 12px;
  line-height: 1.35;
}

.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
@media (max-width: 520px){ .split{ grid-template-columns: 1fr; } }

.p12{ padding: 12px; }
.mt10{ margin-top: 10px; }
.muted{ color: rgba(255,255,255,.65); }
.strong{ color: rgba(255,255,255,.88); font-weight: 800; }

.checkline{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;
}
.checkline input{ width:auto; margin:0; }

/* small icon button */
.icon-btn{
  width: 42px;
  height: 42px;
  display:grid;
  place-items:center;
  padding: 0;
  border-radius: 14px;
  cursor: pointer;
}
.icon-btn svg{ opacity: .9; }
.icon-btn:hover svg{ opacity: 1; }

button:disabled{
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
  filter: saturate(.8);
}

/* ---------- Drawer ---------- */
.drawer-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 40;
}
.drawer-backdrop[hidden]{ display:none !important; }

.drawer{
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  z-index: 50;

  border-radius: 18px 0 0 18px;
  border-right: none;

  transform: translateX(110%);
  transition: transform .22s ease;
  box-shadow: 0 22px 60px rgba(0,0,0,.65);
  overflow: hidden;
}

.drawer.is-open{
  transform: translateX(0);
}

.drawer-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.drawer-title{
  font-weight: 900;
  font-size: 16px;
  color: rgba(255,255,255,.92);
}

.drawer-subtitle{
  font-size: 12px;
  color: rgba(255,255,255,.58);
  margin-top: 2px;
}

.drawer-body{
  padding: 14px;
  overflow: auto;
  height: calc(100vh - 72px - 68px);
}

.drawer-footer{
  display:flex;
  gap:10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.drawer-footer button{ flex: 1 1 160px; }
