.btn-primary {
  margin-left: auto;
  background: #3182ce;
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover  { background: #2b6cb0; }
.btn-primary:active { transform: scale(0.97); }

/* ── Game area ─────────────────────────────────────────────────────── */
#game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 28px;
  align-items: center;
  justify-content: flex-start;
}

.area-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #718096;
  margin-bottom: 8px;
  text-align: center;
}

#pattern-section, #bank-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#pattern-row, #bank-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ── Sequence boxes ────────────────────────────────────────────────── */
.seq-box {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  line-height: 1;
}
.seq-box-blank {
  background: #f1f5f9;
  border-style: dashed;
  color: #cbd5e0;
}
.seq-box-blank::before {
  content: '?';
  font-size: 1.6rem;
  font-weight: 700;
  color: #cbd5e0;
}
.seq-box-active {
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66,153,225,0.28), 0 3px 8px rgba(0,0,0,0.08);
  background: #ebf4fb;
}

/* ── Bank tiles ────────────────────────────────────────────────────── */
.bank-tile {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.10);
  font-size: 2.8rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.bank-tile:hover  { border-color: #4299e1; box-shadow: 0 4px 12px rgba(66,153,225,0.28); }
.bank-tile:active { transform: scale(0.96); }

/* ── Shake (wrong answer) ──────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px) rotate(-2deg); }
  40%      { transform: translateX(8px)  rotate(2deg); }
  60%      { transform: translateX(-6px) rotate(-1deg); }
  80%      { transform: translateX(6px)  rotate(1deg); }
}
.shake { animation: shake 0.45s ease; }

/* Prompt button in settings bar */
.btn-prompt {
  background: #dd6b20;
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-prompt:hover { background: #c05621; }

/* ── Prompt effects on bank tiles ──────────────────────────────────── */
@keyframes sparkle-pulse {
  0%   { box-shadow: 0 0 6px 3px #ffd700, 0 0 14px 6px rgba(255,215,0,0.55), 0 0 24px 10px rgba(255,165,0,0.25); }
  50%  { box-shadow: 0 0 12px 6px #ffd700, 0 0 28px 12px rgba(255,215,0,0.65), 0 0 44px 20px rgba(255,140,0,0.35); }
  100% { box-shadow: 0 0 6px 3px #ffd700, 0 0 14px 6px rgba(255,215,0,0.55), 0 0 24px 10px rgba(255,165,0,0.25); }
}
.bank-tile.prompt-sparkle {
  animation: sparkle-pulse 1s ease-in-out infinite;
  border-color: #d69e2e !important;
}
.bank-tile.prompt-outline {
  border: 3px solid #38a169 !important;
  box-shadow: 0 0 0 3px rgba(56,161,105,0.38), 0 3px 8px rgba(0,0,0,0.1) !important;
  background: rgba(56,161,105,0.05);
}

/* ── Next / Retry overlay ──────────────────────────────────────────── */
#bank-section { position: relative; }

#trial-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
}
.btn-watermark {
  padding: 11px 30px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 18px rgba(0,0,0,0.28);
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}
.btn-watermark:hover  { opacity: 0.93; transform: scale(1.04); }
.btn-watermark:active { transform: scale(0.97); }
.btn-watermark-next  { background: rgba(47,133,90,0.92);  color: #fff; }
.btn-watermark-retry { background: rgba(192,86,33,0.88);  color: #fff; }

/* ── Bottom bar ────────────────────────────────────────────────────── */
#bottom-bar {
  background: #fff;
  border-top: 2px solid #dde3ed;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.btn-print     { background: #4a5568; color: #fff; border: none; padding: 7px 18px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-print:hover { background: #2d3748; }
.btn-clear-data { background: #c53030; color: #fff; border: none; padding: 7px 18px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-clear-data:hover { background: #9b2c2c; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  padding: 0;
}
.btn-icon svg { width: 20px; height: 20px; fill: currentColor; }

@media print {
  body > *:not(#print-section) { display: none !important; }
  #print-section {
    display: block;
    padding: 18px 24px;
    font-family: Arial, sans-serif;
    font-size: 11pt;
    color: #000;
  }
  #print-section h2 { font-size: 15pt; margin-bottom: 4px; }
  #print-meta { font-size: 9pt; color: #444; margin-bottom: 14px; }
  #results-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
  #results-table th, #results-table td {
    border: 1px solid #666; padding: 5px 8px; text-align: left; vertical-align: top;
  }
  #results-table th { background: #e8e8e8; font-weight: bold; font-size: 9.5pt; }
  #results-table tr:nth-child(even) td { background: #f7f7f7; }
  #results-table tr.settings-changed td { background: #e8e8e8 !important; }
  #results-table td.outcome-error      { color: #c0392b; }
  #results-table td.outcome-prompted   { color: #b7791f; }
  #results-table td.outcome-correction { color: #6b46c1; }
  #results-table td.outcome-ok         { color: #27ae60; }
  #print-summary { font-size: 9.5pt; color: #333; border-top: 1px solid #bbb; padding-top: 8px; }
  #print-summary span { margin-right: 20px; }
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .seq-box  { width: 60px; height: 60px; font-size: 1.9rem; }
  .bank-tile { width: 72px; height: 72px; font-size: 2.1rem; }
  #game-area { padding: 16px 12px; gap: 18px; }
}
@media (max-width: 480px) {
  .seq-box   { width: 48px; height: 48px; font-size: 1.5rem; }
  .bank-tile { width: 60px; height: 60px; font-size: 1.7rem; }
}

/* ══════════════════════════════════════════════════════════════════
   Round setup panel (Frame 04 - gated compact settings + ABA prompting)
   Sage clinical palette mirrors design_handoff_admin_redesign Frame 04.
   ══════════════════════════════════════════════════════════════════ */
.btn-round {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f3f6ee; border: 1px solid #dfe6d2; color: #4d5840;
  border-radius: 9px; padding: 8px 13px;
  font: inherit; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: none;            /* let press-hold work cleanly on touch */
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-round:hover { background: #eaf0e0; }
.btn-round.is-holding { box-shadow: 0 0 0 3px rgba(77,88,64,0.22); }
.btn-round.is-open { background: #4d5840; color: #fff; border-color: #4d5840; }

#round-panel {
  width: min(1200px, 96vw); max-width: none; margin: 14px auto 6px;
  background: #fff; border: 1px solid #e2e6d9; border-radius: 16px;
  box-shadow: 0 16px 42px rgba(44,51,31,0.16); overflow: hidden;
  font-family: 'Segoe UI', Inter, -apple-system, sans-serif; color: #1a1f14;
}

.round-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.round-title { font-size: 16px; font-weight: 700; color: #1a1f14; }
.round-head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.round-set-picker select {
  background: #f3f6ee; border: 1px solid #dfe6d2; color: #4d5840;
  border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.round-gate-pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 11px;
  font-size: 11.5px; font-weight: 700; background: #eef1e8; border: 1px solid #dfe3d6; color: #7a8568; white-space: nowrap;
}
#round-panel[data-editing="true"] .round-gate-pill { background: #fef3c7; border-color: #fae3a0; color: #92722a; font-size: 0; }
#round-panel[data-editing="true"] .round-gate-pill::before { content: "🔓"; }
#round-panel[data-editing="true"] .round-gate-pill::after  { content: "Editing"; font-size: 11.5px; }
.round-close { background: transparent; border: none; color: #9aa589; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.round-close:hover { color: #5d6a4d; }

/* Body · one field per row, top to bottom, divided (no scanning) */
.round-body { padding: 4px 18px 6px; }
.round-field { padding: 9px 0; border-top: 1px solid #eef0e9; }
.round-field:first-child { border-top: none; }
.round-field-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* Three-column body on desktop: Patterns spans the top; Core | Prompting | Advanced */
.round-field-patterns { border-top: none; }
.round-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: start; border-top: 1px solid #eef0e9; }
.round-col { display: flex; flex-direction: column; min-width: 0; padding: 0 20px; }
.round-col:first-child { padding-left: 0; }
.round-col:last-child { padding-right: 0; }
.round-col + .round-col { border-left: 1px solid #eef0e9; }
.round-col-title { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #a3ad92; padding: 11px 0 1px; }
.round-col-title + .round-field,
.round-col-title + .round-field-prompting { border-top: none; }

/* Tablet: two columns, Advanced drops to a full-width row beneath */
@media (max-width: 900px) {
  .round-cols { grid-template-columns: 1fr 1fr; }
  .round-col { padding: 0 16px; }
  .round-col-advanced { grid-column: 1 / -1; border-left: none; border-top: 1px solid #eef0e9; padding: 0; }
}

/* Phone: single column; column rules become horizontal dividers */
@media (max-width: 639px) {
  .round-cols { grid-template-columns: 1fr; }
  .round-col { padding: 0; }
  .round-col + .round-col { border-left: none; border-top: 1px solid #eef0e9; }
}
.round-field-label { font-size: 13px; font-weight: 700; color: #2c331f; }
.round-field-note  { font-weight: 500; color: #a3ad92; }
.round-field-hint  { font-size: 11px; line-height: 1.35; color: #a3ad92; margin: 8px 0 0; }

.round-patterns { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.round-pill {
  font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px;
  background: #fff; border: 1px solid #dfe3d6; color: #aab199; cursor: pointer; font-family: inherit;
}
.round-pill:hover { border-color: #c7cdb6; }
.round-pill.is-on { font-weight: 700; background: #4d5840; border-color: #4d5840; color: #fff; }
.round-pill.is-on::before { content: "✓ "; }

.round-stepper { display: inline-flex; align-items: center; gap: 2px; background: #f4f6ef; border: 1px solid #e7ebe0; border-radius: 9px; padding: 3px; }
.round-step { width: 32px; height: 32px; border: none; background: #fff; border-radius: 7px; font-size: 17px; color: #5d6a4d; cursor: pointer; box-shadow: 0 1px 2px rgba(44,51,31,0.08); }
.round-step:hover { background: #eef1e8; }
.round-step-val { width: 34px; text-align: center; font-size: 15px; font-weight: 700; color: #1a1f14; }

.round-symbols { background: #fff; border: 1px solid #e2e6d9; border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 12.5px; font-weight: 700; color: #1a1f14; cursor: pointer; }

.round-prompting { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.round-radio {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: #fff; border: 1px solid #e2e6d9; border-radius: 9px; padding: 8px 12px;
  cursor: pointer; font-family: inherit; width: 100%;
}
.round-radio:hover { border-color: #c7cdb6; }
.round-radio-dot { flex-shrink: 0; width: 16px; height: 16px; border-radius: 999px; border: 2px solid #cdd4c0; background: #fff; }
.round-radio-label { font-size: 13px; font-weight: 600; color: #2c331f; }
.round-radio.is-on { border-color: #4d5840; box-shadow: inset 0 0 0 1px #4d5840; }
.round-radio.is-on .round-radio-label { font-weight: 700; }
.round-radio.is-on .round-radio-dot { border-color: #4d5840; background: radial-gradient(circle at center, #4d5840 0 5px, #fff 6px); }

.round-toggle { position: relative; width: 46px; height: 26px; border-radius: 999px; border: none; background: #d4dac9; cursor: pointer; transition: background 0.15s; }
.round-toggle.is-on { background: #4d5840; }
.round-toggle-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.15s; }
.round-toggle.is-on .round-toggle-knob { transform: translateX(20px); }

/* Advanced overrides - collapsible group holding the former Options controls */
.round-advanced { margin-top: 4px; }
.round-advanced > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 7px 0; font-size: 12px; font-weight: 700; color: #5d6a4d; }
.round-advanced > summary::-webkit-details-marker { display: none; }
.round-advanced > summary::before { content: "▸"; color: #9aa589; transition: transform 0.15s; }
.round-advanced[open] > summary::before { transform: rotate(90deg); }
.round-advanced-body { display: flex; flex-direction: column; gap: 9px; padding: 4px 0 6px; }
.round-advanced-body .checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: #2c331f; cursor: pointer; }
.round-advanced-body .extra-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.round-advanced-body .extra-row select,
.round-advanced-body #sel-prompt-style { background: #fff; border: 1px solid #e2e6d9; border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 12px; font-weight: 700; color: #1a1f14; cursor: pointer; }

/* Footer */
.round-foot { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.btn-round-start { flex: 1; background: #4d5840; color: #fff; border: none; border-radius: 10px; padding: 12px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-round-start:hover { background: #3f4a35; }
.btn-round-save { background: transparent; color: #5d6a4d; border: 1px solid #e2e6d9; border-radius: 10px; padding: 11px 14px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-round-save:hover { background: #f4f6ef; }
.btn-round-reset { background: transparent; color: #8a9678; border: none; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Gating - when locked, editable controls are inert + muted (Start stays live) */
#round-panel[data-editing="false"] .round-pill,
#round-panel[data-editing="false"] .round-step,
#round-panel[data-editing="false"] .round-symbols,
#round-panel[data-editing="false"] .round-radio,
#round-panel[data-editing="false"] .round-toggle,
#round-panel[data-editing="false"] .round-advanced-body,
#round-panel[data-editing="false"] .btn-round-save,
#round-panel[data-editing="false"] .btn-round-reset {
  pointer-events: none; opacity: 0.55;
}

@media (max-width: 520px) {
  #round-panel { max-width: none; margin: 12px 10px 6px; }
}
