@font-face {
  font-family: "Graphik";
  src: url("/graphik-regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Graphik";
  src: url("/graphik-semibold.otf") format("opentype");
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
}
/* Pixa design tokens. Canvas selection reads --accent from this same source. */
:root {
  font-family: "Graphik", sans-serif;
  color: #24283d;
  background: #f7f8fc;
  --accent: #5869d3;
  --accent-hover: #4859bf;
  --accent-soft: #eef0fc;
  --canvas-bg: #5869d326;
  --surface: #fff;
  --line: #e0e3ee;
  --muted: #686e83;
  --radius: 12px;
  --control-radius: 8px;
  --shadow: 0 2px 8px #24283d04;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select,
input[type="number"],
textarea,
input[type="color"] {
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: inherit;
}
button {
  min-height: 42px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition:
    background-color 120ms,
    border-color 120ms,
    color 120ms;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
:where(button, input, select, textarea, summary, a, canvas):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.primary,
.tools > button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.primary:hover:not(:disabled),
.tools > button[aria-pressed="true"]:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.text {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}
button.danger {
  color: #b13748;
}
button.danger:hover:not(:disabled) {
  background: #fff1f2;
  border-color: #b13748;
}
.button-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: -3px;
  margin-right: 6px;
}
p {
  line-height: 1.5;
}
h1 {
  font-size: clamp(24px, 2.3vw, 32px);
  line-height: 1.16;
  letter-spacing: -0.8px;
  margin: 0 0 10px;
}
.note,
small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.note {
  margin: 12px 0 0;
}
small {
  display: block;
  margin-top: 22px;
}
/* Workspace: only the document scrolls past the settings to the footer. */
main {
  max-width: 1680px;
  min-height: 100dvh;
  margin: auto;
  padding: 28px 32px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 24px;
  align-items: start;
}
.workspace {
  min-width: 0;
  position: sticky;
  top: 28px;
  height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
}
.workbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
#filename {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#newFile {
  flex-shrink: 0;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tools > button {
  border-color: transparent;
}
.tool-navigation {
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.history {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.tool-navigation .history {
  margin-left: 0;
}
.history button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 8px 10px;
  border-color: transparent;
  color: var(--muted);
  font-size: 13px;
}
.tool-zoom {
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tool-zoom button {
  min-width: 36px;
  padding: 8px 10px;
}
.tool-zoom output {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.viewbar {
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 5px 2px;
}
#canvasSize {
  margin: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.board {
  min-height: 0;
  flex: 1;
  border: 1px solid #5869d31a;
  border-radius: 16px;
  padding: 28px;
  background: var(--canvas-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.board.zoomed {
  display: block;
  overflow: auto;
}
.board.dragging {
  outline: 3px dashed var(--accent);
  outline-offset: -6px;
  background: var(--accent-soft);
}
#empty {
  text-align: center;
  padding: 20px 0;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: auto;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid #5869d326;
  border-radius: 18px;
}
.empty-icon svg {
  width: 32px;
  height: 32px;
}
#empty h2 {
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.6px;
  max-width: 360px;
  margin: 22px auto 12px;
}
#empty p {
  color: var(--muted);
  font-size: 14px;
}
kbd {
  font: inherit;
  font-size: 12px;
  padding: 3px 6px;
  background: #ffffffb3;
  border: 1px solid #5869d326;
  border-radius: 5px;
}
#empty button {
  display: block;
  margin: 10px auto;
  padding: 12px 20px;
}
canvas {
  display: block;
  max-width: none;
  max-height: none;
  flex-shrink: 0;
  object-fit: contain;
  touch-action: none;
  cursor: crosshair;
  background: #fff;
  box-shadow: 0 4px 20px #24283d18;
}
body[data-tool="caption"] #canvas {
  cursor: default;
}
body #canvas.over-object {
  cursor: move;
}
.caption-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 14px;
}
.caption-presets button {
  padding: 7px 3px;
  font-size: 11px;
  min-width: 0;
}
.caption-presets svg {
  display: block;
  width: 100%;
  height: 38px;
}
.caption-presets [aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
#captionActions {
  flex-wrap: wrap;
}
#captionActions button {
  flex: 1 1 100px;
}
#redactionReview {
  margin-top: 12px;
}
#redactionReview button {
  margin: 0 4px 8px 0;
}
.below {
  color: var(--muted);
  font-size: 13px;
  min-height: 46px;
}
#hint {
  margin: 12px 2px 0;
}
/* Shared cards and controls. All tool panels use the same component rules. */
aside {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.4px;
  margin: 0 0 18px;
}
label {
  display: block;
  font-size: 13px;
  margin: 16px 0 7px;
  line-height: 1.45;
}
label + select,
label + input[type="number"] {
  margin-top: 0;
}
select,
input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  margin-top: 7px;
  font-size: 14px;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
}
textarea::placeholder {
  color: var(--muted);
}
input[type="range"] {
  display: block;
  width: 100%;
  accent-color: var(--accent);
  margin: 12px 0 0;
  cursor: pointer;
}
input:disabled {
  cursor: default;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
}
.check input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--accent);
}
output {
  float: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.fieldgrid,
.caption-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.fieldgrid > label,
.caption-grid > label {
  min-width: 0;
}
.fieldgrid input {
  min-width: 0;
}
.action-row,
.caption-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.action-row button,
.caption-actions button {
  flex: 1;
}
summary {
  cursor: pointer;
  font-size: 13px;
  padding: 12px 0;
  color: var(--muted);
}
summary:hover {
  color: var(--accent);
}
details {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.caption-details {
  margin-top: 12px;
}
#captionOptions > .note {
  margin-top: 0;
}
#addCaption {
  margin-top: 12px;
  width: 100%;
}
#applyCrop {
  margin-top: 16px;
}
#applyCrop,
#resetCrop {
  display: block;
}
#resetCrop {
  margin-top: 10px;
}
.crop-margins {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
#regions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#regions:empty {
  display: none;
}
#regions button {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
  background: #f7f8fc;
  font-size: 13px;
}
#regions button[aria-pressed="true"] {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-color: var(--accent);
}
/* Export remains one card: dimensions, preview, and both download sizes. */
.export button {
  width: 100%;
  margin-bottom: 8px;
}
.size-control {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}
.size-control output {
  float: none;
  font-size: 12px;
}
#resetSize {
  margin: 8px 0 16px;
  font-size: 12px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}
.final-download {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
#exportFilename {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 14px;
  margin-bottom: 12px;
}
#exportFilename::placeholder {
  color: var(--muted);
}
#dimensions {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f7f8fc;
  border-radius: var(--control-radius);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
#restoreProject {
  margin-top: 12px;
}
/* Footer and preview. */
.site-footer {
  max-width: 1616px;
  margin: auto;
  padding: 24px 32px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #24283d;
  text-decoration: none;
}
.brand-meta {
  font-size: 13px;
  color: var(--muted);
}
.site-footer .note {
  margin: 0;
}
dialog {
  width: min(1000px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  color: #24283d;
  box-shadow: 0 24px 80px #24283d33;
}
dialog::backdrop {
  background: #20243d80;
}
.dialoghead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dialoghead h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.5px;
}
.preview-scroll {
  max-height: 65dvh;
  overflow: auto;
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--control-radius);
  background: var(--canvas-bg);
}
#previewCanvas {
  cursor: default;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #24283d;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--control-radius);
  max-width: 90%;
  font-size: 14px;
  line-height: 1.5;
  z-index: 10;
  box-shadow: 0 4px 20px #24283d26;
}
/* Responsive layout, kept together to avoid competing overrides. */
@media (max-width: 1200px) {
  main {
    padding: 24px;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 296px;
  }
  .workspace {
    top: 24px;
    height: calc(100dvh - 48px);
  }
  .tools .button-icon {
    display: none;
  }
  .site-footer {
    padding: 24px;
  }
}
@media (max-width: 1000px) {
  main {
    display: block;
  }
  .workspace {
    position: static;
    height: auto;
  }
  .board {
    height: min(60dvh, 600px);
    min-height: 380px;
    flex: auto;
  }
  aside {
    margin-top: 24px;
  }
}
@media (max-width: 740px) {
  main {
    display: block;
    padding: 20px 16px;
  }
  .workspace {
    position: static;
    height: auto;
  }
  .workbar {
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
  }
  h1 {
    font-size: 27px;
  }
  #newFile {
    min-height: 40px;
  }
  .tools {
    gap: 4px;
    padding: 6px;
  }
  .tools > button {
    flex: 1 1 calc(50% - 4px);
    font-size: 13px;
    padding: 10px 8px;
  }
  .tool-navigation {
    flex-basis: 100%;
  }
  .tool-zoom {
    width: auto;
    margin-top: 0;
  }
  .tool-zoom #zoomFit {
    margin-left: auto;
  }
  .history {
    margin-left: auto;
  }
  .board {
    height: 380px;
    min-height: 380px;
    flex: auto;
    padding: 16px;
  }
  #empty h2 {
    font-size: 24px;
  }
  aside {
    margin-top: 20px;
  }
  select,
  input[type="number"],
  textarea,
  .tool-zoom select {
    font-size: 16px;
  }
  .panel {
    padding: 20px;
  }
  .site-footer {
    padding: 22px 16px;
  }
  .site-footer .note {
    width: 100%;
  }
  dialog {
    padding: 18px;
  }
  .dialoghead h2 {
    font-size: 21px;
  }
}
@media (max-height: 650px) and (min-width: 1001px) {
  main {
    padding-top: 16px;
  }
  .workspace {
    top: 16px;
    height: calc(100dvh - 32px);
  }
  .workbar {
    margin-bottom: 10px;
  }
  h1 {
    font-size: 24px;
    margin-bottom: 6px;
  }
  #empty {
    padding: 8px 0;
  }
  .empty-icon {
    display: none;
  }
  #empty h2 {
    margin-top: 0;
  }
  #empty small {
    margin-top: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}

.optimize-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 12px;
  cursor: pointer;
}
.optimize-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
#exportStatus.processing::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #616ccc40;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: export-spin 1s linear infinite;
}
@keyframes export-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #exportStatus.processing::before {
    animation: none;
  }
}

.board.pan-ready,
.board.pan-ready #canvas {
  cursor: grab;
}
.board.panning,
.board.panning #canvas {
  cursor: grabbing;
}
.help-link {
  color: var(--accent-hover);
  text-underline-offset: 4px;
  font-size: 14px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.help-page main {
  display: block;
  min-height: 0;
  max-width: 850px;
  padding: 48px 24px 64px;
}
.help-page h1 {
  margin-top: 28px;
  font-size: clamp(28px, 5vw, 42px);
}
.help-page h2 {
  margin: 36px 0 12px;
  font-size: 23px;
  letter-spacing: -0.4px;
}
.help-page p,
.help-page li {
  line-height: 1.65;
}
.help-page li + li {
  margin-top: 8px;
}
.help-page nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin: 24px 0;
}
.help-page a {
  color: var(--accent-hover);
  text-underline-offset: 4px;
}
.help-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.help-page th,
.help-page td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}
.help-page th:first-child {
  width: 45%;
}
.help-page kbd {
  font-family: inherit;
  font-size: 13px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  white-space: nowrap;
}
@media (max-width: 740px) {
  .help-page main {
    padding: 28px 16px 40px;
  }
  .help-page th,
  .help-page td {
    padding: 12px 5px;
  }
}

.brand-logo {
  display: block;
  width: 122px;
  height: 32px;
}
@media (max-width: 740px) {
  .site-footer .note {
    width: auto;
    flex: 1 1 100%;
    order: 0;
  }
  .site-footer .brand {
    flex: 1 1 100%;
  }
}
/* Native colour dialog, with a larger, keyboard-accessible swatch. */
input[type="color"] {
  display: block;
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
  height: 46px;
  padding: 6px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff, var(--accent-soft));
  box-shadow: inset 0 1px 2px #24283d06;
  transition:
    border-color 140ms,
    box-shadow 140ms;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: 1px solid #24283d26;
  border-radius: 7px;
}
input[type="color"]::-moz-color-swatch {
  border: 1px solid #24283d26;
  border-radius: 7px;
}
input[type="color"]:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="color"]:disabled {
  opacity: 0.45;
  cursor: default;
}
#exportStatus {
  padding: 10px;
  background: #f2f3fa;
  border-radius: 8px;
  margin: 12px 0 16px;
  line-height: 1.5;
}
#download,
#download1x {
  min-height: 46px;
}
button.saved,
button.saved:hover {
  background: #e7f5ee;
  border-color: #9dceb5;
  color: #236344;
  opacity: 1;
}
button.saved::before {
  content: "✓";
  margin-right: 8px;
}
@media (prefers-reduced-motion: no-preference) {
  button:active:not(:disabled) {
    transform: translateY(1px);
  }
  button.saved {
    animation: saved-feedback 180ms ease-out;
  }
  @keyframes saved-feedback {
    from {
      opacity: 0.65;
    }
    to {
      opacity: 1;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  button,
  input[type="color"] {
    transition: none;
  }
}
.caption-size {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
}
.caption-size output {
  white-space: nowrap;
}
.caption-size input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 4px 0 0;
}

.margin-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.margin-presets button {
  padding: 9px 6px;
  font-size: 12px;
}
.margin-presets [aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.size-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.size-presets button {
  padding: 9px 6px;
  font-size: 12px;
  margin: 0;
}
.size-presets [aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 380px) {
  .tool-zoom output {
    min-width: 32px;
  }
  .tool-zoom button {
    min-width: 32px;
    padding: 8px;
  }
  .history button {
    width: 36px;
    padding: 6px;
  }
  .tool-navigation {
    gap: 4px;
  }
  .panel {
    padding: 16px;
  }
  .help-page table {
    table-layout: fixed;
    overflow-wrap: anywhere;
  }
}
