:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--c-white);
  color: var(--c-bg);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.skip-link:focus {
  left: 0.5rem;
  outline: 2px solid var(--c-sec);
  outline-offset: 2px;
}

/* Scrollbar — come Gravity (4px, var(--c-track)) */
.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--c-track);
  border-radius: 2px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--c-muted);
}

.animate-spin-slow {
  animation: spin 3s linear infinite;
}

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

:focus-visible {
  outline: 2px solid var(--c-sec);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* Slider — stesso pattern di training-gravity/style.css */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--c-white);
  cursor: pointer;
  margin-top: -5px;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  background: var(--c-track);
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  background: var(--c-track);
  border: 0;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-white);
  border: 0;
  cursor: pointer;
}

/* Zona canvas — piano come sceneContainer Gravity */
.canvas-stage {
  position: relative;
  background: var(--c-bg);
}

.canvas-stage.is-dragover {
  outline: 2px dashed var(--c-muted);
  outline-offset: -8px;
  background: var(--c-sidebar);
}

#main-canvas.canvas-ready {
  box-shadow: 0 0 0 1px var(--c-border);
}

/* Tab — evidenziazione neutra */
.tab-segment {
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.tab-segment[aria-selected="true"] {
  background: var(--c-border);
  color: var(--c-white);
}

.tab-segment[aria-selected="false"] {
  color: var(--c-sec);
}

.tab-segment[aria-selected="false"]:hover {
  color: var(--c-primary);
  background: color-mix(in oklab, var(--c-white), transparent 96%);
}

/* Categorie effetti */
.effect-cat {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-bg);
  margin-bottom: 0.35rem;
  overflow: hidden;
}

.effect-cat > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.45rem 0.5rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.effect-cat > summary::-webkit-details-marker {
  display: none;
}

.effect-cat > summary:hover {
  background: var(--c-sidebar);
  color: var(--c-sec);
}

.effect-cat > summary .chevron {
  width: 14px;
  height: 14px;
  opacity: 0.45;
  transition: transform 0.2s var(--ease-out);
}

.effect-cat[open] > summary .chevron {
  transform: rotate(90deg);
}

.effect-cat .effect-cat-inner {
  padding: 0 0.4rem 0.4rem;
}

.timeline-thumb {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Play / pausa timeline — bianco come Gravity, rosso in riproduzione */
#btn-play {
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}

#btn-play.is-playing {
  background: #dc2626;
  color: #fff;
}

#btn-play.is-playing:hover {
  background: #b91c1c;
}

#btn-play:not(.is-playing):hover {
  background: var(--c-primary);
}

/* Live — neutro / hint verde molto soft come stato “attivo” */
#btn-live {
  border-color: var(--c-track);
  background: var(--c-sidebar);
  color: var(--c-sec);
}

#btn-live.live-on {
  border-color: var(--c-muted);
  background: var(--c-border);
  color: var(--c-primary);
}

#btn-live:not(.live-on) {
  animation: none;
}

#btn-record.is-recording {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}

#btn-record.is-recording:hover {
  background: #b91c1c;
}

/* Ricerca effetti — select Gravity-like */
.effects-search {
  width: 100%;
  background: var(--c-border);
  border: 1px solid var(--c-track);
  border-radius: 4px;
  padding: 0.5rem 0.65rem 0.5rem 2rem;
  font-size: 12px;
  color: var(--c-primary);
  outline: none;
  transition: border-color 0.15s;
}

.effects-search::placeholder {
  color: var(--c-muted);
}

.effects-search:hover {
  border-color: var(--c-muted);
}

.effects-search:focus {
  border-color: var(--c-muted);
}

.search-wrap {
  position: relative;
}

.search-wrap .search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--c-muted);
  pointer-events: none;
}