/* O’Phys RC6 — éditeur structuré de théorie et paquets de chapitre */
.ophys-theory-builder {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(244,215,123,.20);
  border-radius: 22px;
  background: linear-gradient(145deg,rgba(212,175,55,.06),rgba(255,255,255,.025));
}
.ophys-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.ophys-builder-head h3 { margin: 8px 0 5px; }
.ophys-builder-head p { margin: 0; color: #aeb8c9; line-height: 1.55; }
.ophys-builder-head strong { color: #f4d77b; white-space: nowrap; }
.ophys-builder-add { display: flex; flex-wrap: wrap; gap: 9px; }
.ophys-builder-add button,
.ophys-package-tools button,
.ophys-package-tools label {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}
.ophys-builder-list { display: grid; gap: 13px; }
.ophys-builder-empty {
  padding: 22px;
  border: 1px dashed rgba(255,255,255,.14);
  border-radius: 18px;
  color: #9faabd;
  text-align: center;
}
.ophys-builder-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  background: rgba(2,7,15,.54);
}
.ophys-builder-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ophys-builder-card > header > div:first-child { display: flex; align-items: center; gap: 9px; }
.ophys-builder-card > header span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(212,175,55,.18);
  color: #f4d77b;
  font-size: 12px;
  font-weight: 950;
}
.ophys-builder-card-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ophys-builder-card-actions button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  color: #fff;
  font-weight: 800;
}
.ophys-builder-card-actions button.danger { color: #ffb4b4; }
.ophys-builder-card-actions button:disabled { opacity: .34; }
.ophys-builder-card label { display: grid; gap: 7px; font-weight: 800; color: #e8e5dd; }
.ophys-builder-card small { color: #9faabd; font-weight: 500; }
.ophys-builder-image-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ophys-builder-image-preview {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(244,215,123,.22);
  border-radius: 16px;
  background: #02050b;
}
.ophys-builder-image-preview img { display: block; width: 100%; max-height: 310px; object-fit: contain; }
.ophys-builder-image-preview button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.84);
  color: #fff;
  font-weight: 850;
}
.ophys-package-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ophys-structured-theory { display: grid; gap: 18px; margin: 24px 0; }
.ophys-theory-section {
  margin: 0;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.035);
}
.ophys-theory-section h3 { margin: 0 0 12px; font-size: 22px; }
.ophys-theory-section p { margin: 0 0 12px; line-height: 1.75; color: #d9dfeb; }
.ophys-theory-section p:last-child { margin-bottom: 0; }
.ophys-theory-image-section { padding: 0; overflow: hidden; }
.ophys-theory-image-section h3 { padding: 18px 20px 0; }
.ophys-theory-image-section img { display: block; width: 100%; max-height: 520px; object-fit: contain; background: #02050b; }
.ophys-theory-image-section figcaption { padding: 12px 18px 16px; color: #9faabd; font-size: 13px; line-height: 1.5; }
.ophys-theory-callout.info { border-color: rgba(93,216,255,.28); background: rgba(93,216,255,.07); }
.ophys-theory-callout.warning { border-color: rgba(255,183,77,.30); background: rgba(255,183,77,.08); }
.ophys-theory-callout.success { border-color: rgba(71,213,135,.30); background: rgba(71,213,135,.08); }
.ophys-theory-table-wrap { overflow-x: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; }
.ophys-theory-table-wrap table { width: 100%; border-collapse: collapse; min-width: 520px; }
.ophys-theory-table-wrap th,
.ophys-theory-table-wrap td { padding: 12px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); border-right: 1px solid rgba(255,255,255,.06); }
.ophys-theory-table-wrap th { background: rgba(212,175,55,.10); color: #f4d77b; font-weight: 900; }
.ophys-theory-table-wrap td { color: #dce2ed; }
.ophys-theory-table-wrap tr:last-child td { border-bottom: 0; }

@media (max-width: 700px) {
  .ophys-builder-head,
  .ophys-builder-card > header { flex-direction: column; align-items: stretch; }
  .ophys-builder-card-actions { justify-content: flex-start; }
  .ophys-builder-image-grid { grid-template-columns: 1fr; }
  .ophys-theory-builder { padding: 14px; }
  .ophys-theory-section { padding: 17px; }
}
