:root{
  --bg:#fafafa;
  --card:#fff;
  --muted:#6b7280;
  --accent:#0ea5a4;
  --danger:#ef4444;
}
*{box-sizing:border-box}
html,body,#app{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
  background:var(--bg);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
main#app{
  width:100%;
  max-width:720px;
  background:var(--card);
  border-radius:12px;
  box-shadow:0 6px 22px rgba(15,23,42,0.08);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height:360px;
}
form{display:flex;flex-direction:column;gap:10px}
.row{display:flex;gap:8px;align-items:center}
input[type="text"],input[type="file"],#text{
  flex:1;
  padding:12px;
  border:1px solid #e6e9ee;
  border-radius:8px;
  font-size:15px;
}
.file{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:#f3f7f8;
  padding:8px 10px;
  border-radius:8px;
  cursor:pointer;
  font-size:13px;
  color:var(--muted);
}
.file input{display:none}
.actions{display:flex;gap:8px}
button{
  padding:10px 14px;
  border-radius:8px;
  border:0;
  font-weight:600;
  background:var(--accent);
  color:white;
  min-width:88px;
}
button#clear{background:#e6eef0;color:#064e4b}
#result{display:flex;flex-direction:column;gap:8px;align-items:flex-start}

/* Dropzone & thumbnails */
#preview.dropzone{
  width:100%;
  min-height:96px;
  border:2px dashed #e6eef0;
  border-radius:10px;
  display:flex;
  gap:8px;
  padding:8px;
  align-items:center;
  flex-wrap:wrap;
  background:linear-gradient(180deg, rgba(255,255,255,0.6), rgba(250,250,250,0.6));
}
#preview.dropzone.dragover{
  border-color:var(--accent);
  background:rgba(14,165,164,0.03);
}
.thumb{
  width:80px;
  height:80px;
  border-radius:8px;
  overflow:hidden;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #eef3f4;
  position:relative;
  background:#fff;
}
.thumb img{width:100%;height:100%;object-fit:cover}
.thumb .remove{
  position:absolute;
  top:6px;
  right:6px;
  background:rgba(0,0,0,0.6);
  color:#fff;
  border-radius:50%;
  width:22px;
  height:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  cursor:pointer;
  line-height:1;
}
.thumb .copy{
  position:absolute;
  bottom:6px;
  right:6px;
  background:rgba(255,255,255,0.92);
  color:#064e4b;
  border-radius:6px;
  padding:4px 6px;
  font-size:12px;
  cursor:pointer;
  border:1px solid rgba(6,78,75,0.08);
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Single-image fallback styling kept */
#preview img{max-width:100%;border-radius:8px;border:1px solid #eef3f4}
#summary{background:#fbfdfe;border:1px solid #eef6f6;padding:10px;border-radius:8px;width:100%}
#label{font-weight:700;font-size:16px}
#confidence{color:var(--muted);font-size:13px;margin-top:6px}
#reason{margin-top:8px;color:#111827;font-size:14px;white-space:pre-wrap}
.credit{font-size:12px;color:var(--muted);text-align:center}
@media (max-width:420px){
  main#app{padding:12px}
  .row{flex-direction:column;align-items:stretch}
  .file{width:100%;justify-content:center}
  .actions{flex-direction:row}
}