/**
 * CS Quiz — interactive worksheet styles
 */

.cs-quiz {
  margin: 12px 0;
  padding: 14px;
  background: #f8fafc;
  border: 2px solid var(--line, #c7d2fe);
  border-radius: 16px;
}

.cs-grid {
  display: grid;
  gap: 4px;
  max-width: 280px;
  margin: 0 auto 12px;
}

.cs-grid.mini {
  max-width: 160px;
}

.cs-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1.35rem;
  min-height: 52px;
}

.cs-grid.mini .cs-cell {
  min-height: 36px;
  font-size: 1rem;
}

.cs-cell.is-start { background: #dbeafe; border-color: #3b82f6; }
.cs-cell.is-goal { background: #fef9c3; border-color: #eab308; }
.cs-cell.is-obs { background: #f1f5f9; }

.cs-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  justify-content: center;
}

.cs-steps-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-deep, #4338ca);
  background: #eef2ff;
  padding: 4px 10px;
  border-radius: 999px;
}

.cs-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.cs-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 8px 10px;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}

.cs-slot.active { border-color: var(--accent, #6366f1); background: #eef2ff; }
.cs-slot.filled { border-style: solid; border-color: #64748b; }
.cs-slot-no { font-size: 10px; font-weight: 800; color: #64748b; }
.cs-slot-val { font-size: 1.4rem; font-weight: 900; min-height: 1.4em; }

.cs-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.cs-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border: 2px solid #c7d2fe;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: border-color 0.15s, transform 0.1s;
}

.cs-block:hover { border-color: var(--accent, #6366f1); transform: translateY(-1px); }
.cs-block-icon { font-size: 1.35rem; line-height: 1; }
.cs-block-lab { font-size: 10px; color: #64748b; }

.cs-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.cs-feedback, .cs-feedback-host {
  margin-top: 10px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  min-height: 1.2em;
}

.cs-feedback.ok, .cs-feedback-host.ok { color: #047857; }
.cs-feedback.no, .cs-feedback-host.no { color: #be123c; }
.cs-feedback.hint, .cs-feedback-host.hint { color: #64748b; }

.cs-quiz.is-done .cs-block,
.cs-quiz.is-done .cs-slot { pointer-events: none; opacity: 0.85; }

.cs-expanded {
  text-align: center;
  margin-bottom: 12px;
}

.cs-exp-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 6px;
}

.cs-pat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.cs-pat-tok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 4px 8px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 800;
}

.cs-cmd-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
}

.cs-cmd-btn, .cs-pat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.cs-cmd-btn:hover, .cs-pat-btn:hover { border-color: var(--accent, #6366f1); }
.cs-cmd-btn.is-bug, .cs-pat-btn.is-bug {
  border-color: #047857;
  background: #ecfdf5;
}
.cs-cmd-btn.is-wrong-pick, .cs-pat-btn.is-wrong-pick {
  border-color: #be123c;
  background: #fff1f2;
}

.cs-cmd-no {
  width: 1.6em;
  height: 1.6em;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--accent-deep, #4338ca);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.parent-guide-box {
  margin-top: 10px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.parent-guide-box strong {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #b45309;
  margin-bottom: 4px;
}

.problem-title-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  color: var(--accent-deep, #4338ca);
  background: #eef2ff;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.cs-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.cs-hub-card {
  display: block;
  padding: 16px;
  border: 2px solid #fff;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-card, 0 8px 18px rgba(0,0,0,0.06));
  text-decoration: none;
  color: inherit;
}

.cs-hub-card h3 { margin: 0 0 6px; font-family: var(--font-display); color: var(--heading); }
.cs-hub-card p { margin: 0; font-size: 13px; color: var(--muted); }

.problem.interactive .work-space,
.problem.interactive .answer-line,
.problem.interactive .mc-choices { display: none !important; }

.cs-cell.on-path {
  background: #dbeafe;
  box-shadow: inset 0 0 0 2px #93c5fd;
}

.cs-trace-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.cs-trace-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-deep, #4338ca);
  min-width: 140px;
  text-align: center;
}

.cs-debug-hint {
  font-size: 13px;
  color: var(--muted, #64748b);
  margin: 8px 0 12px;
  line-height: 1.5;
}

.cs-cmd-list.is-pattern .cs-cmd-btn {
  min-width: 52px;
}

.cs-cmd-btn.is-bug {
  background: #fef3c7;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.cs-cmd-btn.is-wrong-pick {
  background: #fee2e2;
  border-color: #f87171;
}

.answer-grid-rich {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.answer-item {
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.answer-item-head {
  font-size: 15px;
  margin-bottom: 6px;
}

.answer-explanation {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
}

.answer-explain-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  color: #4338ca;
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
}

.problem.interactive .answer-reveal { display: none; }

.cs-loop-compress.is-pattern-next .compress-slots.single-pick {
  justify-content: center;
}

.cs-loop-compress.is-pattern-next .cs-slot {
  min-width: 72px;
  min-height: 72px;
  font-size: 28px;
}

.cs-pat-tok.is-q {
  background: #fef3c7;
  border: 2px dashed #f59e0b;
  border-radius: 8px;
  padding: 2px 8px;
}

.cs-loop-compress.is-pattern-next .cs-block.picked {
  background: #eef2ff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
