:root {
  --bg: #0f172a;
  --panel: #111827;
  --line: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #22c55e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #020617, #0f172a);
  color: var(--text);
}
.wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
}
.panel {
  background: rgba(17,24,39,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.sticky { position: sticky; top: 20px; align-self: start; }
.sub, .hint { color: var(--muted); }
.form, fieldset { display: grid; gap: 16px; }
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
label span, legend { display:block; margin-bottom:6px; font-size:14px; color: var(--muted); }
input[type="number"], input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1220;
  color: var(--text);
  padding: 12px 14px;
}
.filebox {
  display:block;
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed #475569;
  background: rgba(15,23,42,.7);
}
.check { display:flex; align-items:center; gap:8px; }
.check input { width:auto; }
button, .download {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 14px 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #052e16;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
button:disabled { opacity:.7; cursor: progress; }
.error {
  background:#7f1d1d;
  color:#fecaca;
  padding:12px 14px;
  border-radius:12px;
  margin-bottom: 12px;
}
.resultHead { display:flex; justify-content:space-between; gap:16px; align-items:center; }
.resultsGrid {
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.resultCard {
  border:1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(2,6,23,.55);
}
.cardTop {
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  margin-bottom: 12px;
}
.result img {
  width: 100%;
  height: auto;
  display:block;
  border-radius: 14px;
  background:#dbeef0;
}
pre {
  overflow:auto;
  background:#020617;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color:#cbd5e1;
  white-space: pre-wrap;
}
.empty {
  margin-top: 16px;
  padding: 24px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  color: var(--muted);
}
.loading[hidden] { display:none; }
.loading {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.72);
  backdrop-filter: blur(4px);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9999;
}
.loadingBox {
  width: min(92vw, 460px);
  background: #0f172a;
  border:1px solid #334155;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.bar {
  width:100%;
  height: 14px;
  border-radius: 999px;
  overflow:hidden;
  background:#1e293b;
  border:1px solid #334155;
  margin: 14px 0 10px;
}
.fill {
  height:100%;
  width:0%;
  background: linear-gradient(90deg, #22c55e, #86efac);
  transition: width .25s ease;
}
summary { cursor:pointer; color: var(--muted); margin-top: 10px; }
@media (max-width: 960px) {
  .wrap { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
