:root {
  color-scheme: light;
  --blue: #8b6cff;
  --blue-dark: #654bd8;
  --blue-soft: #efeaff;
  --ink: #191625;
  --muted: #6d687d;
  --line: #e1ddec;
  --surface: #ffffff;
  --surface-soft: #faf9fd;
  --danger: #d94a66;
  --shadow: 0 18px 60px rgba(69, 50, 125, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 64px;
  padding: 0 52px;
  display: grid;
  grid-template-columns: 210px 1fr 210px;
  align-items: center;
  border-bottom: 1px solid #e6e9ef;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111217;
  font-size: 16px;
  font-weight: 650;
  text-decoration: none;
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 32px;
}

.footer-brand .brand-logo {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.ad-shell {
  width: min(970px, calc(100vw - 48px));
  min-height: 112px;
  margin: 24px auto 76px;
  display: none;
  position: relative;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

html[data-ads-state="ready"] .ad-shell {
  display: grid;
}

body:has(.editor:not(.hidden)) .ad-shell {
  display: none;
}

.ad-shell > span {
  position: absolute;
  top: 7px;
  left: 50%;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.ad-mount,
.ad-mount .adsbygoogle {
  width: 100%;
  min-height: 90px;
}

.ad-shell-content {
  margin-top: -58px;
}

.ad-shell-footer {
  margin-top: 72px;
  margin-bottom: 32px;
}

.brand-mark {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-block;
  border: 2px solid #76a0f7;
  border-left: 0;
}

.brand-mark::before {
  position: absolute;
  content: "";
  top: -6px;
  left: -5px;
  width: 10px;
  height: 10px;
  border: 2px solid #83df59;
}

.brand-mark-green {
  position: absolute;
  top: 5px;
  left: -2px;
  width: 8px;
  height: 2px;
  background: #76a0f7;
}

.main-nav {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 30px;
}

.main-nav a {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #050507;
  font-size: 14px;
  font-weight: 520;
  text-decoration: none;
}

.main-nav a:hover {
  color: var(--blue-dark);
}

.header-actions {
  justify-self: end;
  display: flex;
  gap: 24px;
}

.button {
  min-height: 36px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-outline {
  border: 1px solid #d1d8e2;
  background: white;
}

.button-primary {
  color: white;
  background: var(--blue-dark);
}

.button-primary:hover,
.resize-button:hover {
  background: #5439c4;
  box-shadow: 0 8px 22px rgba(101, 75, 216, 0.3);
}

.button-secondary,
.button-quiet {
  border: 1px solid var(--line);
  color: #29313d;
  background: white;
}

.mobile-menu {
  display: none;
  padding: 5px;
  border: 0;
  background: transparent;
}

.mobile-menu span {
  width: 22px;
  height: 2px;
  display: block;
  margin: 4px 0;
  background: #111;
}

.hero {
  min-height: 610px;
  padding: 34px 24px 0;
}

.hero-heading {
  text-align: center;
}

.hero-heading h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.25;
}

.hero-heading p {
  margin: 10px 0 0;
  font-size: 21px;
}

.dropzone {
  width: min(744px, calc(100vw - 48px));
  height: 306px;
  margin: 132px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 12px solid #ece7ff;
  outline: 3px dashed rgba(255, 255, 255, 0.52);
  outline-offset: -24px;
  color: white;
  background: linear-gradient(135deg, #7658e8 0%, #9a6cf6 100%);
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    outline-color 160ms ease;
}

.dropzone:hover,
.dropzone.dragging,
.dropzone:focus-visible {
  outline-color: white;
  background: linear-gradient(135deg, #694bd8 0%, #8b5fe8 100%);
  transform: translateY(-2px);
}

.upload-icon {
  width: 62px;
  height: 62px;
  fill: none;
  stroke: white;
  stroke-width: 2;
}

.select-button {
  height: 60px;
  min-width: 224px;
  padding: 0;
  display: grid;
  grid-template-columns: 48px 1fr 56px;
  align-items: center;
  border: 0;
  border-radius: 7px;
  color: #101114;
  background: white;
  cursor: pointer;
  font-weight: 620;
}

.select-button svg {
  width: 18px;
  justify-self: end;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.select-chevron {
  height: 60px;
  display: grid;
  place-items: center;
  border-left: 1px solid #dce0e7;
  font-size: 23px;
}

.dropzone strong {
  font-size: 15px;
}

.dropzone small {
  font-size: 12px;
}

.dropzone small a {
  text-underline-offset: 2px;
}

.upload-error {
  min-height: 22px;
  margin: 14px auto 0;
  color: var(--danger);
  text-align: center;
}

.features {
  width: min(860px, calc(100vw - 48px));
  margin: 20px auto 96px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 70px 85px;
  text-align: center;
}

.features article {
  min-width: 0;
}

.feature-icon {
  height: 36px;
  display: block;
  font-family: Georgia, serif;
  font-size: 38px;
  line-height: 1;
}

.features h2 {
  margin: 20px 0 18px;
  font-size: 14px;
}

.features p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.45;
}

.how-to {
  width: min(1040px, calc(100vw - 48px));
  margin: 40px auto 110px;
  padding: 54px 64px;
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  align-items: center;
  border-radius: 18px;
  background: #f4f7fc;
}

.how-to h2 {
  margin: 0 0 24px;
  font-size: 25px;
}

.how-to ol {
  margin: 0;
  padding-left: 22px;
  color: #3f4651;
  line-height: 2;
}

.how-to-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  color: var(--blue-dark);
}

.art-image {
  width: 110px;
  height: 94px;
  display: grid;
  place-items: center;
  border: 3px solid currentColor;
  border-radius: 12px;
  font-size: 45px;
}

.art-image.small {
  width: 76px;
  height: 65px;
  font-size: 30px;
}

.art-arrow {
  font-size: 34px;
}

.editor {
  min-height: calc(100vh - 64px);
  padding: 44px max(24px, calc((100vw - 1380px) / 2)) 72px;
  background: #f6f7fa;
}

.editor-heading {
  margin: 0 0 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.editor-heading h1 {
  margin: 5px 0;
  font-size: 28px;
}

.editor-heading p {
  margin: 0;
  color: var(--muted);
}

.editor-layout {
  display: grid;
  grid-template-columns: 220px minmax(360px, 1fr) 370px;
  min-height: 650px;
  overflow: hidden;
  border: 1px solid #e0e4eb;
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow);
}

.image-queue {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fbfbfc;
}

.queue-title {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.queue-title span {
  min-width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #486db4;
  background: #e6edfc;
  font-size: 12px;
  font-weight: 700;
}

.image-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item {
  width: 100%;
  padding: 8px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 20px;
  gap: 9px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.queue-item:hover,
.queue-item.active {
  border-color: #b8cdf6;
  background: #edf3ff;
}

.queue-item img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.queue-item span:not(.queue-remove) {
  min-width: 0;
}

.queue-item strong,
.queue-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item strong {
  font-size: 12px;
}

.queue-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.queue-remove {
  display: grid;
  place-items: center;
  color: #7b8492;
  font-size: 18px;
}

.queue-remove:hover {
  color: var(--danger);
}

.remove-all {
  margin-top: 18px;
  padding: 0;
  border: 0;
  color: #bb404a;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.preview-panel {
  min-width: 0;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #eef0f4;
}

.preview-stage {
  position: relative;
  width: 100%;
  min-height: 450px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: white;
  box-shadow: inset 0 0 0 1px #dfe3e9;
}

.checkerboard {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #dfe2e8 25%, transparent 25%),
    linear-gradient(-45deg, #dfe2e8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe2e8 75%),
    linear-gradient(-45deg, transparent 75%, #dfe2e8 75%);
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}

.preview-stage img {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 48px);
  max-height: 520px;
  object-fit: contain;
  transition: transform 180ms ease;
}

.image-meta {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.control-panel {
  padding: 24px;
  border-left: 1px solid var(--line);
  background: white;
}

.tool-tabs {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1.3fr;
  gap: 4px;
  padding: 4px;
  border-radius: 9px;
  background: #f0f2f6;
}

.tool-tab {
  min-height: 38px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  color: #5a6270;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.tool-tab.active {
  color: #172033;
  background: white;
  box-shadow: 0 2px 9px rgba(22, 33, 57, 0.09);
}

.tool-pane {
  display: none;
  padding: 24px 2px 22px;
}

.tool-pane.active {
  display: block;
}

.field-label,
.tool-pane label,
.export-grid label {
  color: #343b46;
  font-size: 12px;
  font-weight: 620;
}

.field-control,
.crop-grid input {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid #ccd2dc;
  border-radius: 7px;
  color: #1a202b;
  background: white;
}

.dimension-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 38px 1fr;
  gap: 8px;
  align-items: end;
}

.input-suffix {
  height: 42px;
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 30px;
  align-items: center;
  border: 1px solid #ccd2dc;
  border-radius: 7px;
  overflow: hidden;
}

.input-suffix input {
  min-width: 0;
  height: 40px;
  padding: 0 7px 0 11px;
  border: 0;
  outline: 0;
}

.input-suffix span {
  color: #7a8390;
  font-size: 11px;
}

.ratio-lock {
  width: 38px;
  height: 42px;
  padding: 9px;
  border: 1px solid #ccd2dc;
  border-radius: 7px;
  color: #7b8490;
  background: white;
  cursor: pointer;
}

.ratio-lock.active {
  border-color: #82a7ee;
  color: #4d79d1;
  background: #eef4ff;
}

.ratio-lock svg {
  width: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.percentage-field {
  margin-top: 24px;
  display: block;
}

.range-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 12px;
  align-items: center;
}

.range-row input {
  accent-color: var(--blue-dark);
}

.range-row output {
  padding: 6px;
  border-radius: 5px;
  color: #476daf;
  background: #edf3ff;
  font-size: 11px;
  text-align: center;
}

.pane-help {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.crop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.crop-grid label span {
  display: block;
}

.full-width {
  width: 100%;
  margin-top: 18px;
}

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

.transform-grid button {
  min-height: 70px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d3d8e1;
  border-radius: 8px;
  color: #3d4653;
  background: white;
  cursor: pointer;
  font-size: 20px;
}

.transform-grid button:hover {
  border-color: #7fa2e7;
  background: #f3f7ff;
}

.transform-grid span {
  font-size: 11px;
  font-weight: 650;
}

.export-settings {
  padding: 22px 2px 4px;
  border-top: 1px solid #e5e8ed;
}

.export-settings h2 {
  margin: 0 0 16px;
  font-size: 14px;
}

.export-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 12px;
}

.range-row.compact {
  height: 42px;
  margin-top: 8px;
  grid-template-columns: 1fr 46px;
}

.resize-button {
  width: 100%;
  height: 50px;
  margin-top: 24px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--blue-dark);
  cursor: pointer;
  font-weight: 700;
}

.resize-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.result-panel {
  margin-top: 24px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #badfc7;
  border-radius: 12px;
  background: #f0fbf4;
}

.result-panel > div {
  display: flex;
  align-items: center;
  gap: 15px;
}

.result-check {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: #3cab67;
  font-size: 21px;
}

.result-panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.result-panel p {
  margin: 0;
  color: #567061;
  font-size: 12px;
}

footer {
  padding: 68px max(28px, calc((100vw - 1180px) / 2)) 26px;
  border-top: 1px solid #e3e6eb;
  background: #fafbfc;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.5fr;
  gap: 48px;
}

.footer-grid h2 {
  margin: 0 0 18px;
  font-size: 14px;
}

.footer-grid > div > a:not(.brand) {
  margin: 11px 0;
  display: block;
  color: #5e6672;
  font-size: 13px;
  text-decoration: none;
}

.footer-grid > div > a:hover {
  color: var(--blue-dark);
}

.footer-about p {
  max-width: 320px;
  color: #717986;
  font-size: 13px;
  line-height: 1.6;
}

.footer-brand {
  margin-bottom: 22px;
}

.footer-bottom {
  margin-top: 52px;
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #e2e6ec;
  color: #848b96;
  font-size: 12px;
}

@media (max-width: 1120px) {
  .site-header {
    padding: 0 24px;
    grid-template-columns: 190px 1fr auto;
  }

  .main-nav {
    gap: 18px;
  }

  .editor-layout {
    grid-template-columns: 170px minmax(300px, 1fr) 340px;
  }
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .mobile-menu {
    display: block;
    justify-self: end;
  }

  .main-nav,
  .header-actions {
    display: none;
  }

  .main-nav.open {
    position: absolute;
    top: 64px;
    right: 16px;
    left: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    border: 1px solid #e0e4eb;
    border-radius: 12px;
    background: white;
    box-shadow: var(--shadow);
  }

  .hero {
    min-height: 570px;
  }

  .dropzone {
    margin-top: 90px;
  }

  .features {
    grid-template-columns: repeat(2, 1fr);
  }

  .editor-layout {
    grid-template-columns: 150px 1fr;
  }

  .control-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

@media (max-width: 620px) {
  .site-header {
    height: 58px;
    padding: 0 16px;
  }

  .main-nav.open {
    top: 58px;
  }

  .hero {
    min-height: 540px;
    padding: 30px 16px 0;
  }

  .hero-heading h1 {
    font-size: 25px;
  }

  .hero-heading p {
    font-size: 17px;
  }

  .dropzone {
    width: 100%;
    height: 310px;
    margin-top: 72px;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 52px;
  }

  .how-to {
    padding: 36px 25px;
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .editor {
    padding: 30px 14px 52px;
  }

  .editor-heading {
    align-items: start;
    flex-direction: column;
  }

  .editor-layout {
    display: flex;
    flex-direction: column;
  }

  .image-queue {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .image-list {
    flex-direction: row;
    overflow-x: auto;
  }

  .queue-item {
    min-width: 180px;
  }

  .preview-panel {
    padding: 16px;
  }

  .preview-stage {
    min-height: 330px;
  }

  .control-panel {
    padding: 18px;
  }

  .result-panel,
  .footer-bottom {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }

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

/* Extended local toolbox */
body,
.site-header,
.editor,
.editor-layout,
.image-queue,
.control-panel,
.preview-panel,
.preview-stage,
footer {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

body[data-theme="dark"] {
  --ink: #edf2fb;
  --muted: #aeb8c8;
  --line: #354052;
  --surface: #111722;
  --surface-soft: #18202d;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  color: var(--ink);
  background: var(--surface);
}

body[data-theme="dark"] .site-header,
body[data-theme="dark"] .editor-layout,
body[data-theme="dark"] .control-panel,
body[data-theme="dark"] .nav-popover,
body[data-theme="dark"] .field-control,
body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select,
body[data-theme="dark"] .button-secondary,
body[data-theme="dark"] .button-quiet,
body[data-theme="dark"] .transform-grid button {
  color: #edf2fb;
  border-color: #354052;
  background: #18202d;
}

body[data-theme="dark"] .editor,
body[data-theme="dark"] .image-queue,
body[data-theme="dark"] .preview-panel,
body[data-theme="dark"] footer {
  color: #edf2fb;
  border-color: #354052;
  background: #111722;
}

body[data-theme="dark"] .preview-stage {
  background: #202938;
}

body[data-theme="dark"] .brand,
body[data-theme="dark"] .main-nav button,
body[data-theme="dark"] .footer-grid button {
  color: #edf2fb;
}

.brand-button,
.main-nav button,
.footer-grid button {
  padding: 0;
  border: 0;
  color: #050507;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.brand-button {
  justify-self: start;
}

.main-nav {
  align-self: stretch;
}

.nav-menu {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-menu > button {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  font-weight: 520;
}

.nav-menu > button:hover {
  color: var(--blue-dark);
}

.nav-popover {
  position: absolute;
  z-index: 50;
  top: 55px;
  left: -16px;
  width: 230px;
  padding: 9px;
  display: none;
  border: 1px solid #e0e5ee;
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow);
}

.nav-menu:hover .nav-popover,
.nav-menu:focus-within .nav-popover {
  display: grid;
}

.nav-popover-wide {
  width: 410px;
  grid-template-columns: 1fr 1fr;
}

.nav-popover button {
  padding: 10px 12px;
  border-radius: 7px;
  color: #343b46;
  text-align: left;
  font-size: 13px;
}

.nav-popover button:hover {
  color: var(--blue-dark);
  background: #eef4ff;
}

.header-actions {
  gap: 12px;
  align-items: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
}

.local-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: #a84232;
  background: #fff0eb;
  font-size: 11px;
  font-weight: 720;
}

.hero {
  min-height: 590px;
}

.hero-heading .eyebrow {
  display: inline-block;
  margin-bottom: 8px;
}

.tool-catalog {
  width: min(1180px, calc(100vw - 48px));
  margin: 18px auto 110px;
}

.section-heading {
  max-width: 620px;
  margin: 0 auto 38px;
  text-align: center;
}

.section-heading h2 {
  margin: 7px 0 9px;
  font-size: 30px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.tool-grid button {
  min-height: 142px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.tool-grid button:hover {
  border-color: #91afe9;
  box-shadow: 0 12px 34px rgba(55, 86, 143, 0.12);
  transform: translateY(-3px);
}

.tool-grid button > span {
  min-width: 36px;
  height: 30px;
  color: var(--blue-dark);
  font-size: 22px;
  font-weight: 750;
}

.tool-grid strong {
  margin-top: 12px;
  font-size: 14px;
}

.tool-grid small {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.4;
}

.editor-heading-actions,
.button-row,
.result-actions {
  display: flex;
  gap: 10px;
}

.queue-item canvas {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #eef0f4;
  object-fit: cover;
}

.preview-panel {
  position: relative;
  justify-content: flex-start;
}

.preview-toolbar {
  width: 100%;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.preview-toolbar button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.preview-stage canvas {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 36px);
  max-height: 530px;
  object-fit: contain;
}

.crop-overlay {
  position: absolute;
  z-index: 2;
  border: 2px solid white;
  box-shadow: 0 0 0 9999px rgba(9, 15, 27, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.crop-overlay i {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid white;
  background: var(--blue-dark);
}

.crop-overlay i:nth-child(1) { top: -7px; left: -7px; }
.crop-overlay i:nth-child(2) { top: -7px; right: -7px; }
.crop-overlay i:nth-child(3) { bottom: -7px; left: -7px; }
.crop-overlay i:nth-child(4) { right: -7px; bottom: -7px; }

.control-panel {
  overflow-y: auto;
  max-height: 760px;
}

.mode-heading {
  padding-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.mode-heading > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 18px;
  font-weight: 750;
}

.mode-heading strong,
.mode-heading small {
  display: block;
}

.mode-heading small {
  margin-top: 3px;
  color: var(--muted);
}

.control-section {
  padding: 20px 2px 22px;
}

.control-section > label {
  margin-bottom: 18px;
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 620;
}

.control-section > label > span,
.export-grid label > span {
  display: block;
  margin-bottom: 7px;
}

.control-section input:not([type="range"]):not([type="checkbox"]):not([type="color"]),
.control-section textarea,
.crop-grid input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #ccd2dc;
  border-radius: 7px;
  color: #1a202b;
  background: white;
  resize: vertical;
}

.toggle-row {
  flex-direction: row !important;
  gap: 9px;
  align-items: center;
}

.toggle-row span {
  margin: 0 !important;
}

.color-input {
  width: 100%;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.color-input.large {
  height: 70px;
}

.color-readout {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 34px auto auto 1fr 1fr;
  gap: 8px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.color-readout button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  cursor: pointer;
}

.palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.palette button {
  aspect-ratio: 1;
  border: 2px solid white;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.batch-results {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.batch-result {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12px;
}

.batch-result a {
  color: var(--blue-dark);
  font-weight: 700;
}

.footer-grid > div > button {
  margin: 11px 0;
  display: block;
  color: #5e6672;
  font-size: 13px;
  text-align: left;
}

/* Polished navigation and uploader controls */
.site-header {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  grid-template-columns: 190px minmax(460px, 1fr) 190px;
  border-bottom-color: #e9edf3;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
}

.main-nav {
  justify-self: center;
  gap: 4px;
}

.nav-menu > button {
  min-height: 40px;
  padding: 9px 12px;
  gap: 6px;
  border-radius: 9px;
  color: #20242c;
  font-size: 14px;
  font-weight: 600;
  transition: color 140ms ease, background-color 140ms ease;
}

.nav-menu > button:hover,
.nav-menu:focus-within > button {
  color: var(--blue-dark);
  background: #f3efff;
}

.nav-chevron {
  width: 16px;
  height: 16px;
  display: inline-grid;
  flex: 0 0 16px;
  place-items: center;
  color: #747d8b;
  transition: transform 160ms ease, color 160ms ease;
}

.nav-chevron svg,
.select-chevron svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-menu:hover .nav-chevron,
.nav-menu:focus-within .nav-chevron {
  color: var(--blue-dark);
  transform: rotate(180deg);
}

.nav-popover {
  top: calc(100% - 5px);
  left: 0;
  padding: 8px;
  border-color: #e4e9f1;
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(30, 45, 74, 0.14);
}

.nav-popover button {
  min-height: 38px;
  padding: 9px 11px;
}

.hero {
  min-height: 560px;
  padding-top: 42px;
}

.hero-heading {
  max-width: 760px;
  margin: 0 auto;
}

.hero-heading p {
  max-width: 680px;
  margin-right: auto;
  margin-left: auto;
  color: #303641;
  line-height: 1.45;
}

.dropzone {
  height: 292px;
  margin-top: 78px;
  border-width: 10px;
  border-radius: 18px;
  outline-offset: -22px;
  box-shadow: 0 20px 50px rgba(83, 57, 173, 0.22);
}

.select-button {
  width: 236px;
  min-width: 236px;
  height: 56px;
  padding: 0 16px;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  gap: 10px;
  border: 1px solid rgba(21, 35, 59, 0.08);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(57, 37, 116, 0.18);
  font-weight: 650;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.select-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 32px rgba(57, 37, 116, 0.24);
}

.select-button > .select-file-icon {
  width: 32px;
  height: 32px;
  padding: 7px;
  justify-self: start;
  border-radius: 9px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  stroke-width: 1.8;
}

.select-chevron {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-left: 0;
  color: #5e6877;
  font-size: 0;
}

.select-button:hover .select-chevron {
  color: var(--blue-dark);
  background: transparent;
}

body[data-theme="dark"] .nav-menu > button {
  color: #edf2fb;
}

body[data-theme="dark"] .nav-menu > button:hover,
body[data-theme="dark"] .nav-menu:focus-within > button,
body[data-theme="dark"] .select-button:hover .select-chevron {
  background: transparent;
}

@media (max-width: 1120px) {
  .site-header {
    padding: 0 22px;
    grid-template-columns: 165px minmax(430px, 1fr) 44px;
  }

  .main-nav { gap: 0; }
  .nav-menu > button { padding: 8px; }
  .local-badge { display: none; }
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .site-header {
    padding: 0 20px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .nav-menu { height: auto; display: block; }
  .nav-menu > button { width: 100%; padding: 10px 12px; justify-content: space-between; }
  .nav-popover,
  .nav-popover-wide { position: static; width: 100%; margin-top: 7px; grid-template-columns: 1fr 1fr; box-shadow: none; }
  .nav-menu:focus-within .nav-popover { display: grid; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .hero { min-height: 520px; padding-top: 34px; }
  .dropzone { height: 290px; margin-top: 58px; border-radius: 14px; }
  .select-button { width: 232px; min-width: 232px; }
  .tool-catalog { width: calc(100vw - 28px); }
  .tool-grid { grid-template-columns: 1fr; }
  .editor-heading-actions { width: 100%; }
  .editor-heading-actions .button { flex: 1; }
  .color-readout { grid-template-columns: 34px 1fr auto; }
  .batch-result { grid-template-columns: 1fr auto; }
  .ad-shell { width: calc(100vw - 28px); min-height: 272px; }
  .ad-mount,
  .ad-mount .adsbygoogle { min-height: 250px; }
}

.legal-body {
  min-height: 100vh;
  background: var(--surface-soft);
}

.legal-header {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 920px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.legal-header > a:last-child {
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.legal-page {
  width: min(920px, calc(100vw - 32px));
  margin: 40px auto 72px;
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.legal-page h1 { margin: 8px 0 12px; font-size: clamp(32px, 5vw, 48px); }
.legal-page h2 { margin: 34px 0 10px; font-size: 20px; }
.legal-page p,
.legal-page li { color: #4e485e; line-height: 1.75; }
.legal-page a { color: var(--blue-dark); }
.legal-page .updated { margin-top: 0; color: var(--muted); font-size: 13px; }
.legal-page .notice { padding: 16px 18px; border-radius: 12px; background: var(--blue-soft); }
.legal-links { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 18px; }
