.editor-page {
  --ps-chrome: #2b2b2b;
  --ps-chrome-2: #323232;
  --ps-chrome-3: #3a3a3a;
  --ps-rail: #1f1f1f;
  --ps-canvas-bg: #1e1e1e;
  --ps-border: rgba(255, 255, 255, 0.08);
  --ps-border-strong: rgba(255, 255, 255, 0.14);
  --ps-text: #e8e8e8;
  --ps-muted: #9b9b9b;
  --ps-active: #46a0f0;
  --ps-radius: 2px;
}

.editor-page .noise {
  opacity: 0.025;
}

.editor-page .top,
.editor-page main,
.editor-page footer {
  width: min(1400px, calc(100% - 24px));
}

.editor-page .top {
  padding-top: 16px;
  padding-bottom: 4px;
}

.editor-crumbs {
  margin: 8px 0 10px;
  font-size: 12px;
}

.editor {
  margin: 0 0 40px;
}

.editor-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ps-shell {
  min-height: min(78vh, 860px);
  border: 1px solid var(--ps-border-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--ps-rail);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}

.ps-drop {
  min-height: min(78vh, 860px);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 40px 24px;
  background:
    linear-gradient(180deg, rgba(70, 160, 240, 0.06), transparent 30%),
    radial-gradient(600px 280px at 50% 20%, rgba(232, 255, 71, 0.08), transparent 55%),
    var(--ps-rail);
}

.ps-drop:hover,
.ps-drop.drag {
  outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: -14px;
}

.ps-drop-copy {
  display: grid;
  gap: 10px;
  text-align: center;
  max-width: 420px;
}

.ps-drop-copy strong {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ps-drop-copy span {
  color: var(--ps-text);
}

.ps-drop-copy em {
  font-style: normal;
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ps-muted);
}

.ps-error {
  margin: 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--danger) 18%, var(--ps-chrome));
  border-top: 1px solid var(--ps-border);
}

.ps-app {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: min(78vh, 860px);
  color: var(--ps-text);
}

.ps-menubar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 36px;
  padding: 0 10px;
  background: linear-gradient(180deg, #3d3d3d, #2f2f2f);
  border-bottom: 1px solid #151515;
  font-size: 12px;
}

.ps-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.ps-brand-mark {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
  background: none;
  box-shadow: none;
  border-radius: 0;
}

.ps-doc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ps-muted);
  font-family: "IBM Plex Mono", monospace;
}

.ps-menubar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.ps-btn {
  appearance: none;
  border: 1px solid var(--ps-border-strong);
  background: linear-gradient(180deg, #4a4a4a, #383838);
  color: var(--ps-text);
  border-radius: var(--ps-radius);
  min-height: 26px;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ps-btn:hover {
  background: linear-gradient(180deg, #545454, #404040);
}

.ps-btn-accent {
  background: linear-gradient(180deg, #f2ff7a, var(--accent));
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 40%, #000);
  font-weight: 650;
}

.ps-btn-accent:hover {
  filter: brightness(1.04);
}

.ps-btn-block {
  width: 100%;
  min-height: 30px;
}

.ps-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-height: 34px;
  padding: 6px 10px;
  background: var(--ps-chrome);
  border-bottom: 1px solid #151515;
  font-size: 12px;
}

.ps-option-label {
  font-weight: 650;
  padding-right: 10px;
  border-right: 1px solid var(--ps-border);
  margin-right: 2px;
  white-space: nowrap;
}

.ps-option-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.ps-option-group span {
  color: var(--ps-muted);
  white-space: nowrap;
}

.ps-option-group b {
  color: var(--ps-text);
  font-weight: 500;
}

.ps-option-group input[type="range"] {
  width: 110px;
  accent-color: var(--ps-active);
}

.ps-option-group input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--ps-border-strong);
  border-radius: var(--ps-radius);
  background: transparent;
  cursor: pointer;
}

#editor-gradient-angle {
  width: 48px;
}

#editor-fill-mode .ps-btn,
#editor-gradient-dir .ps-btn {
  font-size: 12px;
  line-height: 1;
  min-width: 24px;
  padding: 0 5px;
}

.ps-option-group select,
.ps-option-group input[type="number"] {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--ps-border-strong);
  border-radius: var(--ps-radius);
  background: #1c1c1c;
  color: var(--ps-text);
  font: inherit;
  font-size: 12px;
}

.ps-option-group select {
  max-width: 180px;
}

.ps-option-group input[type="number"] {
  width: 58px;
}

.ps-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.ps-text-styles {
  gap: 6px;
}

.ps-toggle-group {
  display: inline-flex;
  gap: 2px;
}

.ps-toggle-group .ps-btn,
#editor-font-italic.ps-btn {
  min-width: 26px;
  padding: 0 7px;
  font-weight: 650;
}

.ps-toggle-group .ps-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

#editor-font-align .ps-btn {
  padding: 0 6px;
}

.ps-toggle-group .ps-btn.active,
#editor-font-italic.ps-btn.active {
  background: color-mix(in srgb, var(--ps-active) 35%, #383838);
  border-color: var(--ps-active);
}

.ps-text-hint {
  margin-left: 4px;
}

.ps-option-group input[type="text"] {
  width: min(220px, 36vw);
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--ps-border-strong);
  border-radius: var(--ps-radius);
  background: #1c1c1c;
  color: var(--ps-text);
  font: inherit;
}

.ps-option-transform {
  margin-left: auto;
}

.ps-hint {
  margin: 0;
  color: var(--ps-muted);
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
}

.ps-body {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 250px;
  min-height: 0;
  background: var(--ps-rail);
}

.ps-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: linear-gradient(180deg, #353535, #2a2a2a);
  border-right: 1px solid #151515;
}

.ps-tools button {
  appearance: none;
  width: 36px;
  height: 36px;
  position: relative;
  border: 1px solid transparent;
  border-radius: var(--ps-radius);
  background: transparent;
  color: #d2d2d2;
  cursor: pointer;
  padding: 0;
}

.ps-tools button svg {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
}

.ps-tools button span {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 8px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ps-muted);
  line-height: 1;
}

.ps-tools button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ps-tools button.active {
  background: color-mix(in srgb, var(--ps-active) 28%, #2a2a2a);
  border-color: color-mix(in srgb, var(--ps-active) 55%, transparent);
  color: #fff;
}

.ps-swatch {
  position: relative;
  width: 28px;
  height: 28px;
  margin-top: 10px;
}

.ps-swatch-fg,
.ps-swatch-bg {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.ps-swatch-fg {
  top: 0;
  left: 0;
  z-index: 1;
}

.ps-swatch-bg {
  right: 0;
  bottom: 0;
  background: #fff;
}

.ps-canvas {
  --ps-ruler: 22px;
  min-height: 420px;
  overflow: auto;
  padding: 0;
  background: var(--ps-canvas-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.ps-ruler-layout {
  display: grid;
  grid-template-columns: var(--ps-ruler) minmax(0, 1fr);
  grid-template-rows: var(--ps-ruler) minmax(0, 1fr);
  min-width: 100%;
  min-height: 100%;
}

.ps-ruler-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  width: var(--ps-ruler);
  height: var(--ps-ruler);
  box-sizing: border-box;
  border-right: 1px solid rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  background: linear-gradient(180deg, #3a3a3a, #2f2f2f);
  color: var(--ps-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  user-select: none;
}

.ps-ruler {
  display: block;
  background: linear-gradient(180deg, #3a3a3a, #303030);
  box-sizing: border-box;
  pointer-events: none;
}

.ps-ruler-h {
  position: sticky;
  top: 0;
  z-index: 3;
  width: 100%;
  height: var(--ps-ruler);
  max-height: var(--ps-ruler);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
}

.ps-ruler-v {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--ps-ruler);
  max-width: var(--ps-ruler);
  height: 100%;
  min-height: 100%;
  align-self: stretch;
  border-right: 1px solid rgba(0, 0, 0, 0.45);
  background: linear-gradient(90deg, #3a3a3a, #303030);
}

.ps-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 398px;
  padding: 28px;
  background:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%) 0 8px / 16px 16px,
    var(--ps-canvas-bg);
}

.editor-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  outline: 1px solid rgba(0, 0, 0, 0.65);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.editor-frame canvas {
  display: block;
  max-width: 100%;
  height: auto;
  vertical-align: top;
  touch-action: none;
  background:
    linear-gradient(45deg, #3a3a3a 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(-45deg, #3a3a3a 25%, transparent 25%) 0 6px / 12px 12px,
    #252525;
}

.editor-crop {
  position: absolute;
  border: 1px solid #fff;
  outline: 1px dashed #000;
  background: rgba(70, 160, 240, 0.16);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.ps-panel-layers .ps-panel-body {
  gap: 8px;
}

.ps-layer-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.ps-layer-actions .ps-btn {
  min-height: 28px;
  padding: 0;
  font-size: 14px;
}

.ps-layers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  background: #1c1c1c;
  border: 1px solid var(--ps-border);
}

.ps-layer {
  display: grid;
  grid-template-columns: 28px 36px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 6px;
  border: 1px solid transparent;
  background: #2a2a2a;
  cursor: pointer;
  color: var(--ps-text);
}

.ps-layer:hover {
  background: #333;
}

.ps-layer.active {
  background: color-mix(in srgb, var(--ps-active) 28%, #2a2a2a);
  border-color: color-mix(in srgb, var(--ps-active) 55%, transparent);
}

.ps-layer-eye {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: var(--ps-radius);
  background: transparent;
  color: var(--ps-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.ps-layer-eye:hover {
  color: var(--ps-text);
  background: rgba(255, 255, 255, 0.06);
}

.ps-layer-eye.off {
  opacity: 0.35;
}

.ps-layer-thumb {
  width: 36px;
  height: 28px;
  border: 1px solid #111;
  background:
    linear-gradient(45deg, #444 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, #444 25%, transparent 25%) 0 4px / 8px 8px,
    #2f2f2f;
  object-fit: contain;
  image-rendering: auto;
}

.ps-layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.ps-panels {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #151515;
  border-left: 1px solid #151515;
  overflow: auto;
}

.ps-panel {
  background: var(--ps-chrome-2);
}

.ps-panel > header {
  margin: 0;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cfcfcf;
  background: linear-gradient(180deg, #3c3c3c, #303030);
  border-bottom: 1px solid #1a1a1a;
}

.ps-panel-body {
  display: grid;
  gap: 12px;
  padding: 12px 10px 14px;
}

.ps-slider {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 12px;
}

.ps-slider span {
  color: var(--ps-muted);
}

.ps-slider b {
  color: var(--ps-text);
  font-weight: 500;
}

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

.ps-formats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.ps-formats button {
  appearance: none;
  min-height: 28px;
  border: 1px solid var(--ps-border-strong);
  border-radius: var(--ps-radius);
  background: #2f2f2f;
  color: var(--ps-text);
  font: inherit;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.ps-formats button.active {
  background: color-mix(in srgb, var(--ps-active) 35%, #2f2f2f);
  border-color: var(--ps-active);
}

.ps-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding: 4px 10px;
  background: #1a1a1a;
  border-top: 1px solid #101010;
  color: var(--ps-muted);
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
}

.editor-frame.tool-move canvas {
  cursor: default;
}

.editor-frame.tool-move.moving canvas {
  cursor: grabbing;
}

.editor-frame.tool-move.over-text canvas {
  cursor: grab;
}

.editor-text-box {
  position: absolute;
  z-index: 4;
  border: 1px solid #46a0f0;
  outline: 1px dashed rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.editor-frame.tool-text canvas {
  cursor: text;
}

.editor-frame.tool-crop canvas,
.editor-frame.tool-brush canvas,
.editor-frame.tool-eraser canvas {
  cursor: crosshair;
}

.editor-text-overlay {
  position: absolute;
  z-index: 5;
  margin: 0;
  padding: 0 2px;
  min-width: 1ch;
  min-height: 1em;
  border: 1px solid #46a0f0;
  outline: 1px dashed rgba(0, 0, 0, 0.55);
  background: transparent;
  color: #e8ff47;
  caret-color: currentColor;
  font-family: Outfit, sans-serif;
  font-weight: 500;
  line-height: 1.15;
  resize: none;
  overflow: hidden;
  white-space: pre;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  transform-origin: top left;
}

.editor-text-overlay:focus {
  outline: 1px dashed rgba(0, 0, 0, 0.55);
}

@media (max-width: 900px) {
  .ps-body {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: minmax(280px, 1fr) auto;
  }

  .ps-canvas {
    grid-column: 2;
    grid-row: 1;
    min-height: 280px;
  }

  .ps-stage {
    min-height: 258px;
    padding: 16px;
  }

  .ps-tools {
    grid-row: 1 / span 2;
  }

  .ps-panels {
    grid-column: 2;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid #151515;
  }

  .ps-option-transform {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .ps-menubar {
    flex-wrap: wrap;
    padding: 8px;
  }

  .ps-doc {
    order: 3;
    flex-basis: 100%;
  }

  .ps-tools {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid #151515;
  }

  .ps-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(240px, 1fr) auto;
  }

  .ps-canvas,
  .ps-panels,
  .ps-tools {
    grid-column: 1;
    grid-row: auto;
  }

  .ps-swatch {
    margin-top: 0;
    margin-left: 6px;
  }
}
