/*
 * AI STEAM Plus — Interactive elements stylesheet (Phase 4 f.4)
 * Brand colours: primary #00FF88, secondary #7B5EA7
 * WCAG 2.1 AA — focus rings + contrast + reduced-motion honoured
 */

.aisteam-interactives {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

.aisteam-interactives-heading {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #00FF88;
  margin: 0 0 0.5rem 0;
  border-bottom: 1px solid rgba(0, 255, 136, 0.25);
  padding-bottom: 0.5rem;
}

.aisteam-interactive {
  background: rgba(20, 24, 36, 0.6);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 12px;
  padding: 1.25rem;
  color: #e6f3ec;
  font-family: 'Inter', system-ui, sans-serif;
}

.aisteam-interactive:focus-within {
  outline: 2px solid #00FF88;
  outline-offset: 2px;
}

.aisteam-int-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #00FF88;
}

.aisteam-int-hint {
  font-size: 0.85rem;
  color: #9ab3a8;
  margin: 0.75rem 0 0 0;
  font-style: italic;
}

/* 2026-05-31 STEAM Issues #2/#3/#5/#7/#9/#10 — per-widget instruction
   line that names the activity and what to do, populated from
   lesson.interactiveElements[i].config.instruction. */
.aisteam-int-instruction {
  font-size: 0.95rem;
  color: #c5d8ce;
  margin: 0 0 0.85rem 0;
  line-height: 1.45;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 255, 136, 0.06);
  border-left: 3px solid #00FF88;
  border-radius: 4px;
}

/* PeerVote question shown above the option buttons. */
.aisteam-int-vote-question {
  font-size: 1rem;
  color: #E8F5D9;
  margin: 0 0 0.85rem 0;
  line-height: 1.4;
}

/* SliderExplore formula echoed under the slider. */
.aisteam-int-formula {
  font-size: 0.85rem;
  color: #9ab3a8;
  margin: 0.5rem 0 0 0;
}
.aisteam-int-formula code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
}

/* CanvasSim caption naming the topic being visualised. */
.aisteam-int-canvas-caption {
  font-size: 0.85rem;
  color: #c5d8ce;
  margin: 0.5rem 0 0 0;
  text-align: center;
}

/* ---- 1. ClickReveal ---- */
.aisteam-int-clickreveal {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aisteam-int-cr-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(123, 94, 167, 0.4);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
}

.aisteam-int-cr-item summary {
  color: #d5f7e6;
  font-weight: 500;
  outline: none;
  list-style: none;
}

.aisteam-int-cr-item summary::-webkit-details-marker { display: none; }
.aisteam-int-cr-item summary::before {
  content: '▶ ';
  color: #00FF88;
  margin-right: 0.5em;
}
.aisteam-int-cr-item[open] summary::before { content: '▼ '; }

.aisteam-int-cr-item:hover { border-color: rgba(0, 255, 136, 0.5); }
.aisteam-int-cr-item:focus-within { outline: 2px solid #00FF88; outline-offset: 2px; }

.aisteam-int-cr-answer {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  color: #c0e8d4;
}

/* ---- 2. DragDrop ---- */
.aisteam-int-dd-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .aisteam-int-dd-area { grid-template-columns: 1fr 1fr; }
}

.aisteam-int-dd-source {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px dashed rgba(0, 255, 136, 0.3);
  min-height: 60px;
}

.aisteam-int-dd-item {
  background: linear-gradient(135deg, #00FF88, #00cc70);
  color: #061a10;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  cursor: grab;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
}

.aisteam-int-dd-item:active { cursor: grabbing; }
.aisteam-int-dd-item.dragging { opacity: 0.5; }
.aisteam-int-dd-item:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.aisteam-int-dd-targets {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .aisteam-int-dd-targets { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

.aisteam-int-dd-target {
  background: rgba(123, 94, 167, 0.15);
  border: 2px dashed rgba(123, 94, 167, 0.5);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 80px;
}

.aisteam-int-dd-target.drag-over {
  background: rgba(0, 255, 136, 0.15);
  border-color: #00FF88;
}

.aisteam-int-dd-target h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  color: #b3a0d0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.aisteam-int-dd-target-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 30px;
}

/* ---- 3. TapToCount ---- */
.aisteam-int-ttc {
  text-align: center;
}

.aisteam-int-ttc-display {
  font-size: 2.25rem;
  font-weight: 700;
  color: #00FF88;
  margin: 0.5rem 0 1rem 0;
  font-family: 'JetBrains Mono', monospace;
}

.aisteam-int-ttc-button {
  background: linear-gradient(135deg, #00FF88, #00cc70);
  color: #061a10;
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  min-width: 160px;
}

.aisteam-int-ttc-button:hover { filter: brightness(1.1); }
.aisteam-int-ttc-button:active { transform: translateY(2px); }
.aisteam-int-ttc-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.aisteam-int-ttc-reset {
  display: block;
  margin: 0.5rem auto 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #9ab3a8;
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.aisteam-int-ttc.completed .aisteam-int-ttc-display { color: #00FF88; text-shadow: 0 0 20px rgba(0, 255, 136, 0.6); }
.aisteam-int-ttc.completed .aisteam-int-ttc-button::after { content: ' ✓'; color: #fff; }

/* ---- 4. MatchPair ---- */
.aisteam-int-mp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 480px) {
  .aisteam-int-mp-grid { grid-template-columns: repeat(4, 1fr); }
}

.aisteam-int-mp-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(123, 94, 167, 0.4);
  border-radius: 8px;
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aisteam-int-mp-card .aisteam-int-mp-back { display: none; padding: 0.5rem; text-align: center; }
.aisteam-int-mp-card.flipped { background: rgba(0, 255, 136, 0.15); border-color: #00FF88; }
.aisteam-int-mp-card.flipped .aisteam-int-mp-face { display: none; }
.aisteam-int-mp-card.flipped .aisteam-int-mp-back { display: block; }
.aisteam-int-mp-card.matched { background: rgba(0, 255, 136, 0.3); border-color: #00FF88; cursor: default; }
.aisteam-int-mp-card:focus-visible { outline: 2px solid #00FF88; outline-offset: 2px; }

.aisteam-int-mp-status { font-size: 0.9rem; color: #c0e8d4; }
.aisteam-int-mp-matched { color: #00FF88; font-weight: 700; }

/* ---- 5. SliderExplore ---- */
.aisteam-int-slider-label {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: #d5f7e6;
}

.aisteam-int-slider-value { color: #00FF88; font-family: 'JetBrains Mono', monospace; }

.aisteam-int-slider-input {
  display: block;
  width: 100%;
  margin: 0.5rem 0 1rem 0;
  accent-color: #00FF88;
}

.aisteam-int-slider-input:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.aisteam-int-slider-output {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 1.05rem;
}

.aisteam-int-slider-output-value {
  color: #00FF88;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 0.5rem;
}

/* ---- 6. CanvasSim ---- */
.aisteam-int-canvas-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

.aisteam-int-canvas {
  background: #0a0e1a;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  max-width: 100%;
}

.aisteam-int-canvas-controls { display: flex; gap: 0.5rem; }

.aisteam-int-canvas-play,
.aisteam-int-canvas-reset,
.aisteam-int-graph-add,
.aisteam-int-graph-clear,
.aisteam-int-vote-reset {
  background: rgba(0, 255, 136, 0.15);
  color: #00FF88;
  border: 1px solid #00FF88;
  border-radius: 6px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9rem;
}

.aisteam-int-canvas-play:hover,
.aisteam-int-canvas-reset:hover,
.aisteam-int-graph-add:hover,
.aisteam-int-graph-clear:hover,
.aisteam-int-vote-reset:hover { background: rgba(0, 255, 136, 0.25); }

/* ---- 7. GraphBuilder ---- */
.aisteam-int-graph-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.aisteam-int-graph-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  color: #fff;
  width: 80px;
  font-family: 'JetBrains Mono', monospace;
}

.aisteam-int-graph-canvas {
  display: block;
  background: #0a0e1a;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  max-width: 100%;
}

/* ---- 8. PeerVote ---- */
.aisteam-int-vote-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.aisteam-int-vote-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(123, 94, 167, 0.4);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  text-align: left;
}

.aisteam-int-vote-option:hover { border-color: rgba(0, 255, 136, 0.5); }
.aisteam-int-vote-option:focus-visible { outline: 2px solid #00FF88; outline-offset: 2px; }

.aisteam-int-vote-bar {
  display: block;
  grid-column: 1 / -1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 0.35rem;
  overflow: hidden;
}

.aisteam-int-vote-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7B5EA7, #00FF88);
  transition: width 0.3s ease;
}

.aisteam-int-vote-count {
  color: #00FF88;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .aisteam-int-vote-fill { transition: none; }
  .aisteam-int-mp-card,
  .aisteam-int-dd-item,
  .aisteam-int-ttc-button { transition: none; }
}

/* ---- High contrast ---- */
@media (prefers-contrast: more) {
  .aisteam-interactive { border-color: #00FF88; }
  .aisteam-int-cr-item,
  .aisteam-int-dd-target,
  .aisteam-int-mp-card,
  .aisteam-int-vote-option { border-color: #fff; }
}

/* ---- Error fallback ---- */
.aisteam-interactive-error {
  background: rgba(220, 80, 80, 0.1);
  border-color: rgba(220, 80, 80, 0.4);
  color: #ffb0b0;
  text-align: center;
  padding: 1rem;
}

/* PR-E (2026-05-27): 4 new widget classes. */
.aisteam-int-ptc-prompt {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  color: rgba(255,255,255,0.88);
}
.aisteam-int-ptc-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}
.aisteam-int-ptc-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
}
.aisteam-int-ptc-text {
  width: 100%;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(123,94,167,0.30);
  color: rgba(255,255,255,0.88);
  border-radius: 0.4rem;
  padding: 0.55rem 0.65rem;
  font-family: inherit;
  font-size: 0.88rem;
}
.aisteam-int-ptc-check {
  background: rgba(150,211,95,0.20);
  color: #d4f0b2;
  border: 1px solid rgba(150,211,95,0.40);
  border-radius: 0.4rem;
  padding: 0.42rem 0.85rem;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  margin-top: 0.5rem;
}
.aisteam-int-ptc-check:disabled { opacity: 0.55; cursor: default; }
.aisteam-int-ptc-result {
  margin-top: 0.85rem;
  padding: 0.65rem 0.8rem;
  background: rgba(34,211,238,0.06);
  border: 1px solid rgba(34,211,238,0.22);
  border-radius: 0.45rem;
  color: rgba(255,255,255,0.88);
  font-size: 0.88rem;
}
.aisteam-int-ptc-explain {
  margin-top: 0.4rem;
  color: rgba(255,255,255,0.72);
  font-size: 0.82rem;
}

.aisteam-int-numline-range {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.88rem; color: rgba(255,255,255,0.75);
}
.aisteam-int-numline-slider { flex: 1; min-width: 0; }
.aisteam-int-numline-readout {
  margin-top: 0.55rem;
  font-size: 0.86rem;
  color: rgba(255,255,255,0.85);
}
.aisteam-int-numline-status {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.75);
}
.aisteam-int-numline-status-hit {
  color: #d4f0b2;
  font-weight: 600;
}

.aisteam-int-eqb-tokens {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-bottom: 0.7rem;
}
.aisteam-int-eqb-tok {
  background: rgba(34,211,238,0.10);
  color: #cffafe;
  border: 1px solid rgba(34,211,238,0.30);
  border-radius: 0.35rem;
  padding: 0.32rem 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  cursor: pointer;
}
.aisteam-int-eqb-tok.aisteam-int-eqb-placed { opacity: 0.35; cursor: default; }
.aisteam-int-eqb-target {
  background: rgba(0,0,0,0.32);
  border: 1px dashed rgba(255,255,255,0.20);
  border-radius: 0.45rem;
  padding: 0.65rem 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(255,255,255,0.78);
  min-height: 2.5rem;
  font-size: 0.95rem;
}
.aisteam-int-eqb-actions {
  display: flex; gap: 0.45rem; margin-top: 0.65rem;
}
.aisteam-int-eqb-check, .aisteam-int-eqb-reset {
  background: rgba(150,211,95,0.16);
  color: #d4f0b2;
  border: 1px solid rgba(150,211,95,0.35);
  border-radius: 0.35rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.aisteam-int-eqb-reset {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.75);
  border-color: rgba(255,255,255,0.20);
}
.aisteam-int-eqb-result {
  margin-top: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.4rem;
  font-size: 0.86rem;
}
.aisteam-int-eqb-result-ok { background: rgba(150,211,95,0.12); color: #d4f0b2; }
.aisteam-int-eqb-result-bad { background: rgba(239,68,68,0.12); color: #fecaca; }

.aisteam-int-sphere {
  display: flex; flex-direction: column; gap: 0.85rem;
}
.aisteam-int-sphere-items {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.aisteam-int-sphere-item {
  background: rgba(34,211,238,0.08);
  color: #cffafe;
  border: 1px solid rgba(34,211,238,0.28);
  border-radius: 0.35rem;
  padding: 0.34rem 0.65rem;
  font-size: 0.86rem;
  cursor: pointer;
}
.aisteam-int-sphere-item.aisteam-int-sphere-active {
  background: rgba(34,211,238,0.20);
  border-color: rgba(34,211,238,0.55);
}
.aisteam-int-sphere-item:disabled { opacity: 0.42; cursor: default; }
.aisteam-int-sphere-buckets {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem;
}
@media (min-width: 720px) {
  .aisteam-int-sphere-buckets { grid-template-columns: repeat(4, 1fr); }
}
.aisteam-int-sphere-bucket {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
}
.aisteam-int-sphere-bucket strong {
  display: block; color: #d4f0b2; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.45rem;
}
.aisteam-int-sphere-bucket-body {
  min-height: 2.2rem;
  cursor: pointer;
}
.aisteam-int-sphere-chip {
  display: inline-block;
  background: rgba(123,94,167,0.18);
  border: 1px solid rgba(123,94,167,0.40);
  color: rgba(255,255,255,0.85);
  padding: 0.18rem 0.45rem;
  border-radius: 0.3rem;
  font-size: 0.78rem;
  margin: 0.18rem 0.18rem 0 0;
}
.aisteam-int-sphere-chip.aisteam-int-sphere-ok {
  background: rgba(150,211,95,0.18);
  border-color: rgba(150,211,95,0.45);
  color: #d4f0b2;
}
.aisteam-int-sphere-chip.aisteam-int-sphere-bad {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.45);
  color: #fecaca;
}
.aisteam-int-sphere-result {
  margin-top: 0.45rem;
  padding: 0.55rem 0.75rem;
  background: rgba(34,211,238,0.08);
  border-radius: 0.4rem;
  color: rgba(255,255,255,0.88);
  font-size: 0.88rem;
}
