:root {
  /* --highlight: rgba(221, 255, 0, 0.3); */
  --highlight: #e8e8e8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #000;
  background: #fff;
  min-height: 100dvh;
  letter-spacing: 0.02em;
}


#p5-canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#p5-canvas-container canvas {
  display: block;
  touch-action: none;
}

#eraser-preview {
  position: fixed;
  pointer-events: none;
  z-index: 4;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.18);
  transform: translate(-50%, -50%);
  display: none;
  transition: width 0.08s ease, height 0.08s ease;
}

header {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 24px 32px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.logo {
  font-weight: 400;
}

.modal-overlay {
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 10;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(2px);
  touch-action: auto;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  max-width: 520px;
  width: 90%;
  padding: 56px 48px;
  background: #fff;
  border: 1px solid #000;
  z-index: 11;
  touch-action: auto;
}

.modal h1 {
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 32px;
}

.modal p {
  margin-bottom: 16px;
}

/* .modal p:last-of-type {
  margin-bottom: 32px;
} */

.modal-footnote {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e5;
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}

.modal-footnote a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal-footnote a:hover {
  color: #000;
}


#save-modal .modal {
  max-width: 400px;
  padding: 48px 40px;
}

#save-modal .modal p {
  margin-bottom: 28px;
}

.save-subscribe label {
  display: block;
  margin-bottom: 14px;
  font-size: 12px;
}

.save-subscribe button:disabled {
  background: #d8d8d8;
  color: #888;
  cursor: default;
}

.save-subscribe button:disabled:hover {
  opacity: 1;
}

#confirm-modal .modal {
  max-width: 400px;
  padding: 48px 40px;
}

#confirm-modal .modal p:last-of-type {
  margin-bottom: 32px;
}

.confirm-actions {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.welcome-video {
  display: block;
  width: 100%;
  margin: -12px 0 24px;
  object-fit: cover;
}

@media (max-width: 800px) {
  .welcome-video {
    width: min(100%, 220px);
    margin: -12px auto 20px;
  }
}

.btn-group {
  display: flex;
  height: 36px;
  border: 1px solid #dcdcdc;
  align-items: stretch;
}

.btn-clear-confirm {
  background: #000;
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.btn-clear-confirm:hover {
  opacity: 0.85;
}

.btn-cancel {
  background: none;
  border: none;
  padding: 8px 0;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #000;
  cursor: pointer;
  opacity: 0.5;
  display: flex;
  align-items: center;
}

.btn-cancel:hover {
  opacity: 1;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

button {
  background: #000;
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  align-self: flex-start;
}

button:hover {
  opacity: 0.85;
}

.subscribe {
  border-top: 1px solid #e5e5e5;
  padding-top: 24px;
}

.subscribe label {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
}

.subscribe-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

input[type="email"],
input[type="text"] {
  -webkit-appearance: none;
  appearance: none;
}
input[type="email"] {
  flex: 1;
  border: none;
  border-bottom: 1px solid #000;
  padding: 6px 0;
  font-family: inherit;
  font-size: 12px;
  background: transparent;
  outline: none;
}

input[type="email"]::placeholder {
  color: #999;
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  padding: 0 32px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  z-index: 5;
}

.about-link {
  position: absolute;
  left: 32px;
  bottom: 24px;
  background: none;
  border: none;
  padding: 0;
  color: #000;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.about-link:hover {
  opacity: 0.6;
}

.footer-right {
  position: absolute;
  right: 32px;
  bottom: 24px;
  display: flex;
  align-items: baseline;
}

.notify-trigger {
  background: none;
  border: none;
  padding: 0;
  color: #000;
  font: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  align-self: auto;
}

.notify-trigger:hover {
  opacity: 0.6;
}

.footer-subscribe {
  display: none;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.footer-subscribe.open {
  display: flex;
}

.footer-subscribe .form-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #000;
}

.footer-subscribe input[type="email"] {
  flex: none;
  width: 160px;
  border: none;
  border-bottom: 1px solid #000;
  padding: 4px 0;
  font-size: 12px;
  font-family: inherit;
  background: transparent;
  outline: none;
  text-transform: lowercase;
}

.footer-subscribe input[type="email"]::placeholder {
  color: #999;
  text-transform: lowercase;
}

.footer-subscribe button {
  padding: 4px 10px;
  font-size: 11px;
}

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: #fff;
  border: 1px solid #000;
  padding: 10px 20px;
  font-size: 12px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: #c00;
  color: #c00;
}


.toolbar {
  position: fixed;
  bottom: 27px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: max-content;
  z-index: 6;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 0;
  padding: 4px;
  gap: 2px;
  white-space: nowrap;
  overflow: visible;
}

.mobile-tool-icon {
  display: none;
}

.tb-divider {
  width: 1px;
  margin: 4px 3px;
  align-self: stretch;
  flex-shrink: 0;
}

.tb-btn {
  width: 80px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid #c6c6c6;
  border-radius: 0;
  padding: 0 6px;
  color: rgba(0, 0, 0, 0.38);
  cursor: pointer;
  position: relative;
  align-self: auto;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  flex-shrink: 0;
}

.tb-btn:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.tb-btn.active {
  background: transparent;
  color: #000;
  border-color: #c6c6c6;
  background: var(--highlight);
}

.tb-btn.active:hover {
  background: rgba(0, 0, 0, 0.04);
}

.tb-btn span {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 10px;
  color: #7b7b7b;
}

.tb-action span {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 10px;
  color: #7b7b7b;
}

.tb-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.tb-action {
  position: relative;
  width: 80px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid #c6c6c6;
  border-radius: 0;
  padding: 0 6px;
  color: rgba(0, 0, 0, 0.38);
  cursor: pointer;
  align-self: auto;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tb-action:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.history-group {
  display: flex;
  height: 36px;
  border: 1px solid #c6c6c6;
  align-items: stretch;
  flex-shrink: 0;
}

.tb-history {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  position: relative;
  align-self: auto;
  transition: color 0.12s, background 0.12s, opacity 0.12s;
  flex-shrink: 0;
  font-family: inherit;
}

.tb-history+.tb-history {
  border-left: 1px solid #ececec;
}

.tb-history:hover:not(:disabled) {
  color: #000;
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.tb-history:disabled {
  cursor: default;
  color: rgba(0, 0, 0, 0.18);
}

.tb-history:disabled:hover {
  background: none;
}

.tb-history svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.tb-history-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  letter-spacing: 0.05em;
  color: #b5b5b5;
  text-transform: uppercase;
  pointer-events: none;
  display: none;
}

.tb-swatch {
  width: 36px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 0;
  background: none;
  padding: 0;
  align-self: auto;
  position: relative;
  transition: border-color 0.12s, background 0.12s;
  flex-shrink: 0;
}

.tb-swatch:hover {
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.tb-swatch.active {
  background: var(--highlight);
}

.tb-swatch[data-color="#1a1a2e"].active span {
  border-color: rgba(255, 255, 0, 1);
}

.swatch-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.10);
  flex-shrink: 0;
}

.eraser-sizes {
  display: none;
  align-items: center;
  gap: 2px;
}

.eraser-sizes.visible {
  display: flex;
}

.tb-esize {
  width: 36px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  align-self: auto;
  transition: border-color 0.12s, background 0.12s;
  flex-shrink: 0;
}

.tb-esize:hover {
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.tb-esize.active {
  /* border-color: #000; */
  background: var(--highlight);
}

.esize-dot {
  border-radius: 50%;
  background: #000;
  opacity: 0.35;
  transition: opacity 0.12s;
  flex-shrink: 0;
}

.tb-esize.active .esize-dot {
  opacity: 1;
}

.color-picker-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  overflow: visible;
}

.color-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: 2px;
  z-index: 300;
  isolation: isolate;
}

.color-popover-close {
  position: absolute;
  top: 10px;
  right: 2px;
  width: 4px;
  height: 4px;
  background: #fff;
  color: #000;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.color-popover-close.active {
  background: none;
}

.color-popover-close:hover {
  background: rgba(255, 255, 255, 1);
}

.sq-wrap {
  position: relative;
  line-height: 0;
}

.sq-handle {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translate3d(-50%, -50%, 0);
  will-change: left, top;
  z-index: 1000;
}

.color-well-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid #c6c6c6;
  border-radius: 0;
  background: none;
  padding: 0;
  align-self: auto;
  flex-shrink: 0;
  transition: border-color 0.12s, background 0.12s;
}

.color-well-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

.color-well-btn.open {
  background: var(--highlight);
}

.color-well-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.10);
  flex-shrink: 0;
  background: #1a1a2e;
}

.color-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #c6c6c6;
  border-radius: 0;
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  width: 210px;
}

.color-popover.open {
  display: flex;
}

#colorWheel {
  display: block;
  cursor: crosshair;
  width: 182px;
  height: 182px;
  /* z-index: 100; */
}

.bri-strip-wrap {
  position: relative;
  height: 14px;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}

#briStrip {
  display: block;
  width: 182px;
  height: 14px;
}

.bri-handle {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translate3d(-50%, -50%, 0);
  will-change: left;
}

.sq-wrap,
.bri-strip-wrap {
  position: relative;
  isolation: isolate;
}

#colorWheel,
#briStrip {
  position: relative;
  z-index: 1;
}

.picker-hex-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.picker-preview {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.10);
  flex-shrink: 0;
}

.picker-hex-row span {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #999;
}

.picker-hex-row input {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.02em;
  border: none;
  border-bottom: 1px solid #000;
  border-radius: 0;
  background: transparent;
  padding: 4px 0;
  color: #000;
  width: 80px;
  outline: none;
  text-transform: lowercase;
}

.picker-hex-row input:focus {
  border-color: #aaa;
}

.desktop-header-label {
  pointer-events: none;
}

.mobile-about-link {
  display: none;
  background: none;
  border: none;
  padding: 0;
  color: #000;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  pointer-events: auto;
  align-self: auto;
}

.mobile-about-link:hover {
  opacity: 0.6;
}


.hidden {
  display: none !important;
}


.followup-question {
  margin-top: 8px;
  font-weight: 500;
}


.followup-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

@media (min-width: 520px) {
  .followup-options {
    grid-template-columns: repeat(4, 1fr);
  }
}

.followup-btn {
  padding: 12px 16px;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 0;
  font: inherit;
  font-size: 14px;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.followup-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.followup-btn.active {
  background: currentColor;
}

.followup-btn.active>* {
  color: white;
}

.followup-btn.active {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

.followup-extra {
  margin: 16px 0;
}

.followup-extra label {
  display: block;
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 6px;
}

.followup-extra textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: transparent;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 48px;
  box-sizing: border-box;
}

.followup-extra textarea:focus {
  outline: none;
  border-color: #1a1a2e;
}

.followup-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.followup-send {
  flex: 1;
  padding: 12px 20px;
  background: #1a1a2e;
  color: #fff;
  border: 1px solid #1a1a2e;
  border-radius: 0;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.followup-send:hover {
  opacity: 0.85;
}

.followup-skip {
  padding: 12px 16px;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13px;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
}

.followup-skip:hover {
  opacity: 0.8;
}

@media (max-width: 800px) {
  header {
    padding: 20px;
  }

  .desktop-header-label {
    display: none;
  }

  .mobile-about-link {
    display: block;
    padding: 0 0 16px 16px;
  }

  .modal-overlay {
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 88px 20px 96px;
  }

  .modal {
    width: 100%;
    max-width: none;
    padding: 32px 24px;
    max-height: none;
  }

  .subscribe-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .subscribe-row input[type="email"] {
    width: 100%;
    flex: none;
  }

  .subscribe-row button {
    width: 100%;
    align-self: stretch;
  }

  input[type="email"] {
    font-size: 16px;
  }

  footer {
    display: none;
  }

  .toolbar {
    bottom: 20px;
    left: 16px;
    right: 16px;
    margin: 0;
    transform: none;
    flex-wrap: wrap;
    width: auto;
    max-width: none;
    gap: 2px;
    padding: 4px;
    justify-content: flex-start;
  }

  #brushBtnLabel,
  #tool-eraser .tool-label,
  #tool-save .tool-label,
  #tool-clear .tool-label {
    display: none;
  }

  .mobile-tool-icon {
    display: block;
    width: 18px;
    height: 18px;
    position: static;
    color: currentColor;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .brush-picker-wrap,
  .brush-picker-wrap #tool-brush,
  #tool-eraser,
  #tool-save,
  #tool-clear {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
  }

  .tb-btn {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  .brush-picker-wrap {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    display: flex;
  }

  .brush-picker-wrap #tool-brush {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
  }

  .color-picker-wrap {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .tb-divider:last-of-type {
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 2px 0;
    order: 10;
  }

  .history-group {
    order: 11;
    flex: 0 0 auto;
  }

  .tb-history-label {
    display: none;
  }

  #tool-save,
  #tool-clear {
    order: 11;
    flex: 1 1 auto;
    width: auto;
  }

  .color-popover {
    position: fixed;
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    transform: none !important;
    bottom: 120px;
    z-index: 400;
    max-height: calc(100vh - 150px);
    overflow: auto;
  }



  #colorWheel {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1;
  }

  .bri-strip-wrap,
  #briStrip {
    width: 100% !important;
  }

  .picker-hex-row {
    width: 100%;
  }

  .picker-hex-row input {
    flex: 1;
    width: auto;
    min-width: 0;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
  }
}

.brush-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

#tool-brush {
  position: relative;
}

.tb-btn-caret {
  position: absolute !important;
  top: 5px;
  right: 5px;
  bottom: auto !important;
  left: auto !important;
  width: 6px;
  height: 6px;
  border-right: 1px solid rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(0, 0, 0, 0.55);
  transform: rotate(45deg);
  opacity: 0.35;
  transition: opacity 0.12s;
  pointer-events: none;
}

#tool-brush.active .tb-btn-caret {
  opacity: 0.7;
}

#tool-brush:hover .tb-btn-caret {
  opacity: 0.85;
}

.brush-btn-hint {
  position: absolute !important;
  top: 4px;
  left: 5px;
  bottom: auto !important;
  font-size: 8px !important;
  letter-spacing: 0.08em !important;
  color: rgba(0, 0, 0, 0.4) !important;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}

#tool-brush:hover .brush-btn-hint,
#tool-brush.active .brush-btn-hint {
  opacity: 1;
}

.brush-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  background: #fff;
  border: 1px solid #c6c6c6;
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 200;
  width: 320px;
  max-height: min(640px, calc(100vh - 110px));
  font-size: 12px;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.brush-popover.open {
  display: flex;
}

.brush-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: -2px;
}

.brush-popover-close {
  background: none;
  color: #000;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  border: none;
  align-self: auto;
}

.brush-popover-close:hover {
  opacity: 0.6;
}

.brush-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}

.brush-section-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b5b5b5;
}

.brush-tile-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 4px;
}

.brush-tile {
  background: none;
  border: 1px solid #dcdcdc;
  color: rgba(0, 0, 0, 0.55);
  padding: 9px 6px 7px;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  align-self: auto;
  text-align: left;
  position: relative;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.brush-tile:hover:not(.locked) {
  color: #000;
  background: rgba(0, 0, 0, 0.03);
}

.brush-tile.active {
  background: var(--highlight);
  color: #000;
  border-color: #c6c6c6;
}

.brush-tile.locked {
  cursor: default;
  opacity: 0.45;
}

.brush-tile-name {
  display: block;
  line-height: 1;
}

.brush-tile-meta {
  display: block;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #b5b5b5;
  margin-top: 4px;
  line-height: 1;
}

.brush-tile.active .brush-tile-meta {
  color: #888;
}

.brush-preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  flex: 0 0 auto;
}

.preset-chip {
  background: none;
  border: 1px solid #dcdcdc;
  color: rgba(0, 0, 0, 0.55);
  padding: 7px 4px;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  align-self: auto;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.preset-chip:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.03);
}

.preset-chip.active {
  background: var(--highlight);
  color: #000;
  border-color: #c6c6c6;
}

.preset-chip.modified::after {
  content: "*";
  margin-left: 3px;
  color: #999;
  font-weight: 400;
}

.brush-preview-wrap {
  position: relative;
  width: 100%;
  height: 96px;
  border: 1px solid #ececec;
  overflow: hidden;
  flex: 0 0 auto;
  background: #f3f3f3;
}

#brushPreviewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.brush-preview-wrap::after {
  content: "PREVIEW";
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #c0c0c0;
  text-transform: uppercase;
  pointer-events: none;
}

.brush-sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 2px 0;
  margin: 0 -2px 0 0;
  flex: 1 1 auto;
  min-height: 0;
}

.brush-sliders::-webkit-scrollbar {
  width: 6px;
}

.brush-sliders::-webkit-scrollbar-track {
  background: transparent;
}

.brush-sliders::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 0;
}

.brush-sliders::-webkit-scrollbar-thumb:hover {
  background: #c0c0c0;
}

.brush-slider {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
}

.brush-slider-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.brush-slider-value {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: #000;
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

.brush-slider input[type="range"] {
  grid-column: 1 / 3;
  grid-row: 2 / 3;
  width: 100%;
  height: 18px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.brush-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: #d6d6d6;
  border: none;
}

.brush-slider input[type="range"]::-moz-range-track {
  height: 1px;
  background: #d6d6d6;
  border: none;
}

.brush-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #000;
  margin-top: -7px;
  cursor: grab;
  transition: transform 0.12s;
}

.brush-slider input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.08);
}

.brush-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #000;
  cursor: grab;
}

.brush-slider input[type="range"]:focus {
  outline: none;
}

.brush-slider.changed .brush-slider-value {
  color: #000;
  font-weight: 500;
}

.brush-slider.changed .brush-slider-value::after {
  content: " •";
  color: #999;
}

.brush-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #ececec;
  padding-top: 12px;
  margin-top: 2px;
}

.brush-reset {
  background: none;
  color: #999;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  align-self: auto;
}

.brush-reset:hover {
  color: #000;
}

.brush-reset:disabled {
  opacity: 0.35;
  cursor: default;
}

.brush-reset:disabled:hover {
  color: #999;
}

@media (max-width: 800px) {
  .brush-popover {
    position: fixed;
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    bottom: 120px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 400;
  }

  .brush-preview-wrap {
    height: 120px;
  }

  .brush-slider input[type="range"] {
    height: 28px;
  }

  .brush-slider input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -10px;
  }

  .brush-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }

  .preset-chip {
    padding: 9px 4px;
  }

  .brush-tile {
    padding: 11px 8px 9px;
    font-size: 12px;
  }

  .brush-btn-hint {
    display: none;
  }

  #tool-brush .tb-btn-caret {
    opacity: 0.7;
  }

  #tool-brush.active .tb-btn-caret {
    opacity: 0.85;
  }
}