/*
 * Self-contained palette so the tool looks the same inside any theme
 * (same approach as the other EducationalEngine generators).
 */
.ee-cm-app {
	--ee-cm-bg: #ffffff;
	--ee-cm-surface: #f1f5f9;
	--ee-cm-text: #1e293b;
	--ee-cm-muted: #52606d;
	--ee-cm-border: #cbd5e1;
	--ee-cm-accent: #1d4ed8;
	--ee-cm-accent-hover: #1e40af;
	--ee-cm-danger: #b91c1c;
	--ee-cm-danger-bg: #fef2f2;

	max-width: 1100px;
	margin: 0 auto 48px;
	padding: 24px;
	background: var(--ee-cm-bg);
	border: 1px solid var(--ee-cm-border);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
	color: var(--ee-cm-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	line-height: 1.5;
}
.ee-cm-app * { box-sizing: border-box; }
.ee-cm-app button, .ee-cm-app input, .ee-cm-app select, .ee-cm-app textarea {
	font-family: inherit; box-shadow: none; text-shadow: none; background-image: none;
}
.ee-cm-app [hidden] { display: none !important; }

.ee-cm-quota-bar {
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center;
	background: var(--ee-cm-surface); border: 1px solid var(--ee-cm-border); border-radius: 6px;
	padding: 10px 16px; margin-bottom: 16px; font-size: 0.9em;
}
.ee-cm-quota-label { font-weight: 700; }
.ee-cm-quota-count { color: var(--ee-cm-muted); }
.ee-cm-quota-count a { color: var(--ee-cm-accent); }

.ee-cm-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--ee-cm-border); }
.ee-cm-tab {
	background: transparent !important; border: 0; border-bottom: 3px solid transparent; color: var(--ee-cm-muted) !important;
	padding: 8px 12px; font-weight: 600; cursor: pointer; margin-bottom: -1px;
}
.ee-cm-tab.is-active { color: var(--ee-cm-accent) !important; border-bottom-color: var(--ee-cm-accent); }
.ee-cm-panel { display: none; }
.ee-cm-panel.is-active { display: block; }

.ee-cm-form { max-width: 860px; }
.ee-cm-field { margin-bottom: 14px; flex: 1 1 0; min-width: 0; }
.ee-cm-field label, .ee-cm-label { display: block; font-weight: 600; font-size: 0.9em; margin-bottom: 4px; color: var(--ee-cm-text); }
.ee-cm-field input, .ee-cm-field select, .ee-cm-field textarea {
	width: 100%; padding: 8px 10px; height: auto; min-height: 40px; border: 1px solid var(--ee-cm-border); border-radius: 6px;
	background: #fff !important; color: var(--ee-cm-text) !important; font-size: 0.95em;
}
.ee-cm-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ee-cm-row .ee-cm-field { min-width: 200px; }
.ee-cm-hint { font-size: 0.82em; color: var(--ee-cm-muted); margin: 4px 0 0; }
.ee-cm-more { margin: 0 0 16px; }
.ee-cm-more summary { cursor: pointer; font-weight: 600; font-size: 0.9em; color: var(--ee-cm-accent); margin-bottom: 10px; }

.ee-cm-btn {
	display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 6px; cursor: pointer;
	border: 1px solid var(--ee-cm-border); background: #fff !important; color: var(--ee-cm-text) !important;
	font-weight: 600; font-size: 0.9em; text-decoration: none !important; line-height: 1.2;
}
.ee-cm-btn:hover { border-color: var(--ee-cm-accent); color: var(--ee-cm-accent) !important; }
.ee-cm-btn:focus-visible, .ee-cm-zoom-btn:focus-visible, .ee-cm-viewport:focus-visible { outline: 2px solid var(--ee-cm-accent); outline-offset: 2px; }
.ee-cm-btn-primary { background: var(--ee-cm-accent) !important; border-color: var(--ee-cm-accent); color: #fff !important; padding: 10px 18px; font-size: 1em; }
.ee-cm-btn-primary:hover { background: var(--ee-cm-accent-hover) !important; color: #fff !important; }
.ee-cm-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.ee-cm-btn-small { padding: 5px 10px; font-size: 0.82em; }
.ee-cm-btn-danger:hover { border-color: var(--ee-cm-danger); color: var(--ee-cm-danger) !important; }
.ee-cm-cost-badge { background: rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 2px 8px; font-size: 0.8em; }
.ee-cm-btn:not(.ee-cm-btn-primary) .ee-cm-cost-badge { background: var(--ee-cm-surface); }
.ee-cm-link { background: none !important; border: 0; padding: 0; color: var(--ee-cm-accent) !important; font-weight: 600; font-size: 0.85em; cursor: pointer; text-decoration: underline; }

.ee-cm-status { margin: 14px 0 0; font-weight: 600; color: var(--ee-cm-accent); }
.ee-cm-status:empty { display: none; }
.ee-cm-status.is-error { color: var(--ee-cm-danger); }
.ee-cm-result { margin-top: 18px; }

.ee-cm-list { list-style: none; padding: 0; margin: 0 0 16px; }
.ee-cm-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--ee-cm-border); }
.ee-cm-view-btn { background: none !important; border: 0; padding: 0; color: var(--ee-cm-accent) !important; font-weight: 600; cursor: pointer; text-align: left; }
.ee-cm-list-meta { color: var(--ee-cm-muted); font-size: 0.85em; }

/* PDF upload (same design as Presentation Creator). */
.ee-cm-pdf-picker { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ee-cm-pdf-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.ee-cm-pdf-input:focus-visible + .ee-cm-pdf-btn { outline: 2px solid var(--ee-cm-accent); outline-offset: 2px; }
.ee-cm-pdf-btn.is-busy { opacity: 0.6; pointer-events: none; }
.ee-cm-pdf-status { font-size: 0.85em; color: var(--ee-cm-accent); margin-top: 6px; }
.ee-cm-pdf-status:empty { display: none; }
.ee-cm-pdf-status.is-error { color: var(--ee-cm-danger); font-weight: 600; }
.ee-cm-pdf-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; border: 1px solid var(--ee-cm-border); background: var(--ee-cm-surface); border-radius: 8px; padding: 8px 12px; }
.ee-cm-pdf-name { font-weight: 700; word-break: break-all; }
.ee-cm-pdf-name::before { content: "PDF"; font-size: 0.7em; font-weight: 800; color: #fff; background: var(--ee-cm-danger); border-radius: 3px; padding: 1px 5px; margin-right: 8px; vertical-align: middle; }
.ee-cm-pdf-meta { color: var(--ee-cm-muted); font-size: 0.85em; }
.ee-cm-pdf-preview { margin-top: 8px; max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 0.85em; border: 1px solid var(--ee-cm-border); border-radius: 6px; padding: 10px 12px; background: #fff; }

/* Map view. */
.ee-cm-item-header h3 { margin: 0 0 4px; }
.ee-cm-item-meta { color: var(--ee-cm-muted); font-size: 0.9em; margin: 0 0 6px; }
.ee-cm-upsell-source-note { font-size: 0.85em; font-style: italic; color: var(--ee-cm-muted); margin: 0 0 6px; }
.ee-cm-permalink { font-size: 0.85em; margin: 0 0 10px; }

.ee-cm-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; }
.ee-cm-export-bar { margin: 8px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--ee-cm-border); }
.ee-cm-toolbar-label { font-size: 0.82em; color: var(--ee-cm-muted); }
.ee-cm-export-note { font-size: 0.78em; color: var(--ee-cm-muted); }
.ee-cm-version { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85em; font-weight: 600; max-width: 100%; min-width: 0; }
.ee-cm-version select { padding: 5px 8px; border: 1px solid var(--ee-cm-border); border-radius: 6px; background: #fff !important; color: var(--ee-cm-text) !important; font-size: 1em; max-width: 100%; min-width: 0; flex: 1 1 auto; }
.ee-cm-wordbank, .ee-cm-check { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85em; font-weight: 600; cursor: pointer; }
.ee-cm-wordbank input, .ee-cm-check input { width: auto; min-height: 0; margin: 0; }
.ee-cm-toolbar-status { font-size: 0.85em; font-weight: 600; color: var(--ee-cm-accent); margin: 6px 0 0; }
.ee-cm-toolbar-status:empty { display: none; }
.ee-cm-toolbar-status.is-error { color: var(--ee-cm-danger); }
.ee-cm-student-hint { font-size: 0.85em; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px; padding: 8px 12px; margin: 0 0 10px; }

.ee-cm-viewport-wrap { position: relative; border: 1px solid var(--ee-cm-border); border-radius: 8px; background: #fff; }
.ee-cm-viewport { overflow: auto; max-height: 78vh; min-height: 220px; padding: 2px; -webkit-overflow-scrolling: touch; }
.ee-cm-viewport svg { display: block; margin: 0 auto; max-width: none; height: auto; }
.ee-cm-zoom { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 0; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15); border-radius: 6px; }
.ee-cm-zoom-btn {
	min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--ee-cm-border); background: #fff !important;
	color: var(--ee-cm-text) !important; font-weight: 700; cursor: pointer; font-size: 0.9em; line-height: 1;
}
.ee-cm-zoom-btn:first-child { border-radius: 6px 0 0 6px; }
.ee-cm-zoom-btn:last-child { border-radius: 0 6px 6px 0; }
.ee-cm-zoom-btn + .ee-cm-zoom-btn { margin-left: -1px; }
.ee-cm-item.is-editing .ee-cm-node { cursor: grab; touch-action: none; }
.ee-cm-item.is-dragging .ee-cm-node { cursor: grabbing; }
.ee-cm-item.is-dragging { user-select: none; -webkit-user-select: none; }
.ee-cm-item.is-editing .ee-cm-linklabel { cursor: pointer; }
.ee-cm-item.is-editing .ee-cm-linklabel:hover rect { stroke: #f59e0b; }
.ee-cm-item.is-editing .ee-cm-node:hover rect:first-child { filter: brightness(0.96); }
.ee-cm-node:focus { outline: none; }
.ee-cm-node:focus-visible rect:first-child { stroke: #f59e0b; stroke-width: 3; }

/* Editor. */
.ee-cm-editor { margin: 12px 0 0; border: 2px solid #f59e0b; border-radius: 8px; padding: 12px 14px; background: #fffdf5; }
.ee-cm-editor-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.ee-cm-editor-head .ee-cm-hint { margin: 0; }
.ee-cm-editor-concept { border-top: 1px dashed var(--ee-cm-border); padding-top: 10px; margin-bottom: 10px; }
.ee-cm-editor-where { font-size: 0.85em; font-weight: 700; color: var(--ee-cm-muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.ee-cm-links-head { margin: 4px 0 6px; font-size: 0.9em; }
.ee-cm-links-list { list-style: none; margin: 0 0 10px; padding: 0; }
.ee-cm-link-row, .ee-cm-add-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--ee-cm-border); border-radius: 6px; background: #fff; margin-bottom: 6px; font-size: 0.9em; }
.ee-cm-link-row.is-selected { border-color: #f59e0b; box-shadow: 0 0 0 1px #f59e0b; }
.ee-cm-link-end { font-weight: 600; }
.ee-cm-link-phrase, .ee-cm-add-phrase, .ee-cm-add-target { padding: 4px 8px; border: 1px solid var(--ee-cm-border); border-radius: 5px; background: #fff !important; color: var(--ee-cm-text) !important; font-size: 0.95em; font-style: italic; min-width: 0; flex: 0 1 180px; }
.ee-cm-add-target { font-style: normal; flex-basis: 200px; }
.ee-cm-link-phrase.is-error { border-color: var(--ee-cm-danger); background: var(--ee-cm-danger-bg) !important; }
.ee-cm-add-link { background: var(--ee-cm-surface); }
.ee-cm-add-link-from { font-weight: 600; }
.ee-cm-app .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ee-cm-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.ee-cm-editor-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ee-cm-editor-status { font-size: 0.85em; color: var(--ee-cm-muted); }
.ee-cm-editor-status.is-error { color: var(--ee-cm-danger); font-weight: 600; }

.ee-cm-section { margin: 20px 0 0; }
.ee-cm-section h4 { margin: 0 0 8px; }
.ee-cm-focus { font-style: italic; font-weight: 600; margin: 0 0 14px; }
.ee-cm-propositions { margin: 6px 0 0; padding-left: 24px; }
.ee-cm-propositions li { margin: 3px 0; }
.ee-cm-phrase { color: #334155; }
.ee-cm-propositions li.is-cross .ee-cm-phrase { color: #92400e; }
.ee-cm-cross-tag { font-size: 0.75em; font-weight: 700; color: #92400e; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 999px; padding: 0 7px; vertical-align: 1px; }
.ee-cm-notes-section summary { cursor: pointer; font-weight: 700; }
.ee-cm-concept-notes { margin: 8px 0 0; padding-left: 20px; }
.ee-cm-concept-notes li { margin: 3px 0; }
.ee-cm-note { color: #334155; }
.ee-cm-upsells { margin-top: 22px; }
.ee-cm-disclaimer { font-size: 0.8em; color: var(--ee-cm-muted); margin-top: 16px; }

/* Student versions hide the educator-only parts (the propositions are the answers). */
.ee-cm-item.is-student-view .ee-cm-edu-only { display: none; }

@media (max-width: 600px) {
	.ee-cm-app { padding: 16px; }
	.ee-cm-row .ee-cm-field { min-width: 100%; }
	.ee-cm-viewport { max-height: 70vh; }
	.ee-cm-export-note { width: 100%; }
}
