/* The resizer tool: header, sidebar and the artboard of ad frames */

body.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 10px 20px;
  border-top: 3px solid var(--brand); /* thin brand band across the top */
  border-bottom: 1px solid var(--hairline);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.campaign {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-soft);
}

.campaign input {
  width: 220px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font: 14px var(--font-mono);
  color: var(--ink);
  background: var(--paper);
}

.campaign input:hover {
  border-color: var(--ink-soft);
}

.campaign select {
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
  font: 14px var(--font-sans);
  color: var(--ink);
}

/* ---------- Guided workflow ---------- */

/* Step bar above the previews; it stays in view while the previews scroll */
.stepper {
  position: sticky;
  top: -24px; /* the artboard's top padding */
  z-index: 5;
  margin: -24px -32px 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}

.stepper ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px 0 6px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
  font: 14px var(--font-sans);
  color: var(--ink-soft);
  cursor: pointer;
}

.step:hover {
  border-color: var(--brand-strong);
  color: var(--ink);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--artboard);
  font: 500 11px var(--font-mono);
  color: var(--ink-soft);
}

.step.is-done {
  border-color: var(--brand-tint);
  background: var(--brand-tint);
  color: var(--brand-deep);
}

.step.is-done .step-number,
.step.is-current .step-number {
  background: var(--brand-strong);
  color: var(--paper);
}

.step.is-current {
  border-color: var(--brand-strong);
  box-shadow: 0 0 0 2px var(--brand-tint);
  color: var(--ink);
  font-weight: 500;
}

.optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-soft);
}

/* "Next" prompt under the step bar */
.next-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: var(--paper);
}

.next-step-text {
  flex: 1 1 320px;
}

.next-step-title {
  font-size: 16px;
}

.next-step-text p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-soft);
}

.next-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Before anything is uploaded, the prompt is a big welcome and drop target */
.next-step.is-large {
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  border: 2px dashed #9fc9c2;
  border-radius: 12px;
  background: #f7fbfa;
  text-align: center;
}

.next-step.is-large .next-step-text {
  flex: none;
  max-width: 460px;
}

.next-step.is-large .next-step-title {
  font-size: 22px;
}

.next-step.is-finished {
  border-left-color: var(--brand-strong);
  background: var(--brand-tint);
}

/* Accordion sidebar: every step is a row with its number and title; only the
   open step shows its contents. */
.accordion {
  display: grid;
  margin-top: -12px;
  border-top: 1px solid var(--hairline);
}

.step-panel {
  border-bottom: 1px solid var(--hairline);
}

.step-panel .step-heading {
  margin: 0;
  font-size: 15px;
}

.step-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 0;
  border: 0;
  background: none;
  font: 500 15px var(--font-sans);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.step-toggle:hover .step-title {
  color: var(--brand-strong);
}

.step-title {
  flex: 1;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--artboard);
  font: 500 12px var(--font-mono);
  color: var(--ink-soft);
}

.step-panel.is-done .step-badge {
  background: var(--brand-tint);
  color: var(--brand-deep);
}

.step-panel.is-current .step-badge {
  background: var(--brand-strong);
  color: var(--paper);
}

.step-panel.is-open .step-title {
  color: var(--brand-strong);
}

/* A small arrow: pointing down when closed, up when open */
.chevron {
  flex: none;
  width: 8px;
  height: 8px;
  margin: 0 4px 4px 0;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.step-panel.is-open .chevron {
  margin-bottom: -4px;
  transform: rotate(-135deg);
}

.step-body {
  padding: 4px 0 20px;
}

.step-footer {
  margin-top: 18px;
}

/* Check sizes section */
.check-summary {
  margin: 0 0 10px;
  font-size: 14px;
}

.auto-adjust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 20px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: #fbfdfc;
}

.auto-adjust .setting-note {
  flex-basis: 100%;
  margin: 0;
}

.auto-adjust-message {
  flex-basis: 100%;
  margin: 0;
  font-size: 13px;
  color: var(--brand-strong);
}

.auto-adjust-message:empty {
  display: none;
}

/* Download section */
.download-all {
  width: 100%;
  margin-bottom: 12px;
}

/* "Unlock with Pro" on locked sizes */
.unlock-link {
  justify-self: start;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-strong);
}

/* Font, weight and alignment for the selected text line in Adjust */
.editor-text-style {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.editor-text-style .setting-note {
  grid-column: 1 / -1;
  margin: 0;
}

/* "Show me" briefly highlights the size that needs attention */
.tile.is-flashing {
  border-color: var(--caution);
  box-shadow: 0 0 0 3px rgba(154, 91, 0, 0.25);
}

@media (prefers-reduced-motion: no-preference) {
  .tile.is-flashing {
    animation: flash 0.8s ease-in-out 2;
  }
}

@keyframes flash {
  50% { box-shadow: 0 0 0 6px rgba(154, 91, 0, 0.12); }
}

/* Design bar at the top of the sidebar */
.design-bar {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
}

.design-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.design-head h2 {
  margin-bottom: 8px;
}

.save-state {
  font-size: 12px;
  color: var(--ink-soft);
}

.save-state.is-error {
  color: var(--caution);
}

.design-name {
  width: 100%;
  height: 36px;
  margin-bottom: 10px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font: 500 14px var(--font-sans);
  color: var(--ink);
}

.design-name:hover {
  border-color: var(--ink-soft);
}

.design-bar .source-actions {
  margin-top: 0;
}

/* Recent image thumbnails */
.recent {
  margin-top: 14px;
}

.recent h3 {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}

.recent-thumb {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: repeating-conic-gradient(var(--artboard) 0 25%, var(--paper) 0 50%) 0 0 / 10px 10px;
  cursor: pointer;
  overflow: hidden;
}

.recent-thumb:hover {
  border-color: var(--ink);
}

.recent-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The Open… window */
.designs-dialog .setting-note {
  margin-top: 6px;
}

.design-list {
  display: grid;
  gap: 0;
  max-height: 50vh;
  margin: 12px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.design-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}

.design-thumb {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--hairline);
  background: var(--artboard);
}

.design-info {
  display: grid;
  gap: 2px;
  align-content: start;
}

.design-label {
  font-size: 15px;
  font-weight: 500;
}

.design-updated {
  font-size: 12px;
  color: var(--ink-soft);
}

.design-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.design-confirm {
  font-size: 13px;
  color: var(--caution);
}

.btn.danger {
  border-color: var(--caution);
  color: var(--caution);
}

.designs-message {
  min-height: 1.4em;
  margin-top: 10px;
  font-size: 13px;
}

.design-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.design-files label:focus-within {
  outline: 2px solid var(--crop);
  outline-offset: 2px;
}

/* Export progress and results, above the grid */
.export-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.45;
}

.export-status.is-error {
  border-left-color: var(--caution);
  color: var(--caution);
}

.export-status span {
  flex: 1 1 320px;
}

.export-status progress {
  flex: 1 1 200px;
  height: 6px;
  accent-color: var(--ink);
}

.drive-tip {
  max-width: 240px;
  font-size: 12px;
}

.drive-tip a {
  color: var(--ink);
}

.campaign input::placeholder {
  color: #6b8286;
}

.app-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 0;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--hairline);
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  border: 1.5px dashed #9fc9c2;
  border-radius: 8px;
  background: #f7fbfa;
  text-align: center;
}

.dropzone.is-dragging {
  border-color: var(--crop);
  background: var(--brand-tint);
}

.dropzone .hint {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Keyboard focus lands on the hidden file input, so show it on the button */
.dropzone label:focus-within {
  outline: 2px solid var(--crop);
  outline-offset: 2px;
}

.status {
  min-height: 1.5em;
  margin-top: 12px;
  font-size: 14px;
}

/* The general message line under the Design bar takes no space when empty */
.sidebar > .status {
  min-height: 0;
  margin: -20px 0 0;
}

.sidebar > .status:empty {
  margin-top: -32px;
}

.status.is-error {
  color: var(--caution);
}

/* Focal point / Text area switch */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.mode-switch label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  font-size: 14px;
  cursor: pointer;
}

.mode-switch label + label {
  border-left: 1px solid var(--hairline);
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-switch label:has(input:checked) {
  background: var(--brand-strong);
  color: var(--paper);
  font-weight: 500;
}

.mode-switch label:has(input:focus-visible) {
  outline: 2px solid var(--crop);
  outline-offset: 2px;
}

/* Text areas: numbered dashed boxes, on the sidebar image and in the Adjust window */
.text-area-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.text-area {
  position: absolute;
  border: 2px dashed var(--crop);
  outline: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(10, 158, 142, 0.12);
}

.is-text-mode .text-area {
  pointer-events: auto;
  cursor: move;
}

.text-area.is-selected {
  border-style: solid;
  background: rgba(10, 158, 142, 0.2);
}

.text-area.is-excluded {
  border: 1px dotted var(--paper);
  outline-color: rgba(14, 42, 47, 0.4);
  background: none;
}

.text-area-number {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--brand-strong);
  color: var(--paper);
  font: 500 11px/16px var(--font-mono);
}

.text-area.is-excluded .text-area-number {
  background: var(--ink-soft);
}

/* Resize handles on the selected text area */
.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--crop);
  background: var(--paper);
  transform: translate(-50%, -50%);
}

.handle-nw { left: 0; top: 0; cursor: nwse-resize; }
.handle-n { left: 50%; top: 0; cursor: ns-resize; }
.handle-ne { left: 100%; top: 0; cursor: nesw-resize; }
.handle-e { left: 100%; top: 50%; cursor: ew-resize; }
.handle-se { left: 100%; top: 100%; cursor: nwse-resize; }
.handle-s { left: 50%; top: 100%; cursor: ns-resize; }
.handle-sw { left: 0; top: 100%; cursor: nesw-resize; }
.handle-w { left: 0; top: 50%; cursor: ew-resize; }

/* List of text areas under the image */
.text-area-panel {
  margin-top: 12px;
}

.text-area-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.text-area-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.area-select {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 500 13px var(--font-sans);
  cursor: pointer;
}

.text-area-list li.is-selected .area-select {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: var(--paper);
}

.area-size {
  font-size: 12px;
  color: var(--ink-soft);
}

.area-remove {
  margin-left: auto;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: 13px var(--font-sans);
  text-decoration: underline;
  cursor: pointer;
}

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

/* Text panel: one block of controls per text line */
.text-lines {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.text-line {
  padding: 10px 0 12px;
  border-top: 1px solid var(--hairline);
}

.text-line-head {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
}

.text-line-name {
  font-size: 14px;
  font-weight: 500;
}

.text-line textarea {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font: 14px/1.4 var(--font-sans);
  color: var(--ink);
  resize: vertical;
}

.text-line textarea:hover,
.text-line select:hover,
.text-line input:hover {
  border-color: var(--ink-soft);
}

.text-line-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 10px;
  margin-top: 8px;
}

.text-field {
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: var(--ink-soft);
}

.text-field select,
.text-field input {
  width: 100%;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
  font: 13px var(--font-sans);
  color: var(--ink);
}

.text-field input[type="color"] {
  padding: 2px;
  cursor: pointer;
}

/* The font menu gets the full width */
.text-field:first-child {
  grid-column: 1 / -1;
}

.text-position {
  margin: 16px 0 4px;
}

.position-options {
  display: flex;
  gap: 16px;
}

.tile.has-text-overflow .frame {
  outline: 2px solid var(--caution);
}

/* Text line boxes in the Adjust window */
.line-box-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.line-box {
  position: absolute;
  border: 1.5px dashed rgba(255, 255, 255, 0.9);
  outline: 1px dashed rgba(14, 42, 47, 0.6);
  pointer-events: auto;
  cursor: move;
}

.line-box.is-selected {
  border: 2px solid var(--crop);
  outline: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(10, 158, 142, 0.1);
}

.line-box:focus-visible {
  outline: 2px solid var(--crop);
  outline-offset: 3px;
}

/* Number tags sit just left of each box, so they never cover text */
.line-box .text-area-number {
  top: -2px;
  left: auto;
  right: calc(100% + 4px);
}

.line-box .handle {
  display: none;
}

.line-box.is-selected .handle {
  display: block;
}

/* "Image 1" labels sit inside the top-left of image boxes */
.image-box .image-number {
  top: 0;
  right: auto;
  left: 0;
}

/* Images panel in the sidebar */
.image-layers {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.image-layer {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}

/* Checkerboard behind thumbnails, so transparent areas are visible */
.image-layer-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--hairline);
  background: repeating-conic-gradient(var(--artboard) 0 25%, var(--paper) 0 50%) 0 0 / 12px 12px;
}

.image-layer-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.image-layer-file {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-layer-size {
  font-size: 12px;
  color: var(--ink-soft);
}

.image-tip {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--brand);
  border-radius: 0;
  background: var(--artboard);
  font-size: 13px;
  line-height: 1.45;
}

.image-tip strong {
  font-weight: 500;
}

.image-layer-note {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--caution);
}

.pinned-note {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--brand-strong);
}

.pinned-note .area-remove {
  margin-left: 2px;
  padding: 0;
  font-size: 12px;
}

.editor-applied {
  min-height: 0;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.editor-applied:empty {
  display: none;
}

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

.editor-text-size {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
}

.editor-text-size output {
  min-width: 56px;
  text-align: center;
  font-size: 13px;
}

.tag-text-adjusted {
  display: none;
  border-color: var(--brand-strong);
  color: var(--brand-strong);
}

.tile.is-text-adjusted .tag-text-adjusted {
  display: inline-flex;
}

/* "Keep in frame" checkboxes in the Adjust window */
.keep-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.keep-text legend {
  float: left;
  margin-right: 8px;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}

.keep-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.source-stage.is-text-mode .focal-marker {
  opacity: 0.35;
}

/* Uploaded image with its focal point */
.source-frame {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: var(--artboard);
}

.source-stage {
  position: relative;
  line-height: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.source-stage img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
}

.focal-marker {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--crop);
  border-radius: 50%;
  /* White ring keeps the marker visible on dark and busy images */
  box-shadow: 0 0 0 2px var(--paper), inset 0 0 0 2px var(--paper);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.focal-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--crop);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.source-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.source-facts {
  display: grid;
  gap: 4px;
  margin: 14px 0 0;
  font-size: 14px;
}

.source-facts div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.source-facts dt {
  color: var(--ink-soft);
}

.source-facts dd {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-facts dd.mono {
  font-size: 13px;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.source-actions label:focus-within {
  outline: 2px solid var(--crop);
  outline-offset: 2px;
}

/* Settings */
.setting {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.setting legend {
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}

.setting-note {
  margin: 2px 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 14px;
  cursor: pointer;
}

.choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}

.swatch {
  width: 16px;
  height: 16px;
  margin-left: 2px;
  border: 1px solid var(--hairline);
  background: var(--paper);
}

.colour-input {
  width: 64px;
  height: 28px;
  margin: 0 0 4px 24px;
  padding: 2px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
}

.panel-note,
.dev-note {
  font-size: 14px;
  color: var(--ink-soft);
}

.dev-note {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--hairline);
}

/* Artboard */
.artboard {
  padding: 24px 32px 48px;
  overflow-y: auto;
  background: var(--artboard);
}

.artboard:focus {
  outline: none;
}

.artboard-intro {
  font-size: 15px;
  color: var(--ink-soft);
}

.platform-group {
  margin-top: 28px;
}

.platform-group h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
  font-size: 17px;
}

.count {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

/* A gentle lift on hover, the only place tiles get a shadow */
.tile:hover {
  border-color: #b7d3ce;
  box-shadow: var(--shadow-hover);
}

.tile-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 196px;
  padding: 16px;
  border-bottom: 1px solid var(--hairline);
}

/* Empty frame at the placement's true proportions */
.frame {
  position: relative;
  background: var(--artboard);
  outline: 1px solid var(--hairline);
}

.preview {
  display: block;
  width: 100%;
  height: 100%;
}

/* Safe zones: shaded bands over the preview, shown only when switched on */
.safe-zone {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
}

.show-safe-zones .safe-zone {
  display: block;
}

.safe-area {
  position: absolute;
  border: 1px dashed var(--paper);
  box-shadow: 0 0 0 4000px rgba(14, 42, 47, 0.45);
}

/* Resolution and text warnings */
.tile.is-low .frame,
.tile.is-too-small .frame,
.tile.has-text-problem .frame {
  outline: 2px solid var(--caution);
}

.tile-warning {
  display: grid;
  gap: 4px;
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--caution);
}

.warning-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.tile-warning svg,
.resolution-summary svg {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 2px;
}

.tile-warning strong {
  font-weight: 500;
}

.warning-label {
  padding: 0 5px;
  border-radius: var(--radius);
  background: var(--caution);
  color: var(--paper);
  font-weight: 500;
}

.resolution-summary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  font-size: 15px;
  color: var(--caution);
}

/* Adjust button and label */
.btn-small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 14px;
}

.tile-actions {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.has-image .tile-actions {
  display: flex;
}

.tile-crop {
  display: none;
}

.tile.is-fitted .tile-crop {
  display: inline-flex;
}

.tag-fitted {
  display: none;
}

.tile.is-fitted .tag-fitted {
  display: inline-flex;
}

.tag-partial {
  display: none;
}

.tile.is-partial .tag-partial {
  display: inline-flex;
}

.tag-adjusted {
  display: none;
  border-color: var(--brand-strong);
  color: var(--brand-strong);
}

.tile.is-adjusted .tag-adjusted {
  display: inline-flex;
}

.tile.is-locked .frame {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
}

.tile.is-locked .frame svg {
  width: 16px;
  height: 16px;
}

.tile-meta {
  display: grid;
  gap: 4px;
  padding: 10px 12px 12px;
}

.tile-name {
  font-size: 14px;
  line-height: 1.35;
}

.tile-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.tile-size {
  font-size: 13px;
  color: var(--ink-soft);
}

.load-error {
  margin-top: 16px;
  color: var(--caution);
}

/* Adjust window */
.editor {
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 20px 50px rgba(14, 42, 47, 0.25);
}

.editor::backdrop {
  background: rgba(14, 42, 47, 0.55);
}

.editor-body {
  padding: 20px 24px 24px;
}

.editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.editor-header h2 {
  font-size: 18px;
}

.editor-header .mono {
  font-size: 14px;
  color: var(--ink-soft);
}

.editor-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 24px;
  overflow: hidden;
  background: var(--artboard);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.editor-stage.is-dragging {
  cursor: grabbing;
}

.editor-frame {
  position: relative;
  outline: 1px solid var(--hairline);
}

.editor-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.editor-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.editor-warning {
  margin-top: 8px;
}

.editor-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 14px;
}

.editor-controls input[type="range"] {
  flex: 1;
  accent-color: var(--ink);
}

.editor-controls output {
  min-width: 48px;
  text-align: right;
  font-size: 13px;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Narrow screens: stack the sidebar above the artboard */
@media (max-width: 800px) {
  body.app {
    display: block;
    height: auto;
    overflow: visible;
  }

  .app-header {
    padding: 10px 16px;
  }

  .campaign input {
    width: 160px;
  }

  .app-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    padding: 16px;
  }

  .artboard {
    padding: 20px 16px 40px;
  }

  .stepper {
    top: 0;
    margin: -20px -16px 16px;
    padding: 10px 16px;
  }
}
