/* Sơ đồ tư duy (/cong-cu/so-do-tu-duy). Tệp nạp ở mọi trang → mọi lớp có tiền tố sd-. */
.chinh:has(> .sd) { max-width: 1440px; }
.sd-an { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sd-dau { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.sd-dau h1 { margin: 0; }
.sd-dau .phu { margin: 2px 0 0; }
.sd-dau__phai { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.sd-chon { min-width: 240px; }

.sd-tab { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.sd-tab [role="tab"] { flex: none; min-height: 46px; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--vien); background: var(--the);
  color: var(--chu); font: inherit; font-weight: 700; cursor: pointer; }
.sd-tab [role="tab"]:hover { border-color: var(--c-vien); color: var(--c-dam); }
.sd-tab [role="tab"][aria-selected="true"] { background: var(--c-dam); border-color: var(--c-dam); color: #fff; }

.sd-cong-cu { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.sd-ngan { width: 1px; height: 26px; background: var(--vien); margin: 0 4px; }
.sd-bo-cuc { display: inline-flex; align-items: center; gap: 6px; }
.sd-bo-cuc select { min-height: 36px; border: 1px solid var(--vien); border-radius: var(--r-nho); padding: 4px 8px; font: inherit; background: #fff; }

.sd-khu { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .sd-khu { grid-template-columns: minmax(0, 1fr) 300px; } }
.sd-khung { position: relative; background: #f8faf7; border: 1px solid var(--vien); border-radius: var(--r); overflow: hidden; }
.sd-me { width: 100%; height: clamp(420px, 68vh, 820px); }
.sd-khung:fullscreen { border-radius: 0; border: 0; background: #fff; }
.sd-khung:fullscreen .sd-me, .sd-khung:fullscreen .sd-mm { height: 100vh; }
.sd-khung:-webkit-full-screen .sd-me, .sd-khung:-webkit-full-screen .sd-mm { height: 100vh; }

/* Cỡ chữ nhánh to hơn cho màn chiếu; nhánh dài tự xuống dòng */
.sd-me .map-container me-tpc { max-width: 340px; line-height: 1.35; font-size: 15px; }
.sd-me .map-container me-root me-tpc { font-size: 24px; max-width: 360px; }
.sd-me .map-container me-main > me-wrapper > me-parent > me-tpc { font-size: 18px; font-weight: 700; padding: 8px 20px; }

.sd-thu { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; z-index: 5; }
.sd-thu[hidden] { display: none; }
.sd-thu__nut { min-width: 48px; height: 48px; border-radius: 999px; border: 1px solid var(--c-vien); background: #fff; color: var(--c-dam);
  font: inherit; font-size: 1.4rem; font-weight: 800; cursor: pointer; box-shadow: var(--bong); }
.sd-thu__chu { font-size: 1rem; padding: 0 18px; }
.sd-ghi-chieu { position: absolute; left: 16px; bottom: 16px; max-width: min(560px, 60%); background: #fff; border: 1px solid var(--c-vien);
  border-left: 4px solid var(--nhan-dam); border-radius: var(--r-nho); padding: 10px 14px; box-shadow: var(--bong); font-size: 1.05rem; z-index: 5;
  white-space: pre-wrap; display: none; }
.sd-khung:fullscreen .sd-ghi-chieu:not([hidden]) { display: block; }
.sd-khung:-webkit-full-screen .sd-ghi-chieu:not([hidden]) { display: block; }

.sd-ben { padding: 14px 16px; margin: 0; align-self: start; }
.sd-ben__h { font-size: 1rem; margin: 0 0 8px; }
.sd-ben .field { margin-bottom: 10px; }
.sd-nhan { font-weight: 600; font-size: .9375rem; margin: 4px 0 6px; }
.sd-mau { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sd-mau__o { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--vien); cursor: pointer; padding: 0; }
.sd-mau__o--bo { background: linear-gradient(135deg, #fff 45%, var(--do) 45%, var(--do) 55%, #fff 55%) !important; }
.sd-mau__o[aria-pressed="true"] { outline: 3px solid var(--c); outline-offset: 2px; }
.sd-bt { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 10px; }
.sd-bt__o { height: 34px; border-radius: var(--r-nho); border: 1px solid var(--vien); background: #fff; font-size: 1.1rem; cursor: pointer; padding: 0; }
.sd-bt__o[aria-pressed="true"] { background: var(--nhan-nhat); border-color: var(--nhan-dam); }
.sd-meo { margin: 10px 0 0; }

/* Dàn ý */
.sd-dy { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .sd-dy { grid-template-columns: 360px minmax(0, 1fr); } }
.sd-dy__trai textarea { min-height: 300px; height: clamp(300px, 60vh, 760px); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9375rem; line-height: 1.6; }
.sd-khung--mm { background: #fff; }
.sd-mm { display: block; width: 100%; height: clamp(360px, 64vh, 800px); }
.sd-mm foreignObject div { font-size: 16px; }
.sd-dy__nut { margin-top: 10px; }

.sd-tep { margin-top: 16px; padding: 14px 16px; }
.sd-ten-o { max-width: 460px; margin-bottom: 12px; }
.sd-bao { margin-top: 12px; }
.sd-bao:empty { display: none; }

@media (max-width: 640px) {
  .sd-chon { min-width: 0; flex: 1; }
  .sd-dau__phai { width: 100%; }
  .sd-me { height: 62vh; }
  .sd-mm { height: 55vh; }
  .sd-ngan { display: none; }
  .sd-bt { grid-template-columns: repeat(8, 1fr); }
}
