/* Redact — dark theme. Colours live in the variables below; tweak to restyle. */
:root {
  --bg: #0d1017;
  --panel: #151a23;
  --panel-2: #1c2330;
  --border: #2a3342;
  --text: #e6e9ef;
  --muted: #8b95a7;
  --accent: #5b8cff;
  --accent-2: #3d6df0;
  --danger: #ff5c6c;
  --ok: #3ecf8e;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: .3px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: #111827; border: 1px solid var(--border);
  display: grid; align-content: center; gap: 3px; padding: 0 5px; }
.logo i { display: block; height: 5px; background: #fff; }
.logo i + i { width: 70%; background: var(--accent); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 8px 14px; border-radius: 8px; }
.tabs button:hover { color: var(--text); background: var(--panel-2); }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--panel-2); border-color: var(--border); }
.privacy { margin-left: auto; color: var(--muted); font-size: 13px; }

main { flex: 1; padding: 18px; width: 100%; max-width: 1400px; margin: 0 auto; }

/* ---------- controls ---------- */
button, select, input[type=range] { font: inherit; font-size: 14px; }
button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: #3a4558; background: #222b3a; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent-2); border-color: var(--accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent); }
button.ghost { background: transparent; }
select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
input[type=range] { accent-color: var(--accent); width: 120px; vertical-align: middle; }
label { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
kbd { background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- drop zone ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: 16px; background: var(--panel);
  min-height: 52vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #17203a; }
.dropzone h2 { margin: 10px 0 6px; font-size: 22px; }
.dropzone p { color: var(--muted); margin: 0; }
.dz-icon { font-size: 46px; }

/* ---------- workspace ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px;
}
.group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.group.end { margin-left: auto; }
.seg button.on { background: var(--accent-2); border-color: var(--accent); }
.pill { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 2px; }

.stage {
  background: repeating-conic-gradient(#121722 0 25%, #0f141d 0 50%) 0 0 / 22px 22px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; justify-content: center; align-items: flex-start; overflow: auto;
}
.stage canvas {
  max-width: 100%; max-height: calc(100vh - 230px); /* canvas keeps its aspect ratio */
  box-shadow: 0 4px 30px rgba(0,0,0,.5); background: #fff; cursor: crosshair; outline: none;
}

.status { min-height: 22px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.status[data-kind="busy"] { color: var(--accent); }
.status[data-kind="busy"]::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px;
  border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.status[data-kind="ok"] { color: var(--ok); }
.status[data-kind="error"] { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

.progress { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- guide ---------- */
.guide { max-width: 1100px; margin: 0 auto; }
.guide .lead { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.cards article { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px 14px; }
.cards li { margin: 6px 0; line-height: 1.45; }
.note { color: var(--muted); font-size: 13px; border-left: 3px solid var(--accent); padding-left: 10px; }
.guide ul li { margin: 6px 0; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .privacy { display: none; }
  .tabs { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .tabs button { padding: 6px 4px; font-size: 12px; white-space: normal; line-height: 1.2; }
  main { padding: 10px; }
  .toolbar { gap: 8px; }
  .group.end { margin-left: 0; }
  .stage { padding: 6px; }
  .stage canvas { max-height: 70vh; }
  .dropzone { min-height: 40vh; }
}
