:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b36;
  --ink: #e6e9ef;
  --dim: #99a1b3;
  --accent: #5b9dff;
  --danger: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

header, main, footer { max-width: 900px; margin: 0 auto; }

header { padding: 2rem 0 1rem; }
h1 { margin: 0; font-size: 1.9rem; letter-spacing: -0.02em; }
h2 { margin: 0 0 .35rem; font-size: 1.05rem; font-weight: 600; }
.tag { margin: .25rem 0 0; color: var(--dim); }

.step {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.step.active { display: block; }

.hint { color: var(--dim); font-size: .9rem; margin: .3rem 0 .9rem; }

.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .8rem; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #1e2330;
  color: var(--ink);
  padding: .6rem 1rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
}
.btn:hover { border-color: #38405275; background: #232939; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #07101f; font-weight: 600; }
.btn.danger { border-color: #4a2a2a; color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.check {
  display: inline-flex; align-items: center; gap: .5rem;
  margin-top: .8rem; font-size: .9rem; color: var(--dim); cursor: pointer;
}
.check input { accent-color: var(--accent); width: 1rem; height: 1rem; }

.field { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--dim); }
.field input, .field select {
  font: inherit; background: #1e2330; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: .4rem;
}
#scrub { min-width: 220px; }

#cropwrap { position: relative; display: inline-block; max-width: 100%; touch-action: none; }
#poster { display: block; max-width: 100%; height: auto; border-radius: 8px; background: #000; }

#croprect {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(8, 10, 14, .62);
  cursor: move;
}
#croprect .h { position: absolute; background: var(--accent); }
#croprect .n, #croprect .s { left: 20%; width: 60%; height: 8px; margin-top: -4px; cursor: ns-resize; border-radius: 4px; }
#croprect .n { top: 0; }
#croprect .s { top: 100%; }
#croprect .w, #croprect .e { top: 20%; height: 60%; width: 8px; margin-left: -4px; cursor: ew-resize; border-radius: 4px; }
#croprect .w { left: 0; }
#croprect .e { left: 100%; }

.bar { height: 10px; background: #10131a; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
#barfill { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }

#preview { margin-top: 1rem; max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
#preview img { display: block; width: 100%; }

.err { color: var(--danger); background: #2a1a1e; border: 1px solid #4a2a2a; padding: .8rem 1rem; border-radius: var(--radius); }

footer { color: var(--dim); font-size: .85rem; padding-top: 1rem; }
footer a { color: var(--accent); }

.wip {
  max-width: 900px;
  margin: 0 auto 1rem;
  background: #2a2417;
  border: 1px solid #4a3f22;
  border-left: 3px solid #d9a441;
  color: #e8dcc0;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.5;
}
.wip strong { color: #f0c96b; }
