:root {
  --bg: #0b0b0c;
  --panel: #17171a;
  --panel-2: #1f1f24;
  --text: #f1f1f3;
  --text-dim: #9a9aa3;
  --accent: #4f8cff;
  --border: #2a2a30;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
.status { font-size: 12px; color: var(--text-dim); }

.main { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 18px; }

.picker-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; border: 2px dashed var(--border); border-radius: 14px;
  padding: 32px 16px; cursor: pointer; background: var(--panel);
  color: var(--text); font-family: inherit; width: 100%;
  transition: border-color .15s; }
.file-input-hidden { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }
.picker-btn:active { border-color: var(--accent); }
.picker-btn span { font-size: 15px; font-weight: 500; }
.picker-btn small { color: var(--text-dim); font-size: 12px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: var(--panel-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ev { position: absolute; left: 4px; bottom: 4px; padding: 2px 6px;
  font-size: 10px; background: rgba(0,0,0,.6); border-radius: 4px; }
.thumb .rm { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(0,0,0,.6); display: grid; place-items: center;
  font-size: 14px; cursor: pointer; }

.controls { background: var(--panel); border-radius: 14px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px; }
.control-row { display: flex; align-items: center; gap: 10px; }
.control-row label { flex: 0 0 70px; font-size: 13px; color: var(--text-dim); }
.control-row select, .control-row input[type="range"] { flex: 1; }
.control-row span.value { flex: 0 0 36px; text-align: right; font-size: 13px; color: var(--text-dim); }
.control-row > span:not(.value) { flex: 1; line-height: 1.5; }

select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; }

button { font-size: 15px; padding: 12px 16px; border-radius: 10px; border: none;
  background: var(--panel-2); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; border: 1px solid var(--border); }
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: not-allowed; }

.result { background: var(--panel); border-radius: 14px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px; }
.result canvas { width: 100%; height: auto; max-height: 60vh; object-fit: contain;
  background: #000; border-radius: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { flex: 1; min-width: 100px; }

.progress { font-size: 13px; color: var(--text-dim); min-height: 18px; }

.footer { padding: 16px; text-align: center; color: var(--text-dim); font-size: 11px;
  border-top: 1px solid var(--border); }

@media (min-width: 768px) {
  .main { max-width: 720px; margin: 0 auto; width: 100%; }
}
