/* ==========================================================================
   Graphic Resort - PNG to JPG Converter
   Brand: light grey page background, white cards, blue #2563EB + orange #F97316
   ========================================================================== */

.grpj-app{
  --grpj-blue:#2563EB;
  --grpj-blue-deep:#0B2545;
  --grpj-blue-tint:#EFF4FF;
  --grpj-orange:#F97316;
  --grpj-orange-deep:#EA580C;
  --grpj-orange-tint:#FFF3EA;
  --grpj-ink:#0B2545;
  --grpj-slate:#5B6472;
  --grpj-bg:#F7F8FA;
  --grpj-white:#FFFFFF;
  --grpj-border:#E5E7EB;
  --grpj-green:#16A34A;
  --grpj-green-tint:#EAFBF1;
  --grpj-radius-lg:22px;
  --grpj-radius-md:16px;
  --grpj-radius-sm:11px;
  --grpj-control-h:46px;
  --grpj-shadow-sm:0 8px 22px -16px rgba(11,37,69,.25);
  --grpj-shadow-md:0 20px 44px -18px rgba(11,37,69,.28);
  --grpj-shadow-lg:0 30px 60px -22px rgba(11,37,69,.35);
  --grpj-ease:cubic-bezier(.22,1,.36,1);

  background:var(--grpj-bg);
  color:var(--grpj-ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:16.5px;
  max-width:1280px;
  margin:0 auto;
  padding:20px 16px 8px;
  border-radius:24px;
  line-height:1.6;
}
.grpj-app *{ box-sizing:border-box; }
.grpj-app h1,.grpj-app h2,.grpj-app h3{ font-weight:800; letter-spacing:-.01em; color:var(--grpj-blue-deep); margin:0; }
.grpj-app button{ font-family:inherit; }
.grpj-app svg{ display:block; }
.grpj-app input[type="number"]{ font-family:inherit; }
.grpj-app :focus-visible{ outline:3px solid var(--grpj-blue); outline-offset:2px; }

/* ---------- header ---------- */
.grpj-head{ text-align:center; margin-bottom:32px; }
.grpj-badge{
  display:inline-flex; align-items:center; gap:9px; font-size:13px; font-weight:700; color:var(--grpj-orange-deep);
  background:var(--grpj-orange-tint); border-radius:999px; padding:8px 18px 8px 14px; margin-bottom:16px; letter-spacing:.01em;
}
.grpj-badge .grpj-dot{ width:7px; height:7px; border-radius:50%; background:var(--grpj-orange); flex-shrink:0; }
.grpj-head h1{ font-size:clamp(25px,3.6vw,36px); margin-bottom:10px; }
.grpj-head p{ color:var(--grpj-slate); font-size:16px; max-width:560px; margin:0 auto; }

/* ---------- dropzone (empty state) ---------- */
.grpj-dropzone{
  max-width:720px; margin:0 auto; background:var(--grpj-white); border:2px dashed #C7D2E5; border-radius:var(--grpj-radius-lg);
  padding:56px 40px; text-align:center; cursor:pointer; transition:border-color .2s var(--grpj-ease), background .2s var(--grpj-ease), transform .2s var(--grpj-ease), box-shadow .2s var(--grpj-ease);
  box-shadow:var(--grpj-shadow-sm);
}
.grpj-dropzone:hover, .grpj-dropzone.grpj-drag{ border-color:var(--grpj-orange); background:var(--grpj-orange-tint); transform:translateY(-2px); box-shadow:var(--grpj-shadow-md); }
.grpj-drop-icon{
  width:72px; height:72px; border-radius:20px; margin:0 auto 24px;
  background:linear-gradient(135deg,var(--grpj-blue),var(--grpj-blue-deep)); color:#fff;
  display:flex; align-items:center; justify-content:center; box-shadow:0 16px 30px -12px rgba(37,99,235,.5);
  transition:transform .25s var(--grpj-ease);
}
.grpj-dropzone:hover .grpj-drop-icon{ transform:scale(1.06) rotate(-3deg); }
.grpj-drop-icon svg{ width:32px; height:32px; }
.grpj-dropzone h3{ font-size:22px; margin-bottom:8px; }
.grpj-dropzone p{ color:var(--grpj-slate); font-size:15px; margin:0 0 14px; }
.grpj-drop-formats{
  display:inline-block; font-size:12.5px; font-weight:600; color:var(--grpj-blue); background:var(--grpj-blue-tint);
  padding:6px 14px; border-radius:999px;
}

/* ---------- studio: two-column workspace ---------- */
.grpj-studio{ display:grid; grid-template-columns:1.35fr 1fr; gap:24px; align-items:start; }
@media (max-width:980px){ .grpj-studio{ grid-template-columns:1fr; } }

/* ---------- left: preview ---------- */
.grpj-preview-col{ display:flex; flex-direction:column; gap:16px; }
.grpj-preview-card{
  background:var(--grpj-white); border:1px solid var(--grpj-border); border-radius:var(--grpj-radius-lg);
  padding:20px; box-shadow:var(--grpj-shadow-md);
}
.grpj-preview-topbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.grpj-preview-filename{
  font-size:15px; font-weight:700; color:var(--grpj-ink); margin:0; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; flex:1; min-width:0;
}

.grpj-icon-btn{
  width:var(--grpj-control-h); height:var(--grpj-control-h); border-radius:50%; border:1px solid var(--grpj-border);
  background:var(--grpj-white); color:var(--grpj-slate); display:flex; align-items:center; justify-content:center; flex-shrink:0;
  cursor:pointer; transition:background .18s ease, color .18s ease, border-color .18s ease, transform .18s var(--grpj-ease);
}
.grpj-icon-btn:hover{ transform:translateY(-2px); }
.grpj-icon-btn-danger:hover{ background:#FDECEC; border-color:#F3B9B9; color:#C81E3A; }

.grpj-preview-stage{
  position:relative; border-radius:var(--grpj-radius-md); overflow:hidden; min-height:340px; max-height:480px;
  display:flex; align-items:center; justify-content:center; margin-bottom:18px;
  background:
    linear-gradient(45deg,#eef1f6 25%,transparent 25%),linear-gradient(-45deg,#eef1f6 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#eef1f6 75%),linear-gradient(-45deg,transparent 75%,#eef1f6 75%);
  background-size:22px 22px; background-position:0 0,0 11px,11px -11px,-11px 0; background-color:#fafbfc;
}
.grpj-preview-stage canvas{ max-width:100%; max-height:480px; display:block; transition:opacity .15s ease; }
.grpj-alpha-badge{
  position:absolute; top:14px; left:14px; font-size:11.5px; font-weight:700; color:#fff; background:rgba(11,37,69,.75);
  padding:5px 12px; border-radius:999px; letter-spacing:.02em; backdrop-filter:blur(3px); z-index:2;
}

.grpj-preview-sizes{ display:flex; align-items:center; justify-content:center; gap:14px; margin-bottom:16px; flex-wrap:wrap; }
.grpj-size-block{ text-align:center; }
.grpj-size-block span{ display:block; font-size:11.5px; color:var(--grpj-slate); font-weight:600; margin-bottom:2px; }
.grpj-size-block b{ font-size:16px; color:var(--grpj-blue-deep); font-variant-numeric:tabular-nums; }
.grpj-size-arrow{ stroke:var(--grpj-slate); flex-shrink:0; }
.grpj-preview-percent{
  font-size:14px; font-weight:800; color:var(--grpj-green); background:var(--grpj-green-tint); padding:6px 14px; border-radius:999px;
}
.grpj-preview-percent.is-negative{ color:var(--grpj-orange-deep); background:var(--grpj-orange-tint); }

.grpj-preview-override{ border-top:1px solid var(--grpj-border); padding-top:14px; margin-bottom:14px; }
.grpj-text-link{
  display:inline-flex; align-items:center; gap:7px; background:none; border:none; padding:0; cursor:pointer;
  font-size:13px; font-weight:700; color:var(--grpj-blue);
}
.grpj-text-link:hover{ color:var(--grpj-blue-deep); text-decoration:underline; }
.grpj-inline-quality{ display:flex; align-items:center; gap:10px; margin-top:12px; }
.grpj-inline-quality input[type="range"]{ flex:1; }
.grpj-inline-quality span{ font-size:12.5px; font-weight:700; color:var(--grpj-orange-deep); width:36px; text-align:right; }

.grpj-preview-download{ width:100%; justify-content:center; }

/* ---------- thumbnail rail ---------- */
.grpj-rail{
  display:flex; align-items:center; gap:10px; background:var(--grpj-white); border:1px solid var(--grpj-border);
  border-radius:var(--grpj-radius-md); padding:12px; box-shadow:var(--grpj-shadow-sm);
}
.grpj-rail-track{ display:flex; gap:10px; overflow-x:auto; flex:1; padding-bottom:2px; scroll-behavior:smooth; }
.grpj-rail-track::-webkit-scrollbar{ height:6px; }
.grpj-rail-track::-webkit-scrollbar-thumb{ background:var(--grpj-border); border-radius:999px; }

.grpj-rail-item{
  position:relative; flex-shrink:0; width:72px; height:72px; border-radius:var(--grpj-radius-sm);
  border:2.5px solid transparent; padding:0; cursor:pointer; overflow:hidden;
  background:
    linear-gradient(45deg,#eef1f6 25%,transparent 25%),linear-gradient(-45deg,#eef1f6 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#eef1f6 75%),linear-gradient(-45deg,transparent 75%,#eef1f6 75%);
  background-size:14px 14px; background-position:0 0,0 7px,7px -7px,-7px 0; background-color:#fafbfc;
  transition:border-color .18s ease, transform .18s var(--grpj-ease);
}
.grpj-rail-item:hover{ transform:translateY(-2px); }
.grpj-rail-item.is-active{ border-color:var(--grpj-blue); box-shadow:0 0 0 3px var(--grpj-blue-tint); }
.grpj-rail-item canvas{ width:100%; height:100%; object-fit:contain; }
.grpj-rail-alpha{
  position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:rgba(11,37,69,.75);
}
.grpj-rail-alpha::before{ content:""; position:absolute; inset:5px; border:1.5px solid #fff; border-radius:2px; }

.grpj-rail-add{
  flex-shrink:0; width:52px; height:52px; border-radius:var(--grpj-radius-sm); border:2px dashed var(--grpj-border);
  background:var(--grpj-bg); color:var(--grpj-blue); display:flex; align-items:center; justify-content:center; cursor:pointer;
  transition:border-color .18s ease, background .18s ease, transform .18s var(--grpj-ease);
}
.grpj-rail-add:hover{ border-color:var(--grpj-blue); background:var(--grpj-blue-tint); transform:translateY(-2px); }

/* ---------- right: controls ---------- */
.grpj-controls-col{ display:flex; flex-direction:column; gap:18px; }
.grpj-card{
  background:var(--grpj-white); border:1px solid var(--grpj-border); border-radius:var(--grpj-radius-lg);
  padding:22px 24px; box-shadow:var(--grpj-shadow-sm);
}
.grpj-card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:10px; }
.grpj-card h2{ font-size:16px; margin:0; }
.grpj-card-desc{ font-size:13px; color:var(--grpj-slate); margin:-6px 0 16px; }

.grpj-text-btn{
  display:inline-flex; align-items:center; gap:7px; background:var(--grpj-blue-tint); color:var(--grpj-blue-deep);
  border:none; border-radius:999px; height:36px; padding:0 15px; font-size:12.5px; font-weight:700; cursor:pointer;
  transition:background .18s ease, transform .18s var(--grpj-ease);
}
.grpj-text-btn:hover{ background:#DCE9FF; transform:translateY(-1px); }

.grpj-control-block label{
  display:flex; justify-content:space-between; align-items:center; font-size:13.5px; font-weight:700; color:var(--grpj-slate); margin-bottom:12px; gap:8px;
}
.grpj-val{ color:var(--grpj-orange-deep); font-weight:800; font-variant-numeric:tabular-nums; }

input[type="range"]{
  width:100%; -webkit-appearance:none; appearance:none; height:6px; border-radius:999px;
  background:linear-gradient(90deg,var(--grpj-blue) var(--grpj-fill,50%),var(--grpj-border) var(--grpj-fill,50%)); outline:none; cursor:pointer;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:20px; height:20px; border-radius:50%; background:#fff; border:3.5px solid var(--grpj-blue-deep);
  cursor:pointer; box-shadow:0 2px 8px rgba(11,37,69,.35); transition:transform .15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover{ transform:scale(1.12); }
input[type="range"]::-moz-range-thumb{ width:20px; height:20px; border-radius:50%; background:#fff; border:3.5px solid var(--grpj-blue-deep); cursor:pointer; }
input[type="range"]::-moz-range-track{ height:6px; border-radius:999px; background:var(--grpj-border); }

/* resize toggle row */
.grpj-toggle-row{
  display:flex; align-items:center; gap:11px; font-size:15px; font-weight:700; color:var(--grpj-ink); cursor:pointer; user-select:none;
}
.grpj-toggle-row input{ width:19px; height:19px; accent-color:var(--grpj-blue); cursor:pointer; flex-shrink:0; }
.grpj-resize-body{ margin-top:16px; padding-top:16px; border-top:1px solid var(--grpj-border); }
.grpj-resize-row{ display:flex; align-items:flex-end; gap:10px; }
.grpj-resize-field{ flex:1; min-width:0; }
.grpj-resize-field label{ display:block; font-size:12px; font-weight:700; color:var(--grpj-slate); margin-bottom:7px; }
.grpj-resize-field input{
  width:100%; height:var(--grpj-control-h); padding:0 14px; border:1px solid var(--grpj-border); border-radius:var(--grpj-radius-sm);
  font-size:14.5px; color:var(--grpj-ink); transition:border-color .15s ease;
}
.grpj-resize-field input:focus{ border-color:var(--grpj-blue); }
.grpj-lock-btn{
  flex-shrink:0; width:var(--grpj-control-h); height:var(--grpj-control-h); border-radius:var(--grpj-radius-sm);
  border:1px solid var(--grpj-border); background:var(--grpj-bg); color:var(--grpj-slate); display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:background .18s ease, color .18s ease, border-color .18s ease;
}
.grpj-lock-btn:hover{ border-color:var(--grpj-blue); color:var(--grpj-blue); }
.grpj-lock-btn.is-locked{ background:var(--grpj-blue-tint); border-color:var(--grpj-blue); color:var(--grpj-blue); }
.grpj-field-note{ display:block; font-size:11.5px; color:var(--grpj-slate); margin-top:10px; }

/* background fill */
.grpj-bg-row{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.grpj-swatch{
  width:40px; height:40px; border-radius:11px; border:2px solid var(--grpj-border); cursor:pointer; padding:0;
  transition:transform .18s var(--grpj-ease), border-color .18s ease, box-shadow .18s ease; position:relative;
  display:flex; align-items:center; justify-content:center; color:var(--grpj-slate); background:var(--grpj-white);
}
.grpj-swatch:hover{ transform:translateY(-2px); border-color:var(--grpj-blue); }
.grpj-swatch.is-active{ border-color:var(--grpj-blue); box-shadow:0 0 0 3px var(--grpj-blue-tint); }
.grpj-swatch-custom{ overflow:hidden; background:conic-gradient(from 90deg,#F97316,#2563EB,#16A34A,#F97316); border-color:transparent; }
.grpj-swatch-custom input[type="color"]{ opacity:0; width:100%; height:100%; cursor:pointer; border:none; padding:0; }
.grpj-swatch-image{ background:var(--grpj-bg); border-style:dashed; }
.grpj-swatch-image:hover{ background:var(--grpj-blue-tint); }
.grpj-swatch-image.is-active{ background:var(--grpj-white); border-style:solid; }
.grpj-bg-image-name{ margin:12px 0 0; font-size:12px; color:var(--grpj-slate); font-weight:600; }

/* stats + downloads */
.grpj-summary-stats{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:18px; }
.grpj-stat{ background:var(--grpj-bg); border-radius:var(--grpj-radius-sm); padding:14px 12px; text-align:center; }
.grpj-stat span{ display:block; font-size:11.5px; color:var(--grpj-slate); font-weight:600; margin-bottom:4px; }
.grpj-stat b{ font-size:18px; color:var(--grpj-blue-deep); font-variant-numeric:tabular-nums; }
.grpj-stat-highlight{ background:linear-gradient(135deg,var(--grpj-green-tint),#DFF7EA); }
.grpj-stat-highlight b{ color:var(--grpj-green); }

.grpj-summary-actions{ display:flex; flex-direction:column; gap:10px; margin-bottom:6px; }
.grpj-btn-block{ width:100%; justify-content:center; }

.grpj-clear-all{ display:block; width:100%; text-align:center; margin-top:14px; color:var(--grpj-slate); font-weight:600; }
.grpj-clear-all:hover{ color:#C81E3A; }

/* ---------- buttons (shared) ---------- */
.grpj-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight:700; font-size:14.5px;
  height:var(--grpj-control-h); padding:0 22px; border-radius:999px; border:none; cursor:pointer;
  transition:transform .18s var(--grpj-ease), box-shadow .18s var(--grpj-ease), background .18s ease, opacity .18s ease, color .18s ease;
  text-decoration:none;
}
.grpj-btn svg{ width:16px; height:16px; }
.grpj-btn:disabled{ opacity:.4; cursor:not-allowed; transform:none !important; box-shadow:none !important; }
.grpj-btn-primary{ background:linear-gradient(135deg,var(--grpj-orange),var(--grpj-orange-deep)); color:#fff; box-shadow:0 14px 26px -10px rgba(234,88,12,.5); }
.grpj-btn-primary:hover:not(:disabled){ transform:translateY(-2px); box-shadow:0 18px 32px -10px rgba(234,88,12,.55); color:#fff; }
.grpj-btn-ghost{ background:var(--grpj-white); color:var(--grpj-blue-deep); border:1.5px solid var(--grpj-border); }
.grpj-btn-ghost:hover:not(:disabled){ border-color:var(--grpj-blue); background:var(--grpj-blue-tint); color:var(--grpj-blue-deep); }

.grpj-spinner-btn{
  width:16px; height:16px; border-radius:50%; border:2.5px solid rgba(255,255,255,.4); border-top-color:#fff;
  animation:grpj-spin .7s linear infinite;
}
@keyframes grpj-spin{ to{ transform:rotate(360deg); } }
.grpj-progress{ height:5px; background:var(--grpj-border); border-radius:999px; margin-top:14px; overflow:hidden; }
.grpj-progress-bar{ height:100%; width:0%; background:linear-gradient(90deg,var(--grpj-blue),var(--grpj-orange)); transition:width .2s ease; }

.grpj-note{ text-align:center; font-size:12.5px; color:var(--grpj-slate); margin:4px 0 0; }

/* ---------- responsive ---------- */
@media (max-width:720px){
  .grpj-app{ padding:14px 10px; font-size:15.5px; }
  .grpj-dropzone{ padding:38px 22px; }
  .grpj-preview-stage{ min-height:260px; }
  .grpj-card{ padding:18px 18px; }
  .grpj-summary-stats{ grid-template-columns:repeat(2,1fr); }
  .grpj-resize-row{ flex-wrap:wrap; }
  .grpj-lock-btn{ order:3; margin:0 auto; }
}
@media (prefers-reduced-motion:reduce){
  .grpj-app *{ transition:none !important; animation:none !important; }
}
