.optimizer-menu-toggle,
.optimizer-footer {
  display: none;
}

/* Keep the standalone optimizer header identical to the main site header. */
.header-505 {
  left: 50%;
  width: min(100%, 1920px);
  min-height: 0;
  padding: 43px 72px 18px 56px;
  transform: translateX(-50%);
}

.header-505__brand img {
  width: 232px;
}

.header-505__nav-main {
  gap: 64px;
  margin-left: 353px;
  padding-top: 6px;
}

.header-505__actions {
  margin-left: auto;
}

.header-505__link {
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  letter-spacing: 0;
  text-decoration: none;
  transition: color 160ms ease;
}

.header-505__link:hover,
.header-505__link:focus-visible {
  color: #2e8cff;
  text-decoration: none;
}

.header-505__cta {
  gap: 15px;
  min-width: 246.76px;
}

.header-505__cta img {
  width: 19.38px;
  height: 19.38px;
}

.new-file-action {
  position: absolute;
  z-index: 9;
  top: calc(var(--panel-y) + 390 * var(--u));
  left: calc(var(--panel-x) + 687 * var(--u));
  display: none;
  width: calc(418 * var(--u));
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(245, 245, 245, 0.72);
  font-size: clamp(13px, calc(20 * var(--u)), 20px);
  font-weight: 400;
  line-height: 1.3;
  cursor: pointer;
  transition: color 160ms ease;
}

.complete .new-file-action {
  display: block;
}

.new-file-action:hover,
.new-file-action:focus-visible {
  color: #2e8cff;
  outline: none;
}

.hero-title,
.hero-title span,
.tech-copy h2 {
  font-weight: 500;
  letter-spacing: -0.02em;
}

.hero-title span {
  color: inherit;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.hero-mark {
  display: none;
}

.desktop-drop-hint {
  display: none;
}

.cancelled-message {
  display: none;
}

@media (min-width: 1181px) {
  .hero-lockup {
    left: var(--page-x);
    right: var(--page-x);
    width: auto;
  }

  .hero-title {
    top: calc(26 * var(--u));
    left: 0;
    width: min(calc(1320 * var(--u)), 100%);
  }

  .desktop-drop-hint {
    position: absolute;
    top: calc(388 * var(--u));
    left: 50%;
    display: block;
    margin: 0;
    color: rgba(245, 245, 245, 0.5);
    font-size: clamp(11px, calc(16 * var(--u)), 16px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0;
    transform: translateX(-50%);
    transition: color 160ms ease;
    white-space: nowrap;
  }

  .stage.dragover .upload-panel {
    background:
      linear-gradient(90deg, transparent calc(16 * var(--u)), rgba(255, 255, 255, 0.24) calc(16 * var(--u)) calc(16 * var(--u) + 1px), transparent calc(16 * var(--u) + 1px)),
      linear-gradient(90deg, transparent calc(1776 * var(--u)), rgba(255, 255, 255, 0.24) calc(1776 * var(--u)) calc(1776 * var(--u) + 1px), transparent calc(1776 * var(--u) + 1px)),
      #262626;
  }

  .stage.dragover .desktop-drop-hint {
    color: #fff;
  }

  .progress-counter strong {
    display: flex;
    width: 100%;
    align-items: flex-end;
    gap: calc(44 * var(--u));
  }

  .progress-counter strong span {
    flex: 0 0 auto;
  }

  #progress-current {
    order: 1;
  }

  .progress-counter strong::before {
    position: static;
    order: 2;
    flex: 1 1 auto;
    min-width: calc(140 * var(--u));
    max-width: calc(424 * var(--u));
    align-self: center;
    transform: translateY(calc(20 * var(--u)));
  }

  #progress-total {
    order: 3;
  }

  .diagnostics-meta p {
    display: none;
  }

  .result-pages {
    top: calc(24 * var(--u));
    left: calc(44 * var(--u));
    width: auto;
    font-size: clamp(14px, calc(22 * var(--u)), 22px);
    line-height: 1.3;
    white-space: nowrap;
  }

  .result-diagnostics {
    top: calc(65 * var(--u));
    left: calc(44 * var(--u));
    display: flex;
    grid-template-columns: none;
    gap: calc(30 * var(--u));
    font-size: 0;
  }

  .result-diagnostics p {
    display: block;
    white-space: nowrap;
  }

  .result-diagnostics p:first-of-type::before {
    content: "Разрешение: 1600x900";
  }

  .result-diagnostics p:last-of-type::before {
    content: "Формат: JPG";
  }

  .result-diagnostics p::before {
    color: var(--copy);
    font-size: clamp(14px, calc(22 * var(--u)), 22px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.02em;
  }

  .corner-log {
    font-size: clamp(5px, calc(7 * var(--u)), 7px);
    line-height: 1.2;
  }

  .corner-log p {
    font-size: clamp(6px, calc(8 * var(--u)), 8px);
  }
}

@media (min-width: 1181px) and (max-width: 1600px) {
  .header-505 {
    padding-right: 48px;
    padding-left: 48px;
  }

  .header-505__brand img {
    width: clamp(184px, 14.5vw, 220px);
  }

  .header-505__nav-main {
    gap: clamp(28px, 3.2vw, 48px);
    margin-left: auto;
  }

  .header-505__actions {
    margin-left: clamp(32px, 4vw, 64px);
  }

  .header-505__cta {
    min-width: 0;
  }
}

@media (max-width: 1180px) {
  html,
  body {
    overflow-x: hidden;
  }

  body.optimizer-menu-open {
    overflow: hidden;
  }

  .stage {
    display: block;
    width: 100%;
    min-height: 100vh;
    overflow: visible;
  }

  .header-505 {
    position: relative;
    left: auto;
    width: 100%;
    min-height: 0;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 24px 20px 18px;
    transform: none;
  }

  .header-505__brand img {
    width: 232px;
    max-width: calc(100vw - 96px);
  }

  .optimizer-menu-toggle {
    position: relative;
    z-index: 2;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    margin-left: auto;
    border: 1px solid #303030;
    border-radius: 10px;
    padding: 0;
    background: #111;
    color: #fff;
    cursor: pointer;
  }

  .optimizer-menu-toggle span {
    position: absolute;
    width: 19px;
    height: 1px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 160ms ease;
  }

  .optimizer-menu-toggle span:first-child {
    transform: translateY(-4px);
  }

  .optimizer-menu-toggle span:last-child {
    transform: translateY(4px);
  }

  .header-505.is-menu-open {
    position: fixed;
    inset: 0;
    left: 0;
    z-index: 100;
    width: 100%;
    height: 100dvh;
    align-content: flex-start;
    align-items: flex-start;
    overflow-y: auto;
    background: #000;
    transform: none;
  }

  .header-505.is-menu-open .optimizer-menu-toggle span:first-child {
    transform: rotate(45deg);
  }

  .header-505.is-menu-open .optimizer-menu-toggle span:last-child {
    transform: rotate(-45deg);
  }

  .header-505__nav-main,
  .header-505__actions {
    display: none;
  }

  .header-505.is-menu-open .header-505__nav-main {
    display: flex;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: flex-start;
    gap: 30px;
    margin: 0;
    padding-top: clamp(68px, 12vh, 124px);
  }

  .header-505.is-menu-open .header-505__actions {
    display: flex;
    width: 100%;
    order: 4;
    margin: auto 0 0;
    padding-top: 52px;
  }

  .header-505.is-menu-open .header-505__link {
    font-size: clamp(30px, 4.2vw, 46px);
    font-weight: 300;
    line-height: 1.15;
  }

  .header-505.is-menu-open .header-505__cta {
    gap: 10px;
    font-size: clamp(22px, 3vw, 32px);
  }

  .header-505.is-menu-open .header-505__cta span {
    display: inline;
  }

  .hero-lockup {
    position: relative;
    top: auto;
    left: auto;
    display: block;
    width: auto;
    height: auto;
    min-height: 96px;
    margin: 8px 24px 12px;
  }

  .hero-title {
    position: static;
    width: auto;
    margin: 0;
    color: #f5f5f5;
    font-size: clamp(24px, 4.4vw, 40px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .hero-title span {
    color: inherit;
    background: none;
    -webkit-text-fill-color: currentColor;
  }

  .app-panel {
    position: relative;
    top: auto;
    left: auto;
    width: calc(100% - 48px);
    height: 300px;
    margin: 0 24px;
  }

  .progress-panel,
  .result-panel {
    overflow: visible;
  }

  .progress-panel::after {
    display: none;
  }

  .cancelled .cancelled-message {
    position: absolute;
    top: 20px;
    right: 20px;
    left: 20px;
    display: block;
    margin: 0;
    color: rgba(245, 245, 245, 0.72);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.35;
  }

  .processing-status {
    top: 18px;
    left: 20px;
    width: calc(100% - 150px);
    font-size: 14px;
    line-height: 1.25;
  }

  .cancel-action {
    top: 16px;
    right: 18px;
  }

  .background-warning {
    top: 62px;
    left: 20px;
    right: 20px;
    font-size: 14px;
  }

  .progress-counter {
    top: 104px;
    left: 20px;
    right: 20px;
    width: auto;
  }

  .progress-counter strong {
    grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
    column-gap: 10px;
  }

  .progress-counter strong span {
    font-size: clamp(68px, 20vw, 112px);
  }

  .progress-counter strong::before {
    top: 54%;
    left: 50%;
    width: 42px;
    height: 2px;
    transform: translate(-50%, -50%);
  }

  .processing-meta {
    top: auto;
    right: 20px;
    bottom: 18px;
    left: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    font-size: 10px;
  }

  .processing-meta .loader-star {
    position: absolute;
    right: 0;
    bottom: 58px;
    width: 44px;
    height: 44px;
  }

  .processing-meta p:last-child {
    text-align: right;
  }

  .processing .corner-log,
  .complete .result-corner-log {
    display: block;
    top: calc(100% + 14px);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    max-height: 104px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding: 25px 0 0;
    text-align: left;
  }

  .processing .corner-log .copy-log-action,
  .complete .result-corner-log .copy-log-action {
    right: 0;
  }

  .complete .result-diagnostics {
    display: none;
  }

  .result-warning {
    top: 20px;
    left: 20px;
    right: 20px;
    font-size: 15px;
  }

  .complete .result-summary > strong {
    top: auto;
    bottom: 18px;
    left: 20px;
    font-size: 80px;
  }

  .complete .result-pages {
    top: auto;
    bottom: 24px;
    right: 20px;
    left: auto;
    width: auto;
    text-align: right;
  }

  .primary-action,
  .complete .primary-action {
    top: 378px;
    transform: translate(-50%, -50%);
  }

  .primary-action:hover:not(:disabled),
  .dragover .primary-action {
    transform: translate(-50%, -50%);
  }

  .new-file-action {
    top: 408px;
    left: 50%;
    width: 220px;
    transform: translateX(-50%);
    font-size: 14px;
  }

  .story-section {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: calc(100% - 48px);
    margin: 36px 24px 0;
  }

  .processing .story-section,
  .complete .story-section {
    margin-top: 150px;
  }

  .tech-section {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: calc(100% - 48px);
    margin: 72px 24px 0;
  }

  .tech-copy h2 {
    width: 100%;
    margin-bottom: 28px;
    font-size: clamp(34px, 7vw, 52px);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.02em;
  }

  .feature-card {
    width: 100%;
  }

  .error-panel p,
  .error-panel span {
    width: auto;
    max-width: calc(100% - 48px);
  }

  .error-panel span {
    margin-top: 12px;
    font-size: clamp(13px, 2.1vw, 16px);
    line-height: 1.22;
  }

  .optimizer-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 72px;
    border-top: 1px solid #171717;
    padding: 42px 24px 56px;
    color: #777;
    background: #000;
  }

  .optimizer-footer__brand img {
    display: block;
    width: 132px;
    height: auto;
  }

  .optimizer-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
  }

  .optimizer-footer a,
  .optimizer-footer p {
    margin: 0;
    color: #aaa;
    font-size: 15px;
    line-height: 21px;
  }
}

@media (max-width: 560px) {
  .header-505__brand img {
    width: 232px;
    max-width: calc(100vw - 96px);
  }

  .header-505.is-menu-open .header-505__nav-main {
    gap: 26px;
  }

  .header-505.is-menu-open .header-505__link {
    font-size: 30px;
  }

  .header-505.is-menu-open .header-505__cta {
    font-size: 22px;
  }

  .hero-lockup {
    min-height: 78px;
    margin-top: 10px;
    margin-bottom: 8px;
  }

  .hero-title {
    font-size: clamp(21px, 5.6vw, 24px);
    line-height: 1.12;
  }

  .app-panel {
    height: 280px;
  }

  .complete .result-summary > strong {
    top: auto;
    bottom: 16px;
    font-size: 72px;
  }

  .complete .result-pages {
    top: auto;
    bottom: 20px;
  }

  .processing-status {
    width: calc(100% - 136px);
  }

  .progress-counter {
    top: 102px;
  }

  .progress-counter strong span {
    font-size: clamp(64px, 20vw, 92px);
  }

  .processing-meta {
    bottom: 16px;
  }

  .processing .corner-log,
  .complete .result-corner-log {
    max-height: 92px;
  }

  .processing .story-section,
  .complete .story-section {
    margin-top: 132px;
  }

  .primary-action,
  .complete .primary-action {
    top: 348px;
  }

  .new-file-action {
    top: 392px;
  }

  .error-panel {
    padding: 18px 20px;
  }

  .error-panel p {
    max-width: calc(100% - 40px);
    font-size: clamp(24px, 6.8vw, 30px);
    line-height: 1;
    letter-spacing: -0.03em;
  }

  .error-panel span {
    max-width: calc(100% - 40px);
    margin-top: 7px;
    font-size: clamp(11px, 3vw, 13px);
    line-height: 1.18;
  }

  .error .primary-action {
    top: 374px;
  }

  .tech-copy h2 {
    font-size: clamp(30px, 8.2vw, 38px);
  }
}
