/* --- FELOLDÁS SZERKESZTÉSRE GOMB --- */
#btnUnlockFinal {
    display: inline-block;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  body:not(.teacher-mode) #btnUnlockFinal { display: none !important; }

  .fixed-name-banner {
    display: none; background: #e0e7ff; border: 1px solid #a5b4fc;
    color: #3730a3; padding: 10px 16px; border-radius: 8px;
    margin-bottom: 16px; font-size: 0.85rem; font-weight: 600;
  }
  body.fixed-name-mode .fixed-name-banner { display: block; }
  header {
    background: #e2e8f0;
    color: var(--text);
    padding: 24px 28px; border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #475569;
    border-right: 4px solid #475569;
  }
  .header-title-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; flex-wrap: wrap;
  }
  header h1 {
    margin: 0 0 8px; font-size: 1.6rem; flex: 1; min-width: 0;
    color: #1e293b;
    font-weight: 700;
  }
  .activity-indicator {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 20px; font-size: 0.82rem;
    font-weight: 700; cursor: pointer; user-select: none;
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    white-space: nowrap; line-height: 1;
  }
  .activity-indicator:hover { transform: scale(1.03); }
  .activity-indicator:active { transform: scale(0.98); }
  .activity-indicator.green { background: #dcfce7; color: #166534; border-color: #86efac; }
  .activity-indicator.yellow { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
  .activity-indicator.red { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
  header .activity-indicator {
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  }

  /* FEJLÉC JOBB OLDALI ELEMEK */
  .header-title-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }

  /* ============================================================
     KOMPAKT FEJLÉC — Fájlnév + Leírás, majd dátum + tanár + kilépés
     ============================================================
     A fejléc két tömör sorba rendezve:
       1. sor: Fájlnév (1/3) | Leírás (2/3)
       2. sor: Létrehozva | Tanár neve | Kijelentkezés
     ============================================================ */
  header.worksheet-header {
    padding: 16px 20px;
  }
  header.worksheet-header .header-title-row {
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }
  header.worksheet-header h1 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.25;
  }

  /* 1. sor: fájlnév 1/3, leírás 2/3 */
  header.worksheet-header .meta.header-fields-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
    margin-top: 0;
  }
  header.worksheet-header .header-field {
    min-width: 0;
  }
  header.worksheet-header .header-field label {
    margin-bottom: 3px;
    font-size: 0.72rem;
  }
  header.worksheet-header .header-field label .req {
    color: #dc2626;
  }
  header.worksheet-header .header-field input,
  header.worksheet-header .header-field select {
    padding: 7px 10px;
    font-size: 0.9rem;
  }

  /* 2. sor: létrehozva + tanár neve + kijelentkezés */
  header.worksheet-header .meta.header-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-top: 12px;
  }
  header.worksheet-header .header-field-created {
    flex: 0 1 210px;
    min-width: 180px;
  }
  header.worksheet-header .header-field-teacher {
    flex: 1 1 280px;
    min-width: 220px;
  }
  header.worksheet-header .header-teacher-controls {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  header.worksheet-header .header-teacher-controls input {
    flex: 1 1 auto;
    min-width: 0;
  }
  header.worksheet-header .header-logout-btn {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.35);
    border-radius: 8px;
    white-space: nowrap;
  }
  header.worksheet-header .header-logout-btn:hover {
    background: rgba(220, 38, 38, 0.16);
    border-color: rgba(220, 38, 38, 0.55);
  }
  header.worksheet-header .header-title-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }
  header.worksheet-header .storage-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
  }
  header.worksheet-header .storage-info.warn {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
  }
  header.worksheet-header .storage-info.danger {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    font-weight: 700;
  }

  /* Az igazítás- és összecsukás gombok a világos fejlécen */
  header.worksheet-header .side-toggle-group {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }
  header.worksheet-header .side-toggle-group .side-toggle-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
  }
  header.worksheet-header .side-toggle-group .side-toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
  }
  header.worksheet-header .side-toggle-group .side-toggle-btn.active {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
  }
  header.worksheet-header .header-toggle-steps-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 1.05rem;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    opacity: 1;
  }
  header.worksheet-header .header-toggle-steps-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
  }

  @media (max-width: 720px) {
    header.worksheet-header .header-title-row {
      flex-wrap: wrap;
      align-items: flex-start;
    }
    header.worksheet-header h1 {
      flex: 1 1 100%;
    }
    header.worksheet-header .header-title-right {
      flex: 1 1 100%;
      justify-content: flex-start;
      flex-wrap: wrap;
    }
    header.worksheet-header .meta.header-fields-row {
      grid-template-columns: 1fr;
    }
    header.worksheet-header .header-teacher-controls {
      flex-wrap: wrap;
    }
    header.worksheet-header .header-logout-btn {
      width: 100%;
      justify-content: center;
    }
  }

  /* A tanári összecsukás gomb – "láthatatlan": csak az emoji. */
  .header-toggle-steps-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
    transition: transform 0.1s, opacity 0.15s;
    user-select: none;
    border-radius: 6px;
    opacity: 0.75;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .header-toggle-steps-btn:hover { opacity: 1; }
  .header-toggle-steps-btn:active { transform: scale(0.9); }

  /* Láthatóság: a footer gomb CSAK a tanárnál van elrejtve.
     A header gomb mindenkinél látszik (a diáknál a buildStudentHtml
     külön beszúrja a fejlécbe). */
  body.teacher-mode #btnToggleAllSteps { display: none !important; }
  .activity-indicator.hidden { display: none; }

/* --- Fázis 6c/6g — Lab status badge + valódi overlay div --- */
.lab-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    z-index: 20;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    border-radius: 8px;
    white-space: pre-wrap;
    box-sizing: border-box;
  }
  .block.no-lab {
    position: relative;
    min-height: 180px;
  }
  .lab-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
    border: 2px solid transparent;
    user-select: none;
  }
  .lab-status-badge.running { background: #dcfce7; color: #166534; border-color: #86efac; }
  .lab-status-badge.not-running { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
  .lab-status-badge.unknown { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
  .lab-status-badge.hidden { display: none; }

/* --- Fázis 7 — Lab újraindítás gomb --- */
.btn-restart-labs {
    background: #eff6ff;
    border: 2px solid #93c5fd;
    color: #1e40af;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
  }
  .btn-restart-labs:hover { background: #dbeafe; border-color: #60a5fa; }
  .btn-restart-labs:disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: wait;
  }
  .btn-restart-labs.hidden { display: none; }

/* --- Fázis 21 — "Még dolgozom" gomb --- */
.btn-extend-labs {
    background: #fef3c7;
    border: 2px solid #fcd34d;
    color: #92400e;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
  }
  .btn-extend-labs:hover { background: #fde68a; border-color: #f59e0b; }
  .btn-extend-labs:disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: wait;
  }
  .btn-extend-labs.hidden { display: none; }

/* --- Fázis 28 — "Munkám törlése" gomb (diák) --- */
.btn-clear-work {
    background: #fee2e2;
    border: 2px solid #fca5a5;
    color: #991b1b;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
  }
  .btn-clear-work:hover { background: #fecaca; border-color: #f87171; }
  .btn-clear-work:disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: wait;
  }
  .btn-clear-work.hidden { display: none; }

  /* Overlay a paneleken, ha a diák labja nem fut */


  .activity-indicator .activity-icon { font-size: 1rem; }
  .activity-indicator .activity-label { font-family: "Consolas", "Courier New", monospace; }
  .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
  .meta label {
    display: block; font-size: 0.8rem; font-weight: 600; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
  }
  header .meta label {
    color: #475569;
  }
  .meta input, .meta select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.95rem; font-family: inherit; background: white;
  }
  .meta input:disabled, .meta select:disabled {
    background: #f1f5f9; color: #475569; cursor: not-allowed;
  }
  header .meta input, header .meta select {
    border-color: #cbd5e1;
  }
  header .meta input:disabled, header .meta select:disabled {
    background: #e2e8f0;
    color: #475569;
  }
  /* Írásvédett fejléc mezők a diáknál */
  header .meta input.header-readonly,
  header .meta select.header-readonly,
  .header-readonly {
    background: #f1f5f9 !important;
    color: #475569 !important;
    cursor: default !important;
    border-color: #cbd5e1 !important;
    /* A zárolt mezőbe ne lehessen kattintani (a kurzor ne menjen bele).
       Csak a diáknál van ilyen mező, a tanárnál nincs header-readonly. */
    pointer-events: none !important;
  }
  .header-readonly:focus {
    outline: none !important;
    border-color: #cbd5e1 !important;
  }
  .setup-info {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
    padding: 10px 14px; margin-top: 12px; font-size: 0.85rem; color: #1e40af;
  }
  header .setup-info {
    background: white;
    border-color: #cbd5e1;
    color: #1e40af;
  }
  .setup-info:empty { display: none; }
  .preset-row {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 8px 2px 10px;
    background: #f0f9ff; border: 1px solid #bae6fd;
    border-radius: 10px;
    font-size: 0.82rem;
  }
  .preset-row label {
    font-weight: 700; color: #0c4a6e;
    font-size: 0.75rem; letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .preset-row select {
    padding: 3px 6px; border: 1px solid #bae6fd;
    border-radius: 6px; font-size: 0.82rem;
    font-family: inherit; background: white;
    cursor: pointer;
  }
  /* Kötelező mező jelölése (a requireLeiras állítja be) */
  #feladatLeirasInput.leiras-required,
  .leiras-required {
    border-color: #fca5a5 !important;
    background: #fef2f2 !important;
    outline: 2px solid #fecaca;
  }
  #feladatLeirasInput.leiras-required:focus,
  .leiras-required:focus {
    outline: 2px solid #f87171;
    border-color: transparent !important;
  }
  body:not(.teacher-mode) .preset-row { display: none !important; }
  .step {
    background: var(--card); border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 20px 24px; margin-bottom: 20px; transition: background 0.15s;
    border-left: 2px solid #94a3b8;
    border-right: 2px solid #94a3b8;
  }
  .step.dragging { opacity: 0.5; background: #f1f5f9; }
  .step.drag-over-top { box-shadow: 0 -3px 0 0 #3b82f6, 0 1px 4px rgba(0,0,0,0.08); }
  .step.drag-over-bottom { box-shadow: 0 3px 0 0 #3b82f6, 0 1px 4px rgba(0,0,0,0.08); }
  .step-header {
    display: grid; grid-template-columns: 1fr auto;
    gap: 12px; align-items: stretch; margin-bottom: 14px;
  }
  .step-header-right {
    display: flex; align-items: center; gap: 4px;
    justify-content: flex-end;
    /* Fix szélesség, hogy a step-title-group (1fr) ne ugorjon
       vízszintesen, amikor a .step-actions megjelenik/eltűnik. */
    min-width: 180px;
  }
  .step-title-group {
    display: flex; align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    overflow: hidden;
    min-width: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .step-title-group:focus-within {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.3);
  }
  .step-title-group .step-number {
    margin: 0;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    background: #f8fafc;
    border-right: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: grab; user-select: none;
    min-width: 44px;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
  }
  .step-title-group .step-number:hover {
    background: #f1f5f9;
    color: #475569;
  }
  .step-title-group .step-number:active { cursor: grabbing; }
  .step-title-group .step-title {
    flex: 1; min-width: 0;
    border: none;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    outline: none;
    border-radius: 0;
  }
  .step-title-group .step-title:focus {
    outline: none;
  }
  /* Összecsukott feladat */
  .step.collapsed {
    padding-bottom: 16px;
  }
  .step.collapsed .step-header {
    margin-bottom: 0;
  }
  .step.collapsed .step-instructions,
  .step.collapsed .button-row,
  .step.collapsed .sections,
  .step.collapsed .step-comment-area,
  .step.collapsed .section-config-panel {
    display: none !important;
  }
  .step-collapse-btn {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Fix szélesség, hogy a 👁️ és 🙈 ikon cseréje ne változtassa
       meg a gomb méretét, és ne okozzon vízszintes ugrást. */
    min-width: 34px;
    width: 34px;
    box-sizing: border-box;
  }
  .step-collapse-btn.collapsed {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #78350f;
  }
  .step-collapse-btn.collapsed:hover {
    background: #fde68a;
  }
  /* A step-title input stílusa a .step-title-group-on belül van */
  .step-actions { display: flex; gap: 4px; flex-wrap: wrap; }
  /* Feladat "Kész" checkbox – csak a diáknál látszik.
     A tanárnál rejtve.
     Összecsukott feladatnél is látható, mert a step-header nem tűnik el. */
  .step-done-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    user-select: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
  }
  .step-done-wrap:hover { background: #f1f5f9; }
  .step-done-wrap input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    accent-color: #16a34a;
    flex-shrink: 0;
  }
  .step-done-wrap.checked {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
  }
  .step-done-wrap.checked:hover { background: #bbf7d0; }
  body.teacher-mode .step-done-wrap { display: none !important; }

  /* Készre jelölt feladat – kék árnyalat (mint a diák feladatleírás háttere):
     • a feladat sorszáma (.step-number) MINDIG kék hátteret kap
     • a cím-keret (.step-title-group) kék szegélyt kap
     • ÖSSZECSUKVA: a teljes látható feladat háttere kék + kék keret
     • KINYITVA:    a háttér visszavált fehérre */
  .step.step-done .step-title-group {
    border-color: #93c5fd;
  }
  .step.step-done .step-title-group .step-number {
    background: #dbeafe;
    color: #1e40af;
  }
  .step.step-done .step-title-group .step-number:hover {
    background: #bfdbfe;
    color: #1e3a8a;
  }
  .step.step-done.collapsed {
    background: #eff6ff;
    border-left-color: #3b82f6;
    border-right-color: #3b82f6;
  }

  /* Megjegyzés szövegmező (feladatenként) */
  .step-comment-area {
    display: none;
    margin: 0 0 14px 0;
    padding: 12px 14px;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-left: 4px solid #0891b2;
    border-radius: 6px;
  }
  .step-comment-area.show { display: block; }
  .step-comment-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #0c4a6e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .step-comment-label .step-comment-hint {
    font-weight: 400;
    color: #0e7490;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.72rem;
  }
  .step-comment-textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1px solid #a5f3fc;
    border-radius: 6px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.88rem;
    resize: vertical;
    background: white;
    color: #1e293b;
    outline: none;
    overflow: hidden;
    transition: height 0.12s ease;
    max-height: 60vh;
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
  }
  .step-comment-textarea:focus {
    outline: 2px solid #0891b2;
    border-color: transparent;
  }
  .step-comment-textarea::placeholder { color: #94a3b8; font-style: italic; }
  body.locked .step-comment-textarea,
  body.no-name-yet .step-comment-textarea {
    background: #f8fafc;
    cursor: not-allowed;
  }

  /* Megjegyzés gomb */
  .btn.comment-step-btn { background: #0891b2; }
  .btn.comment-step-btn:hover { background: #0e7490; opacity: 1; }
  .btn.comment-step-btn.open {
    background: #0e7490;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4);
  }
  .btn.comment-step-btn.has-comment::after {
    content: ' ●';
    color: #fbbf24;
    font-size: 0.9em;
    margin-left: 2px;
  }
  .icon-btn {
    background: white; border: 1px solid var(--border); border-radius: 6px;
    padding: 5px 8px; cursor: pointer; font-size: 0.8rem;
    font-weight: 600; color: #475569; line-height: 1;
  }
  .icon-btn:hover { background: #e2e8f0; }
  .icon-btn.danger { color: #b91c1c; }
  .icon-btn.danger:hover { background: #fee2e2; }
  .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
  .icon-btn:disabled:hover { background: white; }
  /* Nyitott lakat â€“ vĂˇltozatlan (amber / barna) */
  .icon-btn.lock-btn { color: #92400e; }
  .icon-btn.lock-btn:hover { background: #fef3c7; }
  /* modosit_683.py: zĂˇrt lakat â€“ piros Ăˇrnyalat + keret, jobban lĂˇtszik */
  .icon-btn.lock-btn.is-locked {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
  }
  .icon-btn.lock-btn.is-locked:hover {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
  }
  .icon-btn.lock-btn:disabled { opacity: 1; cursor: not-allowed; }
  .icon-btn.lock-btn:disabled:hover { background: #fef3c7; }
  .icon-btn.lock-btn.is-locked:disabled:hover {
    background: #fef2f2;
  }
  .icon-btn.dup-btn { color: var(--dup); }
  .icon-btn.dup-btn:hover { background: #e0f2fe; }
  .icon-btn.md-btn { color: #0891b2; }
  .icon-btn.md-btn:hover { background: #cffafe; }
  .icon-btn.md-btn.active { background: #cffafe; border-color: #67e8f9; color: #155e75; }
  .icon-btn.format-btn {
    color: #6b21a8;
    font-weight: 700;
    font-family: "Consolas", "Courier New", monospace;
    min-width: 26px;
    text-align: center;
  }
  .icon-btn.format-btn:hover { background: #f3e8ff; }
  .icon-btn.format-btn.is-markdown { background: #f3e8ff; border-color: #c4b5fd; color: #5b21b6; }
  .icon-btn.edit-note-btn { color: #166534; }
  .icon-btn.edit-note-btn:hover { background: #dcfce7; }
  .icon-btn.example-btn { color: #7c3aed; }
  .icon-btn.example-btn:hover { background: #f3e8ff; border-color: #c4b5fd; }

/* ============================================================
   FLOATING MODE (univerzalis)
   ============================================================ */

.block.floating-mode {
  position: fixed !important;
  z-index: 9500;
  margin: 0 !important;
  padding: 0;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.35),
              0 0 0 1px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  min-width: 360px;
  min-height: 240px;
  max-width: 95vw;
  max-height: 95vh;
}

.block.floating-mode > .block-toolbar {
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 10px 10px 0 0;
}

.block.floating-mode > .block-toolbar:active {
  cursor: grabbing;
}

.block.floating-mode > *:not(.block-toolbar) {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.floating-placeholder-box {
  padding: 20px 24px;
  margin: 8px 0;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px dashed #7dd3fc;
  border-radius: 10px;
  color: #075985;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}

.floating-popup-placeholder {
  padding: 18px 22px;
  margin: 8px 0;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 2px dashed #a5b4fc;
  border-radius: 10px;
  color: #3730a3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s;
}

.floating-popup-placeholder:hover {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  border-color: #818cf8;
}

.floating-popup-placeholder .popup-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.floating-popup-placeholder .popup-text {
  font-size: 0.9rem;
  font-weight: 600;
}

.floating-popup-placeholder .popup-hint {
  flex-basis: 100%;
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
}


/* ============================================================
   CONTAINER IGAZITAS (oldalvalto gomb)
   ============================================================
   A body osztalya hatarozza meg, hogy a .container balra,
   kozepre vagy jobbra igazodik-e.
   ============================================================ */

body.container-left .container {
  margin-left: 16px;
  margin-right: auto;
}

body.container-right .container {
  margin-left: auto;
  margin-right: 16px;
}

/* A gomb stilusai */
.side-toggle-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.side-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.side-toggle-btn:active {
  transform: scale(0.97);
}



/* ============================================================
   CONTAINER IGAZITAS (3 gombos oldalvalto)
   ============================================================ */

body.container-left .container {
  margin-left: 16px;
  margin-right: auto;
}

body.container-right .container {
  margin-left: auto;
  margin-right: 16px;
}

/* A 3 gombos csoport */
.side-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.side-toggle-group .side-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.side-toggle-group .side-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.side-toggle-group .side-toggle-btn.active {
  background: rgba(255, 255, 255, 0.3);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
}

.side-toggle-group .side-toggle-btn:active {
  transform: scale(0.95);
}


/* ============================================================
   MARKDOWN KÉP (max-width: 100%)
   ============================================================ */

.md-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.md-image-missing {
  display: inline-block;
  padding: 4px 8px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  font-size: 0.85rem;
}


/* ============================================================
   MARKDOWN EDITOR — 50-50 layout
   ============================================================ */

.md-editor-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 400px;
}

.md-editor-left,
.md-editor-right {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-editor-textarea,
.md-editor-preview {
  flex: 1;
  min-height: 300px;
  overflow: auto;
}


/* ============================================================
   MARKDOWN EDITOR — 50-50 layout (kemenyitett)
   ============================================================ */

.md-editor-body {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  min-height: 400px;
}

.md-editor-body > .md-editor-left,
.md-editor-body > .md-editor-right {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-editor-textarea,
.md-editor-preview {
  flex: 1;
  min-height: 300px;
  overflow: auto;
}


/* ============================================================
   MARKDOWN KÉP LISTA — fix 48x48 bélyegkép
   ============================================================ */

.md-image-thumb {
  width: 48px !important;
  height: 48px !important;
  object-fit: cover !important;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
  cursor: pointer;
  background: #f1f5f9;
}

.md-image-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.md-image-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.md-image-num {
  font-family: Consolas, monospace;
  font-size: 0.78rem;
  color: #64748b;
}

.md-image-name {
  font-size: 0.82rem;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-image-size-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
}

.md-image-size-slider {
  width: 100px;
  cursor: pointer;
}

.md-image-size-value {
  min-width: 40px;
  text-align: right;
  font-family: Consolas, monospace;
  font-size: 0.75rem;
  color: #475569;
}

.md-image-actions {
  display: flex;
  gap: 2px;
}

/* Elválasztó vonal a forrás és az előnézet között */
.md-editor-body {
  position: relative;
}

.md-editor-body::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: #e2e8f0;
  pointer-events: none;
}

/* A kép lista panel (a szerkesztő alatt) */
.md-editor-images-panel {
  margin-top: 8px;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.md-images-empty {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
  font-style: italic;
}

/* A felesleges fejléc elrejtése */
.md-editor-images-header {
  display: none !important;
}


/* ============================================================
   MEGOLDÁS LÁTHATÓSÁG — 3 gombos csoport (mint a vágólap)
   ============================================================ */

.megoldas-visibility-group {
  display: inline-flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 2px;
  align-items: center;
}

.megoldas-vis-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
  min-width: 24px;
  text-align: center;
}

.megoldas-vis-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.megoldas-vis-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.megoldas-vis-btn:active {
  transform: scale(0.95);
}


/* ============================================================
   MEGOLDÁS LÁTHATÓSÁG POPUP (mint a vágólap)
   ============================================================ */

.megoldas-visibility-popup {
  position: fixed;
  z-index: 100000;
  display: none;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  padding: 12px 14px;
  min-width: 340px;
  max-width: 420px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.88rem;
}

.megoldas-visibility-popup.show {
  display: block;
}

.megoldas-popup-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.megoldas-popup-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  padding: 0 4px;
  line-height: 1;
}

.megoldas-popup-close:hover {
  color: #dc2626;
}

.megoldas-popup-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.megoldas-popup-label {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
}

.megoldas-popup-options {
  display: flex;
  gap: 4px;
}

.megoldas-popup-options button {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: #475569;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.megoldas-popup-options button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.megoldas-popup-options button.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  box-shadow: 0 0 0 1px #3b82f6 inset;
}

.megoldas-popup-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  line-height: 1.4;
}


/* ============================================================
   BLOKK HÁTTÉRÁRNYALATOK — megerősített (!important)
   ============================================================ */

.block[data-origin="teacher"]:not(.megoldas-block) {
  background-color: #eff6ff !important;
  border-left: 3px solid #3b82f6 !important;
}

.block.megoldas-block {
  background-color: #fefce8 !important;
  border-left: 3px solid #eab308 !important;
}

.block[data-origin="student"] {
  background-color: #ffffff !important;
}

/* A blokk-toolbar háttere ne takarja el a színt */
.block[data-origin="teacher"] > .block-toolbar,
.block.megoldas-block > .block-toolbar {
  background-color: rgba(255, 255, 255, 0.6) !important;
}

/* A hint mező háttere is maradjon semleges */
.block[data-origin="teacher"] .hint-field-wrap,
.block.megoldas-block .hint-field-wrap {
  background-color: rgba(255, 255, 255, 0.8) !important;
}


/* ============================================================
   UTASÍTÁS BLOKK — pontosan úgy, mint a szövegblokk
   ============================================================ */

.instruction-block {
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  padding: 12px !important;
  background: #fefce8 !important;
  border-left: 3px solid #eab308 !important;
  border-radius: 8px !important;
  margin: 8px 0 !important;
}

.instruction-block .block-toolbar {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  margin-bottom: 8px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  width: 100% !important;
}

.instruction-block textarea.instruction-text {
  width: 100% !important;
  min-height: 80px !important;
  padding: 10px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  font-family: Consolas, "Courier New", monospace !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
  resize: vertical !important;
  margin-top: 0 !important;
  box-sizing: border-box !important;
}

.instruction-block .markdown-preview {
  width: 100% !important;
  min-height: 80px !important;
  padding: 10px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  margin-top: 0 !important;
  box-sizing: border-box !important;
}

/* A diáknál: nincs toolbar, a textarea readonly */
body:not(.teacher-mode) .instruction-block .block-toolbar {
  display: none !important;
}

body:not(.teacher-mode) .instruction-block textarea.instruction-text {
  background: #fefce8 !important;
  border-color: #eab308 !important;
  cursor: default !important;
}


/* ============================================================
   UTASÍTÁS BLOKK — címke (block-handle) javítása
   ============================================================ */

.instruction-block .block-toolbar {
  /* A toolbar egy sorban legyen, ne tördeljen */
  flex-wrap: nowrap !important;
  align-items: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding-bottom: 4px !important;
}

.instruction-block .block-handle {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  margin-right: 8px !important;
  position: static !important;
  max-width: 200px !important;
}

.instruction-block .block-handle .handle-label-input {
  max-width: 140px !important;
  font-size: 0.85rem !important;
  padding: 4px 8px !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #64748b !important;
  font-weight: 600 !important;
}

.instruction-block .block-handle .handle-label-input:hover,
.instruction-block .block-handle .handle-label-input:focus {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
}

.instruction-block .block-handle .handle-icon {
  color: #94a3b8 !important;
  font-size: 1rem !important;
  cursor: grab !important;
}

.instruction-block .block-handle .handle-icon:active {
  cursor: grabbing !important;
}

/* A gombok ne tördeljenek, de a toolbar görgethető legyen */
.instruction-block .block-toolbar > button {
  flex-shrink: 0 !important;
}

/* A textarea alatt ne legyen extra tér */
.instruction-block textarea.instruction-text {
  margin-top: 0 !important;
}
/* modosit_708.py: elonezet modban a szerkeszto ne latszodjon. */
.instruction-block.is-preview textarea.instruction-text {
  display: none !important;
}
.instruction-block.is-preview .markdown-preview {
  display: block !important;
}

/* A diáknál: nincs toolbar, a textarea readonly */
body:not(.teacher-mode) .instruction-block .block-toolbar {
  display: none !important;
}


/* ============================================================
   BLOCK-HANDLE (címke) — inline-flex, a toolbar bal szélén
   ============================================================ */

.block-toolbar > .block-handle,
.block-toolbar > span.block-handle {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  margin: 0 8px 0 0 !important;
  padding: 0 !important;
  position: static !important;
  float: none !important;
  height: auto !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

.block-toolbar > .block-handle .handle-icon,
.block-toolbar > span.block-handle .handle-icon {
  color: #94a3b8 !important;
  font-size: 1rem !important;
  cursor: grab !important;
  line-height: 1 !important;
  display: inline-block !important;
}

.block-toolbar > .block-handle .handle-label-input,
.block-toolbar > span.block-handle .handle-label-input {
  max-width: 160px !important;
  font-size: 0.85rem !important;
  padding: 4px 8px !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #64748b !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  height: auto !important;
  margin: 0 !important;
  display: inline-block !important;
}

.block-toolbar > .block-handle .handle-label-input:hover,
.block-toolbar > .block-handle .handle-label-input:focus,
.block-toolbar > span.block-handle .handle-label-input:hover,
.block-toolbar > span.block-handle .handle-label-input:focus {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  outline: none !important;
}

.block-toolbar > .block-handle .handle-label,
.block-toolbar > span.block-handle .handle-label {
  font-size: 0.85rem !important;
  color: #64748b !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

/* A toolbar-t ne tördelje a handle miatt */
.instruction-block .block-toolbar {
  flex-wrap: nowrap !important;
  align-items: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding-bottom: 4px !important;
}


/* ============================================================
   HANDLE-LABEL-INPUT — width: auto, ne 160px
   ============================================================ */

.block-toolbar .block-handle .handle-label-input,
.block-toolbar > .block-handle .handle-label-input,
.block-toolbar > span.block-handle .handle-label-input {
  width: auto !important;
  min-width: 60px !important;
  max-width: 120px !important;
  flex: 0 1 auto !important;
  box-sizing: border-box !important;
}

/* A block-handle ne legyen 174px szeles */
.block-toolbar .block-handle,
.block-toolbar > .block-handle,
.block-toolbar > span.block-handle {
  flex: 0 0 auto !important;
  max-width: 140px !important;
  width: auto !important;
  overflow: hidden !important;
}


/* ============================================================
   UTASÍTÁS BLOKK — block-handle (ne legyen absolute)
   ============================================================ */

.instruction-block .block-handle,
.block.instruction-block .block-handle {
  position: static !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  z-index: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 8px 0 0 !important;
  padding: 2px 4px !important;
  max-width: 200px !important;
  min-width: 0 !important;
  flex-shrink: 0 !important;
  background: transparent !important;
  border-radius: 4px !important;
  cursor: grab !important;
  user-select: none !important;
}


/* ============================================================
   UTASÍTÁS BLOKK — toolbar balra igazítás, címke bal szélen
   ============================================================ */

.instruction-block .block-toolbar,
.block.instruction-block .block-toolbar {
  justify-content: flex-start !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
}

/* A címke kitolja a gombokat jobbra */
.instruction-block .block-handle,
.block.instruction-block .block-handle {
  margin-right: auto !important;
  margin-left: 0 !important;
  flex-shrink: 0 !important;
}

/* A gombok egymás mellett, jobbra */
.instruction-block .block-toolbar > button,
.block.instruction-block .block-toolbar > button {
  flex-shrink: 0 !important;
}


/* ============================================================
   UTASÍTÁS BLOKK — okkersárga szín (korábbi)
   ============================================================ */

.instruction-block {
  background: #fef3c7 !important;
  border-left: 3px solid #f59e0b !important;
}

.instruction-block textarea.instruction-text {
  background: #ffffff !important;
  border: 1px solid #fcd34d !important;
}

.instruction-block textarea.instruction-text:focus {
  border-color: #f59e0b !important;
  outline: 2px solid rgba(245, 158, 11, 0.25) !important;
}

.instruction-block .markdown-preview {
  background: #ffffff !important;
  border: 1px solid #fcd34d !important;
}

/* A diáknál: a textarea readonly, de az okkersárga háttér marad */
body:not(.teacher-mode) .instruction-block textarea.instruction-text {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
}


/* ============================================================
   UTASÍTÁS BLOKK — okkersárga szín (erősebb, felülírja a kéket)
   ============================================================ */

.block.instruction-block,
.block.instruction-block[data-origin="teacher"],
.block.instruction-block[data-origin="student"] {
  background: #fef3c7 !important;
  border-left: 3px solid #f59e0b !important;
}

/* A toolbar háttere is okkersárga legyen */
.block.instruction-block > .block-toolbar {
  background: transparent !important;
}

/* A textarea fehér, sárga szegéllyel */
.block.instruction-block textarea.instruction-text {
  background: #ffffff !important;
  border: 1px solid #fcd34d !important;
}

.block.instruction-block textarea.instruction-text:focus {
  border-color: #f59e0b !important;
  outline: 2px solid rgba(245, 158, 11, 0.25) !important;
}

.block.instruction-block .markdown-preview {
  background: #ffffff !important;
  border: 1px solid #fcd34d !important;
}

/* A diáknál: a textarea readonly, de az okkersárga háttér marad */
body:not(.teacher-mode) .block.instruction-block textarea.instruction-text {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
}


/* ============================================================
   ÖSSZES BLOKK — toolbar balra igazítás, címke bal szélen
   ============================================================ */

/* Minden blokk toolbar-ja balra igazítva */
.block .block-toolbar {
  justify-content: flex-start !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
}

/* A címke kitolja a gombokat jobbra */
.block .block-toolbar > .block-handle,
.block .block-toolbar > span.block-handle {
  margin-right: auto !important;
  margin-left: 0 !important;
  flex-shrink: 0 !important;
}

/* A gombok egymás mellett, jobbra */
.block .block-toolbar > button {
  flex-shrink: 0 !important;
}


/* ============================================================
   PUBLISH MODAL — szürke csoportok (végleges)
   ============================================================ */

/* A szürke doboz */
#publishModal .publish-section {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
  display: block !important;
}

/* A doboz címe */
#publishModal .publish-section-title {
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  margin-bottom: 10px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* A dobozon belüli checkboxok */
#publishModal .publish-section .modal-checkbox {
  margin-bottom: 8px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

#publishModal .publish-section .modal-checkbox:last-child {
  margin-bottom: 0 !important;
}

/* A dobozon belüli aktivitás opciók */
#publishModal .publish-section .modal-activity-option {
  margin-top: 8px !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* A vágólap rádiógombok */
#publishModal .publish-section .publish-clipboard-row {
  display: flex !important;
  gap: 16px !important;
  margin-bottom: 8px !important;
  flex-wrap: wrap !important;
}

#publishModal .publish-section .publish-clipboard-options {
  display: flex !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
}

/* A névlista fájlválasztó */
#publishModal .publish-section .field-label {
  margin-top: 6px !important;
}

#publishModal .publish-section input[type=file],
#publishModal .publish-section input[type=text] {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* A sablon kártyák */
#publishModal .publish-section .modal-templates {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}

@media (max-width: 520px) {
  #publishModal .publish-section .modal-templates {
    grid-template-columns: 1fr !important;
  }
}


/* ============================================================
   A tanári címke rugalmas (modosit_125.py)
   ============================================================
   A handle-label-input (a címke szerkesztőmező) rugalmas:
   kitölti a rendelkezésre álló helyet, és hosszabb szöveget
   is be lehet írni.
   ============================================================ */

.block-toolbar > .block-handle,
.block-toolbar > span.block-handle {
  flex: 1 1 auto !important;
  min-width: 80px !important;
  max-width: 100% !important;
}

.block-toolbar > .block-handle .handle-label-input,
.block-toolbar > span.block-handle .handle-label-input,
.block-toolbar .block-handle .handle-label-input {
  flex: 1 1 auto !important;
  min-width: 80px !important;
  max-width: 300px !important;
  width: auto !important;
  box-sizing: border-box !important;
}


/* ============================================================
   A handle-label-input rugalmas (modosit_126.py)
   ============================================================
   A címke szerkesztőmező (handle-label-input) kitölti a
   rendelkezésre álló helyet, és hosszabb szöveget is be lehet
   írni. Az utasítás blokkra is ugyanez.
   ============================================================ */

/* A block-handle (a szülő) kitölti a toolbar bal oldalát. */
.block-toolbar > .block-handle,
.block-toolbar > span.block-handle {
  flex: 1 1 auto !important;
  min-width: 80px !important;
  max-width: 100% !important;
  width: auto !important;
}

/* A handle-label-input rugalmas. */
.block-toolbar > .block-handle .handle-label-input,
.block-toolbar > span.block-handle .handle-label-input,
.block-toolbar .block-handle .handle-label-input {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 60px !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Az utasítás blokk handle-label-input-ja is rugalmas. */
.instruction-block .block-toolbar > .block-handle,
.instruction-block .block-toolbar > span.block-handle {
  flex: 1 1 auto !important;
  min-width: 80px !important;
  max-width: 100% !important;
  width: auto !important;
}

.instruction-block .block-toolbar > .block-handle .handle-label-input,
.instruction-block .block-toolbar > span.block-handle .handle-label-input {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 60px !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}


/* ============================================================
   A lebegő mód block-toolbar háttere (modosit_160.py)
   ============================================================
   A block-toolbar háttere rgba(255, 255, 255, 0.6) (fehér,
   60% átlátszóság). A blokk háttere fehér, ezért a
   block-toolbar összeolvad a blokk hátterével.

   A lebegő módban a block-toolbar háttere legyen szürke,
   és legyen border-bottom, hogy látszódjon.
   ============================================================ */

.block.floating-mode > .block-toolbar {
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  padding: 4px 8px !important;
  min-height: 32px !important;
  cursor: grab !important;
}

.block.floating-mode > .block-toolbar:active {
  cursor: grabbing !important;
}

.block.floating-mode > .block-toolbar .block-handle {
  cursor: grab !important;
}


/* ============================================================
   A lebegő mód block-toolbar magassága (modosit_161.py)
   ============================================================
   A lebegő módban a block-toolbar magasabb, hogy könnyebb
   legyen megfogni. A handle nagyobb, a gombok között több
   hely.
   ============================================================ */

.block.floating-mode > .block-toolbar {
  min-height: 44px !important;
  padding: 8px 14px !important;
  gap: 10px !important;
  cursor: grab !important;
  align-items: center !important;
}

.block.floating-mode > .block-toolbar:active {
  cursor: grabbing !important;
}

/* A handle nagyobb, hogy könnyebb legyen megfogni. */
.block.floating-mode > .block-toolbar > .block-handle {
  min-width: 120px !important;
  min-height: 28px !important;
  padding: 4px 8px !important;
  cursor: grab !important;
}

.block.floating-mode > .block-toolbar > .block-handle:active {
  cursor: grabbing !important;
}

/* A handle ikon nagyobb. */
.block.floating-mode > .block-toolbar > .block-handle .handle-icon {
  font-size: 1.3rem !important;
  line-height: 1 !important;
}

/* A gombok között több hely. */
.block.floating-mode > .block-toolbar > button {
  min-height: 28px !important;
}


/* ============================================================
   A lebegő mód block-toolbar (modosit_162.py)
   ============================================================
   Tanárnál: 44px magas, cursor: grab.
   Diáknál: 32px magas, cursor: grab.
   A block-toolbar gyermekeire is cursor: grab (kivéve gombok).
   ============================================================ */

/* Tanárnál: 44px magas. */
body.teacher-mode .block.floating-mode > .block-toolbar {
  min-height: 44px !important;
  padding: 8px 14px !important;
  gap: 10px !important;
  cursor: grab !important;
  align-items: center !important;
}

/* Diáknál: 32px magas. */
body:not(.teacher-mode) .block.floating-mode > .block-toolbar {
  min-height: 32px !important;
  padding: 4px 10px !important;
  gap: 6px !important;
  cursor: grab !important;
  align-items: center !important;
}

.block.floating-mode > .block-toolbar:active {
  cursor: grabbing !important;
}

/* A block-toolbar gyermekeire is cursor: grab (kivéve gombok). */
body.teacher-mode .block.floating-mode > .block-toolbar > .block-handle,
body:not(.teacher-mode) .block.floating-mode > .block-toolbar > .block-handle,
body.teacher-mode .block.floating-mode > .block-toolbar > span,
body:not(.teacher-mode) .block.floating-mode > .block-toolbar > span {
  cursor: grab !important;
}

/* A gombokra ne legyen grab. */
.block.floating-mode > .block-toolbar > button,
.block.floating-mode > .block-toolbar > button * {
  cursor: pointer !important;
}

/* A tanárnál a handle nagyobb. */
body.teacher-mode .block.floating-mode > .block-toolbar > .block-handle {
  min-width: 120px !important;
  min-height: 28px !important;
  padding: 4px 8px !important;
  cursor: grab !important;
}

body.teacher-mode .block.floating-mode > .block-toolbar > .block-handle .handle-icon {
  font-size: 1.3rem !important;
  line-height: 1 !important;
}

body.teacher-mode .block.floating-mode > .block-toolbar > button {
  min-height: 28px !important;
}

/* A diáknál a handle kisebb. */
body:not(.teacher-mode) .block.floating-mode > .block-toolbar > .block-handle {
  min-height: 24px !important;
  padding: 2px 6px !important;
  cursor: grab !important;
}

body:not(.teacher-mode) .block.floating-mode > .block-toolbar > button {
  min-height: 24px !important;
}


/* ============================================================
   Szöveg beállítások popup — ÖSSZEVONVA (blokk-beállítások)
   ============================================================
   A korábbi, külön ⚙️ szövegbeállítások popup helyét a
   #blockSettingsPopup vette át (lásd text.css: .block-settings-popup),
   ami a vágólap-beállításokat ÉS a diák szerkesztési módját is
   tartalmazza.

   A régi .text-settings-popup / .text-settings-backdrop szabályok
   AZÉRT maradnak meg, mert a KORÁBBAN KIADOTT diáklapok HTML-je
   még tartalmazza ezt a markúpot. Ha törölnénk a display:none-t,
   azokban a fájlokban a popup tartalma láthatóvá válna.
   ============================================================ */

.text-settings-popup {
  position: fixed;
  z-index: 9999;
  display: none;
  min-width: 300px;
  max-width: 360px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.18);
  padding: 14px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  color: #1e293b;
}

.text-settings-popup.show {
  display: block;
}

.text-settings-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.text-settings-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.text-settings-close:hover {
  background: #f1f5f9;
  color: #dc2626;
}

.text-settings-row {
  margin-bottom: 12px;
}

.text-settings-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}

.text-settings-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.text-settings-options button {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  color: #1e293b;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.text-settings-options button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.text-settings-options button.active {
  background: #eef2ff;
  border-color: #4f46e5;
  color: #4f46e5;
  font-weight: 700;
}

.text-settings-hint {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}


/* ============================================================
   Szöveg beállítások backdrop (modosit_166.py) — régi markúp
   ============================================================
   A textSettingsPopup mögötti sötét háttér, ami blokkolja a
   kattintásokat, amíg a popup nyitva van. A popup z-indexe
   (9999) fölötte van a backdrop-énak (9998).

   Az összevont #blockSettingsPopup NEM használ backdropot, de a
   régi diáklapok miatt ez a szabály megmarad.
   ============================================================ */

.text-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.35);
  display: none;
}

.text-settings-backdrop.show {
  display: block;
}


/* ============================================================
   modosit_199.py: a block-toolbar a lab-overlay fölött legyen
   ============================================================
   A .lab-overlay position: absolute; inset: 0; z-index: 20; miatt
   a teljes blokkot lefedi. A .block > .block-toolbar position:
   relative; z-index: 21; miatt a toolbar a lab-overlay fölött
   van, így kattintható marad.
   ============================================================ */
.block > .block-toolbar {
  position: relative;
  z-index: 21;
}


/* ============================================================
   Beágyazott HTML blokk (modosit_215.py)
   ============================================================ */

.html-embed-block .html-embed-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.85rem;
  color: #64748b;
}

.html-embed-block .html-embed-info-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.html-embed-block .html-embed-frame-wrap {
  position: relative;
  width: 100%;
  min-height: 200px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
}

.html-embed-block .html-embed-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.html-embed-block .html-embed-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: #94a3b8;
  font-style: italic;
  padding: 20px;
  text-align: center;
}

.html-embed-block .html-embed-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  cursor: ns-resize;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.05));
  z-index: 2;
}

.html-embed-input-modal textarea {
  width: 100%;
  box-sizing: border-box;
}

.html-embed-hint-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #0c4a6e;
  line-height: 1.55;
}


/* ============================================================
   modosit_499.py — A képminőség-választó (#presetRow) és a
   tároló-méret kijelzés (#storageInfo) láthatóságának biztosítása.
   ============================================================
   A .save-bar overflow: visible, hogy a benne lévő #presetRow
   ne legyen levágva. A #presetRow display: inline-flex !important,
   hogy semmilyen korábbi display: none !important ne nyerjen.
   A #storageInfo-ra NEM teszünk display szabályt, mert a
   persistence.js updateStorageInfo() kezeli inline !important-tal.
   ============================================================ */
.save-bar {
  overflow: visible !important;
}
.save-bar #presetRow {
  display: inline-flex !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  position: relative !important;
  z-index: 1 !important;
}
.save-bar #storageInfo {
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  position: relative !important;
  z-index: 1 !important;
}

/* ============================================================
   modosit_659.py: beadás után a diáknál minden gomb el van rejtve,
   kivéve a "Megnyitás" gombot (#btnOpenFolder).
   ============================================================
   A beadás után a body.locked osztály aktív (applyLockedMode).
   A tanárnál is lehet body.locked, ezért a CSS csak a diáknál
   érvényesül: body.locked:not(.teacher-mode).
   A #btnLoadLastWork ("Korábbi munkám") is el van rejtve, mert
   a beadás után a szerver törli a korábbi mentéseket
   (modosit_658), tehát nincs mit visszatölteni.
   A #btnOpenFolder ("Megnyitás") NINCS a listában, tehát látszik.
   ============================================================ */
body.locked:not(.teacher-mode) #btnNewDoc,
body.locked:not(.teacher-mode) #btnClearWork,
body.locked:not(.teacher-mode) #btnSaveToFolder,
body.locked:not(.teacher-mode) #btnSaveToFile,
body.locked:not(.teacher-mode) #btnLoadLastWork,
body.locked:not(.teacher-mode) #btnExport,
body.locked:not(.teacher-mode) #presetRow,
body.locked:not(.teacher-mode) #btnAddStep,
body.locked:not(.teacher-mode) #btnToggleAllSteps,
body.locked:not(.teacher-mode) #btnToggleAllStepsHeader,
body.locked:not(.teacher-mode) #btnCertify,
body.locked:not(.teacher-mode) #btnPublish,
body.locked:not(.teacher-mode) #sideToggleGroup,
body.locked:not(.teacher-mode) #activityIndicator,
body.locked:not(.teacher-mode) #footerActions .btn.lock,
body.locked:not(.teacher-mode) #footerActions .btn.secondary,
body.locked:not(.teacher-mode) #footerActions .btn.primary,
body.locked:not(.teacher-mode) #footerActions .btn.warn,
body.locked:not(.teacher-mode) #footerActions .btn.publish,
body.locked:not(.teacher-mode) #footerActions .btn.success {
  display: none !important;
}

/* ============================================================
   modosit_664.py: a már beadott feladat banner stílusa.
   ============================================================ */
.already-submitted-banner {
  display: none;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
  color: #78350f;
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 600;
}
body.locked .already-submitted-banner {
  display: block !important;
}

/* ============================================================
   modosit_665.py: beadás után a teszt (quiz) és kitöltő (fill)
   blokkok ne legyenek tovább írhatók.
   ============================================================
   A gombokat a modosit_659.py CSS-e és a modosit_564.py
   applyLockedMode() már elrejti/letiltja. A válaszlehetőségeket
   (checkboxok) és a kitöltő beviteli mezőket (fill-input) a
   modosit_665.py applyLockedMode() tiltja le, és ez a CSS
   biztosítja, hogy semmilyen interakció ne legyen rajtuk.
   ============================================================ */
body.locked .quiz-block .quiz-answer {
  pointer-events: none !important;
  cursor: default !important;
}
body.locked .quiz-block input[type="checkbox"] {
  pointer-events: none !important;
}
body.locked .fill-block .fill-input {
  pointer-events: none !important;
  cursor: default !important;
  background: #f1f5f9 !important;
  border-bottom-color: #cbd5e1 !important;
}
body.locked .fill-block .fill-input:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* modosit_755: zarolt labor sraffozott piros */
.block.container-lab-block.container-lab-block-locked {
  background: repeating-linear-gradient(
    -45deg,
    #fef2f2,
    #fef2f2 8px,
    #fecaca 8px,
    #fecaca 16px
  ) !important;
  border-color: #fca5a5 !important;
  border-left: 4px solid #dc2626 !important;
}
.block.container-lab-block.container-lab-block-locked .container-lab-body,
.block.container-lab-block.container-lab-block-locked .cl-container-row,
.block.container-lab-block.container-lab-block-locked .cl-network-row,
.block.container-lab-block.container-lab-block-locked .cl-section,
.block.container-lab-block.container-lab-block-locked .cl-info-box,
.block.container-lab-block.container-lab-block-locked .cl-topology-inline,
.block.container-lab-block.container-lab-block-locked .topo-net-selector,
.block.container-lab-block.container-lab-block-locked .cl-collapsible,
.block.container-lab-block.container-lab-block-locked .cl-collapsible-body {
  background: repeating-linear-gradient(
    -45deg,
    #fff5f5,
    #fff5f5 8px,
    #fee2e2 8px,
    #fee2e2 16px
  ) !important;
  border-color: #fca5a5 !important;
}
