/* =============================================================================
   Utiliobox — estilos de las herramientas de color.
   Solo tokens de utiliobox.css. Una sola hoja para las cuatro subpáginas.
   ============================================================================= */

.cl-h3 { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--ink); }
.cl-h3__s { margin: var(--s-1) 0 var(--s-3); font-size: var(--fs-xs); color: var(--ink-soft); }
.cl-nota { margin: var(--s-2) 0 0; font-size: var(--fs-2xs); color: var(--ink-mute); }
.cl-bloque { padding: var(--s-4); border-top: 1px solid var(--border); }
.cl-bloque:first-child { border-top: 0; }

.cl-copy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-soft);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.cl-copy:hover { border-color: var(--accent); color: var(--accent); }
.cl-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl-copy svg { width: 15px; height: 15px; }
.cl-copy.is-ok, .btn.is-ok { border-color: var(--ok); color: var(--ok); }
.cl-color {
  width: 44px; height: 38px; padding: 2px; flex: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
}
.cl-basefila { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.cl-basefila .input { flex: 1 1 130px; min-width: 0; }

/* --- Zona de imagen, compartida --- */
.cl-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-2); text-align: center;
  padding: var(--s-8) var(--s-4);
  border: 2px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-alt);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.cl-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.cl-drop__ico { color: var(--ink-mute); line-height: 0; }
.cl-drop__ico svg { width: 30px; height: 30px; }
.cl-drop__t { margin: 0 0 var(--s-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink); }
.cl-filebtn { position: relative; overflow: hidden; cursor: pointer; }
.cl-filebtn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* =============================================================================
   A. Selector
   ============================================================================= */
.cl-sel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-5); padding: var(--s-4); }
.cl-sel__rueda { display: grid; gap: var(--s-3); justify-items: center; }
.cl-rueda-caja { position: relative; width: 250px; height: 250px; touch-action: none; }
.cl-rueda { display: block; width: 250px; height: 250px; border-radius: 50%; cursor: crosshair; box-shadow: var(--sh-sm); }
.cl-cursor {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 3px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), var(--sh-md);
}
.cl-muestra {
  width: 250px; height: 62px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-family: var(--mono); font-size: var(--fs-sm); font-weight: var(--fw-semi);
  letter-spacing: .06em;
}
.cl-sel__mandos { display: grid; gap: var(--s-3); align-content: start; min-width: 0; }
.cl-mando { display: grid; gap: var(--s-1); }
.cl-mando__e {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-soft);
}
.cl-mando__v { font-family: var(--mono); font-size: var(--fs-2xs); color: var(--accent); }
.cl-range {
  width: 100%; height: 12px; cursor: pointer; appearance: none;
  border-radius: var(--r-full); border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--a, #000), var(--b, #fff));
}
.cl-range--h {
  background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00);
}
.cl-range--l { background: linear-gradient(90deg, #000, var(--m, #888) 50%, #fff); }
.cl-range::-webkit-slider-thumb {
  appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink); cursor: pointer;
  box-shadow: var(--sh-sm);
}
.cl-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink); cursor: pointer;
}
.cl-campos { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.cl-campo { display: flex; align-items: center; gap: var(--s-2); }
.cl-campo__e {
  flex: none; width: 46px;
  font-size: var(--fs-2xs); font-weight: var(--fw-semi); color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .06em;
}
.cl-campo .input { flex: 1 1 auto; min-width: 0; }

/* Lector desde imagen */
.cl-lector { padding: var(--s-4); border-top: 1px solid var(--border); }
.cl-lienzo-caja { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.cl-foto { display: block; max-width: 100%; border-radius: var(--r-sm); cursor: crosshair; }
.cl-lupa {
  position: absolute; width: 94px; height: 94px; margin: -110px 0 0 -47px;
  border: 3px solid var(--accent); border-radius: 50%; overflow: hidden;
  pointer-events: none; box-shadow: var(--sh-lg); background: var(--surface);
}
.cl-lupa canvas { display: block; width: 88px; height: 88px; }
.cl-lector__pie { margin-top: var(--s-3); }

/* =============================================================================
   B. Paletas
   ============================================================================= */
.cl-pal__top {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s-4); padding: var(--s-4);
  border-bottom: 1px solid var(--border); background: var(--surface-alt);
}
.cl-escala { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.cl-paso {
  display: grid; align-content: space-between; gap: var(--s-4);
  min-height: 104px; padding: var(--s-2);
  border: 0; border-radius: var(--r-xs); cursor: pointer; text-align: left;
  font-family: var(--mono); font-size: 10px;
  transition: transform var(--dur-fast) var(--ease-out);
}
.cl-paso:hover { transform: translateY(-2px); }
.cl-paso b { font-size: var(--fs-xs); font-family: var(--sans); }
.cl-paso.is-base { outline: 2px solid var(--ink); outline-offset: 1px; }
.cl-armonias { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--s-4); }
.cl-arm { display: grid; gap: var(--s-2); align-content: start; }
.cl-arm__t { margin: 0; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--ink-soft); }
.cl-arm__tiras { display: flex; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); }
.cl-tira {
  flex: 1 1 0; min-width: 0; border: 0; cursor: pointer;
  padding: var(--s-4) 2px; font-family: var(--mono); font-size: 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cl-arm__copy {
  justify-self: start; display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 2px var(--s-2); border: 0; background: none; cursor: pointer;
  font-size: var(--fs-2xs); color: var(--accent); font-family: var(--sans);
}
.cl-arm__copy svg { width: 13px; height: 13px; }
.cl-exp__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.cl-exp { display: grid; gap: var(--s-3); }
.cl-out {
  width: 100%; min-height: 190px; resize: vertical;
  font-family: var(--mono); font-size: var(--fs-2xs); line-height: 1.6;
  white-space: pre; overflow: auto;
}

/* =============================================================================
   C. Contraste
   ============================================================================= */
.cl-con { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--s-5); padding: var(--s-4); }
.cl-con__mandos { display: grid; gap: var(--s-3); align-content: start; }
.cl-con__mandos .btn { justify-self: start; }
.cl-con__res { display: grid; gap: var(--s-3); align-content: start; min-width: 0; }
.cl-ratio {
  display: grid; gap: 2px; justify-items: center; padding: var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-alt);
}
.cl-ratio b { font-size: var(--fs-3xl); font-weight: var(--fw-bold); line-height: 1; font-family: var(--mono); }
.cl-ratio span { font-size: var(--fs-2xs); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.cl-ratio.is-aaa { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.cl-ratio.is-aaa b { color: var(--ok); }
.cl-ratio.is-aa  { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.cl-ratio.is-aa b { color: var(--ok); }
.cl-ratio.is-parcial { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.cl-ratio.is-parcial b { color: var(--warn); }
.cl-ratio.is-mal { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.cl-ratio.is-mal b { color: var(--danger); }

.cl-tabla-caja { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.cl-tabla { width: 100%; min-width: 340px; border-collapse: collapse; font-size: var(--fs-xs); }
.cl-tabla th {
  padding: var(--s-2) var(--s-3); text-align: left;
  background: var(--surface-alt); border-bottom: 1px solid var(--border);
  font-size: var(--fs-2xs); font-weight: var(--fw-semi); color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .06em;
}
.cl-tabla td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); }
.cl-tabla tbody th { text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); color: var(--ink); background: none; }
.cl-tabla tr:last-child td, .cl-tabla tr:last-child th { border-bottom: 0; }
.cl-tabla small { color: var(--ink-mute); font-family: var(--mono); font-size: 10px; }
.cl-marca { display: inline-flex; align-items: center; gap: 3px; font-weight: var(--fw-semi); }
.cl-marca svg { width: 14px; height: 14px; }
.cl-marca--si { color: var(--ok); }
.cl-marca--no { color: var(--danger); }

.cl-preview { padding: var(--s-6) var(--s-5); border-top: 1px solid var(--border); }
.cl-preview__g { margin: 0 0 var(--s-3); font-size: var(--fs-2xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.cl-preview__n { margin: 0 0 var(--s-2); font-size: var(--fs-base); line-height: var(--lh-base); }
.cl-preview__p { margin: 0; font-size: var(--fs-xs); line-height: var(--lh-base); }

.cl-fix { padding: 0 var(--s-4) var(--s-4); }
.cl-fix__caja { padding: var(--s-4); border: 1px solid var(--accent-border); border-radius: var(--r-md); background: var(--accent-soft); }
.cl-fix__t { margin: 0 0 var(--s-3); font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); }
.cl-fix__ops { display: grid; gap: var(--s-2); }
.cl-fix__op {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface);
}
.cl-fix__demo {
  flex: none; width: 46px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-weight: var(--fw-bold); font-size: var(--fs-md);
}
.cl-fix__txt { display: grid; gap: 1px; flex: 1 1 150px; min-width: 0; }
.cl-fix__txt b { font-size: var(--fs-xs); color: var(--ink); }
.cl-fix__txt code { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); }
.cl-fix__txt small { font-size: var(--fs-2xs); color: var(--ink-soft); }

/* =============================================================================
   D. Extractor
   ============================================================================= */
.cl-ex { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: var(--s-5); padding: var(--s-4); }
.cl-ex__img canvas { display: block; max-width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border); }
.cl-ex__lado { display: grid; gap: var(--s-3); align-content: start; min-width: 0; }
.cl-ex__lista { display: grid; gap: var(--s-1); }
.cl-domi {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-2); padding: var(--s-3); border: 0; border-radius: var(--r-sm);
  cursor: pointer; overflow: hidden; text-align: left;
  font-family: var(--mono); font-size: var(--fs-2xs);
}
.cl-domi b { font-size: var(--fs-xs); font-weight: var(--fw-semi); }
.cl-domi__barra {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: currentColor; opacity: .55;
}

/* =============================================================================
   Hub
   ============================================================================= */
.cl-hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-4); }
.cl-hub__card {
  display: grid; gap: var(--s-2); align-content: start;
  padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.cl-hub__card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cl-hub__ico {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent);
}
.cl-hub__ico svg { width: 20px; height: 20px; }
.cl-hub__t { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--ink); }
.cl-hub__d { margin: 0; font-size: var(--fs-xs); color: var(--ink-soft); line-height: var(--lh-base); }
.cl-hub__tiras { display: flex; gap: 2px; margin-top: var(--s-1); }
.cl-hub__tiras span { flex: 1 1 0; height: 6px; border-radius: 2px; }

/* Tabla de la parte de contenido */
.cl-ref { overflow-x: auto; margin: var(--s-5) 0; }
.cl-ref table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: var(--fs-xs); }
.cl-ref th, .cl-ref td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.cl-ref thead th { background: var(--surface-alt); font-weight: var(--fw-semi); color: var(--ink-soft); white-space: nowrap; }
.cl-ref tbody th { font-weight: var(--fw-medium); color: var(--ink); white-space: nowrap; }
.cl-ref code { font-family: var(--mono); font-size: .92em; }
.cl-ref td:last-child { color: var(--ink-soft); }
.cl-ref tr:last-child th, .cl-ref tr:last-child td { border-bottom: 0; }
.prose code, .faq__answer code { overflow-wrap: anywhere; }

/* =============================================================================
   Móvil
   ============================================================================= */
@media (max-width: 900px) {
  .cl-sel, .cl-con, .cl-ex { grid-template-columns: 1fr; }
  .cl-sel__rueda { justify-items: start; }
}
@media (max-width: 620px) {
  .cl-escala { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cl-sel, .cl-lector, .cl-bloque, .cl-pal__top, .cl-con, .cl-ex { padding: var(--s-3); }
  .cl-rueda-caja, .cl-rueda, .cl-muestra { width: 100%; max-width: 250px; }
  .cl-rueda-caja { height: auto; aspect-ratio: 1; }
  .cl-rueda { height: auto; aspect-ratio: 1; }
}

/* Alto reservado de la tarjeta mientras el JavaScript la monta. Medido en el
   sitio, no estimado: sin esto la herramienta empuja al aparecer y eso es
   CLS en la primera pantalla. Si la herramienta cambia de tamaño, este
   número hay que volver a medirlo. */
#cl-contrast { --alto-herramienta: 465px; }
#cl-extract { --alto-herramienta: 177px; }
#cl-palette { --alto-herramienta: 887px; }
#cl-picker { --alto-herramienta: 735px; }
