/* ====================================================================
   RETROPRESS — base CSS (design system Training Design)
   ==================================================================== */
*, *::before, *::after { box-sizing: border-box; }
:root { --ease-out: cubic-bezier(0.22, 1, 0.36, 1); }
html, body { margin: 0; padding: 0; height: 100%; }
body { overflow: hidden; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #404040; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #525252; }

/* ---- Range slider ---- */
input[type=range] {
  -webkit-appearance: none; appearance: none;
  background: transparent; width: 100%; height: 14px; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: #404040; border-radius: 2px; }
input[type=range]::-moz-range-track { height: 2px; background: #404040; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  height: 12px; width: 12px; border-radius: 50%; background: #ffffff; border: 0; margin-top: -5px;
}
input[type=range]::-moz-range-thumb { height: 12px; width: 12px; border-radius: 50%; background: #ffffff; border: 0; }
input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid #a3a3a3; outline-offset: 2px; }

/* ---- Mobile / touch: area tappabile più ampia e thumb più grande ---- */
@media (max-width: 767px) {
  input[type=range] { height: 44px; }
  input[type=range]::-webkit-slider-runnable-track { height: 4px; }
  input[type=range]::-moz-range-track { height: 4px; }
  input[type=range]::-webkit-slider-thumb { height: 22px; width: 22px; margin-top: -9px; }
  input[type=range]::-moz-range-thumb { height: 22px; width: 22px; }
}

/* ---- Color dots (inchiostro / carta) ---- */
.color-dots {
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 32px;
  padding: 2px 0;
}
.color-dot {
  display: inline-block !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border: 2px solid #404040;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  vertical-align: middle;
  pointer-events: auto;
  user-select: none;
  /* transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease; */
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px #0a0a0a;
}
.color-dot:focus-visible {
  outline: 2px solid #a3a3a3;
  outline-offset: 2px;
}

/* ---- Color input ---- */
input[type=color] {
  -webkit-appearance: none; appearance: none;
  border: none; padding: 0; background: transparent; cursor: pointer; border-radius: 6px; overflow: hidden;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 1px solid #404040; border-radius: 6px; }
input[type=color]::-moz-color-swatch { border: 1px solid #404040; border-radius: 6px; }

/* ---- Select appearance ---- */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center; padding-right: 1.7rem;
}

/* ---- Focus ring ---- */
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid #a3a3a3; outline-offset: 1px;
}

/* ---- Sidebar mobile ---- */
@media (max-width: 767px) {
  #sidebar {
    position: fixed; top: 0; left: 0; height: 100%; width: 18rem; max-width: 85vw;
    transform: translateX(-100%); transition: transform 0.3s var(--ease-out);
  }
  #sidebar.open { transform: translateX(0); }
}
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease-out); z-index: 40;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* ---- Toast ---- */
#toast {
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ---- Canvas ---- */
/* p5 imposta width/height inline sul <canvas>: serve !important per scalarlo */
#canvasWrap { aspect-ratio: 9 / 16; height: 88vh; max-width: 90vw; background: #0a0a0a; }
#canvasWrap canvas { display: block; width: 100% !important; height: 100% !important; }
@media (max-width: 767px) {
  #canvasWrap { height: auto; width: 86vw; max-width: 86vw; }
}
