:root {
  color-scheme: light;
  --paper: #eef1f5;
  --panel: #fbfcfe;
  --ink: #14213d;
  --muted: #697386;
  --line: #d7dde7;
  --line-strong: #b8c2d1;
  --blue: #2f6fed;
  --blue-dark: #2256bf;
  --blue-soft: #e8efff;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(32, 47, 75, 0.12), 0 2px 8px rgba(32, 47, 75, 0.08);
  --display: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --utility: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
}

body {
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: rgba(47, 111, 237, 0.18);
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.4);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
}

.topbar {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
  padding: 14px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid rgba(184, 194, 209, 0.8);
  background: rgba(251, 252, 254, 0.92);
  backdrop-filter: blur(14px);
}

.brand,
.topbar-actions,
.brand-mark,
.field-row,
.section-heading,
.history-section,
.workspace-bar {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 6px;
  gap: 3px;
  border-radius: 11px;
  background: var(--ink);
  box-shadow: 0 5px 14px rgba(20, 33, 61, 0.24);
}

.brand-mark span {
  border: 1.5px solid rgba(255, 255, 255, 0.58);
  border-radius: 2px;
}

.brand-mark span:nth-child(4) {
  background: #78a3ff;
  border-color: #78a3ff;
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 9px;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-note span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25a56a;
  box-shadow: 0 0 0 3px rgba(37, 165, 106, 0.12);
}

.button,
.apply-button,
.paste-card,
.empty-state,
.segment,
.icon-text-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--line-strong);
  background: #f6f8fb;
}

.button-primary {
  background: var(--ink);
  color: white;
  box-shadow: 0 4px 10px rgba(20, 33, 61, 0.18);
}

.button-primary:hover:not(:disabled) {
  background: #23345a;
  transform: translateY(-1px);
}

.button:disabled,
.apply-button:disabled,
.icon-text-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.main-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 0;
}

.tool-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 20px 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
}

.tool-section {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.edit-section {
  padding-top: 22px;
}

.edit-section[aria-disabled="true"] > :not(.section-heading) {
  opacity: 0.46;
  pointer-events: none;
}

.section-heading {
  justify-content: space-between;
  min-height: 26px;
  margin-bottom: 11px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.step-label {
  font-family: var(--utility);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.text-button {
  min-height: 28px;
  padding: 0 5px;
  background: transparent;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 650;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.paste-card {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 13px;
  gap: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #f6f8fb;
  color: var(--ink);
  text-align: left;
}

.paste-card:hover,
.paste-card.is-dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.paste-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--blue-dark);
}

.paste-icon svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.paste-card strong,
.paste-card small {
  display: block;
}

.paste-card strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.paste-card small {
  color: var(--muted);
  font-size: 11px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-right: 3px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: white;
  color: #3d4960;
  font: 10px var(--utility);
}

.selection-readout {
  color: var(--muted);
  font: 10px var(--utility);
  font-variant-numeric: tabular-nums;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #edf0f5;
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.15);
}

.patch-mode-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
}

.mode-swatch {
  width: 13px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
}

.text-glyph {
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.arrange-glyph,
.blur-glyph,
.crop-glyph {
  width: 15px;
  color: currentColor;
  font: 700 15px/1 var(--utility);
  text-align: center;
}

.annotation-glyph {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  color: currentColor;
  font-size: 17px;
  font-weight: 750;
  line-height: 1;
}

.circle-glyph {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.arrow-glyph {
  transform: translateY(-1px);
}

.line-glyph::before {
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: rotate(-38deg);
}

.field-row {
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 10px;
}

.field-label,
.stacked-field > span,
.range-heading {
  color: #3d4960;
  font-size: 12px;
  font-weight: 600;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 114px;
  padding: 4px 8px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

input[type="color"] {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(20, 33, 61, 0.18);
  border-radius: 5px;
}

.color-control output {
  color: #4c5870;
  font: 10px var(--utility);
  text-transform: uppercase;
}

.pattern-field {
  display: grid;
  gap: 9px;
  margin: 3px 0 17px;
}

.pattern-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.pattern-button {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 50px;
  padding: 6px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.pattern-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.pattern-button.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
  box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.12);
}

.pattern-sample,
.recent-swatch {
  --sample-color: #111827;
  --sample-line: rgba(255, 255, 255, 0.3);
  background-color: var(--sample-color);
}

.pattern-sample {
  display: block;
  width: 100%;
  height: 18px;
  border: 1px solid rgba(20, 33, 61, 0.15);
  border-radius: 4px;
}

.pattern-diagonal,
.recent-swatch[data-patch-pattern="diagonal"] {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--sample-line) 6px 8px);
}

.pattern-hatch,
.recent-swatch[data-patch-pattern="hatch"] {
  background-image:
    repeating-linear-gradient(135deg, transparent 0 7px, var(--sample-line) 7px 8.5px),
    repeating-linear-gradient(45deg, transparent 0 7px, var(--sample-line) 7px 8.5px);
}

.text-options {
  padding-top: 3px;
}

.blur-options {
  padding-top: 3px;
}

.blur-style-field {
  display: grid;
  gap: 8px;
  margin: 3px 0 13px;
}

.blur-style-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.blur-style-button {
  min-height: 32px;
  font-size: 10px;
}

.blur-strength-field {
  margin: 4px 0 12px;
}

.text-style-field {
  display: grid;
  gap: 8px;
  margin: 3px 0 15px;
}

.text-style-control {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.text-style-button {
  min-height: 32px;
  font-size: 11px;
}

.text-style-button[data-text-style="normal"] {
  font-style: normal;
  font-weight: 400;
}

.text-style-button[data-text-style="bold"] {
  font-style: normal;
  font-weight: 700;
}

.text-style-button[data-text-style="italic"] {
  font-style: italic;
  font-weight: 400;
}

.stacked-field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.stacked-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 14px;
}

.stacked-field input::placeholder {
  color: #929bad;
}

.range-field {
  display: grid;
  gap: 8px;
  margin: 6px 0 18px;
}

.range-heading {
  display: flex;
  justify-content: space-between;
}

.range-heading output {
  color: var(--muted);
  font: 11px var(--utility);
  font-variant-numeric: tabular-nums;
}

.font-size-field {
  margin-bottom: 11px;
}

.font-size-field input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.annotation-options {
  padding-top: 2px;
}

.annotation-size-field {
  margin: 6px 0 10px;
}

.annotation-style-field {
  display: grid;
  gap: 8px;
  margin: 2px 0 11px;
}

.annotation-style-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.annotation-style-button {
  min-height: 32px;
  font-size: 10px;
}

.annotation-roughness-field {
  margin: 3px 0 12px;
}

.annotation-note {
  margin: -1px 0 16px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.apply-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--blue);
  color: white;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 5px 13px rgba(47, 111, 237, 0.25);
}

.apply-button:hover:not(:disabled) {
  background: var(--blue-dark);
}

.presentation-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.presentation-heading {
  margin-bottom: 4px;
}

.presentation-intro {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 32px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #dfe4eb;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.switch-track span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.24);
  transition: transform 150ms ease;
}

.switch-control input:checked + .switch-track {
  border-color: var(--blue);
  background: var(--blue);
}

.switch-control input:checked + .switch-track span {
  transform: translateX(14px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid rgba(47, 111, 237, 0.4);
  outline-offset: 2px;
}

.presentation-controls {
  display: grid;
  gap: 16px;
  padding-top: 17px;
}

.control-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-group legend {
  width: 100%;
  margin-bottom: 8px;
  padding: 0;
  color: #3d4960;
  font-size: 12px;
  font-weight: 600;
}

.ratio-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ratio-button {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: center;
  min-height: 45px;
  padding: 6px 8px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.ratio-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.ratio-button.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
  box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.1);
}

.ratio-button strong,
.ratio-button small {
  display: block;
}

.ratio-button strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
}

.ratio-button small {
  margin-top: 2px;
  font: 8px var(--utility);
  opacity: 0.72;
}

.ratio-shape {
  display: block;
  justify-self: center;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: rgba(47, 111, 237, 0.08);
}

.ratio-square { width: 18px; height: 18px; }
.ratio-portrait { width: 15px; height: 19px; }
.ratio-landscape { width: 22px; height: 13px; }
.ratio-story { width: 11px; height: 20px; }

.dimension-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.dimension-fields > span {
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.dimension-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
}

.dimension-fields input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: 11px var(--utility);
  font-variant-numeric: tabular-nums;
}

.match-ratio-control {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 44px;
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
  color: var(--ink);
  cursor: pointer;
}

.match-ratio-control:hover {
  border-color: var(--line-strong);
  background: #f2f5f9;
}

.match-ratio-control input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}

.match-ratio-control strong,
.match-ratio-control small {
  display: block;
}

.match-ratio-control strong {
  font-size: 10px;
}

.match-ratio-control small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.auto-text-size-control {
  margin: 0 0 18px;
}

.auto-text-size-control strong {
  font-size: 11px;
}

.custom-size-note {
  margin: 6px 0 0;
  color: var(--muted);
  font: 8px var(--utility);
}

.gradient-presets {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.gradient-button {
  position: relative;
  min-width: 0;
  height: 31px;
  padding: 0;
  border: 2px solid white;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
}

.gradient-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--line-strong), 0 4px 8px rgba(20, 33, 61, 0.12);
}

.gradient-button.is-active {
  box-shadow: 0 0 0 2px var(--blue), 0 4px 9px rgba(47, 111, 237, 0.22);
}

.gradient-button.is-active::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 6px;
  height: 6px;
  border: 2px solid white;
  border-radius: 50%;
  background: rgba(20, 33, 61, 0.45);
  transform: translate(-50%, -50%);
}

.gradient-dusk { background: linear-gradient(135deg, #5b4bdb, #b44ad7 52%, #f28b66); }
.gradient-tide { background: linear-gradient(135deg, #08b6d8, #2563eb 52%, #6336cc); }
.gradient-mango { background: linear-gradient(135deg, #ffd36e, #ff8a65 54%, #c45acb); }
.gradient-iris { background: linear-gradient(135deg, #363795, #8b5cf6 48%, #ec4899); }
.gradient-mint { background: linear-gradient(135deg, #b9fbc0, #39c6b0 50%, #157a87); }
.gradient-graphite { background: linear-gradient(135deg, #64748b, #26354b 55%, #0f172a); }
.gradient-transparent {
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: 10px 10px;
}

.presentation-range {
  margin: -2px 0 0;
}

.transparency-note {
  margin: -7px 0 2px;
  color: var(--muted);
  font: 8px/1.4 var(--utility);
}

.reflection-control {
  margin-top: -2px;
}

.layers-section {
  padding: 18px 0 15px;
  border-bottom: 1px solid var(--line);
}

.layers-heading {
  margin-bottom: 8px;
}

.layers-list {
  display: grid;
  gap: 5px;
}

.image-layer-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.image-layer-row:hover {
  border-color: var(--line);
  background: #f2f5f9;
}

.image-layer-row.is-active {
  border-color: rgba(47, 111, 237, 0.45);
  background: var(--blue-soft);
}

.image-layer-select {
  display: contents;
}

.image-layer-thumb {
  width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  object-fit: contain;
}

.image-layer-copy {
  min-width: 0;
  text-align: left;
}

.image-layer-copy strong,
.image-layer-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-layer-copy strong {
  font-size: 10px;
}

.image-layer-copy small {
  margin-top: 3px;
  color: var(--muted);
  font: 8px var(--utility);
}

.layer-actions {
  display: inline-flex;
  gap: 2px;
}

.layer-action {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 700 11px var(--utility);
  cursor: pointer;
}

.layer-action:hover:not(:disabled) {
  background: white;
  color: var(--ink);
}

.layer-action:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.image-history-section,
.recent-section {
  padding: 18px 0 15px;
  border-bottom: 1px solid var(--line);
}

.recent-heading {
  margin-bottom: 8px;
}

.collapsible-heading {
  margin-bottom: 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.collapsible-heading::-webkit-details-marker {
  display: none;
}

.collapsible-heading:hover .step-label {
  color: var(--blue-dark);
}

.collapse-chevron {
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  transition: transform 140ms ease;
}

.image-history-section[open] .collapse-chevron {
  transform: rotate(180deg);
}

.recent-images-body {
  padding-top: 9px;
}

.recent-images-clear {
  display: block;
  margin: 0 0 7px auto;
}

.recent-list {
  display: grid;
  gap: 5px;
}

.recent-empty {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.recent-images-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.recent-images-list .recent-empty {
  grid-column: 1 / -1;
}

.recent-image {
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.recent-swatch.is-annotation {
  background: #f8fafc;
  color: var(--annotation-color, #ef4444);
  font-family: var(--body);
  font-size: 23px;
  font-weight: 750;
  line-height: 1;
}

.recent-image:hover,
.recent-image:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.12), 0 5px 12px rgba(20, 33, 61, 0.09);
  transform: translateY(-1px);
}

.recent-image img {
  display: block;
  width: 100%;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: #e7ebf1;
  object-fit: contain;
}

.recent-image:disabled {
  cursor: progress;
  opacity: 0.62;
}

.recent-image-copy {
  display: block;
  min-width: 0;
  padding: 7px 8px 8px;
}

.recent-image-copy strong,
.recent-image-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-image-copy strong {
  font-size: 10px;
  font-weight: 700;
}

.recent-image-copy small {
  margin-top: 3px;
  color: var(--muted);
  font: 8px var(--utility);
}

.recent-preset {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 5px 7px 5px 5px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.recent-preset:hover,
.recent-preset:focus-visible {
  border-color: var(--line);
  background: #f2f5f9;
}

.recent-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 30px;
  border: 1px solid rgba(20, 33, 61, 0.14);
  border-radius: 6px;
  color: var(--sample-text, white);
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
}

.recent-copy {
  min-width: 0;
}

.recent-copy strong,
.recent-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-copy strong {
  font-size: 11px;
  font-weight: 700;
}

.recent-copy small {
  margin-top: 3px;
  color: var(--muted);
  font: 9px var(--utility);
}

.recent-arrow {
  color: #8b96a9;
  font-size: 14px;
}

.history-section {
  gap: 4px;
  margin-top: auto;
  padding-top: 16px;
}

.icon-text-button {
  min-height: 34px;
  padding: 0 8px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.icon-text-button:hover:not(:disabled) {
  background: #edf0f5;
  color: var(--ink);
}

#clearSelectionButton {
  margin-left: auto;
}

.version-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 8px 0;
  color: #8b96a9;
  font: 8px var(--utility);
  letter-spacing: 0.04em;
}

.creator-credit {
  text-align: right;
  white-space: nowrap;
}

.creator-credit a {
  color: #52617a;
  font-weight: 700;
  text-decoration: none;
}

.creator-credit a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.creator-credit a:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.workspace {
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 0 clamp(14px, 2.2vw, 28px) clamp(14px, 2.2vw, 28px);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(20, 33, 61, 0.09) 0.65px, transparent 0.65px);
  background-size: 16px 16px;
}

.workspace-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  color: var(--muted);
  font: 10px var(--utility);
}

.workspace-bar p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tip {
  text-align: right;
}

.view-controls {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  padding: 2px;
  gap: 2px;
  border: 1px solid rgba(184, 194, 209, 0.9);
  border-radius: 8px;
  background: rgba(251, 252, 254, 0.82);
  box-shadow: 0 2px 7px rgba(32, 47, 75, 0.07);
}

.view-button {
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #4c5870;
  font: 700 11px var(--body);
  cursor: pointer;
}

.view-button:hover:not(:disabled) {
  background: #e8edf5;
  color: var(--ink);
}

.view-button.is-active {
  background: var(--ink);
  color: white;
}

.view-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.view-word-button {
  min-width: 34px;
  font-size: 9px;
}

.zoom-value {
  width: 40px;
  color: var(--muted);
  font: 9px var(--utility);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  border: 1px solid rgba(184, 194, 209, 0.78);
  border-radius: 14px;
  background: #dfe4eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
  overflow: hidden;
}

.canvas-wrap.is-dragging {
  border-color: var(--blue);
  background: #dce5f7;
}

.canvas-wrap.is-pan-mode,
.canvas-wrap.is-pan-mode #editorCanvas {
  cursor: grab;
}

.canvas-wrap.is-panning,
.canvas-wrap.is-panning #editorCanvas {
  cursor: grabbing;
}

.frame-preview {
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  transform-origin: center;
}

.canvas-wrap:not(.is-panning) .frame-preview {
  transition: transform 150ms ease;
}

.frame-preview:not(.is-framed) {
  width: 100%;
  height: 100%;
}

.frame-preview.is-framed {
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(32, 47, 75, 0.18);
  overflow: hidden;
}

.frame-preview.is-framed.shows-transparency {
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.frame-preview.is-framed #editorCanvas {
  background: transparent;
  box-shadow: none;
}

.frame-preview.is-framed.is-zero-padding #editorCanvas {
  box-shadow: none;
}

.empty-state {
  display: grid;
  justify-items: center;
  max-width: 360px;
  padding: 26px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  margin: 18px 0 7px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: -0.02em;
}

.empty-state > span:last-child {
  font-size: 13px;
  line-height: 1.55;
}

.empty-visual {
  display: grid;
  place-items: center;
  width: 162px;
  height: 104px;
  border: 1px solid #bec7d4;
  border-radius: 10px;
  background: linear-gradient(145deg, #f5f7fa 0 58%, #d8dfe8 58% 68%, #ecf0f5 68%);
  box-shadow: 0 12px 28px rgba(36, 48, 73, 0.13);
}

.selection-box {
  position: relative;
  width: 78px;
  height: 36px;
  border: 2px solid var(--blue);
  background: rgba(47, 111, 237, 0.12);
}

.selection-box i {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid white;
  background: var(--blue);
}

.selection-box i:nth-child(1) { top: -4px; left: -4px; }
.selection-box i:nth-child(2) { top: -4px; right: -4px; }
.selection-box i:nth-child(3) { right: -4px; bottom: -4px; }
.selection-box i:nth-child(4) { bottom: -4px; left: -4px; }

#editorCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #d7dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d7dee8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d7dee8 75%),
    linear-gradient(-45deg, transparent 75%, #d7dee8 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  box-shadow: var(--shadow);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

#editorCanvas.is-selecting {
  cursor: crosshair;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: min(90vw, 420px);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(20, 33, 61, 0.96);
  color: white;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(20, 33, 61, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    min-height: 66px;
  }

  .brand p,
  .privacy-note {
    display: none;
  }

  .main-layout {
    display: flex;
    flex-direction: column-reverse;
  }

  .workspace {
    grid-template-rows: 34px minmax(380px, 54dvh);
    padding-bottom: 12px;
  }

  .canvas-wrap {
    padding: 12px;
  }

  .tool-panel {
    border-top: 1px solid var(--line);
    border-right: 0;
    overflow: visible;
  }

  .history-section {
    margin-top: 0;
  }
}

@media (max-width: 460px) {
  .topbar {
    padding-inline: 14px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .button {
    min-height: 44px;
    padding-inline: 13px;
  }

  .workspace-tip {
    display: none;
  }

  .workspace-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .view-controls {
    justify-self: end;
  }

  .stacked-field input {
    font-size: 16px;
  }

  .dimension-fields input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
