body[data-experiment="peanut-variation"] {
  --peanut-panel: #f4f7ef;
  --peanut-trim: #b1c6b4;
  --peanut-ink: #284e42;
  --peanut-hint: #f9faf3;
  --peanut-edge: #9bb5a4;
}
body[data-experiment="peanut-variation"] .stage {
  background: #dce5df;
}
body[data-experiment="peanut-variation"] [data-hint]:not(:empty) {
  padding: 9px 11px;
  border: 1px solid var(--peanut-trim);
  border-radius: 8px;
  background: #edf4e9;
  color: var(--peanut-ink);
  line-height: 1.7;
}
body[data-experiment="peanut-variation"] [data-hint]:empty { display: none; }

.peanut-record {
  width: min(760px, calc(100vw - 32px));
  max-height: 90vh;
  padding: 22px;
  border: 1px solid var(--peanut-trim);
  border-radius: 10px;
  background: var(--peanut-panel);
  color: var(--peanut-ink);
}
.peanut-record::backdrop { background: #0c1115b8; }
.peanut-record h2 { margin: 0 65px 16px 0; font-size: 19px; }
.peanut-record form { position: absolute; top: 15px; right: 18px; }
.peanut-record table { width: 100%; border-collapse: collapse; text-align: center; }
.peanut-record th, .peanut-record td { padding: 8px 4px; border-bottom: 1px solid var(--peanut-trim); }
.peanut-record details { margin: 14px 0; line-height: 1.7; }
.peanut-record summary { cursor: pointer; }
.peanut-record canvas { width: 100%; height: auto; }
.peanut-record textarea { width: 100%; margin-top: 6px; padding: 8px; font: inherit; }
#peanut-prediction { display: block; width: 100%; margin-top: 8px; }
.peanut-camera {
  position: absolute;
  z-index: 2;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 24px);
  color: #fff;
}
.peanut-camera button, .peanut-camera span {
  border: 1px solid var(--peanut-edge);
  border-radius: 5px;
  padding: 6px 9px;
  background: #f9faf3ed;
  color: var(--peanut-ink);
  font-size: 11px;
  line-height: 1.2;
}
.peanut-camera span { padding: 5px 8px; border-radius: 4px; font-size: 11px; }

.peanut-click-hint {
  position: fixed;
  z-index: 2147483647;
  width: max-content;
  max-width: min(260px, calc(100vw - 16px));
  padding: 10px 13px;
  border-radius: 7px;
  background: var(--peanut-hint);
  color: var(--peanut-ink);
  border: 1px solid var(--peanut-trim);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 6px 20px #0005;
  pointer-events: none;
}

.peanut-record [data-readings] {
  padding: 9px 12px;
  border: 1px solid var(--peanut-trim);
  border-radius: 6px;
}
.peanut-record summary { font-weight: 600; }
.peanut-record [data-reading-count] { margin-left: 7px; color: #486b5e; font-size: .88em; }
.peanut-reading-list { max-height: 280px; overflow: auto; }
.peanut-reading-list thead { position: sticky; top: 0; background: var(--peanut-panel); }

.peanut-auto-prompt {
  width: min(390px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--peanut-trim);
  border-radius: 10px;
  background: var(--peanut-panel);
  color: var(--peanut-ink);
}
.peanut-auto-prompt::backdrop { background: #0c1115b8; }
.peanut-auto-prompt h2 { margin: 0; font-size: 18px; }
.peanut-auto-prompt p { margin: 12px 0 18px; line-height: 1.6; }
.peanut-auto-prompt .control-buttons { justify-content: flex-end; }

/* The graph lives above the sample boxes in both modes. Only its summary
   accepts input so manual picking can still reach the scene through the chart. */
.stage > .peanut-distribution {
  display: none;
  position: absolute;
  z-index: 4;
  top: 5%;
  left: 50%;
  width: min(70%, 670px);
  height: 43%;
  margin: 0;
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid var(--peanut-trim);
  border-radius: 8px;
  background: #f4f7eff5;
  color: var(--peanut-ink);
  box-shadow: 0 8px 22px #0004;
  pointer-events: none;
}
.stage > .peanut-distribution[open] {
  display: flex;
  flex-direction: column;
}
.peanut-distribution summary {
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  font-weight: 600;
  pointer-events: auto;
}
.stage > .peanut-distribution canvas:not([hidden]) {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 2px 0 0;
  object-fit: contain;
}
.peanut-distribution canvas[hidden] { display: none; }
body.phone-lab #controls .peanut-camera { position: static; flex-wrap: wrap; margin-bottom: 8px; }
body.phone-lab #controls .peanut-distribution:not([open]) { display: none; }
body.phone-lab #controls .peanut-distribution canvas { width: 100%; height: auto; }
