/* LogoTrace UI — light, quiet chrome; symmetrical split panes */
:root {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e2e0d8;
  --line-strong: #cfcbc0;
  --accent: #1a1a1a;
  --accent-fg: #ffffff;
  --danger: #b42318;
  --ok: #1f7a4c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: none;
  margin: 0 auto;
  padding: 24px 24px 28px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.top {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--ink);
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* Two equal columns — same height, controls aligned to bottom */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
@media (max-width: 860px) {
  .app { max-height: none; height: auto; overflow: auto; }
  .grid { grid-template-columns: 1fr; min-height: 70vh; }
  h1 { font-size: 24px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* Drop zone fills panel; controls stay at bottom naturally via flex */
.drop {
  flex: 1;
  min-height: 0;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fafaf7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, background .15s;
  outline: none;
}
.drop:hover, .drop:focus-visible {
  border-color: var(--ink);
  background: #fff;
}
.drop.drag {
  border-color: var(--ink);
  border-style: solid;
  background: #fff;
}
.drop.has-file {
  border-style: solid;
  border-color: var(--line);
  background: #fff;
  cursor: default;
}
.drop-empty {
  text-align: center;
  padding: 24px;
  pointer-events: none;
}
.drop-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.drop-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: #fff;
  color: var(--ink);
}
.preview-in {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 16px;
}
.hidden { display: none !important; }

/* Controls: segmented colors + Clear + Vectorize in one row, status under */
.controls {
  flex-shrink: 0;
}
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.controls-row .seg {
  margin-right: auto; /* push Clear + Vectorize to the right */
}

.seg {
  display: inline-flex;
  background: #f0efe9;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  min-width: 44px;
}
.seg-btn:hover { background: rgba(0,0,0,.04); }
.seg-btn.active {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  font-weight: 650;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 9px;
  padding: 12px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: #fafaf7; border-color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn.primary:hover:not(:disabled) { background: #000; border-color: #000; }
.btn.muted-btn {
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
}
.btn.muted-btn:hover:not(:disabled) {
  background: #fafaf7;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}
.btn.tiny {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

#btn-run, #btn-download {
  padding: 11px 16px; /* match segmented height */
  font-size: 15px;
  font-weight: 600;
}

.status {
  margin: 4px 0 0;
  min-height: 1.25em;
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
}
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

/* Output side: preview fills; zoom/download in foot bar */
.out-empty,
.out-stage {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafaf7;
}
.out-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 15px;
}
.out-stage {
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  outline: none;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.out-stage.panning,
.out-stage:active {
  cursor: grabbing;
}
.out-stage:focus-visible {
  border-color: var(--ink);
}
#pdf-canvas {
  display: block;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
  border-radius: 2px;
  max-width: none;
  flex-shrink: 0;
}

.out-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.zoom-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0efe9;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
}
.zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}
