:root {
  --bg: #0b0b0e;
  --panel: #1e1f27;
  --panel-border: rgba(255, 255, 255, 0.04);
  --btn: #3e414b;
  --btn-hover: #4a4e59;
  --btn-active: #353842;
  --btn-disabled: #2c2e36;
  --track: #12131a;
  --thumb: #4a4e58;
  --thumb-hover: #5b5f6b;
  --text: #f4f4f6;
  --muted: #9a9ba3;
  --radius-panel: 14px;
  --radius-btn: 8px;
  --sidebar: 318px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr var(--sidebar);
  grid-template-rows: auto 1fr;
  gap: 18px 22px;
  padding: 18px 22px 22px;
}

.brand {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.btn-header {
  margin-left: auto;
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 11px;
}

.btn-header[hidden] {
  display: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: var(--text);
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.stage {
  position: relative;
  min-width: 0;
  border-radius: 16px;
  background: #0f0f13;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage.is-drop-target {
  outline: 1px dashed #6b6e79;
  outline-offset: -10px;
}

#viewport {
  display: none;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage.has-image #viewport {
  display: block;
}

.stage.has-image.is-zoomed #viewport {
  cursor: grab;
}

.stage.has-image.is-zoomed #viewport.is-panning {
  cursor: grabbing;
}

.dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stage.has-image .dropzone {
  display: none;
}

.dropzone-card {
  text-align: center;
  padding: 28px;
  max-width: 420px;
}

.dropzone-icon {
  margin: 0 auto 16px;
  color: #8b8d97;
  font-size: 40px;
  line-height: 1;
}

.dropzone-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.dropzone-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.dropzone-formats {
  margin: 0;
  color: #6c6e78;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dropzone-formats + .dropzone-formats {
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.stage-meta {
  position: absolute;
  left: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8d8f98;
  pointer-events: none;
}

.stage-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #5c5e68;
}

.zoom-bar {
  position: absolute;
  right: 16px;
  bottom: 12px;
  display: none;
  align-items: center;
  gap: 10px;
  width: 228px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(30, 31, 39, 0.9);
  border: 1px solid var(--panel-border);
  z-index: 2;
}

.stage.has-image .zoom-bar {
  display: flex;
}

.zoom-bar i {
  color: #ececf0;
  font-size: 15px;
  line-height: 1;
  flex: 0 0 16px;
}

.zoom-bar input[type="range"] {
  flex: 1;
  min-width: 0;
}

.zoom-label {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  min-width: 42px;
  text-align: right;
  cursor: pointer;
}

.zoom-label em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -12px);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(30, 31, 39, 0.92);
  border: 1px solid var(--panel-border);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-panel);
}

.panel-controls {
  padding: 20px 18px 22px;
}

.panel-actions {
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  background: var(--panel);
}

.btn {
  appearance: none;
  border: 0;
  background: var(--btn);
  color: var(--text);
  border-radius: var(--radius-btn);
  height: 42px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}

.btn:hover:not(:disabled) {
  background: var(--btn-hover);
}

.btn:active:not(:disabled) {
  background: var(--btn-active);
  transform: translateY(1px);
}

.btn:disabled {
  background: var(--btn-disabled);
  color: #7a7c85;
  cursor: default;
}

.btn-block {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-block + .btn-block {
  margin-top: 10px;
}

.icon-wand {
  font-size: 15px;
  line-height: 1;
}

.lut-link {
  width: 100%;
  margin: 12px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #8f919a;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
}

.lut-link:hover {
  color: var(--text);
}

.lut-link.has-lut {
  color: #d6d7dc;
}

.lut-clear {
  display: none;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #3e414b;
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.lut-link.has-lut .lut-clear {
  display: inline-flex;
}

.sliders {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sliders .btn-block {
  margin-top: 2px;
}

.sliders .lut-link {
  margin: 0;
}

.slider-group {
  margin: 10px 0 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6d6f78;
}

.slider-group:first-child {
  margin-top: 0;
}

.slider-row {
  display: block;
}

.slider-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
}

.slider-head em {
  font-style: normal;
}

.slider-icon {
  width: 16px;
  flex: 0 0 16px;
  font-size: 15px;
  line-height: 1;
  color: #ececf0;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--track);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--thumb-hover);
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.panel-actions .btn {
  flex: 1;
}

@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(240px, 1fr) auto;
    height: auto;
    min-height: 100%;
  }

  .brand-copy {
    flex-wrap: wrap;
    gap: 4px 10px;
  }

  .btn-header {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .stage {
    min-height: 42vh;
  }

  .zoom-bar {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .stage-meta {
    bottom: 56px;
  }

  .sidebar {
    max-width: 360px;
    width: 100%;
    justify-self: center;
  }
}
