:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --stage: #f5f5f7;
  --stage-rgb: 245, 245, 247; /* canvas background used by app.js */
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --hairline: rgba(0, 0, 0, 0.08);
  --fill: rgba(0, 0, 0, 0.05);
  --fill-hover: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.08);
  --bar: rgba(251, 251, 253, 0.72);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --stage: #1c1c1e;
    --stage-rgb: 28, 28, 30;
    --text: #f5f5f7;
    --secondary: #a1a1a6;
    --hairline: rgba(255, 255, 255, 0.1);
    --fill: rgba(255, 255, 255, 0.08);
    --fill-hover: rgba(255, 255, 255, 0.14);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 28px rgba(0, 0, 0, 0.5);
    --bar: rgba(22, 22, 23, 0.72);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

/* Translucent nav bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 980px;
  background: var(--fill);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s, opacity .2s, transform .1s;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--fill-hover); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .35; cursor: default; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }

.status {
  min-height: 20px;
  margin: 12px 0 64px;
  text-align: center;
  color: var(--secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Image grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 28px;
}

.card { margin: 0; min-width: 0; }

.frame {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: var(--stage);
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}

canvas { display: block; width: 100%; height: auto; }

figcaption {
  margin-top: 14px;
  text-align: center;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 500;
}

/* Empty state / drop zone */
.empty {
  position: absolute;
  inset: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed var(--hairline);
  border-radius: 14px;
  color: var(--secondary);
  cursor: pointer;
  transition: border-color .2s, color .2s, background-color .2s;
}
.empty svg { width: 36px; height: 36px; margin-bottom: 6px; }
.empty span { color: var(--text); font-size: 15px; font-weight: 500; }
.empty small { font-size: 13px; }
.empty:hover, #drop.dragging .empty {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
#drop.dragging .frame { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; gap: 24px; }
}
