:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --panel: #fbfaf6;
  --ink: #171817;
  --muted: #666962;
  --line: #d9d7ce;
  --dark: #202321;
  --accent: #6c5ce7;
  --accent-dark: #5544d2;
  --accent-soft: #e7e2ff;
  --success: #20825c;
  --warning: #b06e1f;
  --danger: #b84343;
  --shadow: 0 26px 70px rgba(28, 31, 29, 0.12);
  --radius-large: 28px;
  --radius-medium: 18px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 10%, rgba(108, 92, 231, 0.12), transparent 28rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 55%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

button,
[role="button"],
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(23, 24, 23, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--dark);
  font-size: 18px;
  font-weight: 750;
  transform: rotate(-3deg);
}

.brand-name {
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.health-status {
  display: inline-flex;
  max-width: 440px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
  text-align: right;
}

.health-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a9aaa6;
  box-shadow: 0 0 0 4px rgba(169, 170, 166, 0.15);
}

.health-loading .health-dot {
  animation: health-pulse 1.4s ease-in-out infinite;
}

.health-ok .health-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(32, 130, 92, 0.13);
}

.health-warning .health-dot {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(176, 110, 31, 0.13);
}

.health-error .health-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(184, 67, 67, 0.13);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(310px, 0.72fr) minmax(520px, 1.45fr);
  gap: clamp(24px, 4vw, 58px);
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 72px) clamp(20px, 4vw, 64px) 64px;
}

.control-panel {
  align-self: start;
}

.intro {
  margin-bottom: 36px;
}

.eyebrow,
.workspace-kicker {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 520px;
  margin-bottom: 18px;
  font-size: clamp(40px, 5vw, 70px);
  font-weight: 720;
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.lead {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.65;
}

.control-stack {
  display: grid;
  min-width: 0;
  gap: 23px;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 13px;
  font-weight: 750;
}

.drop-zone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  min-height: 104px;
  padding: 17px;
  border: 1.5px dashed #bdbbb1;
  border-radius: var(--radius-medium);
  background: rgba(251, 250, 246, 0.65);
  cursor: pointer;
  outline: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #faf8ff;
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
  transform: translateY(-1px);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: rgba(32, 130, 92, 0.45);
  background: rgba(239, 250, 245, 0.72);
}

.upload-symbol {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 27px;
  font-weight: 300;
}

.has-file .upload-symbol {
  color: var(--success);
  background: rgba(32, 130, 92, 0.11);
}

.drop-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.drop-copy strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choose-chip {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--dark);
  background: #e8e7e1;
  font-size: 11px;
  font-weight: 750;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  outline: none;
  color: var(--ink);
  background: var(--panel);
  line-height: 1.55;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

textarea::placeholder {
  color: #9a9b96;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

textarea:disabled {
  cursor: wait;
  opacity: 0.72;
}

.field-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button {
  min-height: 54px;
  padding: 13px 16px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
  transition:
    transform 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-2px);
}

.button:not(:disabled):active {
  transform: translateY(0);
}

.button:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.28);
  outline-offset: 2px;
}

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

.button-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 25px rgba(108, 92, 231, 0.24);
}

.button-primary:not(:disabled):hover {
  background: var(--accent-dark);
  box-shadow: 0 14px 28px rgba(108, 92, 231, 0.29);
}

.button-arrow {
  font-size: 20px;
  font-weight: 400;
}

.button-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ink);
  background: #deddd6;
}

.button-secondary:not(:disabled):hover {
  background: #d2d0c8;
}

.spark {
  color: var(--accent-dark);
  font-size: 15px;
}

.privacy-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.workspace {
  min-width: 0;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid rgba(23, 24, 23, 0.08);
  border-radius: var(--radius-large);
  background: rgba(251, 250, 246, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.workspace-kicker {
  margin-bottom: 5px;
}

.workspace h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.045em;
}

.local-badge {
  padding: 8px 11px;
  border: 1px solid #dad8d0;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.download-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--dark);
  border-radius: 999px;
  color: var(--dark);
  background: transparent;
  font-size: 12px;
  font-weight: 740;
  text-decoration: none;
  transition:
    transform 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.download-current:hover {
  background: var(--dark);
  color: white;
  transform: translateY(-1px);
}

.download-current:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.28);
  outline-offset: 2px;
}

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.photo-frame {
  min-width: 0;
  margin: 0;
}

.photo-frame figcaption {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-kind {
  overflow: hidden;
  max-width: 60%;
  color: var(--accent-dark);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-stage {
  position: relative;
  display: grid;
  min-height: clamp(360px, 54vw, 660px);
  overflow: hidden;
  place-items: center;
  border-radius: 18px;
  background:
    linear-gradient(45deg, #252826 25%, transparent 25%),
    linear-gradient(-45deg, #252826 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #252826 75%),
    linear-gradient(-45deg, transparent 75%, #252826 75%),
    #2b2e2c;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.image-stage::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 660px;
  object-fit: contain;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 30px;
  color: rgba(255, 255, 255, 0.76);
  text-align: center;
}

.placeholder strong {
  font-size: 14px;
}

.placeholder > span:last-child {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  line-height: 1.5;
}

.placeholder-frame {
  position: relative;
  width: 58px;
  height: 47px;
  margin-bottom: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.27);
  border-radius: 9px;
}

.placeholder-frame::before {
  position: absolute;
  right: 9px;
  bottom: 9px;
  left: 9px;
  height: 17px;
  background:
    linear-gradient(140deg, transparent 45%, rgba(255, 255, 255, 0.19) 46% 69%, transparent 70%),
    linear-gradient(40deg, transparent 35%, rgba(255, 255, 255, 0.13) 36% 62%, transparent 63%);
  content: "";
}

.placeholder-frame::after {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  content: "";
}

.placeholder-spark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 7px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  color: #bcb2ff !important;
  background: rgba(108, 92, 231, 0.17);
  font-size: 20px !important;
}

.job-status {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #dedbd0;
  border-radius: 14px;
  background: #f2f0e8;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 19px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(108, 92, 231, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: #dbd7ca;
}

.progress-bar {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: progress-slide 1.7s ease-in-out infinite;
}

.job-status[data-kind="success"] {
  border-color: rgba(32, 130, 92, 0.22);
  background: rgba(32, 130, 92, 0.07);
}

.job-status[data-kind="success"] .status-row {
  color: var(--success);
}

.job-status[data-kind="success"] .status-spinner {
  border: 0;
  animation: none;
}

.job-status[data-kind="success"] .status-spinner::after {
  content: "✓";
  font-weight: 800;
}

.job-status[data-kind="success"] .progress-track {
  display: none;
}

.job-status[data-kind="error"] {
  border-color: rgba(184, 67, 67, 0.22);
  background: rgba(184, 67, 67, 0.07);
}

.job-status[data-kind="error"] .status-row {
  color: var(--danger);
}

.job-status[data-kind="error"] .status-spinner {
  border: 0;
  animation: none;
}

.job-status[data-kind="error"] .status-spinner::after {
  content: "!";
  font-weight: 850;
}

.job-status[data-kind="error"] .progress-track {
  display: none;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  min-height: 0;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 12px;
  color: white;
  background: var(--dark);
  font-size: 12px;
  font-weight: 740;
  text-decoration: none;
  transition:
    transform 150ms ease,
    background 150ms ease;
}

.download-link:hover {
  background: #303531;
  transform: translateY(-1px);
}

.download-link:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.28);
  outline-offset: 2px;
}

.noscript {
  margin: 20px;
  padding: 16px;
  border-radius: 12px;
  color: #7a2424;
  background: #ffe4e4;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes health-pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.82);
  }
}

@keyframes progress-slide {
  0% {
    transform: translateX(-115%);
  }

  50% {
    transform: translateX(85%);
  }

  100% {
    transform: translateX(245%);
  }
}

@media (max-width: 1040px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    display: grid;
    grid-template-columns: minmax(260px, 0.75fr) minmax(330px, 1fr);
    gap: 36px;
  }

  .intro {
    margin-bottom: 0;
  }

  h1 {
    font-size: clamp(42px, 7vw, 68px);
  }

  .image-stage {
    min-height: min(62vw, 600px);
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 68px;
    padding: 14px 18px;
  }

  .health-status {
    max-width: 58%;
    font-size: 11px;
  }

  .editor-layout {
    gap: 34px;
    padding: 34px 16px 40px;
  }

  .control-panel {
    display: block;
  }

  .intro {
    margin-bottom: 30px;
  }

  h1 {
    max-width: 450px;
    font-size: clamp(40px, 13vw, 58px);
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px 14px;
    border-radius: 22px;
  }

  .comparison {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .image-stage {
    min-height: min(105vw, 520px);
  }

  .field-foot span:first-child {
    max-width: 70%;
  }
}

@media (max-width: 460px) {
  .brand-name {
    display: none;
  }

  .health-status {
    max-width: calc(100% - 56px);
  }

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

  .choose-chip {
    display: none;
  }

  .workspace-head {
    align-items: flex-start;
  }

  .local-badge {
    padding: 7px 9px;
  }

  .history-node {
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden !important;
  }

  .history-node.is-root {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-node-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

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

/* -- История версий ------------------------------------------------- */

.history-section {
  margin-top: 30px;
}

.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.history-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.history-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 14px;
  overflow: hidden auto;
  padding: 4px 4px 10px;
}

.history-group {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--panel);
}

.history-group-count {
  display: block;
  margin: 7px 2px 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.history-group-body {
  padding-left: 18px;
}

.history-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-small);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
  min-width: 0;
}

.history-node.is-root {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.history-node:hover {
  background: rgba(108, 92, 231, 0.05);
}

.history-node.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.history-node-toggle {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.history-node-toggle:hover {
  color: var(--ink);
  background: #ecebe5;
}

.history-node-main {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.history-node-main:hover {
  background: rgba(108, 92, 231, 0.07);
}

.history-node-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: #ecece6;
}

.history-node-meta {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.history-node-title {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}

.history-node-badge {
  justify-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.history-node-date {
  font-size: 11px;
  color: var(--muted);
}

.history-node-prompt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.history-node-children {
  grid-column: 1 / -1;
  display: grid;
  min-width: 0;
  gap: 6px;
  padding-left: 18px;
}

.history-node-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.history-node:hover .history-node-actions,
.history-node:focus-within .history-node-actions {
  opacity: 1;
  visibility: visible;
}

.history-node-action {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.history-node-action:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.history-node-action.history-delete {
  color: var(--danger);
}

.history-node-action.history-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(184, 67, 67, 0.07);
}

.history-empty {
  padding: 10px 2px;
  font-size: 13px;
  color: var(--muted);
}

/* -- Референс ---------------------------------------------------- */

.reference-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.button-small {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease,
    opacity 150ms ease;
}

.button-small:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.button-small:disabled {
  cursor: not-allowed;
  opacity: 0.43;
}

.reference-select {
  min-height: 36px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  font-size: 12px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.reference-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.reference-select:disabled {
  cursor: not-allowed;
  opacity: 0.43;
}

.reference-preview {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--paper);
}

.reference-canvas {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 8px;
  background: #ecece6;
  cursor: crosshair;
  touch-action: none;
}

.reference-preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.reference-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* -- Подсказки промптов ------------------------------------------- */

.button-suggest {
  width: 100%;
}

.suggest-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(251, 250, 246, 0.7);
}

.suggest-section-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggest-chip {
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: left;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.suggest-chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.suggest-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.suggest-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* -- Авторизация -------------------------------------------------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--dark);
  border-radius: 999px;
  color: var(--dark);
  background: transparent;
  font-size: 12px;
  font-weight: 740;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.logout-button:hover {
  background: var(--dark);
  color: white;
  transform: translateY(-1px);
}

.logout-button:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.28);
  outline-offset: 2px;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(243, 240, 232, 0.82);
  backdrop-filter: blur(10px);
}

.auth-card {
  width: min(400px, 100%);
  padding: 34px 32px;
  border: 1px solid rgba(23, 24, 23, 0.08);
  border-radius: var(--radius-large);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.auth-eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: -0.045em;
}

.auth-lead {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  color: var(--danger);
  background: rgba(184, 67, 67, 0.07);
  font-size: 13px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  min-height: 52px;
}
