@font-face {
  font-family: "LogoHandCN";
  src: url("./assets/fonts/ZCOOLKuaiLe-Regular.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "LogoSkeletonCN";
  src: url("./assets/fonts/ZCOOLQingKeHuangYou-Regular.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "LogoDesignedCN";
  src: url("./assets/fonts/LongCang-Regular.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "LogoScriptEN";
  src: url("./assets/fonts/PrincessSofia-Regular.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "LogoHandEN";
  src: url("./assets/fonts/Kalam-Bold.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 700;
}

:root {
  color-scheme: light;
  --ink: #17232d;
  --muted: #697680;
  --line: #dfe3e2;
  --paper: #f4f1eb;
  --panel: #fffdf9;
  --white: #ffffff;
  --blue: #0962b5;
  --blue-dark: #075792;
  --sky: #44a5db;
  --yellow: #fcc641;
  --shadow: 0 22px 55px rgba(31, 45, 55, 0.09);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 4%, rgba(58, 184, 233, 0.12), transparent 22rem),
    radial-gradient(circle at 93% 94%, rgba(255, 197, 47, 0.13), transparent 20rem),
    var(--paper);
  font-family:
    Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei UI", "PingFang SC",
    "LogoHandCN", "LogoSkeletonCN", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="color"],
input[type="range"],
summary {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(58, 184, 233, 0.34);
  outline-offset: 2px;
}

.app-shell {
  display: flex;
  width: min(1760px, 100%);
  height: 100vh;
  min-height: 0;
  margin: 0 auto;
  padding: 22px 28px 34px;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 58px;
  margin-bottom: 18px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(8, 107, 182, 0.23);
  font-size: 25px;
  transform: rotate(-5deg);
}

.brand strong {
  display: block;
  overflow: hidden;
  font-size: 17px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  min-height: 0;
  overflow: hidden;
  flex: 1;
  border: 1px solid rgba(207, 211, 210, 0.9);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 30px 30px 26px;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  border-left: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.98);
}

.section-title,
.preview-toolbar,
.export-bar,
.toggle-row {
  display: flex;
  align-items: center;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h2,
p {
  margin-top: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #56636c;
  background: #fff;
  font-size: 21px;
  transition: 160ms ease;
}

.icon-button:hover {
  color: var(--blue);
  border-color: #b7d8ec;
  transform: rotate(-14deg);
}

.control-section {
  margin-top: 26px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.control-section.first-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section-title {
  gap: 9px;
  margin-bottom: 17px;
}

.section-title h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.section-title .icon-button {
  width: 32px;
  height: 32px;
  margin-left: auto;
  border-radius: 10px;
  font-size: 18px;
}

.step-number {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: #eaf5fb;
  font-size: 9px;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field > span,
.range-field > span {
  display: flex;
  justify-content: space-between;
  color: #54616a;
  font-size: 11px;
  font-weight: 700;
}

.field output {
  color: #97a0a6;
  font-weight: 600;
}

.field input,
.field select,
.scale-select select {
  width: 100%;
  height: 43px;
  border: 1px solid #d7dcdb;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  transition: 150ms ease;
}

.field input {
  padding: 0 13px;
}

.field select,
.scale-select select {
  padding: 0 34px 0 12px;
}

.field input:hover,
.field select:hover,
.scale-select select:hover {
  border-color: #b8c5ca;
}

.field input:focus,
.field select:focus,
.scale-select select:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(58, 184, 233, 0.1);
}

.canvas-ratio-field {
  gap: 9px;
}

.canvas-ratio-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.canvas-ratio-option {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  padding: 5px 3px 4px;
  place-items: center;
  border: 1px solid #dde2e1;
  border-radius: 10px;
  color: #758087;
  background: #f0f2f1;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  transition: 140ms ease;
}

.canvas-ratio-option:hover:not(:disabled) {
  color: #4c5d66;
  border-color: #bac9cc;
  background: #e9edec;
}

.canvas-ratio-option.active {
  color: var(--blue);
  border-color: rgba(9, 98, 181, 0.34);
  background: #eaf4fa;
  box-shadow: 0 0 0 2px rgba(9, 98, 181, 0.07);
}

.canvas-ratio-option:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.ratio-icon {
  display: grid;
  width: 30px;
  height: 25px;
  place-items: center;
}

.ratio-shape {
  display: grid;
  border: 1px solid #929b9f;
  border-radius: 2px;
  place-items: center;
  color: #747f84;
  background: #b7bdc0;
  font-style: normal;
  font-size: 8px;
}

.active .ratio-shape {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(9, 98, 181, 0.18);
}

.ratio-banner {
  width: 28px;
  height: 13px;
}

.ratio-landscape {
  width: 27px;
  height: 16px;
}

.ratio-logo {
  width: 27px;
  height: 19px;
}

.ratio-square {
  width: 22px;
  height: 22px;
}

.ratio-ultrawide {
  width: 29px;
  height: 14px;
}

.ratio-auto {
  width: 22px;
  height: 22px;
  border-style: dashed;
  background: transparent;
}

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

.example-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
  color: #8b969c;
  font-size: 10px;
}

.text-button {
  padding: 5px 9px;
  border: 0;
  border-radius: 999px;
  color: #5c6c76;
  background: #f0f2f1;
  font-size: 10px;
  font-weight: 700;
}

.text-button:hover {
  color: var(--blue);
  background: #e9f5fb;
}

.range-field {
  display: grid;
  gap: 8px;
  margin: 8px 0 17px;
}

.range-field output {
  min-width: 48px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--blue);
  background: #eaf5fb;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 6px 0;
  border-radius: 99px;
  appearance: none;
  background: linear-gradient(
    90deg,
    var(--blue) 0 var(--range-progress, 50%),
    #dfe4e4 var(--range-progress, 50%) 100%
  );
}

input[type="range"]::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  appearance: none;
  background: var(--blue);
  box-shadow: 0 2px 7px rgba(4, 78, 129, 0.25);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 2px 7px rgba(4, 78, 129, 0.25);
}

.toggle-row {
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
}

.artwork-transform {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #dfe5e5;
  border-radius: 14px;
  background: #f8faf9;
}

.precision-summary,
.transform-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.precision-summary {
  min-height: 44px;
  padding: 0 14px;
  color: #53616a;
  list-style: none;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.precision-summary::-webkit-details-marker {
  display: none;
}

.precision-summary:hover {
  color: var(--blue);
}

.precision-chevron {
  color: #869198;
  font-size: 15px;
  transition: transform 160ms ease;
}

details[open] > .precision-summary .precision-chevron {
  transform: rotate(180deg);
}

.precision-controls {
  padding: 13px 14px 2px;
  border-top: 1px solid #e3e8e7;
}

.precision-disclosure {
  margin-top: 13px;
  overflow: hidden;
  border: 1px solid #dfe5e5;
  border-radius: 14px;
  background: #f8faf9;
}

.transform-heading {
  margin-bottom: 7px;
}

.transform-heading strong {
  color: #3f4e57;
  font-size: 11px;
}

.transform-heading button {
  padding: 5px 9px;
  border: 1px solid #d7dfdf;
  border-radius: 999px;
  color: #66747c;
  background: #fff;
  font-size: 9px;
  font-weight: 700;
}

.transform-heading button:hover {
  color: var(--blue);
  border-color: #b7d8ec;
}

.artwork-position-grid {
  gap: 14px;
}

.artwork-position-grid .range-field > span {
  gap: 6px;
}

.drag-target-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d9dfdf;
  border-radius: 10px;
  background: #eef2f1;
}

.drag-target-switch button {
  min-width: 48px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  color: #77838a;
  background: transparent;
  font-size: 9px;
  font-weight: 800;
}

.drag-target-switch button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 2px 7px rgba(30, 48, 58, 0.09);
}

.drag-target-switch button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.switch-label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #4f5d65;
  font-size: 11px;
  font-weight: 700;
}

.switch-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 99px;
  background: #ccd3d4;
  transition: 150ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  content: "";
  transition: 150ms ease;
}

.switch-label input:checked + .switch {
  background: var(--blue);
}

.switch-label input:checked + .switch::after {
  transform: translateX(14px);
}

.switch-label input:focus-visible + .switch {
  outline: 3px solid rgba(58, 184, 233, 0.34);
  outline-offset: 2px;
}

.shuffle-button {
  padding: 8px 10px;
  border: 1px solid #d7dcdb;
  border-radius: 10px;
  color: #58666e;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.shuffle-button span {
  margin-right: 4px;
  color: var(--yellow);
}

.shuffle-button:hover {
  color: var(--blue);
  border-color: #b7d8ec;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.color-control {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.color-control input {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: none;
}

.color-control input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-control input::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}

.color-control strong,
.color-control small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-control strong {
  font-size: 10px;
}

.color-control small {
  margin-top: 2px;
  color: #8b969c;
  font-size: 8px;
}

.overlay-upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-bottom: 10px;
}

.upload-button,
.remove-layer-button,
.layer-reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: 150ms ease;
}

.upload-button {
  position: relative;
  gap: 6px;
  overflow: hidden;
  border: 1px dashed #9fcbe2;
  color: var(--blue);
  background: #f2faff;
}

.upload-button:hover {
  border-color: var(--blue);
  background: #e9f6fd;
}

.upload-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-button:focus-within {
  outline: 3px solid rgba(58, 184, 233, 0.22);
  outline-offset: 2px;
}

.remove-layer-button,
.layer-reset-button {
  border: 1px solid #d7dcdb;
  color: #5a6870;
  background: #fff;
}

.remove-layer-button {
  padding: 0 13px;
}

.remove-layer-button:hover:not(:disabled),
.layer-reset-button:hover {
  color: var(--blue);
  border-color: #a9d2e7;
}

.remove-layer-button:disabled {
  color: #aeb6ba;
  cursor: not-allowed;
  background: #f5f6f5;
}

.overlay-file-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.overlay-thumbnail-wrap {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  color: #91a1aa;
  background:
    linear-gradient(45deg, #edf0ef 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(-45deg, #edf0ef 25%, transparent 25%) 0 6px / 12px 12px,
    linear-gradient(45deg, transparent 75%, #edf0ef 75%) 6px -6px / 12px 12px,
    linear-gradient(-45deg, transparent 75%, #edf0ef 75%) -6px 0 / 12px 12px,
    #fff;
}

.overlay-thumbnail-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.overlay-file-card > span:last-child {
  min-width: 0;
}

.overlay-file-card strong,
.overlay-file-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overlay-file-card strong {
  color: #34434c;
  font-size: 10px;
}

.overlay-file-card small {
  margin-top: 3px;
  color: #8b969c;
  font-size: 8px;
}

.overlay-controls {
  margin-top: 13px;
  padding: 12px 11px 2px;
  border: 1px solid #e1e6e5;
  border-radius: 12px;
  background: #fbfcfb;
}

.overlay-controls[hidden] {
  display: none;
}

.overlay-top-controls {
  align-items: end;
}

.overlay-top-controls .field {
  margin-bottom: 10px;
}

.layer-reset-button {
  min-height: 43px;
  margin-bottom: 10px;
}

.compact-range {
  margin: 4px 0 13px;
}

.overlay-position-grid {
  gap: 14px;
}

.overlay-position-grid .range-field > span {
  gap: 6px;
}

.overlay-hint {
  margin: 10px 2px 0;
  color: #89959b;
  font-size: 9px;
  line-height: 1.55;
}

.canvas-frame.dragging #logoCanvas {
  cursor: grabbing;
}

.canvas-frame.manipulating .canvas-selection {
  border-style: solid;
}

.reference-card {
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfbf8;
}

.reference-card summary {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  list-style: none;
}

.reference-card summary::-webkit-details-marker {
  display: none;
}

.reference-card summary > span:nth-child(2) {
  flex: 1;
}

.reference-card strong,
.reference-card small {
  display: block;
}

.reference-card strong {
  font-size: 10px;
}

.reference-card small {
  margin-top: 2px;
  color: #8a949a;
  font-size: 8px;
}

.reference-icon {
  color: var(--blue);
  font-size: 19px;
}

.chevron {
  color: #8b959b;
  transition: 160ms ease;
}

.reference-card[open] .chevron {
  transform: rotate(180deg);
}

.reference-preview {
  margin: 0 10px 10px;
  padding: 10px;
  border-radius: 10px;
  background-color: #f1f1ee;
  background-image:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.reference-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.preview-panel {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  padding: 30px 34px 26px;
  overflow: hidden;
  flex-direction: column;
  background:
    linear-gradient(rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.74)),
    radial-gradient(circle at 70% 20%, rgba(58, 184, 233, 0.14), transparent 36rem),
    #f7f7f3;
}

.preview-toolbar {
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.preview-toolbar h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.background-switcher {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.background-button {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  color: #778289;
  background: transparent;
  font-size: 9px;
  font-weight: 700;
}

.background-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 8px rgba(30, 42, 49, 0.09);
}

.checker-swatch,
.light-swatch,
.dark-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid #cad0d1;
  border-radius: 3px;
}

.checker-swatch {
  background:
    linear-gradient(45deg, #cfd5d7 25%, transparent 25%) 0 0 / 6px 6px,
    linear-gradient(-45deg, #cfd5d7 25%, transparent 25%) 0 3px / 6px 6px,
    linear-gradient(45deg, transparent 75%, #cfd5d7 75%) 3px -3px / 6px 6px,
    #fff;
}

.light-swatch {
  background: #fff;
}

.dark-swatch {
  border-color: #27323a;
  background: #19232b;
}

.canvas-stage {
  display: grid;
  width: 100%;
  min-height: 0;
  flex: 1 1 0;
  place-items: center;
}

.canvas-frame {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  aspect-ratio: var(--canvas-ratio, 1600 / 743);
  flex: 0 0 auto;
  place-items: stretch;
  overflow: hidden;
  border: 1px solid #d9dddd;
  border-radius: 20px;
  user-select: none;
  transition: background-color 180ms ease;
}

.canvas-frame.checker {
  background-color: #f5f5f3;
  background-image:
    linear-gradient(45deg, #e0e2e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e2e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e2e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e2e0 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.canvas-frame.light {
  background: #fff;
}

.canvas-frame.dark {
  border-color: #27323a;
  background: #172129;
}

#logoCanvas {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: fill;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 8px 8px rgba(6, 50, 82, 0.05));
}

.canvas-object-tools {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 5px 6px 5px 9px;
  border: 1px solid rgba(201, 211, 214, 0.88);
  border-radius: 13px;
  color: #617079;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 5px 18px rgba(27, 44, 54, 0.09);
  backdrop-filter: blur(10px);
  font-size: 9px;
  font-weight: 800;
}

.canvas-object-tools .drag-target-switch {
  padding: 2px;
  border: 0;
}

.canvas-object-tools .drag-target-switch button {
  min-width: 43px;
  padding: 5px 8px;
}

.canvas-reset-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #d7dfdf;
  border-radius: 8px;
  color: #65747c;
  background: #fff;
  font-size: 15px;
  line-height: 1;
}

.canvas-reset-button:hover {
  color: var(--blue);
  border-color: #acd3e9;
}

.canvas-selection {
  position: absolute;
  z-index: 4;
  min-width: 36px;
  min-height: 28px;
  border: 1.5px dashed var(--blue);
  border-radius: 5px;
  pointer-events: none;
  transform-origin: center;
}

.canvas-selection[hidden] {
  display: none;
}

.canvas-selection-label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  min-width: max-content;
  padding: 4px 7px;
  border-radius: 7px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 9px rgba(8, 89, 148, 0.22);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.rotation-stem {
  display: none;
}

.canvas-handle {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 10px rgba(6, 61, 99, 0.28);
  pointer-events: auto;
  touch-action: none;
  font-size: 12px;
  line-height: 1;
}

.rotation-handle {
  top: 6px;
  right: 6px;
  cursor: grab;
}

.rotation-handle:active {
  cursor: grabbing;
}

.scale-handle {
  right: 6px;
  bottom: 6px;
  cursor: nwse-resize;
}

.dark .canvas-object-tools {
  color: #d0d9dd;
  border-color: rgba(89, 106, 116, 0.82);
  background: rgba(20, 30, 37, 0.84);
}

.dark .canvas-object-tools .drag-target-switch {
  background: rgba(255, 255, 255, 0.09);
}

.dark .canvas-reset-button {
  color: #d3dde1;
  border-color: #53636c;
  background: #26343c;
}

.canvas-corner-label {
  position: absolute;
  right: 13px;
  bottom: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  color: #5d6a72;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(8px);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dark .canvas-corner-label {
  color: #c5ced3;
  background: rgba(16, 23, 28, 0.72);
}

.preview-caption {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  margin: 10px 2px 16px;
  color: #7c878e;
  font-size: 9px;
  font-weight: 600;
}

.preview-caption > span {
  display: flex;
  gap: 6px;
  align-items: center;
}

.canvas-edit-icon {
  color: var(--blue);
  font-style: normal;
  font-size: 11px;
}

.export-bar {
  flex: 0 0 auto;
  gap: 14px;
  min-height: 68px;
  padding: 11px 12px 11px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 7px 22px rgba(37, 49, 56, 0.05);
}

.export-copy {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 155px;
  margin-right: auto;
}

.export-icon {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 11px;
  color: var(--blue);
  background: #eaf5fb;
  font-size: 18px;
}

.export-copy strong,
.export-copy small {
  display: block;
}

.export-copy strong {
  font-size: 11px;
}

.export-copy small {
  margin-top: 2px;
  color: #849097;
  font-size: 8px;
}

.scale-select {
  display: grid;
  gap: 3px;
  min-width: 120px;
}

.scale-select span {
  color: #849097;
  font-size: 8px;
  font-weight: 700;
}

.scale-select select {
  height: 31px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
}

.download-button {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 17px rgba(8, 107, 182, 0.22);
  font-size: 11px;
  font-weight: 800;
  transition: 160ms ease;
}

.download-button span {
  font-size: 17px;
  line-height: 1;
}

.download-button:hover {
  background: var(--blue-dark);
  box-shadow: 0 10px 23px rgba(8, 107, 182, 0.29);
  transform: translateY(-1px);
}

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

.download-button.loading {
  pointer-events: none;
  opacity: 0.7;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 28px;
  bottom: 28px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 17px;
  border-radius: 13px;
  color: #fff;
  background: #17232d;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast span:first-child {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  color: #17232d;
  background: var(--yellow);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .control-panel {
    padding: 26px 23px;
  }

  .preview-panel {
    padding: 26px 25px 22px;
  }

  .export-copy {
    min-width: auto;
  }

  .export-copy span:last-child {
    display: none;
  }
}

@media (max-width: 820px) {
  html,
  body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body {
    min-height: 0;
  }

  .app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 14px;
  }

  .workspace {
    display: flex;
    height: auto;
    min-height: 0;
    overflow: hidden;
    flex: 1;
    flex-direction: column-reverse;
    border-radius: 20px;
  }

  .control-panel {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 0;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .preview-panel {
    height: min(52vh, 500px);
    height: min(52dvh, 500px);
    min-height: 0;
    overflow: hidden;
    flex: 0 0 auto;
  }

  .canvas-stage {
    display: grid;
    min-height: 0;
    flex: 1 1 0;
  }

  .canvas-frame {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 8px;
  }

  .topbar {
    min-height: 46px;
    margin-bottom: 9px;
    padding: 0 4px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 21px;
  }

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

  .workspace {
    border-radius: 17px;
  }

  .preview-panel {
    padding: 14px 12px 12px;
  }

  .control-panel {
    padding: 20px 14px 24px;
  }

  .preview-toolbar {
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-direction: row;
  }

  .background-switcher {
    width: auto;
    flex: 0 0 auto;
  }

  .background-button {
    flex: 1;
    justify-content: center;
  }

  .canvas-frame {
    min-height: 0;
    aspect-ratio: var(--canvas-ratio, 1600 / 743);
    flex: none;
    border-radius: 14px;
  }

  .canvas-object-tools {
    top: 8px;
    left: 8px;
    gap: 4px;
    padding: 4px 5px 4px 7px;
  }

  .canvas-object-tools > span {
    display: none;
  }

  .canvas-object-tools .drag-target-switch button {
    min-width: 39px;
    padding: 5px 6px;
  }

  .canvas-reset-button {
    width: 26px;
    height: 26px;
  }

  .canvas-selection-label,
  .canvas-corner-label {
    display: none;
  }

  #logoCanvas {
    width: 100%;
    max-width: none;
    max-height: none;
  }

  .field input,
  .field select {
    min-height: 46px;
  }

  input[type="range"] {
    height: 28px;
    margin: 0;
    background-size: 100% 4px;
    background-position: center;
    background-repeat: no-repeat;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 21px;
    height: 21px;
  }

  .control-section {
    margin-top: 22px;
    padding-top: 21px;
  }

  .two-column {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .color-grid {
    gap: 6px;
  }

  .color-control {
    justify-content: center;
  }

  .color-control > span {
    display: none;
  }

  .export-bar {
    flex-wrap: wrap;
  }

  .export-copy {
    flex: 1;
  }

  .export-copy span:last-child {
    display: block;
  }

  .scale-select {
    min-width: 112px;
  }

  .download-button {
    width: 100%;
    justify-content: center;
  }

  .preview-caption {
    margin: 6px 2px 8px;
  }

  .preview-caption > span:last-child {
    display: none;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    justify-content: center;
  }
}

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