.draw-page {
  min-height: 100vh;
}

.draw-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 178, 216, 0.48), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(185, 205, 255, 0.55), transparent 32%),
    radial-gradient(circle at 50% 92%, rgba(255, 236, 184, 0.42), transparent 34%);
  pointer-events: none;
}

.draw-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.62)),
    radial-gradient(circle, rgba(122, 91, 140, 0.11) 1.2px, transparent 1.2px);
  background-size: auto, 18px 18px;
  pointer-events: none;
}

.draw-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.hidden {
  display: none !important;
}

.draw-auth-gate,
.draw-hero,
.draw-panel,
.draw-canvas-card,
.draw-list-section {
  border: 1px solid rgba(98, 68, 96, 0.12);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 238, 0.7)),
    radial-gradient(circle at 0% 0%, rgba(255, 124, 171, 0.13), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(140, 123, 255, 0.15), transparent 34%);
  box-shadow:
    0 24px 70px rgba(74, 48, 92, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
}

.draw-auth-gate {
  max-width: 720px;
  margin: 40px auto;
  padding: 34px;
  text-align: center;
}

.draw-auth-gate h1,
.draw-hero h1 {
  margin: 8px 0 10px;
  color: #35283c;
  letter-spacing: 0.04em;
}

.draw-auth-gate h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.draw-auth-gate p,
.draw-hero p {
  color: #736177;
  line-height: 1.9;
}

.draw-auth-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.draw-user-info,
.draw-status {
  margin: 12px 0 0;
  font-weight: 800;
}

.draw-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 26px;
  padding: 30px;
}

.draw-hero h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.draw-hero p {
  max-width: 700px;
  margin: 0;
}

.draw-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.draw-primary,
.draw-secondary,
.draw-buttons button,
.draw-zoom-buttons button,
.layer-head button,
.layer-actions button,
.draw-card-actions button {
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    background 0.18s ease;
}

.draw-primary {
  border: 0;
  padding: 13px 20px;
  color: #fff;
  background: linear-gradient(135deg, #ff7cab, #8c7bff);
  box-shadow: 0 14px 30px rgba(140, 123, 255, 0.26);
}

.draw-secondary {
  padding: 13px 20px;
  color: #35283c;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(98, 68, 96, 0.14);
}

.draw-primary:hover,
.draw-secondary:hover,
.draw-buttons button:hover,
.draw-zoom-buttons button:hover,
.layer-head button:hover,
.layer-actions button:hover,
.draw-card-actions button:hover {
  transform: translateY(-2px);
}

.draw-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.draw-tools {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
}

.draw-panel {
  padding: 18px;
}

.draw-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #736177;
  font-size: 0.86rem;
  font-weight: 800;
}

.draw-field input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  border-radius: 16px;
  color: #35283c;
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  outline: none;
}

.draw-field input[type="text"]:focus {
  border-color: rgba(140, 123, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(140, 123, 255, 0.12);
}

.draw-tool-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: end;
}

.draw-field.compact {
  margin-bottom: 12px;
}

.draw-field input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  border-radius: 14px;
  background: #fff;
}

.draw-field input[type="range"] {
  width: 100%;
  accent-color: #ff7cab;
}

.draw-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  color: #736177;
  font-weight: 800;
  font-size: 0.9rem;
}

.draw-check input {
  width: 18px;
  height: 18px;
  accent-color: #8c7bff;
}

.draw-zoom-buttons {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  margin: -4px 0 14px;
}

.draw-zoom-buttons button,
.layer-actions button,
.layer-head button {
  padding: 9px 10px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  background: rgba(255, 255, 255, 0.86);
  color: #35283c;
}

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

.draw-buttons button {
  padding: 11px 12px;
  color: #35283c;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(98, 68, 96, 0.14);
}

.draw-buttons button.active {
  color: #fff;
  background: linear-gradient(135deg, #35283c, #8c7bff);
}

.draw-buttons button.save {
  grid-column: 1 / -1;
  color: #fff;
  background: linear-gradient(135deg, #ff7cab, #e8b85f);
  box-shadow: 0 14px 28px rgba(255, 124, 171, 0.22);
}

.draw-note {
  margin: 14px 0 0;
  color: #8a7a8f;
  font-size: 0.78rem;
  line-height: 1.7;
}

.layer-panel {
  padding: 18px;
}

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

.layer-head h2 {
  margin: 3px 0 0;
  color: #35283c;
  font-size: 1.25rem;
}

.layer-head button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 1.25rem;
}

.layer-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 3px;
}

.layer-item {
  display: grid;
  grid-template-columns: 34px 1fr 38px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(98, 68, 96, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.layer-item.active {
  border-color: rgba(140, 123, 255, 0.45);
  background:
    linear-gradient(135deg, rgba(255, 124, 171, 0.16), rgba(140, 123, 255, 0.14)),
    rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(140, 123, 255, 0.14);
}

.layer-select {
  width: 100%;
  border: 0;
  background: transparent;
  color: #35283c;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.layer-eye,
.layer-menu {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(98, 68, 96, 0.12);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.layer-eye.off {
  opacity: 0.38;
}

.layer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.layer-actions .danger {
  grid-column: 1 / -1;
  color: #d94a72;
}

.draw-canvas-card {
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 238, 0.68)),
    rgba(255, 255, 255, 0.86);
}

.draw-canvas-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(98, 68, 96, 0.1);
}

.draw-canvas-head div {
  display: grid;
  gap: 4px;
}

.draw-canvas-head strong {
  color: #35283c;
}

.draw-canvas-head span {
  color: #8a7a8f;
  font-size: 0.84rem;
}

.draw-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  background:
    linear-gradient(45deg, #ded8e6 25%, transparent 25%),
    linear-gradient(-45deg, #ded8e6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ded8e6 75%),
    linear-gradient(-45deg, transparent 75%, #ded8e6 75%);
  background-color: #f7f3fb;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  border-radius: 20px;
}

.draw-canvas-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 24px;
}

.canvas-stack {
  position: relative;
  width: 1240px;
  height: 1754px;
  transform-origin: 0 0;
  will-change: transform;
  touch-action: none;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(48, 40, 58, 0.18);
}

.layer-canvas {
  position: absolute;
  inset: 0;
  width: 1240px;
  height: 1754px;
  display: block;
  touch-action: none;
}

.draw-list-section {
  margin-top: 22px;
  padding: 24px;
}

.draw-section-title {
  margin-bottom: 18px;
}

.draw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.draw-empty {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px dashed rgba(98, 68, 96, 0.22);
  border-radius: 20px;
  color: #8a7a8f;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.draw-card {
  overflow: hidden;
  border: 1px solid rgba(98, 68, 96, 0.12);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 238, 0.7));
  box-shadow: 0 12px 32px rgba(74, 48, 92, 0.1);
}

.draw-card.active {
  outline: 3px solid rgba(140, 123, 255, 0.22);
}

.draw-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.414;
  object-fit: contain;
  background: #fff;
  border-bottom: 1px solid rgba(98, 68, 96, 0.1);
}

.draw-card-body {
  padding: 12px;
}

.draw-card h3 {
  margin: 0 0 4px;
  color: #35283c;
  font-size: 0.98rem;
}

.draw-card time {
  display: block;
  margin-bottom: 10px;
  color: #8a7a8f;
  font-size: 0.76rem;
}

.draw-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.draw-card-actions button {
  padding: 9px 10px;
  border: 1px solid rgba(98, 68, 96, 0.12);
  background: #fff;
  color: #35283c;
  font-size: 0.82rem;
}

.draw-card-actions button.danger {
  grid-column: 1 / -1;
  color: #d94a72;
}

@media (max-width: 860px) {
  .draw-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .draw-layout {
    grid-template-columns: 1fr;
  }

  .draw-tools {
    position: static;
  }

  .draw-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .draw-buttons button.save {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .draw-main {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .draw-hero,
  .draw-panel,
  .draw-list-section,
  .draw-auth-gate {
    border-radius: 22px;
  }

  .draw-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .draw-buttons button.save {
    grid-column: 1 / -1;
  }

  .draw-tool-row {
    grid-template-columns: 76px 1fr;
  }

}

.reference-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 0;
}

.layer-canvas {
  position: absolute;
  inset: 0;
  width: 1240px;
  height: 1754px;
  display: block;
  touch-action: none;
  z-index: 1;
}


.compact-reference-panel {
  padding: 14px;
}

.reference-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.reference-head h2 {
  margin: 2px 0 0;
  color: #35283c;
  font-size: 1.1rem;
}

.reference-clear-btn {
  min-width: 62px;
  padding: 8px 12px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #d94a72;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.reference-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #35283c;
  font-weight: 800;
  cursor: pointer;
}

.reference-file-btn input {
  display: none;
}

.reference-opacity-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
  color: #736177;
  font-size: 0.86rem;
  font-weight: 800;
}

.reference-opacity-row input[type="range"] {
  width: 100%;
  accent-color: #ff7cab;
}

.reference-note {
  margin-top: 8px;
  font-size: 0.74rem;
}

.compact-reference-panel {
  padding: 14px;
  margin: 0 0 14px;
  box-shadow: none;
}

.reference-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.reference-head h2 {
  margin: 2px 0 0;
  color: #35283c;
  font-size: 1.1rem;
}

.reference-clear-btn {
  min-width: 58px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #d94a72;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.reference-file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  margin: 0 0 10px;
  padding: 0 12px;
  border: 1px solid rgba(98, 68, 96, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #35283c;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.reference-file-btn input {
  display: none;
}

.reference-opacity-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #736177;
  font-size: 0.86rem;
  font-weight: 800;
}

.reference-opacity-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #ff7cab;
}

.reference-note {
  margin: 8px 0 0;
  font-size: 0.74rem;
}

.draw-app,
.draw-tools,
.draw-canvas-card,
.draw-canvas-wrap,
.draw-canvas-inner,
.canvas-stack,
.layer-canvas {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.draw-app button,
.draw-app label,
.draw-app span,
.draw-app p,
.draw-app h1,
.draw-app h2,
.draw-app strong {
  -webkit-user-select: none;
  user-select: none;
}

.draw-app input[type="text"],
.draw-app textarea {
  -webkit-user-select: text;
  user-select: text;
}
