/* ---------------- controles propios (web/controles.js) ---------------- */
/* sin flechitas nativas en los números */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* número con − / + */
.nx { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.nx > input { flex: 1; min-width: 0; padding-right: 52px !important; }
/* los números angostos (ancho fijo): el − / + ocupa 52 px, así que se suman al ancho para que se siga viendo el valor */
#top .num .nx > input { width: 104px; }
.opts .nx > input { width: 106px; }
.m5-num .nx > input { width: 124px; }
.nx-b { position: absolute; top: 50%; width: 21px; height: 21px; margin-top: -10.5px; padding: 0; border: 0; border-radius: 7px; display: grid; place-items: center;
  color: var(--muted); background: rgba(var(--hi-rgb), .05); cursor: pointer;
  transition: background .15s, color .15s, scale .4s cubic-bezier(.34, 1.9, .5, 1), box-shadow .2s; }
.nx-b.nx-dn { right: 27px; }
.nx-b.nx-up { right: 4px; }
.nx-b:hover { color: var(--hi); background: rgba(var(--acc-rgb), .22); box-shadow: 0 0 10px rgba(var(--acc-rgb), .35); scale: 1.12; }
.nx-b:active { scale: .82; transition-duration: .05s; }
.nx.bump > input { animation: nxBump .42s cubic-bezier(.34, 1.56, .64, 1); }
.nx.bump.up .nx-up, .nx.bump.dn .nx-dn { color: var(--acc); }
@keyframes nxBump { 0% { scale: 1; } 30% { scale: 1.05; } 60% { scale: .985; } 100% { scale: 1; } }

/* lista (select) propia */
select.sx-hid { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; }
.sx { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 28px; padding: 0 9px 0 10px; border-radius: 7px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: 500 12px var(--sans); text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .2s, scale .4s cubic-bezier(.34, 1.9, .5, 1); }
.sx span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx svg { color: var(--muted); flex: none; transition: rotate .4s cubic-bezier(.34, 1.56, .64, 1); }
.sx:hover { border-color: rgba(var(--acc-rgb), .45); }
.sx.open { border-color: rgba(var(--acc-rgb), .65); box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .14); }
.sx.open svg { rotate: 180deg; color: var(--acc); }
.sx.pick { animation: nxBump .42s cubic-bezier(.34, 1.56, .64, 1); }
#sxPop { position: fixed; z-index: 130; display: none; flex-direction: column; gap: 1px; max-height: 320px; overflow-y: auto; padding: 5px; border-radius: 11px;
  background: rgba(var(--float-rgb), .97); border: 1px solid rgba(var(--acc2-rgb), .3); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(var(--shadow-rgb), .55), 0 0 22px rgba(var(--acc2-rgb), .14); }
#sxPop.on { display: flex; animation: cpkIn .38s cubic-bezier(.34, 1.56, .64, 1); }
#sxPop button { position: relative; height: 30px; padding: 0 30px 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left;
  font: 500 12px var(--sans); white-space: nowrap; animation: sxItem .35s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: calc(var(--i) * 16ms);
  transition: background .12s, padding .25s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes sxItem { 0% { opacity: 0; translate: -6px 0; } 100% { opacity: 1; translate: 0 0; } }
#sxPop button:hover { background: linear-gradient(90deg, rgba(var(--acc2-rgb), .22), rgba(var(--acc-rgb), .06)); padding-left: 14px; }
#sxPop button.on { color: var(--acc); font-weight: 600; }
#sxPop button i { position: absolute; right: 10px; top: 50%; translate: 0 -50%; font-style: normal; font-size: 11px; color: var(--acc); }

/* panel de color */
#cpk { position: fixed; z-index: 130; width: 236px; display: none; flex-direction: column; gap: 9px; padding: 11px; border-radius: 15px;
  background: rgba(var(--float-rgb), .97); border: 1px solid rgba(var(--acc2-rgb), .3); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 22px 52px rgba(var(--shadow-rgb), .6), 0 0 26px color-mix(in srgb, var(--pc, var(--acc)) 30%, transparent); color: var(--text); }
#cpk.on { display: flex; animation: cpkIn .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes cpkIn { 0% { opacity: 0; scale: .82; } 100% { opacity: 1; scale: 1; } }
/* selector de color: el cuadro y la tira de tonos son negro/blanco/tonos puros a propósito (es la matemática HSV, no un color del tema) */
.cpk-sv { position: relative; height: 132px; border-radius: 10px; cursor: crosshair; touch-action: none;
  background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); box-shadow: 0 0 0 1px rgba(var(--hi-rgb), .08) inset; }
.cpk-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2.5px solid var(--hi); pointer-events: none;
  box-shadow: 0 0 0 1px rgba(var(--shadow-rgb), .35), 0 3px 10px rgba(var(--shadow-rgb), .45); transition: scale .3s cubic-bezier(.34, 1.9, .5, 1); }
.cpk-sv:active .cpk-dot { scale: 1.25; }
.cpk-hue { position: relative; height: 12px; border-radius: 999px; cursor: ew-resize; touch-action: none;
  background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); box-shadow: 0 0 0 1px rgba(var(--hi-rgb), .1) inset; }
.cpk-hue i { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2.5px solid var(--hi); pointer-events: none;
  box-shadow: 0 0 0 1px rgba(var(--shadow-rgb), .3), 0 3px 10px rgba(var(--shadow-rgb), .45); transition: scale .3s cubic-bezier(.34, 1.9, .5, 1); }
.cpk-hue:active i { scale: 1.25; }
.cpk-row { display: flex; align-items: center; gap: 7px; }
.cpk-prev { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: 0 0 0 1px rgba(var(--hi-rgb), .15) inset, 0 0 14px var(--pc); animation: cpkBreath 2.6s ease-in-out infinite; }
@keyframes cpkBreath { 0%, 100% { box-shadow: 0 0 0 1px rgba(var(--hi-rgb), .15) inset, 0 0 8px var(--pc); } 50% { box-shadow: 0 0 0 1px rgba(var(--hi-rgb), .15) inset, 0 0 18px var(--pc); } }
.cpk-hex { flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; padding: 0 9px; border-radius: 8px; background: rgba(var(--hi-rgb), .05);
  border: 1px solid rgba(var(--hi-rgb), .08); font: 600 12px var(--mono); color: var(--muted); }
.cpk-hex:focus-within { border-color: rgba(var(--acc-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .14); }
.cpk-hex input { width: 100%; background: none; border: 0; outline: 0; color: var(--hi); font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.cpk-ok { width: 30px; height: 30px; border: 0; border-radius: 9px; flex: none; font-weight: 800; color: var(--on-acc); background: linear-gradient(135deg, var(--acc), var(--acc2));
  box-shadow: 0 0 12px rgba(var(--acc-rgb), .45); transition: scale .4s cubic-bezier(.34, 1.9, .5, 1); }
.cpk-ok:hover { scale: 1.12; }
.cpk-ok:active { scale: .85; }
.cpk-lbl { font: 700 9.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: -4px; }
.cpk-sw { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.cpk-sw button { aspect-ratio: 1; border: 0; border-radius: 7px; padding: 0; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px rgba(var(--hi-rgb), .1) inset;
  animation: cpkSw .4s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: calc(var(--i) * 12ms); transition: scale .35s cubic-bezier(.34, 1.9, .5, 1), box-shadow .2s; }
@keyframes cpkSw { 0% { opacity: 0; scale: .4; } 100% { opacity: 1; scale: 1; } }
.cpk-sw button:hover { scale: 1.25; box-shadow: 0 0 0 2px var(--hi), 0 0 12px var(--c); z-index: 1; }
.cpk-sw button.pop { animation: cpkPop .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes cpkPop { 0% { scale: 1; } 35% { scale: .75; } 100% { scale: 1; } }

/* deslizadores (opacidad y demás) */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 18px; background: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(90deg, rgba(var(--acc2-rgb), .25), rgba(var(--acc-rgb), .85)); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: linear-gradient(90deg, rgba(var(--acc2-rgb), .25), rgba(var(--acc-rgb), .85)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: var(--hi); border: 3px solid var(--acc);
  box-shadow: 0 0 10px rgba(var(--acc-rgb), .6); transition: scale .3s cubic-bezier(.34, 1.9, .5, 1); }
input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--hi); border: 3px solid var(--acc); box-shadow: 0 0 10px rgba(var(--acc-rgb), .6); }
input[type="range"]:hover::-webkit-slider-thumb { scale: 1.2; }
input[type="range"]:active::-webkit-slider-thumb { scale: 1.35; }

@media (prefers-reduced-motion: reduce) { #cpk.on, #sxPop.on, #sxPop button, .cpk-sw button, .cpk-prev, .nx.bump > input { animation: none !important; } }
