:root{
  color-scheme: dark;
}

*{
  box-sizing: border-box;
}

body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 800px at 20% 10%, #1f2a44, #0b0f1a);
  color:#e8eefc;
  margin:0;
  padding:16px;
}

/* Main box */
.container{
  max-width: 1100px;
  width: min(1100px, 96vw);
  margin: 40px auto;
  background: rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:18px;
  padding:26px;
  box-shadow:0 20px 60px rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
}

h1{
  margin:0 0 6px;
  font-size: clamp(20px, 5vw, 28px);
}

p{
  margin:0 0 16px;
  font-size:14px;
  opacity:.85;
}

/* File input */
input[type="file"]{
  width:100%;
  padding:14px;
  border-radius:14px;
  border:2px dashed rgba(96,165,250,.7);
  background: rgba(0,0,0,.25);
  color:#e8eefc;
  cursor:pointer;
}

/* Preview area */
#preview{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
  gap:12px;
  margin:18px 0;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

#preview img{
  width:100%;
  height: 110px;
  object-fit: cover;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.16);
  background:#020617;
}

/* Buttons wrapper */
.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

button{
  flex:1;
  min-width:120px;
  padding:12px 16px;
  border:none;
  border-radius:14px;
  cursor:pointer;
  font-weight:700;
  font-size:14px;
}

#convertBtn{
  background: linear-gradient(135deg,#2563eb,#60a5fa);
  color:white;
}

#resetBtn{
  background: rgba(0,0,0,.35);
  color:#e8eefc;
  border:1px solid rgba(255,255,255,.18);
}

button:hover{
  filter: brightness(1.08);
}

/* Preview item */
.preview-item{
  position: relative;
  cursor: grab;
}

.preview-item:active{
  cursor: grabbing;
}

/* Order number badge (TOP LEFT) */
.order-badge{
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.20);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
  z-index: 3;
}

/* ✅ Remove X button (TOP RIGHT) — FORCE SMALL LIKE BADGE */
.thumb-remove{
  position: absolute;
  top: 8px;
  right: 8px;

  /* override global button style */
  flex: 0 !important;
  min-width: 0 !important;
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;

  border-radius: 999px !important;
  background: rgba(0,0,0,0.65) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;

  color: #fff !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  cursor: pointer;
  z-index: 3;
}

.thumb-remove:hover{
  background: rgba(220, 38, 38, 0.85) !important;
}

/* Options (dropdowns) */
.opt select { min-width: 210px; }

.options{
  margin: 14px 0 8px;
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.opt{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.20);
}

.opt span{
  font-size:13px;
  opacity:.9;
  font-weight:700;
}

.opt select{
  background: rgba(0,0,0,0.35);
  color:#e8eefc;
  border:1px solid rgba(255,255,255,0.18);
  border-radius:10px;
  padding:8px 10px;
  outline:none;
}

/* Left/Right buttons row under thumbnail */
.thumb-actions{
  display:flex;
  gap:8px;
  justify-content:center;
  margin-top:8px;
}

.thumb-actions button{
  flex:1;
  min-width:auto;
  padding:8px 10px;
  font-size:12px;
  border-radius:10px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.18);
  color:#e8eefc;
}

.thumb-actions button:hover{
  filter: brightness(1.1);
}

/* Mobile adjustments */
@media (max-width:600px){
  body{ padding:12px; }

  .container{
    padding:16px;
    margin: 18px auto;
  }

  #preview{
    grid-template-columns: repeat(auto-fill, minmax(120px,1fr));
    max-height: 260px;
  }

  #preview img{
    height: 95px;
  }

  .actions{
    flex-direction:column;
  }

  /* still small, but easier to tap */
  .thumb-remove{
    width: 24px !important;
    height: 24px !important;
    font-size: 13px !important;
  }
}
