/* Circle slider experiment — build here */

/* Keeps layout width steadier when scrollbars are overlay vs classic (pairs with scroll-lock JS). */
html {
  scrollbar-gutter: stable;
}

.circle-slider-page {
  /* Shared type tokens — keep hero/display vs body split; few sizes only */
  --exp-font-display: "Outfit", sans-serif;
  --exp-font-body: "Nunito Sans", sans-serif;
  --exp-size-title: 1.25rem;
  --exp-size-label: 1rem;
  --exp-size-hero: 2rem;
  --exp-size-value: 34.027px;
  --exp-size-sm: 0.8125rem;
  --exp-size-meta: 0.6875rem;

  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 1.5rem;
  padding-bottom: max(5rem, calc(4.5rem + env(safe-area-inset-bottom, 0px)));
  font-family: var(--exp-font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: #000;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Reduce scroll chaining; full P2R block while gesture active uses html.cs-scroll-lock */
  overscroll-behavior-y: contain;
}

/*
 * While dragging: freeze scroll without position:fixed on body (avoids horizontal layout jump).
 * pointermove preventDefault + touch-action on the card handle most touch scroll; this blocks wheel/trackpad.
 */
html.cs-scroll-lock {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
}

.circle-slider-page.cs-scroll-lock {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.circle-slider-page a {
  color: #000;
  text-decoration: underline;
}

.circle-slider-page a:visited {
  color: #000;
}

.circle-slider-page :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--exp-font-display);
  font-weight: 700;
}

/* Picker + demo stack; tweak panel stays fixed at bottom. */
.circle-slider-page main {
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  min-height: 0;
  padding-bottom: 0.5rem;
  width: 100%;
  max-width: 100%;
}

.circle-slider-page .skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 0.5rem 1rem;
  background: #000;
  color: #fff;
  font-weight: 700;
  z-index: 10;
}

.circle-slider-page .skip-link:focus {
  top: 0;
}

/* ——— Picker (matches Paper “Mobile · Pick variation” frame) ——— */
.cs-picker-shell {
  box-sizing: border-box;
  width: 100%;
  max-width: 390px;
  margin: 0 auto 1.5rem;
  padding: 24px 20px 0;
  background: #fff;
}

.cs-picker-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 12px;
}

.cs-picker-title {
  margin: 0;
  letter-spacing: -0.02em;
  font: 700 var(--exp-size-title) / 1.2 var(--exp-font-display);
  color: #000;
}

.cs-picker-intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-picker-sub {
  margin: 0;
  max-width: 320px;
  font-size: var(--exp-size-sm);
  line-height: 1.4;
  color: #444;
}

.cs-picker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 0 8px;
}

.cs-picker-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  padding: 16px 14px;
  border-radius: 10px;
  border: 1px solid #eee;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.cs-picker-row--active {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.cs-picker-row:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.cs-picker-row__icon {
  display: flex;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
}

.cs-picker-row__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
}

.cs-picker-row__label {
  font: 700 var(--exp-size-label) / 1.2 var(--exp-font-display);
  color: #000;
}

.cs-picker-row__desc {
  font-size: var(--exp-size-sm);
  line-height: 1.4;
  color: #666;
}

.cs-picker-row__chev {
  flex-shrink: 0;
}

/* ——— Demo section below picker ——— */
.cs-demo {
  width: 100%;
  max-width: 100%;
  padding-top: 2rem;
  margin-top: 0.25rem;
  border-top: 1px solid #eee;
  box-sizing: border-box;
}

.cs-mode-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

/* Author `display: flex` wins over the `hidden` attribute otherwise — only one slider should paint. */
.cs-mode-panel[hidden] {
  display: none !important;
}

#cs-panel-standard {
  min-height: min(72vh, 640px);
}

#cs-panel-range {
  min-height: min(72vh, 640px);
}

/* Figma frame “iPhone 17 - 1” — prompt + value card (circle control TBD) */
.cs-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  margin-top: 0.25rem;
  box-sizing: border-box;
  overflow: visible;
}

/* Equal flex growth above/below the control → vertically centred in remaining viewport (like justify:center on the old stage). */
.cs-stage__fill {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  pointer-events: none;
}

.cs-control-root {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  overflow: visible;
}

/* Prompt + number share one column so “How many?” centres over the value only */
.cs-value-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
}

.cs-prompt {
  /* Fixed gap to card — no vw/clamp so narrow viewports don’t tighten this. */
  margin: 0 0 4rem;
  font-weight: 700;
  font-size: var(--exp-size-hero);
  line-height: 1;
  color: #000;
  text-align: center;
}

/* Ring / thumb area (Figma node 1:84) + value column on one row */
.cs-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: clamp(1rem, 4vw, 3.9375rem);
}

/* Empty Figma placeholder — keep in DOM for a11y tree but out of layout so the control is viewport-centred */
.cs-control-slot {
  display: none;
}

/* Figma: w 101px, p 10.802px, r 7.021px — width is outer (border-box) */
.cs-value-card {
  box-sizing: border-box;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 101px;
  padding: 10.802px;
  background: #fff;
  border-radius: 7.021px;
  box-shadow:
    0 5.401px 19.444px rgba(0, 0, 0, 0.16),
    0 0 0 0 rgba(0, 0, 0, 0.06);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.cs-value {
  font: 700 var(--exp-size-value) / 1 var(--exp-font-display);
  color: #000;
  font-variant-numeric: tabular-nums;
}

/* Card + radial share a stack so the ring can sit under / around the value */
.cs-card-stack {
  --cs-track-stroke: #c8c8c8;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  touch-action: none;
}

/* Floating readout — anchored to track circle (viewBox y=22 / 200 ≈ 11%), fully above the ring */
.cs-dial-stack {
  position: relative;
  width: 100%;
}

.cs-radial-layer .cs-active-readout {
  position: absolute;
  left: 50%;
  top: 9.5%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%);
  margin-top: -16px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    filter var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear var(--cs-radial-hide-ms, 240ms);
  will-change: opacity, filter;
}

.cs-dial-stack--radial-visible .cs-active-readout {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--cs-radial-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    filter var(--cs-radial-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}

/* Floating value — same chrome as the draggable card (see .cs-value-card) */
.cs-active-readout .cs-value-card--readout-duplicate {
  cursor: default;
  touch-action: none;
}

.cs-dial-stack > .cs-value-card {
  transition: opacity var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-dial-stack--radial-visible > .cs-value-card {
  opacity: 0.68;
  transition: opacity var(--cs-radial-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-dial-stack--radial-visible > .cs-value-card .cs-value {
  color: #a39e98;
  transition: color var(--cs-radial-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-dial-stack > .cs-value-card .cs-value {
  transition: color var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Press halo — same frame + offset as radial SVG; ring diameter = track circle (viewBox 200, radius r → 2r/200 of layer width) */
.cs-press-halo {
  position: absolute;
  left: 50%;
  top: 50%;
  /* Above .cs-radial-layer (same box size) so the ring isn’t lost in WebKit compositing when the radial is opacity 0 */
  z-index: 1;
  width: min(85vw, 280px);
  max-width: 280px;
  aspect-ratio: 1;
  box-sizing: border-box;
  margin: 0;
  transform: translate3d(-50%, -38%, 0);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  filter: blur(var(--cs-halo-blur-rest, 14px));
  -webkit-filter: blur(var(--cs-halo-blur-rest, 14px));
  /* Blur leads, opacity follows so the ring visibly softens before it fades */
  transition:
    filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    -webkit-filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    opacity var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1) var(--cs-halo-hide-opacity-delay, 72ms),
    visibility 0s linear calc(var(--cs-halo-hide-ms, 240ms) + var(--cs-halo-hide-opacity-delay, 72ms));
  will-change: opacity, filter;
  isolation: isolate;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Hiding while radial appears: blur + opacity start together (no --cs-halo-hide-opacity-delay lag) */
.cs-press-halo.cs-press-halo--arc-handoff {
  transition:
    filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    -webkit-filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    opacity var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear var(--cs-halo-hide-ms, 240ms);
}

.cs-press-halo::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  width: calc(100% * var(--cs-halo-diameter-fr, 0.78));
  height: calc(100% * var(--cs-halo-diameter-fr, 0.78));
  border-radius: 50%;
  /* Fallback when color-mix unsupported (older WebKit): ~50% of --cs-track-stroke #c8c8c8 */
  border: 2px solid rgba(200, 200, 200, 0.5);
  pointer-events: none;
}

@supports (color: color-mix(in srgb, black 50%, transparent)) {
  .cs-press-halo::before {
    border-color: color-mix(in srgb, var(--cs-track-stroke) 50%, transparent);
  }
}

.cs-press-halo--visible {
  opacity: 1;
  visibility: visible;
  filter: blur(0);
  -webkit-filter: blur(0);
  transition:
    opacity var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    filter var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    -webkit-filter var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
  will-change: opacity, filter;
}

/*
 * Touch: filter blur often fails to composite the ::before ring; opacity-only reads reliably.
 * Exception: .cs-press-halo--blur-hint (tap affordance) opts back into blur + filter transitions.
 */
@media (pointer: coarse) {
  .cs-press-halo:not(.cs-press-halo--blur-hint),
  .cs-press-halo--visible:not(.cs-press-halo--blur-hint) {
    filter: none !important;
    -webkit-filter: none !important;
  }

  .cs-press-halo:not(.cs-press-halo--blur-hint) {
    transition:
      opacity var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0s linear var(--cs-halo-hide-ms, 240ms);
  }

  .cs-press-halo--visible:not(.cs-press-halo--blur-hint) {
    transition:
      opacity var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 0s;
  }

  /* Tap hint: restore same blur in/out as fine pointer (see base .cs-press-halo / --visible above). */
  .cs-press-halo.cs-press-halo--blur-hint:not(.cs-press-halo--visible) {
    filter: blur(var(--cs-halo-blur-rest, 14px));
    -webkit-filter: blur(var(--cs-halo-blur-rest, 14px));
    transition:
      filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
      -webkit-filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
      opacity var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1) var(--cs-halo-hide-opacity-delay, 72ms),
      visibility 0s linear calc(var(--cs-halo-hide-ms, 240ms) + var(--cs-halo-hide-opacity-delay, 72ms));
  }

  .cs-press-halo.cs-press-halo--blur-hint.cs-press-halo--visible {
    filter: blur(0);
    -webkit-filter: blur(0);
    transition:
      opacity var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
      filter var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
      -webkit-filter var(--cs-halo-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 0s;
  }

  /* Tap hint hide: same as global arc-handoff — blur + opacity together (no opacity lag). */
  .cs-press-halo.cs-press-halo--blur-hint.cs-press-halo--arc-handoff:not(.cs-press-halo--visible) {
    transition:
      filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
      -webkit-filter var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
      opacity var(--cs-halo-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0s linear var(--cs-halo-hide-ms, 240ms);
  }
}

.cs-value-card.cs-value-card--active {
  cursor: grabbing;
}

.cs-value-card:focus-visible {
  outline: 2px solid #000;
  outline-offset: 3px;
}

/* Radial track + thumb — blur-fade in/out (see README) */
.cs-radial-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(85vw, 280px);
  max-width: 280px;
  aspect-ratio: 1;
  transform: translate3d(-50%, -38%, 0);
  z-index: 0;
  pointer-events: none;
  color: var(--cs-track-stroke);
  opacity: 0;
  visibility: hidden;
  filter: blur(var(--cs-blur-rest, 14px));
  -webkit-filter: blur(var(--cs-blur-rest, 14px));
  transition:
    opacity var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    filter var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear var(--cs-radial-hide-ms, 240ms);
  will-change: opacity, filter;
  isolation: isolate;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.cs-radial-layer--visible {
  opacity: 1;
  visibility: visible;
  filter: blur(0);
  -webkit-filter: blur(0);
  transition:
    opacity var(--cs-radial-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    filter var(--cs-radial-appear-ms, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}

/* Black thumb fades in shortly after the grey arc begins appearing */
.cs-radial-layer:not(.cs-radial-layer--visible) .cs-thumb-rot {
  opacity: 0;
  transition: opacity 100ms cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: 0ms;
}

.cs-radial-layer--visible .cs-thumb-rot {
  opacity: 1;
  transition: opacity calc(var(--cs-radial-appear-ms, 300ms) * 0.45) cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--cs-radial-appear-ms, 300ms) * 0.38);
}

/*
 * Pointer-up overscroll (JS eases thumb path): keep --visible so visibility stays composited.
 * Fading by removing --visible first makes parent opacity 0 on WebKit/Android and often stops
 * repainting SVG `d` updates during rAF. This class fades opacity/filter while visibility stays visible.
 */
.cs-radial-layer.cs-radial-layer--visible.cs-radial-layer--release-out {
  opacity: 0;
  visibility: visible;
  filter: blur(var(--cs-blur-rest, 14px));
  -webkit-filter: blur(var(--cs-blur-rest, 14px));
  transition:
    opacity var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    filter var(--cs-radial-hide-ms, 240ms) cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 0s;
}

.cs-radial-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.cs-thumb-path {
  color: #1a1a1a;
}

/* Track stroke uses gradient stops (stroke="url(#…)" ignores `color` on the path) */
.cs-track-fade-stop--edge {
  stop-color: var(--cs-track-stroke);
  stop-opacity: 0;
}

.cs-track-fade-stop--solid {
  stop-color: var(--cs-track-stroke);
  stop-opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .cs-radial-layer {
    filter: none !important;
    -webkit-filter: none !important;
    transition-duration: 0.01ms !important;
  }

  .cs-active-readout {
    transition-duration: 0.01ms !important;
  }

  .cs-radial-layer.cs-radial-layer--visible.cs-radial-layer--release-out {
    transition-duration: 0.01ms !important;
  }

  .cs-radial-layer:not(.cs-radial-layer--visible) {
    opacity: 0;
    visibility: hidden;
  }

  .cs-press-halo {
    filter: none !important;
    -webkit-filter: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .cs-press-halo:not(.cs-press-halo--visible) {
    opacity: 0;
    visibility: hidden;
  }

  .cs-radial-layer--visible .cs-thumb-rot,
  .cs-radial-layer:not(.cs-radial-layer--visible) .cs-thumb-rot {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .cs-value-card {
    transition-duration: 0.01ms !important;
  }

  .cs-value-card.cs-value-card--active {
    transform: scale(1);
  }
}

/* ——— Collapsible tweak panel (bottom) ——— */
.cs-tweak-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  font-size: var(--exp-size-sm);
  line-height: 1.4;
  color: #111;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

.cs-tweak-panel__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 1rem;
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  border: none;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #222;
  cursor: pointer;
}

.cs-tweak-panel__toggle:hover {
  background: #f0f0f0;
}

.cs-tweak-panel__toggle:focus-visible {
  outline: 2px solid #000;
  outline-offset: -2px;
}

.cs-tweak-panel__chev::after {
  content: "▲";
  display: inline-block;
  font-size: 0.65em;
  opacity: 0.55;
  transition: transform 0.2s ease;
}

.cs-tweak-panel:not(.cs-tweak-panel--open) .cs-tweak-panel__chev::after {
  transform: rotate(180deg);
}

.cs-tweak-panel__body {
  max-height: min(52vh, 28rem);
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #eee;
  -webkit-overflow-scrolling: touch;
}

.cs-tweak-panel__hint {
  margin: 0 0 0.75rem;
  color: #444;
}

.cs-tweak-fieldset {
  margin: 0 0 1rem;
  padding: 0.75rem 0 0;
  border: none;
  border-top: 1px solid #eee;
}

.cs-tweak-fieldset:first-of-type {
  border-top: none;
  padding-top: 0;
}

.cs-tweak-fieldset legend {
  padding: 0;
  font: 700 var(--exp-size-meta) / 1.2 var(--exp-font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #666;
}

.cs-tweak-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-top: 0.65rem;
}

.cs-tweak-row--radios {
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.cs-tweak-row--radios .cs-tweak-label {
  grid-column: 1 / -1;
}

.cs-tweak-row--radios label {
  font-weight: 400;
  margin-right: 1rem;
}

.cs-tweak-row--number {
  grid-template-columns: 1fr auto auto;
}

.cs-tweak-label {
  font-weight: 400;
}

.cs-tweak-label em {
  font-weight: 400;
  font-style: normal;
  color: #666;
}

.cs-tweak-row input[type="range"] {
  width: 100%;
  min-width: 6rem;
  max-width: 12rem;
  accent-color: #111;
}

.cs-tweak-row input[type="number"] {
  width: 5rem;
  padding: 0.25rem 0.4rem;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.cs-tweak-out {
  min-width: 3.25rem;
  font-variant-numeric: tabular-nums;
  color: #333;
  text-align: right;
}

.cs-tweak-help {
  margin: 0.35rem 0 0;
  grid-column: 1 / -1;
  font-size: var(--exp-size-meta);
  color: #666;
}

.cs-tweak-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.cs-tweak-btn {
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-weight: 700;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.cs-tweak-btn:hover {
  background: #f5f5f5;
}

.cs-tweak-btn:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.cs-tweak-btn--danger {
  border-color: #c44;
  color: #a22;
}

.cs-tweak-btn--danger:hover {
  background: #fff5f5;
}

@media (max-width: 36rem) {
  .cs-tweak-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .cs-tweak-row input[type="range"] {
    max-width: none;
  }

  .cs-tweak-out {
    text-align: left;
  }
}
