body {
  background-color: #fffffb; /* mild off-white (tufte.css uses #fffff8) */
}

.jspsych-content {
  max-width: 800px;
}

.defer-btn {
  background-color: #e8f0fe;
  border-color: #4a6fd0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

table.feedback,
table.results {
  margin: 0 auto 1em;
  border-collapse: collapse;
}

table.feedback td,
table.results td,
table.results th {
  padding: 6px 12px;
  text-align: left;
}

table.results th,
table.results td {
  border-bottom: 1px solid #ddd;
}

.right-mark {
  color: #1a7f37;
}

.wrong-mark {
  color: #c62828;
}

/* Block details, fixed at the top of the screen */
/* Overall progress bar pinned to the very top, block header just below it */
#jspsych-progressbar-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11;
  height: 32px;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 16px;
}

#block-header {
  position: fixed;
  top: 32px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 24px;
  padding: 6px 16px;
  background: #f4f6fb;
  border-bottom: 1px solid #d8dce6;
  font-size: 15px;
}

#block-header[hidden] {
  display: none;
}

.jspsych-content-wrapper {
  padding-top: 88px; /* progress bar (32px) + block header */
  box-sizing: border-box;
}

/* Dots + robot watching them */
.dots-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.dots-canvas {
  border-radius: 50%;
  border: 1px solid #ccc;
}

.connect-canvas {
  border: 1px solid #ccc;
}

.rotation-canvas {
  border: 1px solid #ccc;
}

ul.premises {
  list-style: none;
  margin: 0;
  padding: 12px 20px;
  min-width: 260px;
  border: 1px solid #ccc;
  text-align: left;
  font-size: 18px;
  line-height: 1.7;
}

.dots-side,
.dots-stage::after {
  width: 130px; /* matching spacer keeps the dots centred */
}

.dots-stage::after {
  content: "";
}

.watcher-name {
  font-size: 13px;
  color: #555;
}

.watcher .robot {
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.dots-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.dots-buttons .robot,
table.results .robot {
  vertical-align: middle;
}

/* Body text: justified, narrow measure */
.jspsych-content p {
  max-width: 50ch;
  margin-left: auto;
  margin-right: auto;
  text-align: justify;
  hyphens: auto;
}

/* The one-line question under each stimulus stays centred under it */
.jspsych-content .dots-prompt p {
  text-align: center;
}

/* First instruction page: text in the usual 50ch column, example picture in the right margin */
.intro-with-example {
  display: grid;
  grid-template-columns: 1fr minmax(0, 50ch) 1fr;
  column-gap: 32px;
  align-items: center;
  width: min(100vw - 32px, 50ch + 2 * 200px + 64px);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.intro-with-example .intro-text {
  grid-column: 2;
}

.margin-figure {
  grid-column: 3;
  margin: 0;
  max-width: 200px;
}

.margin-figure canvas {
  display: block;
  width: 100%;
  height: auto;
  box-sizing: border-box;
}

.margin-figure ul.premises {
  min-width: 0;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.5;
}

.margin-figure .example-question {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.margin-figure figcaption {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: #555;
}
