:root {
  --line: #e6e6e6;
  --bg: #fafafa;
  --ink: #111;
  --muted: #666;
  --panel-soft: #fcfdff;
  --panel-soft-2: #f7faff;
  --lesson-note-bg: #fff9e8;
  --lesson-note-line: #f0df9a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: system-ui, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body {
  overflow: hidden;
}

header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}

button,
select,
input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font: inherit;
}

button {
  cursor: pointer;
}

button:hover {
  filter: brightness(0.98);
}

select {
  min-width: 220px;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.hidden {
  display: none !important;
}

#errStrip {
  display: none;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff2f2;
  color: #7b0000;
  font-size: 12px;
  white-space: pre-wrap;
}

.wrap {
  display: flex;
  height: calc(100vh - 56px);
  width: 100%;
  min-height: 0;
}

.col {
  background: #fff;
  min-height: 0;
}

.left {
  width: 22%;
  min-width: 180px;
  flex: 0 0 22%;
  overflow: auto;
}

.mid {
  width: 38%;
  min-width: 280px;
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.right {
  flex: 1 1 auto;
  min-width: 280px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gutter {
  width: 10px;
  flex: 0 0 10px;
  background: linear-gradient(to right, transparent, #f1f1f1, transparent);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  cursor: col-resize;
  user-select: none;
}

.gutter:hover {
  background: linear-gradient(to right, transparent, #e4e4e4, transparent);
}

.paneHead {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.paneHead .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tree {
  padding: 8px 10px;
  font-size: 14px;
  overflow: auto;
}

.node {
  padding: 6px 6px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.node:hover {
  background: #f4f4f4;
}

.node.active {
  background: #eaf2ff;
}

.twisty {
  width: 14px;
  display: inline-flex;
  justify-content: center;
  opacity: 0.65;
}

.midSplit {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.editorPane {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.previewPane {
  flex: 0 0 240px;
  min-height: 90px;
  max-height: 55%;
  border-top: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.previewHead {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#btnOpenTab {
  white-space: nowrap;
}

.imgPreviewWrap {
  padding: 12px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.imgPreviewWrap img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: zoom-in;
  display: block;
}

#editorHost {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#editor {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  resize: none;
  padding: 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 14px;
  line-height: 1.45;
}

.CodeMirror {
  height: 100% !important;
  width: 100%;
  font-size: 14px;
}

body.light-editor .CodeMirror {
  background: #ffffff;
  color: #111;
}

body.light-editor .CodeMirror-gutters {
  background: #f7f7f7;
  border-right: 1px solid var(--line);
}

body.dark-editor .CodeMirror {
  background: #263238;
  color: #eee;
}

body.dark-editor .CodeMirror-gutters {
  background: #1f2a30;
  border-right: 1px solid #3a4a52;
}

.hGutter {
  height: 10px;
  flex: 0 0 10px;
  background: linear-gradient(to bottom, transparent, #ececec, transparent);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: row-resize;
  user-select: none;
}

.hGutter:hover {
  background: linear-gradient(to bottom, transparent, #dddddd, transparent);
}

.lessonPane {
  flex: 1 1 auto;
  min-height: 0;
  border-top: 0;
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lessonPaneRight {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  border-top: 0;
}

.lessonPane.collapsed {
  flex: 0 0 62px;
  min-height: 62px;
  max-height: 62px;
}

.lessonPane.collapsed .lessonBody {
  display: none;
}

.lessonPane:not(.collapsed) .lessonBody {
  display: block;
}

.lessonHead {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}

.lessonHeadText {
  min-width: 0;
}

.lessonHeadActions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.lessonBody {
  padding: 14px;
  overflow: auto;
  line-height: 1.55;
  flex: 1 1 auto;
  min-height: 0;
}

.lessonBody h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.lessonBody p {
  margin: 0 0 10px;
}

.lessonNotice {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--lesson-note-line);
  background: var(--lesson-note-bg);
  border-radius: 12px;
  line-height: 1.5;
}

.lessonCta {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lessonQuiz label {
  display: inline-block;
  margin-bottom: 6px;
}

#preview {
  width: 100%;
  flex: 1 1 auto;
  border: 0;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

#modal.hidden,
#auth.hidden {
  display: none !important;
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modal .backdrop,
#auth {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

#modal .box {
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  width: min(560px, calc(100vw - 24px));
}

#modal input {
  width: 100%;
  margin-top: 10px;
}

#modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

#auth {
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#auth .card {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

#auth h2 {
  margin: 0 0 6px;
}

#auth label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

#auth input {
  width: 100%;
}

#auth .btnRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 14px;
}

#auth .pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  background: #fafafa;
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 999px;
  margin-top: 10px;
}

#auth .danger {
  color: #7b0000;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5000;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.auth-modal-card {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  color: #111;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  z-index: 1;
}

.auth-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.auth-modal-head h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.auth-subtext {
  color: #555;
  margin-bottom: 16px;
}

.auth-section {
  margin-top: 14px;
}

.auth-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-mode-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.auth-mode-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.plan-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}

.plan-option input {
  margin-top: 3px;
}

#authForm input[type="email"],
#authForm input[type="text"],
#authForm input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.auth-actions button {
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.auth-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  background: #eee;
  color: #111;
}

.auth-message {
  margin-top: 14px;
  min-height: 20px;
  color: #c62828;
  font-size: 13px;
}

@media (max-width: 700px) {
  .auth-modal-card {
    max-width: 560px;
  }

  .auth-plans {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .wrap {
    flex-direction: column;
    height: auto;
    overflow: auto;
  }

  .left,
  .mid,
  .right {
    width: 100% !important;
    flex: 0 0 auto !important;
    min-width: 0;
    min-height: 280px;
  }

  .gutter {
    display: none;
  }

  #editorHost {
    height: 420px;
  }

  #preview {
    min-height: 420px;
  }

  .lessonPane {
    min-height: 220px;
  }

  .previewPane {
    min-height: 220px;
    max-height: none;
  }

  .hGutter {
    display: none;
  }
}
.modal-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-title-row > div {
  flex: 1 1 auto;
}

.modal-title-row h2 {
  margin: 0 0 6px 0;
}

.modal-title-row .auth-subtext {
  text-align: left;
  margin-left: 0;
}

.modal-favicon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  margin-top: 2px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-favicon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}
#btnContact {
  white-space: nowrap;
}

#contactMessage {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 140px;
  padding: 12px;
  border: 1px solid #cfd6e4;
  border-radius: 10px;
  font: inherit;
}

#contactForm input[type="email"],
#contactForm input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
}

#contactSendBtn {
  background: #1f6feb;
  color: #fff;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

#contactCancelBtn {
  background: #eee;
  color: #111;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

#contactMessageStatus {
  margin-top: 14px;
  min-height: 20px;
  font-size: 13px;
}
.shop-modal-card-large {
  max-width: 980px;
}

.shop-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #d8e2ec;
}

.shop-section h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.benefits-box,
.order-box {
  background: #f8fbff;
  border: 1px solid #d8e2ec;
  border-radius: 16px;
  padding: 16px;
}

.benefits-box {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.price-card {
  border: 1px solid #d8e2ec;
  background: #fff;
  border-radius: 16px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.price-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 8px;
}

.price-card span {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e7fb3;
}

.price-card:hover {
  border-color: #1e7fb3;
  transform: translateY(-2px);
}

.price-card.selected {
  background: #eaf4ff;
  border: 2px solid #1e7fb3;
}

.order-box {
  margin-bottom: 16px;
}

.order-line,
.order-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.order-line {
  border-bottom: 1px solid #d8e2ec;
  color: #56657a;
}

.order-total {
  font-weight: 700;
  font-size: 1.1rem;
  color: #0f172a;
}

#shopCoupon {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  margin-bottom: 12px;
}

#btnShopContinue {
  background: #1f6feb;
  color: #fff;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

#btnShopCancel {
  background: #eee;
  color: #111;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .subscription-grid {
    grid-template-columns: 1fr;
  }

  .order-line,
  .order-total {
    flex-direction: column;
    align-items: flex-start;
  }
}
.shop-modal-card-large {
  max-width: 980px;
}

.shop-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #d8e2ec;
}

.shop-section h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.benefits-box {
  background: #f8fbff;
  border: 1px solid #d8e2ec;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-help-text {
  font-size: 0.95rem;
  color: #666;
  margin-top: 2px;
}

#authSubmitBtn {
  background: #1f6feb;
  color: #fff;
}

#authCancelBtn {
  background: #eee;
  color: #111;
}

#authCoupon {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
}

@media (max-width: 700px) {
  .shop-modal-card-large {
    max-width: 560px;
  }
}
.welcome-modal-card {
  max-width: 860px;
}

.welcome-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.welcome-plan-card {
  background: #f8fbff;
  border: 1px solid #d8e2ec;
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 8px;
}

.welcome-plan-card h3 {
  margin: 0 0 6px 0;
}

#btnWelcomeFree {
  background: #eee;
  color: #111;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
}

#btnWelcomeShop {
  background: #1f6feb;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
}

#resetPasswordSubmitBtn {
  background: #1f6feb;
  color: #fff;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

#resetPasswordCancelBtn {
  background: #eee;
  color: #111;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .welcome-plan-grid {
    grid-template-columns: 1fr;
  }
}
.price-card.disabled,
.price-card[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  border-color: #d8e2ec !important;
  background: #f3f4f6 !important;
}
.node.drag-over {
  outline: 2px dashed #1f6feb;
  background: rgba(31, 111, 235, 0.08);
  border-radius: 8px;
}
/* =========================
   HTML Lab Shop Branches + Lesson Tree
   Added 2026-05-25
========================= */

.shop-modal-card-large {
  max-width: 1040px;
}

.lesson-info-box {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  background: #f8fbff;
  border: 1px solid #d8e2ec;
  border-radius: 16px;
  padding: 16px;
}

.info-block strong {
  display: block;
  margin-bottom: 6px;
}

.info-block p {
  margin: 0;
  color: #56657a;
  line-height: 1.55;
}

.shop-lesson-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.lesson-card {
  align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lesson-card.selected {
  border-color: #1e7fb3;
  background: #eef8ff;
  box-shadow: 0 0 0 2px rgba(30, 127, 179, 0.12);
}

.lesson-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.lesson-card input[type="radio"] {
  margin-top: 4px;
}

.lesson-plan-details {
  margin-top: 8px;
  color: #56657a;
}

.lessonHeaderCta {
  margin-top: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.lessonHeaderCta button {
  white-space: nowrap;
}

.lesson-lock-btn {
  min-width: 42px;
  font-weight: 800;
}

.lesson-lock-btn.locked {
  background: #fff7ed;
  border-color: #fdba74;
}

.lesson-tree-modal-card {
  max-width: 1040px;
}

.lesson-tree-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 18px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.lesson-tree-badge-btn {
  min-width: 96px;
  min-height: 72px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  background: #ffffff;
  cursor: pointer;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.lesson-tree-badge-btn:hover {
  background: #eef8ff;
  border-color: #1e7fb3;
}

.lesson-tree-section {
  margin: 10px 0;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}

.lesson-tree-section-header {
  width: 100%;
  border: 0;
  background: #f3f4f6;
  padding: 12px 14px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lesson-tree-section-header:hover {
  background: #e5e7eb;
}

.lesson-tree-section-body {
  display: none;
  padding: 12px;
}

.lesson-tree-section.open .lesson-tree-section-body {
  display: block;
}

.lesson-tree-section.open .lesson-tree-arrow {
  transform: rotate(90deg);
}

.lesson-tree-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-tree-btn {
  min-width: 42px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.lesson-tree-btn:hover {
  background: #eef8ff;
  border-color: #1e7fb3;
}

.lesson-tree-btn.active {
  background: #1e7fb3;
  color: #ffffff;
  border-color: #1e7fb3;
}

.lesson-tree-btn.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f3f4f6;
}

@media (max-width: 700px) {
  .subscription-grid {
    grid-template-columns: 1fr;
  }

  .lessonHeaderCta {
    justify-content: flex-start;
  }
}

/* =========================================================
   FINAL HTML LAB LAYOUT OVERRIDE
   Left panel compact layout + wider lesson/output area
   Added: 2026-05-25
   ========================================================= */

/* Default panel widths:
   - Left narrower
   - Middle narrower
   - Right panel gets remaining space
*/
.left {
  width: 170px !important;
  min-width: 150px !important;
  max-width: 260px !important;
  flex: 0 0 170px !important;
}

.mid {
  width: 420px !important;
  min-width: 300px !important;
  max-width: 720px !important;
  flex: 0 0 420px !important;
}

.right {
  flex: 1 1 auto !important;
  min-width: 420px !important;
}

/* Left panel header: put Files/subtext above buttons */
#leftCol .paneHead {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  gap: 8px !important;
  padding: 8px 8px !important;
}

/* Hide the "Files" heading to save space.
   The first visible line will now be: Signed in as mkotze */
#leftCol .paneHead > div:first-child strong {
  display: none !important;
}

/* First line: Signed in as mkotze */
#leftCol .paneHead > div:first-child {
  flex: 1 1 100% !important;
  width: 100% !important;
  min-width: 0 !important;
}

#filesSubtext {
  display: block !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
}

/* Button area below the signed-in line */
#leftCol .paneHead > .actions {
  flex: 0 0 100% !important;
  width: 100% !important;
  min-width: 0 !important;
}

#leftCol .paneHead .actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
  justify-content: stretch !important;
  align-items: stretch !important;
}

/* Compact buttons */
#leftCol .paneHead .actions button {
  width: 100% !important;
  min-width: 0 !important;
  padding: 6px 6px !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  text-align: center !important;
}

/* Desired rows:
   Row 1: + File | Upload Image
   Row 2: Upload Doc/PDF full width
   Row 3: Rename | Delete
*/
#btnNewFolder {
  display: none !important;
}

#btnNewFile {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

#btnUpload {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

#btnUploadDoc {
  grid-column: 1 / span 2 !important;
  grid-row: 2 !important;
}

#btnRename {
  grid-column: 1 !important;
  grid-row: 3 !important;
}

#btnDelete {
  grid-column: 2 !important;
  grid-row: 3 !important;
}

/* Keep file tree compact */
#leftCol .tree {
  padding: 6px 8px !important;
  font-size: 13px !important;
}

#leftCol .node {
  padding: 5px 4px !important;
  gap: 5px !important;
}

/* Lesson header: prevent long title/subtitle from breaking layout */
.lessonHead {
  align-items: flex-start !important;
  gap: 8px !important;
}

.lessonHeadText {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

#lessonTitle {
  display: block !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.25 !important;
}

#lessonSubtext {
  display: block !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.25 !important;
}

/* Lesson header buttons should stay compact */
.lessonHeaderCta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  justify-content: flex-end !important;
  align-items: center !important;
  max-width: 330px !important;
}

.lessonHeaderCta button {
  height: 30px !important;
  padding: 5px 8px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
}

/* Lesson body must use available height cleanly */
.lessonPane,
.lessonPaneRight {
  min-height: 0 !important;
  overflow: hidden !important;
}

.lessonBody {
  min-height: 0 !important;
  overflow: auto !important;
  padding: 12px 14px !important;
}

/* Lesson images:
   - Never overflow the lesson panel
   - Scale down with the gutter / available panel height
   - Keep aspect ratio
*/
.lessonMedia {
  margin: 12px 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
}

.lessonMedia img,
.lessonBody img,
.lessonContent img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: min(52vh, 520px) !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 14px !important;
  border: 1px solid var(--line) !important;
}

/* Override old size classes that made images too large */
.lessonMedia.large img,
.lessonMedia.medium img,
.lessonMedia.small img {
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}

.lessonMedia.small img {
  max-height: min(32vh, 260px) !important;
}

.lessonMedia.medium img {
  max-height: min(42vh, 380px) !important;
}

.lessonMedia.large img {
  max-height: min(52vh, 520px) !important;
}

/* On smaller screens, let panels stack normally */
@media (max-width: 900px) {
  .left,
  .mid,
  .right {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
  }

  .lessonHeaderCta {
    max-width: 100% !important;
    justify-content: flex-start !important;
  }

  .lessonMedia img,
  .lessonBody img,
  .lessonContent img {
    max-height: 420px !important;
  }
}


/* =========================================================
   FINAL HTML LAB PANEL WIDTH FIX
   Allows gutters to move again.
   Added: 2026-05-25
   ========================================================= */

/* Do NOT use !important on width/flex here.
   The splitter JavaScript must be able to set inline widths. */

#leftCol.left {
  width: 170px;
  min-width: 150px;
  max-width: 260px;
  flex: 0 0 170px;
}

#midCol.mid {
  width: 500px;
  min-width: 300px;
  max-width: 820px;
  flex: 0 0 500px;
}

#rightCol.right {
  flex: 1 1 auto;
  min-width: 320px;
}

/* Keep the gutters clearly draggable */
#gut1,
#gut2,
.gutter {
  width: 10px !important;
  flex: 0 0 10px !important;
  cursor: col-resize !important;
  z-index: 20;
}

/* While dragging, iframe must not capture the mouse/pointer */
body.html-lab-resizing iframe {
  pointer-events: none !important;
}

/* Better default preview/lesson split inside the right panel */
#previewPane {
  flex: 0 0 46% !important;
  min-height: 160px !important;
}

#lessonPane:not(.collapsed) {
  flex: 1 1 auto !important;
  min-height: 220px !important;
}

/* Make lesson images feel faster and fit better */
.lessonBody img,
.lessonMedia img,
.lessonContent img {
  display: block !important;
  max-width: 100% !important;
  max-height: min(46vh, 460px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

.lessonMedia.large img {
  max-height: min(46vh, 460px) !important;
}

.lessonMedia.medium img {
  max-height: min(36vh, 340px) !important;
}

.lessonMedia.small img {
  max-height: min(28vh, 240px) !important;
}


/* =========================================================
   FINAL HTML LAB RIGHT PANEL HORIZONTAL GUTTER FIX
   Added: 2026-05-25
   ========================================================= */

#rightCol .midSplit,
#midSplit {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

#previewPane {
  min-height: 110px !important;
  max-height: none !important;
  overflow: hidden !important;
}

#lessonPane {
  min-height: 62px !important;
  max-height: none !important;
  overflow: hidden !important;
}

#lessonPane:not(.collapsed) {
  min-height: 120px !important;
}

#lessonGutter,
.hGutter {
  height: 10px !important;
  flex: 0 0 10px !important;
  min-height: 10px !important;
  max-height: 10px !important;
  cursor: row-resize !important;
  user-select: none !important;
  background: linear-gradient(to bottom, transparent, #ececec, transparent) !important;
  border-top: 1px solid var(--line) !important;
  border-bottom: 1px solid var(--line) !important;
  z-index: 25 !important;
}

#lessonGutter:hover,
.hGutter:hover {
  background: linear-gradient(to bottom, transparent, #dddddd, transparent) !important;
}

body.html-lab-row-resizing iframe {
  pointer-events: none !important;
}


/* =========================================================
   HTML LAB LESSON QUIZ + FRIENDLY FONT FIX
   Added 2026-05-26
   - Makes all quiz options vertical
   - Makes lesson typography closer to Python Lab
   - Adds clear quiz feedback styling
   ========================================================= */

body,
button,
select,
input,
textarea {
  font-family: "Nunito", "Inter", "Segoe UI", "Trebuchet MS", Arial, sans-serif !important;
}

.lessonBody,
#lessonBody,
.lessonContent,
.lessonPane,
.lessonPanel {
  font-family: "Nunito", "Inter", "Segoe UI", "Trebuchet MS", Arial, sans-serif !important;
}

.lessonBody,
#lessonBody {
  font-size: 16px !important;
  line-height: 1.65 !important;
  color: #172033 !important;
}

.lessonBody h3,
#lessonBody h3 {
  font-size: 1.22rem !important;
  line-height: 1.25 !important;
  color: #0f172a !important;
}

.lessonBody p,
#lessonBody p,
.lessonBody li,
#lessonBody li {
  line-height: 1.6 !important;
}

#lessonBody .lessonQuiz,
.lessonBody .lessonQuiz {
  display: block !important;
  margin: 14px 0 !important;
  padding: 14px !important;
  border: 1px solid #d7e2f0 !important;
  border-radius: 14px !important;
  background: #f8fbff !important;
}

#lessonBody .lessonQuizOptions,
.lessonBody .lessonQuizOptions {
  display: block !important;
  margin-top: 10px !important;
}

#lessonBody .lessonQuiz label,
.lessonBody .lessonQuiz label,
#lessonBody .lessonQuizOption,
.lessonBody .lessonQuizOption {
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
  align-items: flex-start !important;
  gap: 8px !important;
  margin: 9px 0 !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  line-height: 1.45 !important;
  cursor: pointer !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  white-space: normal !important;
}

#lessonBody .lessonQuiz label:hover,
.lessonBody .lessonQuiz label:hover,
#lessonBody .lessonQuizOption:hover,
.lessonBody .lessonQuizOption:hover {
  background: #eef8ff !important;
  border-color: #b6d4fe !important;
}

#lessonBody .lessonQuiz label + br,
.lessonBody .lessonQuiz label + br {
  display: none !important;
}

#lessonBody .lessonQuiz input[type="radio"],
.lessonBody .lessonQuiz input[type="radio"] {
  flex: 0 0 auto !important;
  margin: 4px 2px 0 0 !important;
}

#lessonBody .lessonQuizCheck,
.lessonBody .lessonQuizCheck,
#lessonBody #btnCheckLesson {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 12px !important;
  background: #1f6feb !important;
  color: #ffffff !important;
  border-color: #1f6feb !important;
  font-weight: 700 !important;
}

#lessonBody .lessonQuizFeedback,
.lessonBody .lessonQuizFeedback {
  margin-top: 10px !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
  background: #ffffff !important;
  border: 1px solid #d0d7de !important;
}

#lessonBody .lessonQuizFeedback.correct {
  color: #0b6e4f !important;
  background: #f0fff8 !important;
  border-color: #0b6e4f !important;
}

#lessonBody .lessonQuizFeedback.incorrect {
  color: #b42318 !important;
  background: #fff5f5 !important;
  border-color: #d92d20 !important;
}

#lessonBody .lessonQuizFeedback.warning {
  color: #9a6700 !important;
  background: #fff9e8 !important;
  border-color: #f0df9a !important;
}


/* =========================================================
   HTML LAB PYTHON-STYLE LESSON/PREVIEW LAYOUT FIX
   Added 2026-05-26
   - Keeps 🔓 next to Next ➡
   - Adds proper Hide Preview layout support
   - Keeps lesson panel at the bottom by default
   ========================================================= */

.lessonHead {
  flex-wrap: nowrap !important;
  align-items: center !important;
}

.lessonHeadText {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.lessonHeadText strong,
.lessonHeadText .muted {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.lessonHeaderCta,
#lessonHeaderCta {
  flex: 0 0 auto !important;
  margin-left: auto !important;
  margin-top: 0 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.lessonHeaderCta button,
#lessonHeaderCta button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  padding: 7px 9px !important;
}

#btnLessonSubscribe,
.lesson-lock-btn {
  order: 999 !important;
  flex: 0 0 auto !important;
  margin-left: 2px !important;
  white-space: nowrap !important;
}

#previewPane {
  flex: 1 1 auto !important;
  min-height: 160px !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
}

#lessonPane {
  flex: 0 0 280px !important;
  height: 280px !important;
  min-height: 62px !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
}

body.html-lab-preview-hidden #previewPane,
body.html-lab-preview-hidden #lessonGutter {
  display: none !important;
}

body.html-lab-preview-hidden #lessonPane {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.html-lab-preview-hidden #lessonPane .lessonBody {
  display: block !important;
}

#btnHidePreview {
  white-space: nowrap !important;
}

#rightCol:fullscreen,
#lessonPane:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  background: #ffffff !important;
}

#rightCol:fullscreen #lessonPane,
#lessonPane:fullscreen {
  flex: 1 1 auto !important;
  height: auto !important;
  max-height: none !important;
}

#rightCol:fullscreen #lessonPane .lessonBody,
#lessonPane:fullscreen .lessonBody {
  display: block !important;
}

@media (max-width: 900px) {
  .lessonHeaderCta,
  #lessonHeaderCta {
    overflow-x: auto !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    max-width: 100% !important;
  }
}


/* =========================================================
   HTML LAB FINAL PYTHON-LAB PREVIEW / LESSON LAYOUT FIX
   Added 2026-05-26
   ========================================================= */

/* Keep Hide Preview + Screen together on the far right */
.previewHead {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.previewHead .actions {
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

#btnHidePreview,
#btnOpenTab,
#btnRefresh {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Lesson header buttons: keep 🔓 next to Next ➡ */
.lessonHead {
  flex-wrap: nowrap !important;
  align-items: center !important;
}

.lessonHeadText {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.lessonHeaderCta,
#lessonHeaderCta {
  flex: 0 0 auto !important;
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.lessonHeaderCta button,
#lessonHeaderCta button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Default state: preview fills the right panel, lesson is only a bottom header bar */
body:not(.html-lab-preview-hidden) #previewPane {
  flex: 1 1 auto !important;
  min-height: 120px !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
}

body:not(.html-lab-preview-hidden) #lessonPane.collapsed {
  flex: 0 0 62px !important;
  height: 62px !important;
  min-height: 62px !important;
  max-height: 62px !important;
}

body:not(.html-lab-preview-hidden) #lessonPane.collapsed .lessonBody {
  display: none !important;
}

/* Hide Preview mode: keep the preview header/buttons visible, hide only the iframe */
body.html-lab-preview-hidden #previewPane {
  flex: 0 0 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

body.html-lab-preview-hidden #previewPane .previewHead {
  display: flex !important;
  flex: 0 0 auto !important;
}

body.html-lab-preview-hidden #preview {
  display: none !important;
}

body.html-lab-preview-hidden #lessonGutter {
  display: none !important;
}

body.html-lab-preview-hidden #lessonPane {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.html-lab-preview-hidden #lessonPane .lessonBody {
  display: block !important;
}

/* Fullscreen keeps the same Python Lab style controls visible */
#rightCol:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  background: #ffffff !important;
}

#rightCol:fullscreen #previewPane {
  display: flex !important;
}

#rightCol:fullscreen #lessonPane {
  flex: 1 1 auto !important;
  height: auto !important;
  max-height: none !important;
}

/* Tighten quiz check buttons */
#lessonBody .lessonQuizCheck,
.lessonBody .lessonQuizCheck,
#lessonBody #btnCheckLesson {
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  padding: 7px 12px !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  border-radius: 9px !important;
}


/* =========================================================
   HTML LAB CLEAN PREVIEW / LESSON / ZOOM FIX
   Added 2026-05-26
   ========================================================= */

#previewPane .previewHead,
.previewHead {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  flex: 0 0 auto !important;
}

#previewPane .previewHead .actions,
.previewHead .actions {
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

#btnHidePreview,
#btnOpenTab {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
}

body:not(.html-lab-preview-hidden) #lessonPane.collapsed,
body:not(.html-lab-preview-hidden) .lessonPane.collapsed {
  flex: 0 0 62px !important;
  height: 62px !important;
  min-height: 62px !important;
  max-height: 62px !important;
}

body:not(.html-lab-preview-hidden) #lessonPane.collapsed .lessonBody,
body:not(.html-lab-preview-hidden) .lessonPane.collapsed .lessonBody {
  display: none !important;
}

body.html-lab-preview-hidden #previewPane {
  flex: 0 0 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  display: flex !important;
  overflow: visible !important;
}

body.html-lab-preview-hidden #preview {
  display: none !important;
}

body.html-lab-preview-hidden #lessonGutter {
  display: none !important;
}

body.html-lab-preview-hidden #lessonPane {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.html-lab-preview-hidden #lessonPane .lessonBody {
  display: block !important;
}

/* Keep lesson header controls in one row */
.lessonHeaderCta,
#lessonHeaderCta {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  margin-left: auto !important;
  white-space: nowrap !important;
}

.lessonHeaderCta button,
#lessonHeaderCta button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Tighter quiz check buttons */
#lessonBody .lessonQuizCheck,
.lessonBody .lessonQuizCheck,
#lessonBody #btnCheckLesson {
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  line-height: 1.15 !important;
  border-radius: 8px !important;
}


/* =========================================================
   HTML LAB ANTI-RESET GUARD FOR HIDE PREVIEW
   Added 2026-05-26
   ========================================================= */

body.html-lab-preview-hidden #previewPane {
  display: flex !important;
  flex: 0 0 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  overflow: visible !important;
}

body.html-lab-preview-hidden #preview {
  display: none !important;
}

body.html-lab-preview-hidden #lessonGutter {
  display: none !important;
}

body.html-lab-preview-hidden #lessonPane {
  display: flex !important;
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.html-lab-preview-hidden #lessonPane .lessonBody {
  display: block !important;
}

body:not(.html-lab-preview-hidden) #lessonPane.collapsed {
  flex: 0 0 62px !important;
  height: 62px !important;
  min-height: 62px !important;
  max-height: 62px !important;
}

body:not(.html-lab-preview-hidden) #lessonPane.collapsed .lessonBody {
  display: none !important;
}


/* =========================================================
   HTML LAB SMOOTH LESSON IMAGE SIZING
   Added 2026-05-26
   Mirrors Python Lab idea: JS updates one CSS variable.
   ========================================================= */

#lessonPane {
  --html-lesson-image-max-height: 360px;
}

#lessonBody img,
.lessonBody img,
.lessonContent img,
.lessonMedia img {
  display: block !important;
  margin: 14px auto !important;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  max-height: var(--html-lesson-image-max-height, 360px) !important;
  transition: max-height 70ms linear;
}

.lessonMedia.small img,
.lessonMedia.medium img,
.lessonMedia.large img,
.lessonMedia img.small,
.lessonMedia img.medium,
.lessonMedia img.large {
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  max-height: var(--html-lesson-image-max-height, 360px) !important;
}

body.html-lab-preview-hidden #lessonPane {
  --html-lesson-image-max-height: calc(100vh - 150px);
}

body.html-lab-preview-hidden #lessonBody img,
body.html-lab-preview-hidden .lessonBody img,
body.html-lab-preview-hidden .lessonContent img,
body.html-lab-preview-hidden .lessonMedia img {
  max-height: var(--html-lesson-image-max-height, calc(100vh - 150px)) !important;
}

#rightCol:fullscreen #lessonPane,
#lessonPane:fullscreen {
  --html-lesson-image-max-height: calc(100vh - 135px);
}

#rightCol:fullscreen #lessonBody img,
#rightCol:fullscreen .lessonBody img,
#rightCol:fullscreen .lessonContent img,
#rightCol:fullscreen .lessonMedia img,
#lessonPane:fullscreen #lessonBody img,
#lessonPane:fullscreen .lessonBody img,
#lessonPane:fullscreen .lessonContent img,
#lessonPane:fullscreen .lessonMedia img {
  max-height: var(--html-lesson-image-max-height, calc(100vh - 135px)) !important;
}


/* =========================================================
   HTML LAB ASSESSMENT SUBMIT HIGHLIGHT
   Added 2026-05-27
   ========================================================= */

#lessonBody .assessment-submit-highlight {
  outline: 4px solid #1f6feb !important;
  box-shadow: 0 0 0 8px rgba(31, 111, 235, 0.18) !important;
  transform: scale(1.03);
}


/* =========================================================
   HTML LAB PYTHON-STYLE LESSON TREE + BADGE/CERTIFICATE UI
   Added 2026-05-27
   Matches Python Lab lesson tree look and feel
   ========================================================= */

.htmlLessonTreeModal.hidden,
#htmlLabCompletionModal.hidden {
  display: none !important;
}

.htmlLessonTreeModal,
#htmlLabCompletionModal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  background: rgba(15, 23, 42, 0.55) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px !important;
  box-sizing: border-box !important;
}

.htmlLessonTreeCard,
.htmlLabCompletionCard {
  width: min(980px, calc(100vw - 36px)) !important;
  max-height: calc(100vh - 36px) !important;
  overflow: auto !important;
  background: #ffffff !important;
  border-radius: 18px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18) !important;
  padding: 18px !important;
  color: #111827 !important;
  box-sizing: border-box !important;
}

.htmlLessonTreeHeader,
.htmlLabCompletionHeader {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding-bottom: 12px !important;
  border-bottom: 1px solid #e5e7eb !important;
  margin-bottom: 12px !important;
}

.htmlLessonTreeHeader strong,
.htmlLabCompletionHeader strong {
  font-size: 18px !important;
}

.htmlLessonTreeClose,
.htmlLabCompletionClose {
  flex: 0 0 auto !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 999px !important;
  border: 1px solid #d1d5db !important;
  background: #f9fafb !important;
  color: #111827 !important;
  cursor: pointer !important;
  font-size: 22px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

.htmlLessonTreeContent {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

.htmlLessonTreeBadges,
.htmlLabCompletionBadges {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  padding: 12px !important;
  margin-bottom: 8px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  background: #ffffff !important;
}

.htmlLessonTreeBadge,
.htmlLabCompletionBadge {
  width: 106px !important;
  min-height: 106px !important;
  border-radius: 14px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  cursor: pointer !important;
  padding: 8px !important;
  text-align: center !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #111827 !important;
  box-shadow: none !important;
  display: grid !important;
  place-items: center !important;
  gap: 4px !important;
}

.htmlLessonTreeBadgeIcon,
.htmlLabCompletionBadgeIcon {
  width: 54px !important;
  height: 54px !important;
  border-radius: 999px !important;
  border: 2px dashed #cbd5e1 !important;
  background: #f8fafc !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 24px !important;
}

.htmlLessonTreeBadge.locked,
.htmlLabCompletionBadge.locked {
  opacity: 0.45 !important;
  filter: grayscale(1) !important;
}

.htmlLessonTreeBadge.unlocked,
.htmlLabCompletionBadge.unlocked {
  opacity: 1 !important;
  filter: none !important;
}

.htmlLessonNavGroup {
  display: block !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.htmlLessonNavGroup.branchGroup {
  border: 1px solid #1e7fb3 !important;
  margin-bottom: 12px !important;
}

.htmlLessonNavGroup.branchGroup > .htmlLessonNavGroupHeader {
  background: #1e7fb3 !important;
  color: #ffffff !important;
  padding: 13px 16px !important;
  font-size: 16px !important;
}

.htmlLessonNavGroup.branchGroup > .htmlLessonNavGroupBody {
  padding: 12px !important;
  background: #ffffff !important;
}

.htmlLessonNavGroup.levelGroup {
  border: 1px solid #d1d5db !important;
  margin: 10px 0 !important;
  background: #ffffff !important;
  border-radius: 14px !important;
}

.htmlLessonNavGroup.levelGroup > .htmlLessonNavGroupHeader {
  background: #f3f4f6 !important;
  color: #111827 !important;
  padding: 11px 14px !important;
  font-size: 15px !important;
  border-bottom: 1px solid #d1d5db !important;
}

.htmlLessonNavGroupHeader {
  width: 100% !important;
  border: 0 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  text-align: left !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

.htmlLessonNavGroupBody {
  display: none !important;
}

.htmlLessonNavGroup.open > .htmlLessonNavGroupBody {
  display: block !important;
}

.htmlLessonNavArrow {
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.htmlLessonNavButtons {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
}

.htmlLessonCircle,
#lessonTreeContent .lesson-tree-btn.htmlLessonCircle {
  min-width: 38px !important;
  height: 36px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #111827 !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

.htmlLessonCircle:hover {
  border-color: #1e7fb3 !important;
  background: #ffffff !important;
}

.htmlLessonCircle.active {
  background: #1e7fb3 !important;
  color: #ffffff !important;
  border-color: #1e7fb3 !important;
}

.htmlLessonCircle.locked {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  background: #f3f4f6 !important;
}

.htmlLessonCircle.assessment,
.htmlLessonCircle.assessment.active {
  background: #fff7ed !important;
  border-color: #fdba74 !important;
  color: #111827 !important;
  min-width: 96px !important;
}

.htmlLessonCircle.passed,
.htmlLessonCircle.assessment.passed,
.htmlLessonCircle.assessment.passed.active {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #111827 !important;
}

.htmlLessonTreeLockedNote {
  margin: 0 0 12px !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  background: #fff7ed !important;
  border: 1px solid #fed7aa !important;
  color: #9a3412 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.htmlLabCompletionSummary {
  background: #f8fbff !important;
  border: 1px solid #d8e2ec !important;
  border-radius: 16px !important;
  padding: 14px !important;
  margin: 12px 0 !important;
  line-height: 1.5 !important;
}

.htmlLabCompletionActions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  justify-content: flex-end !important;
  margin-top: 14px !important;
}

.htmlLabCompletionActions button {
  min-height: 42px !important;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  border: 1px solid #1e7fb3 !important;
  background: #1e7fb3 !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
}

.htmlLabCompletionActions button.secondary {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
  color: #334155 !important;
}

@media (max-width: 760px) {
  .htmlLessonTreeModal,
  #htmlLabCompletionModal {
    padding: 12px !important;
  }

  .htmlLessonTreeCard,
  .htmlLabCompletionCard {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    padding: 14px !important;
    border-radius: 16px !important;
  }

  .htmlLessonTreeBadge,
  .htmlLabCompletionBadge {
    width: 92px !important;
  }

  .htmlLessonNavGroup.branchGroup > .htmlLessonNavGroupHeader {
    font-size: 15px !important;
  }

  .htmlLessonNavGroup.levelGroup > .htmlLessonNavGroupHeader {
    font-size: 14px !important;
  }
}


/* === SAFE STATIC HIDE BUTTON CSS START === */
#previewPane .previewHead {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#previewPane .previewHead > strong {
  margin-right: auto !important;
}

#btnSafeHideDisplay {
  white-space: nowrap !important;
  margin-left: 8px !important;
}

#btnOpenTab {
  white-space: nowrap !important;
}

#btnHidePreview,
#btnTogglePreviewClean,
#btnPreviewDisplayToggleFinal {
  display: none !important;
  pointer-events: none !important;
}
/* === SAFE STATIC HIDE BUTTON CSS END === */



/* === LOCK SAFE HIDE BUTTON POSITION START === */
#previewPane .previewHead {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
}

#previewPane .previewHead > strong {
  flex: 1 1 auto !important;
  margin-right: 0 !important;
  min-width: 0 !important;
}

#btnSafeHideDisplay {
  order: 20 !important;
  flex: 0 0 auto !important;
  margin-left: auto !important;
  margin-right: 0 !important;
  white-space: nowrap !important;
}

#btnOpenTab {
  order: 30 !important;
  flex: 0 0 auto !important;
  margin-left: 0 !important;
  white-space: nowrap !important;
}

#btnHidePreview,
#btnTogglePreviewClean,
#btnPreviewDisplayToggleFinal {
  display: none !important;
  pointer-events: none !important;
}
/* === LOCK SAFE HIDE BUTTON POSITION END === */


/* === KEEP HIDE DISPLAY BEFORE SCREEN CSS START === */
#previewPane .previewHead {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
}

#previewPane .previewHead > strong {
  flex: 1 1 auto !important;
  margin-right: 0 !important;
  min-width: 0 !important;
}

#btnSafeHideDisplay {
  order: 20 !important;
  flex: 0 0 auto !important;
  margin-left: auto !important;
  margin-right: 8px !important;
  white-space: nowrap !important;
}

#btnOpenTab {
  order: 30 !important;
  flex: 0 0 auto !important;
  margin-left: 0 !important;
  white-space: nowrap !important;
}
/* === KEEP HIDE DISPLAY BEFORE SCREEN CSS END === */


/* === HIDE OLD DYNAMIC HIDE BUTTONS START === */
#btnHidePreview,
#btnTogglePreviewClean,
#btnPreviewDisplayToggleFinal {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

#btnSafeHideDisplay {
  display: inline-flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  width: auto !important;
  height: auto !important;
  white-space: nowrap !important;
  margin-left: auto !important;
  margin-right: 8px !important;
  order: 20 !important;
  flex: 0 0 auto !important;
}

#btnOpenTab {
  order: 30 !important;
  flex: 0 0 auto !important;
}
/* === HIDE OLD DYNAMIC HIDE BUTTONS END === */


/* === PREVENT STARTUP PREVIEW BUTTON SWAP CSS START === */
body.preview-buttons-settling #btnSafeHideDisplay,
body.preview-buttons-settling #btnOpenTab {
  visibility: hidden !important;
}

#btnSafeHideDisplay {
  white-space: nowrap !important;
  margin-left: auto !important;
  margin-right: 8px !important;
}

#btnOpenTab {
  white-space: nowrap !important;
}
/* === PREVENT STARTUP PREVIEW BUTTON SWAP CSS END === */








/* === PREVIEW BUTTON GROUP CSS START === */
#previewPane .previewHead {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
}

#previewPane .previewHead > strong {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}

#previewButtonGroup.previewButtonGroup {
  margin-left: auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
}

#previewButtonGroup #btnSafeHideDisplay,
#previewButtonGroup #btnOpenTab {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  height: auto !important;
  white-space: nowrap !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}

#btnHidePreview,
#btnTogglePreviewClean,
#btnPreviewDisplayToggleFinal {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
/* === PREVIEW BUTTON GROUP CSS END === */


/* === HTML LAB WEB PREVIEW BUTTON CSS START === */
#previewButtonGroup #btnWebPreview,
#previewButtonGroup #btnSafeHideDisplay,
#previewButtonGroup #btnOpenTab {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  height: auto !important;
  white-space: nowrap !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}

#btnWebPreview {
  white-space: nowrap !important;
}
/* === HTML LAB WEB PREVIEW BUTTON CSS END === */


/* === SAFE EARLY BLOB WEB PREVIEW CSS START === */
#btnWebPreview {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

#btnWebPreview:disabled {
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

#previewButtonGroup #btnWebPreview,
#previewButtonGroup #btnSafeHideDisplay,
#previewButtonGroup #btnOpenTab {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  height: auto !important;
  white-space: nowrap !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}
/* === SAFE EARLY BLOB WEB PREVIEW CSS END === */


/* === FINAL PREVIEW BUTTON GROUP SPACING START === */
#previewPane .previewHead {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#previewPane .previewHead > strong {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}

#previewButtonGroup.previewButtonGroup {
  margin-left: auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
}

#previewButtonGroup #btnWebPreview,
#previewButtonGroup #btnSafeHideDisplay,
#previewButtonGroup #btnOpenTab {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: auto !important;
  white-space: nowrap !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  pointer-events: auto !important;
  opacity: 1 !important;
}

#btnWebPreview:disabled {
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}
/* === FINAL PREVIEW BUTTON GROUP SPACING END === */


/* === POLISH PREVIEW BUTTONS START === */
body.preview-buttons-loading #btnWebPreview,
body.preview-buttons-loading #btnSafeHideDisplay,
body.preview-buttons-loading #btnOpenTab {
  visibility: hidden !important;
}

#previewButtonGroup.previewButtonGroup {
  min-height: 38px !important;
  gap: 8px !important;
}

#previewButtonGroup #btnWebPreview,
#previewButtonGroup #btnSafeHideDisplay,
#previewButtonGroup #btnOpenTab {
  box-sizing: border-box !important;
  min-height: 36px !important;
  height: 36px !important;
  line-height: 1 !important;
  padding: 8px 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  font: inherit !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  margin: 0 !important;
}
/* === POLISH PREVIEW BUTTONS END === */


/* === FIX WEB PREVIEW TOOLTIP CSS START === */
#btnWebPreview {
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}
/* === FIX WEB PREVIEW TOOLTIP CSS END === */


/* === STABILISE WEB PREVIEW TOOLTIP CSS START === */
body.web-preview-tooltip-loading #btnWebPreview {
  visibility: hidden !important;
  pointer-events: none !important;
}

#btnWebPreview {
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}
/* === STABILISE WEB PREVIEW TOOLTIP CSS END === */
















/* === HTML LAB ASSESSMENT MESSAGE COLOURS START === */

/* Passed assessment message */
#lessonFeedback,
.assessmentResult,
.lessonNotice {
  line-height: 1.5;
}

/* Green pass wording */
#lessonFeedback,
.assessmentResult.passed,
.lessonNotice.passed {
  color: #14532d;
}

/* Any text block containing the standard pass wording should look successful */
#lessonBody .assessmentResult:has(strong),
#lessonBody .lessonNotice:has(strong) {
  border-radius: 12px;
}

/* Explicit pass message styling */
#lessonBody .assessmentResult:has(*),
#lessonBody .lessonNotice:has(*) {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Modern browser selector for the pass message text */
#lessonBody .assessmentResult:has(:where(strong, b)),
#lessonBody .lessonNotice:has(:where(strong, b)) {
  color: inherit;
}

/* Pass message generated by the assessment checker */
#lessonBody .assessmentResult,
#lessonBody #lessonFeedback {
  border-radius: 12px;
}

/* If the result contains "Well done" / "passed", make it green */
#lessonBody .assessmentResult {
  color: #14532d;
}

/* Failed inline note near Submit Assessment */
#assessmentSubmitInlineNoteV5 {
  color: #991b1b !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  border-radius: 10px !important;
  padding: 8px 10px !important;
  margin-top: 8px !important;
  font-weight: 800 !important;
}

/* Failed assessment blocks */
#lessonBody .assessmentResult.not-passed,
#lessonBody .lessonNotice.not-passed,
#lessonBody .htmlLabSafeLevel1Status.not-passed,
#lessonBody .htmlLabDirectLevel1Status.not-passed,
#lessonBody .htmlLabLevel1FinalStatus.not-passed,
#lessonBody .htmlLabLevel1StableStatus.not-passed,
#lessonBody .htmlLabAssessmentTopStatus.not-passed {
  color: #991b1b !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
}

/* Passed assessment blocks */
#lessonBody .assessmentResult.passed,
#lessonBody .lessonNotice.passed,
#lessonBody .htmlLabSafeLevel1Status.passed,
#lessonBody .htmlLabDirectLevel1Status.passed,
#lessonBody .htmlLabLevel1FinalStatus.passed,
#lessonBody .htmlLabLevel1StableStatus.passed,
#lessonBody .htmlLabAssessmentTopStatus.passed {
  color: #14532d !important;
  background: #ecfdf3 !important;
  border: 1px solid #86efac !important;
}

/* === HTML LAB ASSESSMENT MESSAGE COLOURS END === */


/* === HTML LAB CLEAN PASSED ASSESSMENT TEXT CSS START === */
#assessmentSubmitInlineNoteV5:empty {
  display: none !important;
}
/* === HTML LAB CLEAN PASSED ASSESSMENT TEXT CSS END === */

/* =========================================================
   HTML LAB MODAL READABILITY FIX 20260605
   Loaded from app.css, not style.css.
   ========================================================= */

#modal .box {
  max-width: 580px !important;
  border-radius: 18px !important;
  padding: 22px !important;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22) !important;
}

#modalTitle {
  display: block !important;
  font-weight: 900 !important;
  font-size: 1.28rem !important;
  color: #0f172a !important;
  margin: 0 0 16px 0 !important;
}

#modalBody {
  display: block !important;
  white-space: pre-line !important;
  line-height: 1.65 !important;
  font-size: 0.98rem !important;
  color: #1f2937 !important;
}

#modal .actions {
  margin-top: 20px !important;
  gap: 10px !important;
}

#modalOk {
  background: #1f6feb !important;
  color: #ffffff !important;
  border-color: #1f6feb !important;
  font-weight: 800 !important;
}

#modalCancel {
  background: #f3f4f6 !important;
  color: #111827 !important;
  font-weight: 700 !important;
}

/* =========================================================
   HTML LAB CREATE FOLDER BUTTON 20260606
   ========================================================= */

#btnNewFolder {
  display: inline-flex !important;
}

#leftCol .paneHead .actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
}

/* Row 1 */
#btnNewFile {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

#btnNewFolder {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

/* Row 2 */
#btnUpload {
  grid-column: 1 !important;
  grid-row: 2 !important;
}

#btnUploadDoc {
  grid-column: 2 !important;
  grid-row: 2 !important;
}

/* Row 3 */
#btnRename {
  grid-column: 1 !important;
  grid-row: 3 !important;
}

#btnDelete {
  grid-column: 2 !important;
  grid-row: 3 !important;
}

/* =========================================================
   HTML LAB DRAG FILE TO ROOT FOLDER 20260606
   ========================================================= */

#tree.htmlLabRootDropReady {
  outline: 2px dashed #1f6feb !important;
  outline-offset: -6px !important;
  background: rgba(31, 111, 235, 0.06) !important;
}

#tree.htmlLabRootDropReady::after {
  content: "Drop here to move to main project folder";
  display: block;
  margin: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef6ff;
  color: #174ea6;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid #cfe6ff;
}
