/* The pixel editor dialog (js/editor.js, js/editor-dialog.js): drawing on the left, tools on the right, stacked on phones. */

.editor {
  width: min(1100px, 100vw - 32px);
  height: min(760px, 100dvh - 32px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--background);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.editor[open] { display: flex; flex-direction: column; }
.editor::backdrop { background: rgba(20, 14, 24, .7); }

.editor-header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--surface-raised); }
.editor-title { font-size: 16px; }
.editor-name { min-width: 0; width: 220px; padding: 6px 10px; border: 0; border-radius: 6px; background: var(--surface-raised); color: inherit; font: 600 15px/1.3 system-ui, sans-serif; }
.editor-name::placeholder { color: var(--text-placeholder); }
.editor-size { font-size: 12px; opacity: .65; }
.editor-notice { font-size: 12px; color: var(--highlight); }
.editor-notice:empty { display: none; }
.editor .editor-close { margin-left: auto; width: 36px; height: 36px; padding: 0; font-size: 22px; line-height: 1; }

.editor-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 380px; }
.editor-stage { min-height: 0; display: grid; place-items: center; padding: 8px; overflow: hidden; background: var(--surface-sunken); } /* padding: STAGE_PADDING in editor.js */
.editor-canvas { display: block; touch-action: none; cursor: crosshair; box-shadow: 0 0 0 1px var(--surface-raised); }
.editor-canvas[data-tool="pick"] { cursor: copy; }
.editor-canvas:focus { outline: none; }
.editor-canvas:focus-visible { outline: 2px solid var(--highlight); outline-offset: 4px; }

.editor-panel { overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.editor-panel h3 { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.editor-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.editor-buttons + .editor-buttons, .editor-swatches + .editor-buttons { margin-top: 6px; }

.editor button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 13px; padding: 7px 12px; border: 0; border-radius: 6px; background: var(--surface-raised); color: var(--text); cursor: pointer; }
.editor button .ui-icon { flex: none; margin-left: -2px; }
.editor button:hover:not(:disabled) { background: var(--surface-hover); }
.editor button[aria-pressed="true"] { background: var(--accent); color: var(--text-on-accent); }
.editor button[aria-pressed="true"]:hover:not(:disabled), .editor button.primary:hover:not(:disabled) { background: var(--accent-light); }
.editor button:disabled { opacity: .4; cursor: default; }
.editor button.primary { background: var(--accent); color: var(--text-on-accent); font-weight: 600; }
.editor button:focus-visible, .editor input:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }

.editor-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.editor .editor-swatch { width: 34px; height: 34px; padding: 0; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
/* a ring rather than a fill, so the selected swatch's colour stays visible */
.editor .editor-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--background), 0 0 0 5px var(--highlight); }
.editor-colour-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.editor-colour-input { width: 40px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }

.editor-size-inputs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; font-size: 13px; }
.editor-size-inputs label { display: inline-flex; align-items: center; gap: 6px; }
/* hide the native spinners; the arrow keys still step the value */
.editor-size-inputs input { width: 52px; padding: 6px 8px; border: 0; border-radius: 6px; background: var(--surface-raised); color: inherit; font: inherit; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.editor-size-inputs input::-webkit-inner-spin-button, .editor-size-inputs input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.editor-size-hint { flex-basis: 100%; font-size: 12px; opacity: .65; }

/* two edges per line: name, +, − */
.editor-edges { display: grid; grid-template-columns: repeat(2, auto 34px 34px); gap: 6px; align-items: center; justify-content: start; font-size: 13px; }
.editor-edges span:nth-of-type(even) { padding-left: 14px; }
.editor .editor-edges button { padding: 6px 0; }

.editor-previews {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 10px; border-radius: 8px;
  background: var(--checkerboard);
}
.editor-previews img { image-rendering: pixelated; }

.editor-tip { margin: 0; padding: 10px 16px 14px; font-size: 12px; opacity: .7; border-top: 1px solid var(--surface-raised); }

@media (max-width: 760px) {
  .editor { width: 100vw; height: 100dvh; border-radius: 0; }
  .editor-body { grid-template-columns: 1fr; grid-template-rows: minmax(240px, 48dvh) 1fr; }
  .editor-name { flex: 1; }
}
