.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
}

body {
  font-family: "Manrope", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(247, 249, 251, 0.96), rgba(247, 249, 251, 1)),
    radial-gradient(circle at 18% 12%, rgba(22, 119, 255, 0.07), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(224, 151, 73, 0.10), transparent 27%);
}

.sketch-page {
  padding-bottom: 42px;
}

.sketch-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 4px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #3f6f9f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sketch-hero h1 {
  margin: 0;
  color: #18202b;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 800;
}

.hero-copy {
  max-width: 620px;
  margin: 12px 0 0;
  color: #546274;
  font-size: 15px;
  line-height: 1.7;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  padding: 10px 14px;
  border: 1px solid rgba(22, 119, 255, 0.18);
  border-radius: 999px;
  color: #125fb5;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(0, 89, 199, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.68fr) minmax(0, 1.36fr) 326px;
  gap: 18px;
  align-items: stretch;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(172, 189, 209, 0.34);
  border-radius: 8px;
  box-shadow: 0 26px 58px rgba(29, 62, 98, 0.075);
}

.upload-panel,
.preview-panel,
.controls-panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  color: #202a36;
  font-size: 17px;
  font-weight: 800;
}

.panel-title .material-symbols-outlined {
  color: #1677ff;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 214px;
  overflow: hidden;
  border: 1.5px dashed rgba(83, 106, 134, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.90), rgba(242, 247, 252, 0.92)),
    linear-gradient(150deg, rgba(22, 119, 255, 0.08), transparent 42%),
    linear-gradient(330deg, rgba(224, 151, 73, 0.12), transparent 44%);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: rgba(22, 119, 255, 0.75);
  background: #f7fbff;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#sourcePreview {
  display: none;
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: contain;
  padding: 14px;
}

.drop-zone.has-image #sourcePreview {
  display: block;
}

.upload-hint {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  color: #637184;
  text-align: center;
  padding: 18px;
  z-index: 2;
  pointer-events: none;
}

.drop-zone.has-image .upload-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  flex-direction: row;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(17, 24, 39, 0.58));
  border-radius: 0 0 7px 7px;
}

.drop-zone.has-image .upload-hint .material-symbols-outlined {
  width: auto;
  height: auto;
  padding: 0;
  border-radius: 0;
  color: rgba(255,255,255,0.85);
  background: transparent;
  box-shadow: none;
  font-size: 18px;
}

.drop-zone.has-image .upload-hint strong {
  color: #fff;
  font-size: 13px;
}

.drop-zone.has-image .upload-hint small {
  display: none;
}

.upload-hint .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: #1677ff;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(22, 119, 255, 0.12);
  font-size: 36px;
}

.upload-hint strong {
  color: #263342;
  font-size: 16px;
}

.upload-hint small {
  font-size: 12px;
}

.file-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  margin-top: 12px;
  color: #5b697b;
  font-size: 13px;
}

.file-row.visible {
  display: flex;
}

#fileName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 44px);
}

.file-row button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  color: #69798d;
  background: #eef3f8;
  flex-shrink: 0;
}

.canvas-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 480px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(18, 34, 50, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 34, 50, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #f7f1e8, #eef4f7);
  background-size: 28px 28px, 28px 28px, auto;
}

#resultCanvas {
  width: min(100%, 620px);
  max-height: 520px;
  object-fit: contain;
  filter: drop-shadow(0 20px 28px rgba(67, 58, 42, 0.14));
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: #7b6f5f;
  font-weight: 700;
  pointer-events: none;
}

.empty-state .material-symbols-outlined {
  font-size: 44px;
}

.canvas-shell.has-source .empty-state,
.canvas-shell.has-result .empty-state {
  display: none;
}

.canvas-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 24, 39, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.canvas-status.hidden {
  display: none;
}

.canvas-status .status-icon {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.canvas-status.loading .status-icon {
  display: block;
}

.canvas-shell.has-result .canvas-status {
  opacity: 0;
  transition: opacity 0.25s ease 0.6s;
}

.canvas-shell.has-result:hover .canvas-status {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.fixed-status {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px 999px 0 0;
  color: #fff;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
  font-size: 12px;
  font-weight: 700;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.fixed-status-icon {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.fixed-status.loading .fixed-status-icon {
  display: block;
}

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

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.style-card {
  display: block;
  gap: 10px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid rgba(96, 116, 139, 0.22);
  border-radius: 8px;
  color: #263342;
  background: #f7f9fb;
  text-align: left;
  transition: all 0.18s ease;
}

.style-card strong,
.style-card span {
  display: block;
}

.style-card span {
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.style-card.active {
  border-color: rgba(22, 119, 255, 0.5);
  color: #0f5db8;
  background: #eef6ff;
  box-shadow: inset 3px 0 0 #1677ff;
}

.switch-row,
.range-row {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f8fb;
}

.control-set {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-set.hidden {
  display: none;
}

.switch-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.switch-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-row strong,
.range-row span {
  color: #263342;
  font-size: 14px;
  font-weight: 800;
}

.switch-row small {
  color: #6b7888;
  font-size: 12px;
}

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

.switch-row .toggle-switch-control {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #cfd8e3;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.switch-row .toggle-switch-control::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(28, 38, 52, 0.18);
  transition: transform 0.2s ease;
}

.switch-row input:checked + .toggle-switch-control {
  background: #1677ff;
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.12);
}

.switch-row input:checked + .toggle-switch-control::after {
  transform: translateX(20px);
}

.range-row span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-row input[type="number"] {
  width: 56px;
  padding: 3px 6px;
  border: 1px solid rgba(22, 119, 255, 0.22);
  border-radius: 6px;
  color: #1677ff;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  -moz-appearance: textfield;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.range-row input[type="number"]::-webkit-inner-spin-button,
.range-row input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.range-row input[type="number"]:focus {
  border-color: #1677ff;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.range-row input {
  width: 100%;
  accent-color: #1677ff;
}

.actions {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 10px;
  margin-top: 4px;
}

.secondary-btn,
.primary-action-btn,
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  transition: all 0.18s ease;
}

.secondary-btn {
  color: #334155;
  background: #e9eef4;
}

.primary-action-btn {
  color: #fff;
  background: linear-gradient(145deg, #1677ff, #0f62d9);
  box-shadow: 0 12px 26px rgba(22, 119, 255, 0.24);
}

.download-btn {
  width: 100%;
  color: #0f5db8;
  background: #eaf4ff;
}

.primary-action-btn:not(:disabled):hover,
.download-btn:not(:disabled):hover,
.secondary-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.primary-action-btn:disabled,
.download-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(300px, 90vw);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  color: #fff;
  background: rgba(17, 24, 39, 0.82);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.24s ease;
}

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

.toast.error {
  background: rgba(220, 38, 38, 0.88);
}

.toast.success {
  background: rgba(22, 163, 74, 0.88);
}

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

  .controls-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .controls-panel .panel-title,
  .controls-panel .style-options,
  .controls-panel .switch-row,
  .controls-panel .actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .sketch-page {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 18px;
  }

  .sketch-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: 18px;
    padding-bottom: 12px;
  }

  .sketch-hero h1 {
    font-size: 30px;
  }

  .hero-copy {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.55;
  }

  .hero-badge {
    padding: 8px 11px;
    font-size: 12px;
  }

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

  .drop-zone,
  .canvas-shell {
    min-height: 250px;
  }

  .upload-panel,
  .preview-panel,
  .controls-panel {
    padding: 13px;
  }

  .panel-title {
    margin-bottom: 10px;
  }

  .panel-title h2 {
    font-size: 15px;
  }

  .controls-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .style-options {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .style-card {
    display: block;
    min-height: 86px;
    padding: 12px;
  }

  .style-card strong {
    font-size: 14px;
  }

  .style-card strong,
  .style-card span {
    display: block;
  }

  .style-card span {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
  }

  .switch-row,
  .range-row {
    padding: 12px;
  }

  .switch-row strong,
  .range-row span {
    font-size: 15px;
  }

  .switch-row small {
    font-size: 12px;
  }

  .range-row input {
    min-height: 28px;
  }

  .actions {
    grid-template-columns: 0.8fr 1.2fr;
    gap: 8px;
  }

  .secondary-btn,
  .primary-action-btn,
  .download-btn {
    min-height: 44px;
  }

  .canvas-status {
    display: none;
  }

  .fixed-status.visible {
    display: flex;
    opacity: 1;
  }
}
