:root {
    --ed-bg: #eceef2;          /* work area, like a canvas */
    --ed-side-bg: #f5f6f8;
    --ed-panel: #ffffff;
    --ed-ink: #18202b;
    --ed-muted: #5b6575;
    --ed-line: #e3e6eb;
    --ed-line-strong: #cfd4dc;
    --ed-soft: #f2f4f7;
    --ed-accent: #1570ef;
    --ed-accent-ink: #1059c9;
    --ed-accent-soft: #e7effd;
    --ed-ok: #1d7a46;
    --ed-ok-soft: #e6f4ec;
    --ed-warn: #8a5a00;
    --ed-warn-soft: #fff4d6;
    --ed-err: #c4320a;
    --ed-err-soft: #fdecea;
    --ed-radius: 10px;
    --ed-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
    --ed-shadow-lg: 0 4px 12px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.06);
    --ed-top-h: 60px;
    --ed-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--ed-font); font-size: 14px; line-height: 1.45; color: var(--ed-ink); background: var(--ed-bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--ed-soft); padding: 1px 5px; border-radius: 4px; }

.ed-skip { position: absolute; left: -9999px; }
.ed-skip:focus { left: 12px; top: 8px; z-index: 50; background: #fff; padding: 6px 10px; border-radius: 6px; }

/* Top bar */
.ed-top { position: sticky; top: 0; z-index: 20; height: var(--ed-top-h); display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--ed-panel); border-bottom: 1px solid var(--ed-line); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.ed-brand { display: flex; align-items: center; gap: 10px; flex: none; }
.ed-logo { display: block; border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.15); }
.ed-brand-name { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.015em; }
.ed-doc { min-width: 0; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ed-ink); padding-left: 14px; border-left: 1px solid var(--ed-line); }
.ed-doc:empty { display: none; }
.ed-menubar { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.ed-status { margin-left: auto; font-size: 0.82rem; color: var(--ed-muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ed-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3cc47c; }
@media (max-width: 900px) {
    .ed-top { height: auto; flex-wrap: wrap; padding: 10px 12px; }
    .ed-doc { display: none; }
    .ed-menubar { margin-left: 0; flex-wrap: wrap; order: 3; width: 100%; }
}

/* Shell */
.ed-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - var(--ed-top-h)); }
.ed-side { position: sticky; top: var(--ed-top-h); height: calc(100vh - var(--ed-top-h)); display: flex; flex-direction: column; background: var(--ed-side-bg); border-right: 1px solid var(--ed-line); }
.ed-main { padding: 24px 28px 64px; outline: none; min-width: 0; }
@media (max-width: 860px) {
    .ed-shell { grid-template-columns: 1fr; }
    .ed-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--ed-line); }
    .ed-main { padding: 16px; }
}

/* Sidebar panes: quizzes on top, banks below */
.ed-pane { display: flex; flex-direction: column; min-height: 0; }
.ed-pane.is-quizzes { flex: 0 1 auto; max-height: 45%; }
.ed-pane.is-banks { flex: 1 1 auto; border-top: 1px solid var(--ed-line-strong); box-shadow: inset 0 1px 0 #fff; }
.ed-pane-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 16px; }
.ed-pane-head h2 { margin: 0; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ed-muted); }
.ed-pane-count { font-size: 0.72rem; font-weight: 600; color: var(--ed-muted); background: #e7e9ee; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.ed-pane-body { overflow-y: auto; padding: 0 8px 12px; min-height: 0; }
.ed-icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--ed-ink); cursor: pointer; }
.ed-icon-btn:hover { background: #e7e9ee; }
.ed-icon-btn:focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 1px; }
.ed-side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ed-side-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--ed-ink); }
.ed-side-item:hover { background: #eaecf0; }
.ed-side-item.is-active { background: var(--ed-accent-soft); color: var(--ed-accent-ink); }
.ed-side-line { display: flex; align-items: center; gap: 6px; }
.ed-side-title { flex: 1 1 auto; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-side-item.is-active .ed-side-title { font-weight: 600; }
.ed-side-count { flex: none; font-size: 0.8rem; color: var(--ed-muted); font-variant-numeric: tabular-nums; }
.ed-side-meta { display: block; font-size: 0.76rem; color: var(--ed-muted); margin-top: 1px; }
.ed-side-empty { color: var(--ed-muted); font-size: 0.85rem; padding: 0 8px; margin: 4px 0; }
.ed-in-quiz { flex: none; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; padding: 1px 7px; border-radius: 999px; background: var(--ed-accent); color: #fff; }

/* Buttons */
.ed-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--ed-line-strong); border-radius: 8px; background: var(--ed-panel); color: var(--ed-ink); cursor: pointer; font-weight: 500; white-space: nowrap; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.ed-btn:hover:not(:disabled) { background: var(--ed-soft); }
.ed-btn:focus-visible, .ed-input:focus-visible, .rte-area:focus-visible, .ed-side-item:focus-visible, .ed-qitem:focus-visible, .ed-tab:focus-visible, .ed-chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--ed-accent) 35%, transparent); outline-offset: 1px; }
.ed-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ed-btn.is-primary { background: var(--ed-accent); border-color: var(--ed-accent); color: #fff; }
.ed-btn.is-primary:hover:not(:disabled) { background: var(--ed-accent-ink); border-color: var(--ed-accent-ink); }
.ed-btn.is-danger { background: var(--ed-err); border-color: var(--ed-err); color: #fff; }
.ed-btn.is-danger-text { color: var(--ed-err); }
.ed-btn.is-small { height: 30px; padding: 0 10px; font-size: 0.84rem; }
.ed-btn.is-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.ed-btn.is-ghost:hover:not(:disabled) { background: var(--ed-soft); }

/* Inputs */
.ed-field { margin: 0 0 14px; min-width: 0; }
.ed-label { display: block; font-weight: 600; font-size: 0.84rem; margin-bottom: 5px; color: #2a3341; }
.ed-help { color: var(--ed-muted); font-size: 0.82rem; margin: 5px 0 0; }
.ed-input { width: 100%; padding: 7px 10px; border: 1px solid var(--ed-line-strong); border-radius: 8px; background: #fff; min-height: 36px; }
.ed-input:focus { border-color: var(--ed-accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ed-accent) 18%, transparent); }
select.ed-input { width: auto; max-width: 100%; }
.ed-num { width: 110px; }
.ed-title-input { font-size: 1.4rem; font-weight: 700; border-color: transparent; background: transparent; padding: 4px 8px; margin-left: -8px; }
.ed-title-input:hover { border-color: var(--ed-line); }
.ed-title-input:focus { background: #fff; border-color: var(--ed-line-strong); box-shadow: none; }
.ed-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.ed-toggle input { width: 18px; height: 18px; accent-color: var(--ed-accent); }
.ed-toggle + .ed-help { margin-left: 26px; }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.ed-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 18px; }
.ed-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 18px; align-items: start; }
.ed-badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--ed-soft); color: var(--ed-muted); }
.ed-tags { font-size: 0.75rem; color: var(--ed-muted); }
.ed-kicker { margin: 0; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ed-muted); }
.ed-meta { margin: 4px 0 0; color: var(--ed-muted); font-size: 0.85rem; }
.ed-list { margin: 0; padding-left: 1.2em; }
.ed-list li + li { margin-top: 6px; }

/* Rich text */
.rte { border: 1px solid var(--ed-line-strong); border-radius: 8px; background: #fff; }
.rte:focus-within { border-color: var(--ed-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ed-accent) 18%, transparent); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--ed-line); background: #f9fafb; border-radius: 8px 8px 0 0; }
.rte-btn { border: 0; background: none; padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; color: var(--ed-muted); cursor: pointer; min-width: 30px; }
.rte-btn:hover { background: var(--ed-soft); color: var(--ed-ink); }
.rte-area { min-height: 72px; padding: 8px 10px; outline: none; overflow-wrap: anywhere; }
.rte-area p { margin: 0 0 0.5em; }
.rte-area p:last-child { margin-bottom: 0; }
.rte-area img { max-width: 100%; max-height: 240px; height: auto; border-radius: 4px; }
.rte-single .rte-area { min-height: 0; padding: 6px 9px; }
.rte-area.is-empty::before { content: attr(data-placeholder); color: #98a1ab; pointer-events: none; position: absolute; }

/* Page head */
.ed-view { max-width: 1180px; }
.ed-pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.ed-pagehead-main { flex: 1 1 360px; min-width: 0; }
.ed-pagehead-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Home */
.ed-home { max-width: 680px; }
.ed-home h1 { font-size: 2rem; margin: 8px 0 8px; outline: none; }
.ed-lede { font-size: 1.05rem; color: var(--ed-muted); }
.ed-steps { padding-left: 1.3em; }
.ed-steps li + li { margin-top: 6px; }
.ed-note { margin-top: 24px; padding: 12px 16px; border-radius: var(--ed-radius); background: var(--ed-panel); border: 1px solid var(--ed-line); color: var(--ed-muted); font-size: 0.9rem;  box-shadow: var(--ed-shadow);}
.ed-note p { margin: 0; }

/* Bank */
.ed-bank { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .ed-bank { grid-template-columns: 1fr; } }
.ed-qlist-pane { background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: var(--ed-radius); padding: 12px; position: sticky; top: calc(var(--ed-top-h) + 16px); max-height: calc(100vh - var(--ed-top-h) - 40px); display: flex; flex-direction: column;  box-shadow: var(--ed-shadow);}
@media (max-width: 1100px) { .ed-qlist-pane { position: static; max-height: 360px; } }
.ed-qlist-head h2 { font-size: 0.9rem; margin: 0 0 8px; }
.ed-qlist-items { overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.ed-qlist { list-style: none; margin: 0; padding: 0; }
.ed-qitem { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: inherit; }
.ed-qitem:hover { background: var(--ed-soft); }
.ed-qitem.is-active { background: var(--ed-accent-soft); color: var(--ed-accent-ink); }
.ed-qitem-num { flex: none; width: 22px; color: var(--ed-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; padding-top: 1px; }
.ed-qitem-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ed-qitem-text { font-size: 0.9rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ed-qitem-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-qlist-add { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--ed-line); margin-top: 8px; }

.ed-qedit { background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: var(--ed-radius); padding: 20px 22px; min-width: 0;  box-shadow: var(--ed-shadow);}
.ed-qform-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.ed-qform-head h2 { font-size: 1rem; margin: 0; }
.ed-qform-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-empty { text-align: center; padding: 32px 16px; color: var(--ed-muted); }
.ed-empty .ed-actions { justify-content: center; }

.ed-seg { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ed-seg legend { padding: 0; margin-bottom: 5px; }
.ed-seg-opt { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--ed-line-strong); border-radius: 8px; cursor: pointer; background: #fff; }
.ed-seg-opt:has(input:checked) { border-color: var(--ed-accent); background: var(--ed-accent-soft); color: var(--ed-accent-ink); font-weight: 600; }
.ed-seg-opt input { accent-color: var(--ed-accent); }

.ed-choices { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-choice { border: 1px solid var(--ed-line); border-radius: 6px; padding: 8px; background: #fcfcfd; }
.ed-choice.is-correct { border-color: var(--ed-ok); background: var(--ed-ok-soft); }
.ed-choice-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
@media (max-width: 720px) { .ed-choice-main { grid-template-columns: auto minmax(0, 1fr); } .ed-choice-tools { grid-column: 1 / -1; } }
.ed-choice-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; padding-left: 52px; font-size: 0.85rem; }
.ed-inline-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ed-muted); }
.ed-choice-sub select.ed-input { min-height: 30px; padding: 3px 8px; font-size: 0.85rem; }
.ed-correct { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ed-correct input { width: 18px; height: 18px; accent-color: var(--ed-ok); }
.ed-letter { font-weight: 700; color: var(--ed-muted); width: 1.1em; }
.ed-choice-text .rte { background: #fff; }
.ed-choice-tools { display: flex; gap: 2px; }
.ed-choice-fb { margin-top: 8px; padding-left: 52px; }
.ed-choice-fb .ed-field { margin: 0; }

.ed-hints:empty { display: none; }
.ed-hints { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ed-hint { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 6px; background: var(--ed-warn-soft); border-left: 3px solid var(--ed-warn); font-size: 0.875rem; }
.ed-hint p { margin: 0; }

.ed-details { margin: 6px 0 14px; border: 1px solid var(--ed-line); border-radius: 6px; padding: 0 12px; background: #fcfcfd; }
.ed-details > summary { cursor: pointer; padding: 9px 0; font-weight: 600; font-size: 0.9rem; }
.ed-details[open] { padding-bottom: 4px; }
.ed-details[open] > summary { margin-bottom: 8px; }

/* Quiz */
.ed-chip { border: 0; border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.ed-chip.is-ok { background: var(--ed-ok-soft); color: var(--ed-ok); }
.ed-chip.is-warn { background: var(--ed-warn-soft); color: var(--ed-warn); }
.ed-chip.is-error { background: var(--ed-err-soft); color: var(--ed-err); }
.ed-problems { background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: var(--ed-radius); padding: 10px 16px; margin-bottom: 16px;  box-shadow: var(--ed-shadow);}
.ed-problems ul { margin: 0; padding-left: 1.2em; }
.ed-problems li { margin: 3px 0; }
.ed-problems .is-error, .ed-error { color: var(--ed-err); }
.ed-problems .is-warn { color: var(--ed-warn); }

.ed-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ed-line-strong); margin-bottom: 18px; }
.ed-tab { border: 0; background: none; padding: 9px 16px; font-weight: 600; color: var(--ed-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.ed-tab:hover { color: var(--ed-ink); }
.ed-tab.is-active { color: var(--ed-accent-ink); border-bottom-color: var(--ed-accent); }

.ed-settings, .ed-sections { max-width: 900px; }
.ed-group { background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: var(--ed-radius); padding: 14px 18px 4px; margin-bottom: 16px;  box-shadow: var(--ed-shadow);}
.ed-group h3 { margin: 0 0 12px; font-size: 1rem; }

.ed-section-card { background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: var(--ed-radius); padding: 14px 18px 8px; margin-bottom: 16px;  box-shadow: var(--ed-shadow);}
.ed-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ed-subhead { margin: 6px 0 8px; font-size: 0.9rem; }
.ed-draws { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ed-draw { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 10px 12px; border-radius: 8px; background: var(--ed-soft); }
.ed-draw > .ed-field:nth-child(1) { flex: 1 1 170px; }
.ed-draw > .ed-field:nth-child(2) { flex: 0 0 auto; }
.ed-draw > .ed-field:nth-child(3) { flex: 1 1 140px; }
.ed-draw > .ed-btn { flex: none; }
.ed-draw .ed-field { margin: 0; }
.ed-draw .ed-field > select.ed-input { width: 100%; }
.ed-draw .ed-row { flex-wrap: nowrap; }
.ed-draw .ed-row select.ed-input { width: auto; flex: none; }
.ed-avail { margin: 0; white-space: nowrap; }
.ed-section-summary { font-weight: 600; color: var(--ed-ink); margin: 6px 0 12px; }

.ed-preview { max-width: 860px; }
.ed-preview-bar { margin-bottom: 12px; }
.ed-preview-frame { background: #fff; border: 1px solid var(--ed-line); border-radius: var(--ed-radius); padding: 24px; box-shadow: var(--ed-shadow-lg); }

/* Dialog, toasts, dropzone */
.ed-dialog { border: 0; border-radius: 12px; padding: 22px 24px 18px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 18px 50px rgba(15, 23, 32, 0.28); }
.ed-dialog::backdrop { background: rgba(20, 28, 38, 0.45); }
.ed-dialog-title { margin: 0 0 10px; font-size: 1.15rem; }
.ed-dialog-actions { display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.ed-dialog-preview { max-height: 70vh; overflow-y: auto; }
.ed-dialog:has(.ed-dialog-preview) { width: min(820px, calc(100vw - 32px)); }

.ed-toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.ed-toast { background: #1f2a37; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); max-width: 380px; transition: opacity 0.4s; }
.ed-toast.is-error { background: var(--ed-err); }
.ed-toast.is-out { opacity: 0; }

.ed-dropzone { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(21, 112, 239, 0.14); border: 4px dashed var(--ed-accent); pointer-events: none; }
.ed-dropzone p { background: #fff; padding: 14px 22px; border-radius: 10px; font-weight: 600; }
.ed-dropzone[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Fill in the blanks */
.ed-spacer { flex: 1; }
.ed-blank-tools { margin-bottom: 6px; }
.ed-blank-tools .ed-help { margin: 0; flex: 1 1 260px; }
.ed-blank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-blank { border: 1px solid var(--ed-line); border-radius: 6px; padding: 8px 12px 2px; background: #fcfcfd; }
.ed-blank-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.ed-blank-tag { font-weight: 700; font-size: 0.875rem; }
.ed-blank-head select.ed-input { min-height: 30px; padding: 3px 8px; font-size: 0.875rem; }
.ed-blank-body textarea.ed-input { resize: vertical; font-family: inherit; }
.ed-blank-body .ed-num { width: 120px; }

/* Sort the list */
.ed-help-top { margin: 0 0 8px; }
.ed-sort-items { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-sort-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--ed-line); border-radius: 6px; padding: 8px; background: #fcfcfd; }
.ed-sort-num { font-weight: 700; color: var(--ed-muted); text-align: center; }

/* Match and categorise */
.ed-pairs, .ed-extras, .ed-groups, .ed-cards { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-pair-head { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 170px; gap: 8px; font-size: 0.8rem; font-weight: 600; color: var(--ed-muted); margin-bottom: 4px; }
.ed-pair { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--ed-line); border-radius: 6px; padding: 8px; background: #fcfcfd; }
.ed-extra { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.ed-group-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--ed-line); border-radius: 6px; padding: 8px; background: #fcfcfd; }
.ed-card-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(150px, 220px) auto; gap: 8px; align-items: center; border: 1px solid var(--ed-line); border-radius: 6px; padding: 8px; background: #fcfcfd; }
.ed-card-row select.ed-input { width: 100%; }
@media (max-width: 760px) {
    .ed-pair, .ed-card-row { grid-template-columns: 28px minmax(0, 1fr); }
    .ed-pair > :nth-child(3), .ed-pair > .ed-choice-tools, .ed-card-row > select, .ed-card-row > .ed-btn { grid-column: 2; }
    .ed-pair-head { display: none; }
}

/* Range slider */
.ed-range-summary { margin: 0 0 16px; padding: 8px 12px; border-radius: 6px; background: var(--ed-soft); color: var(--ed-ink); font-weight: 500; }

/* Image hotspot editor */
.ed-hs-drop { border: 2px dashed var(--ed-line-strong); border-radius: var(--ed-radius); padding: 28px 16px; text-align: center; color: var(--ed-muted); background: var(--ed-soft); }
.ed-hs-drop.is-over { border-color: var(--ed-accent); background: var(--ed-accent-soft); }
.ed-hs-drop p { margin: 0 0 12px; }
.ed-hs-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ed-hs-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-hs-canvas { position: relative; width: fit-content; max-width: 100%; line-height: 0; border: 1px solid var(--ed-line); border-radius: 6px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.ed-hs-canvas[data-tool="select"] { cursor: default; }
.ed-hs-canvas:focus-visible { outline: 3px solid color-mix(in srgb, var(--ed-accent) 45%, transparent); outline-offset: 2px; }
.ed-hs-img { display: block; max-width: 100%; max-height: 70vh; height: auto; border-radius: 6px; -webkit-user-drag: none; }
.ed-hs-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ed-hs-layer { position: absolute; inset: 0; pointer-events: none; }
.ed-hs-shape { fill: color-mix(in srgb, var(--ed-ok) 22%, transparent); stroke: var(--ed-ok); stroke-width: 2; }
.ed-hs-shape.is-wrong { fill: color-mix(in srgb, var(--ed-err) 18%, transparent); stroke: var(--ed-err); stroke-dasharray: 5 3; }
.ed-hs-canvas[data-tool="select"] .ed-hs-shape { cursor: move; }
.ed-hs-shape.is-selected { stroke-width: 3; fill-opacity: 1; filter: drop-shadow(0 0 2px #fff); }
.ed-hs-shape.is-draft { fill: color-mix(in srgb, var(--ed-accent) 18%, transparent); stroke: var(--ed-accent); stroke-dasharray: 4 3; }
.ed-hs-num { position: absolute; transform: translate(-30%, -30%); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ed-ok); color: #fff; font: 700 12px/20px var(--ed-font); text-align: center; box-shadow: 0 0 0 2px #fff; }
.ed-hs-num.is-wrong { background: var(--ed-err); }
.ed-hs-handle { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #fff; border: 2px solid var(--ed-accent); border-radius: 3px; pointer-events: auto; cursor: pointer; }
.ed-hs-handle[data-kind="nw"], .ed-hs-handle[data-kind="se"] { cursor: nwse-resize; }
.ed-hs-handle[data-kind="ne"], .ed-hs-handle[data-kind="sw"] { cursor: nesw-resize; }
.ed-hs-handle[data-kind="pt"] { border-radius: 50%; cursor: move; }
.ed-hs-handle[data-kind="close"] { border-radius: 50%; background: var(--ed-accent); }
.ed-hs-status { margin-top: 6px; }
.ed-hs-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.ed-hs-row { display: grid; grid-template-columns: auto 5.5em minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--ed-line); border-radius: 6px; background: var(--ed-panel); }
.ed-hs-row.is-selected { border-color: var(--ed-accent); box-shadow: 0 0 0 2px var(--ed-accent-soft); }
.ed-hs-pick { min-width: 34px; justify-content: center; background: var(--ed-ok); border-color: var(--ed-ok); color: #fff; font-weight: 700; }
.ed-hs-pick:hover:not(:disabled) { background: color-mix(in srgb, var(--ed-ok) 85%, #000); }
.ed-hs-pick.is-wrong { background: var(--ed-err); border-color: var(--ed-err); }
.ed-hs-shape-name { color: var(--ed-muted); font-size: 0.85rem; }
@media (max-width: 640px) { .ed-hs-row { grid-template-columns: auto minmax(0, 1fr) auto; } .ed-hs-shape-name { display: none; } }

/* Equations */
.rte-math { display: inline-block; padding: 0 3px; margin: 0 1px; border-radius: 4px; background: var(--ed-accent-soft); outline: 1px dashed color-mix(in srgb, var(--ed-accent) 45%, transparent); cursor: pointer; user-select: none; -webkit-user-select: none; }
.rte-math.is-block { display: block; text-align: center; padding: 2px 4px; margin: 4px 0; }
.rte-math:hover, .rte-math:focus-visible { background: color-mix(in srgb, var(--ed-accent) 18%, var(--ed-panel)); outline: 2px solid var(--ed-accent); }
.rte-math math { pointer-events: none; }
.rte-msg { margin: 4px 0 0; font-size: 0.85rem; color: var(--ed-err); }
.rte-area.has-error { border-color: var(--ed-err); }
.ed-tex { display: grid; gap: 8px; min-width: 0; }
.ed-dialog:has(.ed-tex) { width: min(640px, calc(100vw - 32px)); }
.ed-tex-input { width: 100%; }
.ed-tex-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem; resize: vertical; }
.ed-tex-snips { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-tex-snips .ed-btn { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 3px 8px; border-color: var(--ed-line); }
.ed-tex-preview { min-height: 56px; padding: 12px; border: 1px solid var(--ed-line); border-radius: 6px; background: var(--ed-panel); font-size: 1.15rem; display: flex; align-items: center; justify-content: center; overflow-x: auto; }
.ed-tex-error { margin: 0; min-height: 1.2em; color: var(--ed-err); font-size: 0.9rem; }
.rte math, .ed-tex-preview math, .ed-qitem math { font-family: "Cambria Math", "STIX Two Math", "STIXTwoMath-Regular", "Latin Modern Math", "NotoSansMath-Regular", math; font-style: normal; font-size: 1.05em; }
.rte-has-mini { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.rte-has-mini > .rte-msg { grid-column: 1 / -1; padding: 0 9px 6px; }
.rte-mini { align-self: center; margin: 2px 3px; padding: 2px 7px; font-size: 0.75rem; opacity: 0.55; }
.rte:hover .rte-mini, .rte:focus-within .rte-mini, .rte-mini:focus-visible { opacity: 1; }
.rte-mini:focus-visible { outline: 2px solid var(--ed-accent); }

/* Export split button */
.ed-split { position: relative; display: inline-flex; }
.ed-split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ed-split-arrow { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255, 255, 255, 0.35); padding: 0 11px; }
.ed-caret { display: inline-block; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; }
.ed-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; width: min(360px, calc(100vw - 32px)); padding: 6px; background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 32, 0.18); display: grid; gap: 2px; }
.ed-menu[hidden] { display: none; }
.ed-menu-item { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; cursor: pointer; font: inherit; color: inherit; }
.ed-menu-item:hover, .ed-menu-item:focus-visible { background: var(--ed-accent-soft); outline: none; }
.ed-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ed-accent); }
.ed-menu-title { font-weight: 600; }
.ed-menu-desc { font-size: 0.85rem; color: var(--ed-muted); line-height: 1.35; }
.ed-scorm-opts { display: grid; gap: 4px; }
.ed-hint-inline { margin: 4px 0 8px 26px; padding: 8px 10px; border-radius: 6px; background: var(--ed-warn-soft); color: var(--ed-warn); font-size: 0.875rem; }
.ed-hint-inline[hidden] { display: none; }

/* Timer, appearance and languages settings */
.ed-time .ed-num { width: 80px; }
.ed-time span { color: var(--ed-muted); }
.ed-row-end { align-items: flex-end; }
.ed-row-end .ed-field { margin-bottom: 0; }
.ed-colour { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--ed-line-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.ed-colour:disabled { opacity: 0.4; cursor: default; }
.ed-langs { display: grid; gap: 12px; }
.ed-lang-list { display: grid; gap: 6px; }
.ed-lang-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--ed-line); border-radius: 8px; background: var(--ed-soft); }
.ed-lang-row .ed-help { margin: 0; }
.ed-lang-name { font-weight: 600; }

/* settings with a live mock-up on the right */
.ed-mock-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 460px); gap: 22px; align-items: start; }
.ed-mock { position: sticky; top: 12px; border: 1px dashed var(--ed-line-strong); border-radius: var(--ed-radius); background: #f4f5f7; padding: 10px 12px 2px; }
.ed-mock-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ed-mock-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ed-muted, #667085); }
.ed-mock-seg { margin: 0; }
.ed-mock-seg .ed-seg-opt { padding: 3px 9px; font-size: 0.8rem; }
.ed-mock-stage { padding: 20px 16px 18px; font-size: 0.9rem; pointer-events: none; user-select: none; }
.ed-mock-stage.qz { max-width: none; }
.ed-mock-stage .qz-card { margin: 0; }
.ed-grid-fixed2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
@media (max-width: 1100px) {
    .ed-mock-split { grid-template-columns: minmax(0, 1fr); }
    .ed-mock { position: static; }
}
@media (max-width: 560px) { .ed-grid-fixed2 { grid-template-columns: minmax(0, 1fr); } }

/* help balloons */
.ed-field.has-balloon { position: relative; }
.ed-label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.ed-label-row .ed-label { margin-bottom: 0; }
.ed-help-btn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ed-line-strong); background: #fff; color: var(--ed-accent); font: 700 0.75rem/1 inherit; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ed-help-btn:hover, .ed-help-btn[aria-expanded="true"] { background: var(--ed-accent-soft); border-color: var(--ed-accent); }
.ed-help-btn:focus-visible, .ed-balloon-close:focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 2px; }
.ed-balloon { position: absolute; z-index: 40; top: calc(100% - 4px); left: 0; width: 500px; max-width: calc(100vw - 48px); max-height: min(70vh, 640px); overflow: auto; background: #fff; border: 1px solid var(--ed-line-strong); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18); font-size: 0.86rem; line-height: 1.5; color: #2a3341; }
.ed-balloon[hidden] { display: none; }
.ed-balloon-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px 8px; background: #fff; border-bottom: 1px solid var(--ed-line); }
.ed-balloon-head h4 { margin: 0; font-size: 0.95rem; }
.ed-balloon-close { border: 0; background: none; font: inherit; font-size: 1rem; line-height: 1; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--ed-muted); }
.ed-balloon-close:hover { background: #f1f3f6; }
.ed-balloon-body { padding: 4px 14px 12px; }
.ed-balloon-body h5 { margin: 14px 0 4px; font-size: 0.86rem; }
.ed-balloon-body p { margin: 6px 0; }
.ed-balloon-body ul { margin: 4px 0 8px; padding-left: 18px; }
.ed-balloon-body li { margin: 3px 0; }
.ed-balloon-table { width: 100%; border-collapse: collapse; margin: 6px 0 8px; font-size: 0.82rem; }
.ed-balloon-table th, .ed-balloon-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--ed-line); vertical-align: top; }
.ed-balloon-table th { background: #f6f7f9; font-weight: 600; }
.ed-balloon-table tr:last-child td { border-bottom: 0; }
