.paint-open-button {
  color: var(--ink);
  background: #ffffffb8;
  border: 1px solid #ffffffd1;
}

.paint-studio {
  z-index: 12;
  padding: calc(16px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  background: #f8eff6d9;
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
}

.paint-studio[aria-hidden="true"] {
  display: none;
}

.paint-panel {
  width: min(920px, 100%);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  color: var(--ink);
  background: #fffaf6ed;
  border: 1px solid #ffffffd6;
  border-radius: 22px;
  box-shadow: 0 24px 80px #544c7038;
}

.paint-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 0;
}

.paint-title {
  margin: 0;
  color: #e85fa7;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  line-height: 1;
}

.paint-subtitle {
  margin: 6px 0 0;
  color: var(--soft-ink);
  font-size: .94rem;
  line-height: 1.35;
}

.paint-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: #ffffffbf;
  box-shadow: 0 10px 24px #5f547e1f;
  font-weight: 950;
}

.paint-grid {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) minmax(280px, 1.1fr);
  gap: 14px;
  padding: 16px 18px 18px;
}

.paint-preview-wrap,
.paint-tools {
  background: #ffffff8c;
  border: 1px solid #ffffffc7;
  border-radius: 18px;
  padding: 14px;
}

.paint-preview-wrap {
  display: grid;
  gap: 12px;
  align-content: start;
}

.paint-preview-stage {
  min-height: 210px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(90deg, #ffffff80 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(#ffffff80 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, #ffe3f1, #d8f8e9);
  perspective: 780px;
}

.paint-vehicle {
  --paint-rotate: -18deg;
  --paint-body: #ff8fc7;
  --paint-accent: #ffdc83;
  --paint-pattern: none;
  width: 220px;
  height: 120px;
  position: relative;
  transform: rotateX(9deg) rotateY(var(--paint-rotate));
  transform-style: preserve-3d;
  transition: transform .18s ease;
}

.paint-body {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 20px;
  height: 62px;
  border-radius: 18px 22px 14px 14px;
  background-color: var(--paint-body);
  background-image: var(--paint-pattern), linear-gradient(135deg, #ffffff73, transparent 45%, #0000000a);
  background-size: cover;
  box-shadow: inset 0 -8px 0 #4f496817, 0 18px 34px #5f547e2b;
}

.paint-cabin {
  position: absolute;
  left: 72px;
  bottom: 70px;
  width: 82px;
  height: 46px;
  border-radius: 22px 22px 10px 10px;
  background: linear-gradient(135deg, #ffffffd9, #dff7ffbf);
  box-shadow: inset 0 -5px 0 #4f496812;
}

.paint-accent {
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 34px;
  height: 10px;
  border-radius: 999px;
  background: var(--paint-accent);
}

.paint-wheel {
  position: absolute;
  bottom: 5px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1f2230;
  box-shadow: inset 0 0 0 8px #34384a, inset 0 0 0 13px #11131d;
}

.paint-wheel.left {
  left: 42px;
}

.paint-wheel.right {
  right: 42px;
}

.paint-canvas {
  width: 100%;
  aspect-ratio: 5 / 3;
  touch-action: none;
  display: block;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #4f49681f;
}

.paint-tool-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.paint-field {
  display: grid;
  gap: 6px;
  text-align: left;
  color: var(--soft-ink);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.paint-field input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: #ffffffbf;
}

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

.paint-patterns,
.paint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paint-chip,
.paint-save,
.paint-secondary {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 14px;
  font-weight: 950;
  box-shadow: 0 10px 24px #5f547e1f;
}

.paint-chip,
.paint-secondary {
  background: #ffffffc2;
}

.paint-save {
  color: #fff;
  background: linear-gradient(135deg, #ff8fc7, #c8a6ff);
}

.paint-toast {
  min-height: 20px;
  color: #805a86;
  font-size: .86rem;
  font-weight: 900;
}

.color-option[title="Atelierlack"]::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 11px;
  background:
    radial-gradient(circle at 25% 30%, #ffffffa8 0 9%, transparent 10%),
    repeating-linear-gradient(135deg, transparent 0 9px, #ffffff66 9px 13px);
  pointer-events: none;
}

@media (width <= 760px) {
  .paint-grid {
    grid-template-columns: 1fr;
  }

  .paint-preview-stage {
    min-height: 170px;
  }

  .paint-vehicle {
    width: 190px;
    height: 104px;
  }
}

@media (width <= 430px), (height <= 650px) {
  .paint-head {
    padding: 14px 14px 0;
  }

  .paint-grid {
    padding: 12px 14px 14px;
    gap: 10px;
  }

  .paint-preview-wrap,
  .paint-tools {
    padding: 10px;
    border-radius: 15px;
  }

  .paint-tool-row {
    grid-template-columns: 1fr;
  }
}
