/* ==========================================================================
   The toy frame — shared by all four toys.

   A toy page is: a title row, a stage (the thing you're making), and a panel
   of controls. Everything below is layout and controls only; the toys
   themselves style nothing outside their own .toy-stage.
   ========================================================================== */

.toy-page { padding: 34px 0 0; }

/* ----------------------------  TITLE ROW  --------------------------------- */

.toy-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}
.toy-back {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  transition: color .18s ease;
}
.toy-back:hover { color: var(--text); }
.toy-title {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(28px, 4.4vw, 46px);
  letter-spacing: .15em;
  text-indent: .15em;
  margin: 0;
  line-height: 1;
}
.toy-sub {
  font-size: 14.5px;
  color: var(--text-dim);
  margin: 10px 0 0;
  max-width: 56ch;
}

/* ----------------------------  LAYOUT  ------------------------------------ */

.toy-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 20px;
  align-items: start;
}

.toy-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(6,4,10,.62);
  overflow: hidden;
  min-height: 320px;
}

.toy-panel {
  background: rgba(10,6,16,.72);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 20px;
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ----------------------------  CONTROLS  ---------------------------------- */

.ctl { display: flex; flex-direction: column; gap: 9px; }

.ctl-label {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.ctl-value {
  font-family: var(--font-ui);
  font-weight: 400;
  color: var(--text);
  letter-spacing: .08em;
  text-transform: none;
}

/* Segmented group — the standard "pick one of these" control */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 9px 10px;
  color: var(--text-dim);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.seg button:hover { background: rgba(255,255,255,.12); color: var(--text); }
.seg button[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(255,255,255,.22) inset;
  cursor: pointer;
  padding: 0;
  transition: transform .14s ease, border-color .14s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { border-color: #fff; transform: scale(1.12); }

/* Range */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255,255,255,.18);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: pointer;
}
input[type="range"]:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

/* Text input */
.ctl input[type="text"] {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--text);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 12px;
  width: 100%;
}
.ctl input[type="text"]:focus {
  outline: none;
  border-color: rgba(255,255,255,.42);
  background: rgba(255,255,255,.1);
}
.ctl input[type="text"]::placeholder { color: rgba(255,255,255,.32); }

/* Action row */
.toy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toy-actions .btn { flex: 1 1 auto; justify-content: center; padding: 12px 16px; font-size: 12px; }

/* A hint line under the stage */
.toy-hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 12px 0 0;
  text-align: center;
}

/* ----------------------------  RESPONSIVE  -------------------------------- */

@media (max-width: 900px) {
  /* minmax(0,1fr), not 1fr: a plain 1fr track refuses to go below its
     content's max-content width, and the 16-step Beat grid then shoved the
     control panel off the right of the screen. */
  .toy-shell { grid-template-columns: minmax(0, 1fr); }
  .toy-panel { order: 2; }
  .toy-stage { order: 1; }
}
