/* SafeBARS Mirror — Ethical Mirror Theater (c5 / X intervention) styles */

.theater-stage {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.theater-block {
  background: var(--surface, #fff);
  border: 1px solid rgba(5, 10, 75, 0.08);
  border-radius: 18px;
  padding: 22px 22px 24px;
  margin: 22px 0;
  box-shadow: 0 10px 30px -18px rgba(5, 10, 75, 0.35);
}

.theater-block-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.theater-num {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, #0b73f6, #050a4b);
}

.theater-block-head h3 {
  margin: 0;
  font-size: 19px;
  color: var(--navy, #050a4b);
}

.theater-block-sub {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--muted, #5a6178);
}

/* ---- Per-section loading / error placeholder cards ---- */
.theater-block-loading,
.theater-block-error {
  border: 1px dashed rgba(5, 10, 75, 0.18);
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  color: var(--muted, #5a6178);
  font-size: 14px;
  background: rgba(5, 10, 75, 0.02);
}
.theater-block-error { border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.04); }
.theater-block-error p { margin: 0 0 10px; }
.theater-retry-btn {
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: transparent;
  color: #b91c1c;
  font-weight: 800;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast, 0.16s), transform var(--transition-fast, 0.16s);
}
.theater-retry-btn:hover { background: rgba(239, 68, 68, 0.1); }
.theater-retry-btn:active { transform: scale(0.96); }

/* ---- Collapsible sections (debate turns, panel comments) ---- */
details.fold-block { border: 0; }
details.fold-block > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(5, 10, 75, 0.04);
  transition: background var(--transition-fast, 0.16s);
}
details.fold-block > summary::-webkit-details-marker { display: none; }
details.fold-block > summary:hover { background: rgba(11, 115, 246, 0.08); }
details.fold-block > summary:focus-visible { outline: 2px solid var(--hero-blue, #0b73f6); outline-offset: 2px; }
details.fold-block > summary::after {
  content: "▸";
  margin-left: auto;
  font-size: 14px;
  color: var(--muted, #5a6178);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}
details.fold-block[open] > summary::after { transform: rotate(90deg); }
.fold-body { padding: 10px 12px 4px; }
.fold-hint {
  font-size: 11.5px;
  color: var(--muted, #5a6178);
  font-weight: 600;
  margin-left: 2px;
}

/* Component 1 — Counterfactual Mirror */
.cf-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.cf-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(5, 10, 75, 0.1);
}

.cf-card.with {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.05);
}

.cf-card.without {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.05);
}

.cf-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px;
  color: #fff;
}

.cf-card.with .cf-tag { background: #10b981; }
.cf-card.without .cf-tag { background: #ef4444; }

.cf-body {
  padding: 12px 14px 14px;
}

.cf-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink, #1c2233);
}

/* Component 2 — Debate */
.debate-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.debate-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.debate-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(11, 115, 246, 0.12);
}

.debate-bubble {
  background: rgba(5, 10, 75, 0.04);
  border-radius: 12px;
  padding: 10px 14px;
  flex: 1;
}

.debate-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy, #050a4b);
  margin-bottom: 3px;
}

.debate-line {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink, #1c2233);
}

.debate-heat {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-top: 6px;
}

.debate-heat.low { background: rgba(16, 185, 129, 0.15); color: #047857; }
.debate-heat.medium { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.debate-heat.high { background: rgba(239, 68, 68, 0.16); color: #b91c1c; }

.blind-spots {
  margin-top: 16px;
  border-top: 1px dashed rgba(5, 10, 75, 0.15);
  padding-top: 14px;
}

.blind-spots h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--navy, #050a4b);
}

.bs-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(5, 10, 75, 0.06);
}

.bs-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  margin-top: 6px;
}

.bs-text strong { display: block; font-size: 14px; color: var(--ink, #1c2233); }
.bs-text span { font-size: 12.5px; color: var(--muted, #5a6178); }

/* Component 3 — Decision Timeline */
.decision-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.decision-timeline::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(5, 10, 75, 0.12);
}

.dt-node {
  position: relative;
  padding: 10px 0 10px 42px;
}

.dt-marker {
  position: absolute;
  left: 6px;
  top: 12px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(5, 10, 75, 0.2);
}

.dt-node.active .dt-marker { background: #10b981; }
.dt-node.passive .dt-marker { background: #ef4444; }

.dt-when {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #5a6178);
}

.dt-headline {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink, #1c2233);
  margin: 2px 0;
}

.dt-what {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted, #5a6178);
}

.dt-flag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  margin-top: 5px;
}

.dt-node.active .dt-flag { background: rgba(16, 185, 129, 0.15); color: #047857; }
.dt-node.passive .dt-flag { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }

.theater-loading {
  padding: 30px 0;
  text-align: center;
  color: var(--muted, #5a6178);
  font-size: 14px;
}

@media (max-width: 600px) {
  .cf-pair { grid-template-columns: 1fr; }
}

/* ---- Counterfactual Mirror: real generated contrast images ---- */
.cf-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.cf-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(5, 10, 75, 0.1);
  background: #f7f8fc;
}
.cf-card.without { border-color: rgba(200, 40, 60, 0.55); border-width: 2px; }
.cf-card.with { border-color: rgba(30, 150, 90, 0.55); border-width: 2px; }
.cf-tag {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cf-tag::before { font-size: 13px; line-height: 1; }
.cf-card.without .cf-tag::before { content: "✕"; }
.cf-card.with .cf-tag::before { content: "✓"; }
.cf-card.without .cf-tag { background: #c8283c; }
.cf-card.with .cf-tag { background: #1e965a; }
.cf-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: #e9ecf5;
}
.cf-img-placeholder {
  width: 100%;
  height: 200px;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted, #5a6178);
  background: #eef1f8;
}
.cf-img-placeholder.is-error { color: #b91c1c; background: #fdf0f0; }
.cf-body { padding: 12px 14px; }
.cf-body p { margin: 0; font-size: 14px; line-height: 1.5; color: #2a2f45; }
.cf-note { grid-column: 1 / -1; font-size: 12px; color: #6b7290; text-align: center; margin-top: 2px; }

/* Component 1b — Personalized plan diff (P1): researcher's own plan steps
   shown as with/without-safeguard rows, generated from their text. */
.cf-plan-diff { margin-top: 18px; }
.cf-diff-head {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy, #050a4b);
  margin: 4px 0 12px;
}
.cf-diff-grid { display: flex; flex-direction: column; gap: 12px; }
.cf-diff-row {
  display: grid;
  grid-template-columns: 1fr 28px 1fr;
  align-items: stretch;
  gap: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(5, 10, 75, 0.1);
}
.cf-diff-col { padding: 12px 14px; }
.cf-diff-col.without { background: rgba(239, 68, 68, 0.05); border-right: 1px dashed rgba(239, 68, 68, 0.35); }
.cf-diff-col.with { background: rgba(16, 185, 129, 0.05); }
.cf-diff-step { font-size: 14px; line-height: 1.5; color: var(--ink, #1c2233); }
/* Left/right columns are mirror-symmetric: one tagged line under the step. */
.cf-diff-line { margin-top: 8px; font-size: 12.5px; line-height: 1.45; }
.cf-diff-line.risk { color: #b4232a; }
.cf-diff-line.safe { color: #1f7a52; }
/* Rationale is a full-width footer under the whole row, so the two columns
   never stack unevenly. */
.cf-diff-why {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 10px;
  border-top: 1px dashed rgba(5, 10, 75, 0.1);
  background: rgba(5, 10, 75, 0.025);
  font-size: 12.5px;
  line-height: 1.45;
  color: #1f7a52;
}
.cf-diff-why-label { font-weight: 700; color: #14643f; white-space: nowrap; }
.cf-diff-label {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-right: 6px;
  color: #fff;
  background: #ef4444;
}
.cf-diff-label.safe { background: #10b981; }
.cf-diff-arrow {
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--muted, #5a6178);
  background: rgba(5, 10, 75, 0.03);
}
@media (max-width: 560px) {
  .cf-diff-row { grid-template-columns: 1fr; }
  .cf-diff-col.without { border-right: none; border-bottom: 1px dashed rgba(239, 68, 68, 0.35); }
  .cf-diff-arrow { padding: 6px 0; }
  .cf-diff-why { grid-column: 1 / -1; }
}


.theater-loading { font-size: 14px; color: #6b7290; padding: 10px 2px; }

@media (max-width: 600px) {
  .cf-pair { grid-template-columns: 1fr; }
}

/* Narrow phones (375px) — keep the two most fragile theater layouts intact:
   the decision-timeline rail and the padded stage. */
@media (max-width: 380px) {
  .theater-stage { padding: 16px 12px 44px; }
  .theater-block { padding: 16px 14px 18px; }
  .dt-node { padding-left: 34px; }
  .decision-timeline::before { left: 9px; }
  .dt-marker { left: 4px; }
  .cf-img, .cf-img-placeholder { height: 170px; }
}
