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

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

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

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

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

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

.ee-ds-status { margin: 14px 0 0; font-weight: 600; color: var(--ee-ds-accent); }
.ee-ds-status:empty { display: none; }
.ee-ds-status.is-error { color: var(--ee-ds-danger); }
.ee-ds-status.is-working::before {
	content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
	border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ee-ds-spin 0.9s linear infinite;
}
@keyframes ee-ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ee-ds-status.is-working::before { animation: none; } }
.ee-ds-result { margin-top: 18px; }

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

.ee-ds-upsells { margin-top: 24px; }
.ee-ds-disclaimer { font-size: 0.8em; color: var(--ee-ds-muted); margin-top: 16px; }

/* Form. */
.ee-ds-fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.ee-ds-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.ee-ds-check { display: flex !important; gap: 8px; align-items: flex-start; font-weight: 400 !important; font-size: 0.92em !important; margin: 2px 0 6px; cursor: pointer; }
.ee-ds-check input { width: auto !important; min-height: 0 !important; margin-top: 4px; flex: 0 0 auto; }
.ee-ds-count-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; }
.ee-ds-count-grid .ee-ds-field { margin-bottom: 4px; display: flex; flex-direction: column; justify-content: flex-end; }
.ee-ds-form-summary { font-size: 0.88em; color: var(--ee-ds-muted); margin: 0 0 14px; font-weight: 600; }

/* Item view. */
.ee-ds-item { max-width: 920px; }
.ee-ds-item-header h3 { margin: 0 0 4px; }
.ee-ds-item-meta { color: var(--ee-ds-muted); font-size: 0.88em; margin: 0 0 4px; word-break: break-word; }
.ee-ds-upsell-source-note { font-size: 0.85em; color: var(--ee-ds-accent); margin: 0 0 4px; font-weight: 600; }
.ee-ds-permalink { font-size: 0.85em; margin: 0 0 10px; }

.ee-ds-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--ee-ds-border); }
.ee-ds-toolbar-label { font-size: 0.82em; color: var(--ee-ds-muted); margin-left: 8px; }
.ee-ds-export-status { font-size: 0.82em; color: var(--ee-ds-muted); }
.ee-ds-export-status.is-error { color: var(--ee-ds-danger); font-weight: 600; }
.ee-ds-btn-danger:hover { border-color: var(--ee-ds-danger); color: var(--ee-ds-danger) !important; }
.ee-ds-viewswitch { display: inline-flex; flex-wrap: wrap; margin-right: 8px; }
.ee-ds-viewswitch .ee-ds-btn { border-radius: 0; margin-left: -1px; }
.ee-ds-viewswitch .ee-ds-btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.ee-ds-viewswitch .ee-ds-btn:last-child { border-radius: 0 6px 6px 0; }
.ee-ds-viewswitch .ee-ds-btn.is-active { background: var(--ee-ds-accent) !important; border-color: var(--ee-ds-accent); color: #fff !important; }

.ee-ds-draft-box { border: 1px solid var(--ee-ds-accent); background: var(--ee-ds-accent-soft); border-radius: 8px; padding: 12px 14px; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ee-ds-draft-box p { margin: 0; flex: 1 1 260px; }
.ee-ds-continue-status, .ee-ds-regen-msg { font-size: 0.85em; color: var(--ee-ds-accent); font-weight: 600; }
.ee-ds-continue-status.is-error, .ee-ds-regen-msg.is-error { color: var(--ee-ds-danger); }
.ee-ds-continue-status.is-working::before, .ee-ds-regen-msg.is-working::before {
	content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
	border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ee-ds-spin 0.9s linear infinite;
}

.ee-ds-paper { border: 1px solid var(--ee-ds-border); border-radius: 8px; padding: 18px 20px; background: #fff; overflow-wrap: anywhere; }
.ee-ds-paper h1 { font-size: 1.45em; margin: 0 0 6px; }
.ee-ds-paper h2 { font-size: 1.2em; margin: 22px 0 6px; padding-top: 12px; border-top: 1px solid var(--ee-ds-border); }
.ee-ds-paper h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.ee-ds-paper h3 { font-size: 1.03em; margin: 14px 0 4px; }
.ee-ds-paper h4 { font-size: 0.95em; margin: 10px 0 4px; }
.ee-ds-paper p { margin: 0 0 8px; }
.ee-ds-paper ul, .ee-ds-paper ol { margin: 0 0 10px; padding-left: 24px; }
.ee-ds-paper li { margin: 0 0 6px; }
.ee-ds-paper li > p:last-child { margin-bottom: 0; }
.ee-ds-muted, .ee-ds-small { color: var(--ee-ds-muted); font-size: 0.88em; }
.ee-ds-center { text-align: center; }
.ee-ds-big { font-size: 1.15em; font-weight: 700; }
.ee-ds-key { color: #15803d; font-weight: 700; }
.ee-ds-pagebreak { border: 0; border-top: 2px dashed var(--ee-ds-border); margin: 22px 0; }
.ee-ds-lines { display: block; height: calc(var(--lines, 3) * 1.9em); margin: 4px 0 10px;
	background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.9em - 1px), #94a3b8 calc(1.9em - 1px), #94a3b8 1.9em) !important; }
.ee-ds-box { border: 1px solid var(--ee-ds-border); background: var(--ee-ds-surface); border-radius: 6px; padding: 8px 12px; margin: 6px 0 12px; }
.ee-ds-box-answer { border-color: #86efac; background: #f0fdf4; color: #14532d; }
.ee-ds-box-warn { border-color: #fcd34d; background: #fffbeb; }
.ee-ds-box-info { border-color: #bfdbfe; background: var(--ee-ds-accent-soft); }
.ee-ds-box-title { font-weight: 700; margin: 0 0 4px !important; }
.ee-ds-box > :last-child { margin-bottom: 0; }
.ee-ds-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0 0 12px; font-size: 0.95em; }
.ee-ds-kv dt { font-weight: 700; }
.ee-ds-kv dd { margin: 0; }
.ee-ds-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.ee-ds-table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
.ee-ds-table th, .ee-ds-table td { border: 1px solid var(--ee-ds-border); padding: 6px 8px; text-align: left; vertical-align: top; }
.ee-ds-table thead th { background: var(--ee-ds-surface); }
.ee-ds-table th, .ee-ds-table td { overflow-wrap: normal; word-break: normal; hyphens: none; }
@media (max-width: 480px) { .ee-ds-table th, .ee-ds-table td { padding: 4px 5px; } }
.ee-ds-regen-wrap { margin: 2px 0 12px; }
.ee-ds-regen-btn { font-size: 0.78em !important; padding: 3px 8px !important; color: var(--ee-ds-muted) !important; }
.ee-ds-regen-btn .ee-ds-cost-badge { background: var(--ee-ds-surface); }
.ee-ds-regen-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.ee-ds-regen-form input { flex: 1 1 220px; min-width: 0; padding: 5px 8px; border: 1px solid var(--ee-ds-border); border-radius: 6px; font-size: 0.85em; background: #fff !important; color: var(--ee-ds-text) !important; }
.ee-ds-item[data-mode] .ee-ds-regen-wrap { display: block; }
.ee-ds-item-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; margin-top: 16px; }
.ee-ds-item-footer .ee-ds-disclaimer { margin: 0; flex: 1 1 300px; }

/* Editor. */
.ee-ds-editor { border: 1px solid var(--ee-ds-accent); border-radius: 8px; padding: 14px; background: var(--ee-ds-surface); }
.ee-ds-editor .ee-ds-field { margin-bottom: 8px; }
.ee-ds-edit-list { margin: 10px 0; }
.ee-ds-edit-list > .ee-ds-label { font-weight: 700; margin: 0 0 4px; }
.ee-ds-edit-items { list-style: decimal; padding-left: 24px; margin: 4px 0 8px; }
.ee-ds-edit-item { background: #fff; border: 1px solid var(--ee-ds-border); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; }
.ee-ds-edit-item .ee-ds-edit-item { background: var(--ee-ds-surface); }
.ee-ds-edit-item-title { font-weight: 700; font-size: 0.85em; color: var(--ee-ds-accent); margin: 0 0 6px; }
.ee-ds-edit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.ee-ds-editor-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; position: sticky; bottom: 0; background: var(--ee-ds-surface); padding: 8px 0 2px; }
.ee-ds-editor-status { font-size: 0.85em; color: var(--ee-ds-muted); }
.ee-ds-editor-status.is-error { color: var(--ee-ds-danger); font-weight: 600; }
.ee-ds-small-field { max-width: 140px; }
.ee-ds-mid-field { max-width: 320px; }
.ee-ds-choices { margin: 0 0 8px; }
.ee-ds-choices > .ee-ds-label { font-weight: 600; font-size: 0.9em; margin: 0 0 4px; }
.ee-ds-choice { display: flex; gap: 6px; align-items: center; margin: 0 0 4px; }
.ee-ds-choice input[type="text"] { flex: 1 1 auto; min-width: 0; padding: 6px 8px; border: 1px solid var(--ee-ds-border); border-radius: 6px; background: #fff !important; color: var(--ee-ds-text) !important; }
.ee-ds-choice input[type="radio"] { width: auto; min-height: 0; }

.ee-ds-app .screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important;
}

@media (max-width: 600px) {
	.ee-ds-app { padding: 16px; }
	.ee-ds-row .ee-ds-field { min-width: 100%; }
	.ee-ds-paper { padding: 14px 12px; }
	.ee-ds-viewswitch { width: 100%; margin: 0 0 4px; }
	.ee-ds-viewswitch .ee-ds-btn { flex: 1 1 auto; justify-content: center; }
	.ee-ds-kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
	.ee-ds-kv dd { margin-bottom: 6px; }
	.ee-ds-paper ul, .ee-ds-paper ol { padding-left: 20px; }
	.ee-ds-small-field, .ee-ds-mid-field { max-width: none; }
}
/* Run timer. */
.ee-ds-timer { text-align: center; border: 1px solid var(--ee-ds-border); border-radius: 10px; padding: 16px; background: var(--ee-ds-surface); }
.ee-ds-timer-settings { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin: 8px 0 14px; font-size: 0.9em; }
.ee-ds-timer-settings label { display: flex; align-items: center; gap: 6px; }
.ee-ds-timer-settings input[type="number"] { width: 4.5em; padding: 4px 6px; border: 1px solid var(--ee-ds-border); border-radius: 6px; font: inherit; }
.ee-ds-timer-round { margin: 0; color: var(--ee-ds-muted); font-weight: 600; min-height: 1.4em; }
.ee-ds-timer-phase { margin: 4px 0 0; font-size: 1.3em; font-weight: 700; }
.ee-ds-timer-clock { margin: 0 0 12px; font-size: clamp(3.5rem, 18vw, 8rem); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ee-ds-timer.is-warning .ee-ds-timer-clock, .ee-ds-timer.is-warning .ee-ds-timer-phase { color: #b45309; }
.ee-ds-timer-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ee-ds-timer-what { margin: 0 auto 14px; max-width: 40em; font-size: 1.15em; }
