/*
 * elhakem Belief Lab
 * Palette and radii intentionally mirror the existing site tools
 * (--tpm-* on task-priority-matrix) so the tool does not look bolted on.
 */

.elhakem-bll {
	--bll-dark: #0a0a0a;
	--bll-surface: #111118;
	--bll-surface-2: #1a1a24;
	--bll-gold: #c5a880;
	--bll-cream: #e8cfa0;
	--bll-text: #e8e4df;
	--bll-muted: #8a8578;
	--bll-border: rgba(197, 168, 128, 0.15);
	--bll-gold-soft: rgba(197, 168, 128, 0.08);
	--bll-radius: 12px;
	--bll-radius-sm: 8px;

	box-sizing: border-box;
	direction: rtl;
	color: var(--bll-text);
	font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", system-ui, sans-serif;
	line-height: 1.7;
	max-width: 820px;
	margin: 0 auto;
	padding: 16px;
}

.elhakem-bll *,
.elhakem-bll *::before,
.elhakem-bll *::after {
	box-sizing: inherit;
}

/* Respect the visitor's motion and contrast preferences. */
@media (prefers-reduced-motion: reduce) {
	.elhakem-bll * {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}

/* ---------- safety resources: shown only when the session is stopped ---------- */

.elhakem-bll-resources {
	background: var(--bll-gold-soft);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius);
	padding: 14px 16px;
	margin-bottom: 18px;
}

.elhakem-bll-resources-title {
	color: var(--bll-gold);
	font-weight: 700;
	margin: 0 0 8px;
	font-size: 15px;
}

.elhakem-bll-resources p {
	margin: 0 0 6px;
	font-size: 14px;
	color: var(--bll-text);
}

.elhakem-bll-country {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-top: 10px;
}

.elhakem-bll-country label {
	font-size: 13px;
	color: var(--bll-muted);
}

.elhakem-bll-country select,
.elhakem-bll-country button {
	background: var(--bll-surface-2);
	color: var(--bll-text);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 6px 10px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

/* ---------- notice ---------- */

.elhakem-bll__notice {
	background: var(--bll-surface);
	border: 1px solid var(--bll-border);
	border-inline-start: 3px solid var(--bll-gold);
	border-radius: var(--bll-radius);
	padding: 12px 14px;
	margin-bottom: 16px;
	display: grid;
	gap: 4px;
}

.elhakem-bll__notice strong {
	color: var(--bll-cream);
	font-size: 14px;
}

.elhakem-bll__notice span {
	font-size: 13px;
	color: var(--bll-muted);
}

/* ---------- phases ---------- */

.elhakem-bll__phases {
	display: flex;
	gap: 6px;
	list-style: none;
	margin: 0 0 18px;
	padding: 0;
	counter-reset: bll-phase;
}

.elhakem-bll__phases li {
	flex: 1 1 0;
	text-align: center;
	font-size: 12px;
	color: var(--bll-muted);
	background: var(--bll-surface);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 7px 4px;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.elhakem-bll__phases li[data-state="done"] {
	color: var(--bll-gold);
	border-color: var(--bll-gold);
}

.elhakem-bll__phases li[data-state="current"] {
	color: var(--bll-dark);
	background: var(--bll-gold);
	border-color: var(--bll-gold);
	font-weight: 700;
}

/* ---------- screens ---------- */

.elhakem-bll__screen {
	background: var(--bll-surface);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius);
	padding: 18px;
}

.elhakem-bll__screen[hidden] {
	display: none;
}

.elhakem-bll__question {
	font-size: 19px;
	line-height: 1.6;
	color: var(--bll-cream);
	margin: 0 0 14px;
	font-weight: 600;
}

.elhakem-bll__label {
	display: block;
	font-size: 13px;
	color: var(--bll-muted);
	margin-bottom: 6px;
}

.elhakem-bll__input {
	width: 100%;
	background: var(--bll-dark);
	color: var(--bll-text);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 10px 12px;
	font: inherit;
	font-size: 15px;
	resize: vertical;
}

.elhakem-bll__input:focus-visible,
.elhakem-bll button:focus-visible,
.elhakem-bll select:focus-visible {
	outline: 2px solid var(--bll-gold);
	outline-offset: 2px;
}

.elhakem-bll__submit,
.elhakem-bll__choices button,
.elhakem-bll__proposal-actions button,
.elhakem-bll__report-actions button,
.elhakem-bll__adjudication button {
	background: linear-gradient(135deg, var(--bll-gold), #b89b6a);
	color: var(--bll-dark);
	border: 0;
	border-radius: var(--bll-radius-sm);
	padding: 10px 18px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: filter 0.2s ease, opacity 0.2s ease;
}

.elhakem-bll__submit:hover:not(:disabled),
.elhakem-bll__choices button:hover,
.elhakem-bll__proposal-actions button:hover,
.elhakem-bll__adjudication button:hover {
	filter: brightness(1.08);
}

.elhakem-bll button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.elhakem-bll__choices {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	margin-bottom: 14px;
}

.elhakem-bll__choices button {
	font-weight: 600;
	padding: 12px 14px;
}

.elhakem-bll__freeform {
	display: grid;
	gap: 10px;
}

.elhakem-bll__freeform[hidden] {
	display: none;
}

.elhakem-bll__meta {
	font-size: 13px;
	color: var(--bll-muted);
	margin: 10px 0 0;
}

/* ---------- proposals are always visibly provisional ---------- */

.elhakem-bll__proposal-badge {
	display: inline-block;
	background: rgba(243, 156, 18, 0.15);
	color: var(--bll-q3, #f39c12);
	border: 1px solid rgba(243, 156, 18, 0.4);
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 10px;
	margin-bottom: 10px;
}

.elhakem-bll__proposal {
	font-size: 15px;
	color: var(--bll-text);
	margin: 0 0 12px;
	padding-inline-start: 10px;
	border-inline-start: 2px solid var(--bll-border);
}

.elhakem-bll__proposal-actions {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.elhakem-bll__decline {
	font-size: 13px;
	color: var(--bll-muted);
	margin: 12px 0 0;
}

/* ---------- locked prediction is visually locked ---------- */

.elhakem-bll__locked-prediction {
	background: var(--bll-surface-2);
	border: 1px solid var(--bll-gold);
	border-radius: var(--bll-radius);
	padding: 14px;
	margin-bottom: 14px;
}

.elhakem-bll__lock {
	float: inline-start;
	font-size: 18px;
}

.elhakem-bll__prediction-text {
	font-weight: 700;
	color: var(--bll-cream);
	margin: 0 0 6px;
	font-size: 16px;
}

.elhakem-bll__prediction-meta,
.elhakem-bll__prediction-falsifier {
	font-size: 13px;
	color: var(--bll-muted);
	margin: 0 0 4px;
}

/* ---------- report, map, terminal ---------- */

.elhakem-bll__report-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.elhakem-bll__report-actions button[data-action="delete"] {
	background: transparent;
	color: #e74c3c;
	border: 1px solid rgba(231, 76, 60, 0.4);
}

.elhakem-bll__belief,
.elhakem-bll__map-item {
	background: var(--bll-surface-2);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 12px;
	margin-bottom: 10px;
}

.elhakem-bll__belief-statement {
	font-weight: 600;
	color: var(--bll-cream);
	margin: 0 0 8px;
}

.elhakem-bll__belief-detail {
	font-size: 13px;
	color: var(--bll-muted);
	margin: 0 0 4px;
}

.elhakem-bll__map-heading {
	font-size: 13px;
	color: var(--bll-gold);
	margin: 16px 0 8px;
	font-weight: 700;
}

.elhakem-bll__terminal-copy {
	font-size: 15px;
	color: var(--bll-text);
	margin: 0;
}

.elhakem-bll__phase-caption {
	font-size: 12px;
	color: var(--bll-muted);
	text-align: center;
	margin: 16px 0 0;
}

/* ---------- transient status ---------- */

/*
 * The question screen shows the wording once, in the heading above. The textarea keeps a
 * real label for assistive technology, but it is not repeated on screen. Scoped to this
 * screen on purpose: the proposal editor elsewhere uses the same class and there the
 * label is the only description of the box, so it stays visible.
 */
[data-screen="question"] .elhakem-bll__freeform .elhakem-bll__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

[data-role="belief-context"] {
	color: #8a7f6d;
	font-size: 0.9rem;
	line-height: 1.6;
	margin: 0 0 0.4rem;
}

.elhakem-bll__starter-lead {
	color: #8a7f6d;
	font-size: 0.85rem;
	margin: 1.5rem 0 0.5rem;
}

.elhakem-bll__why {
	color: #6b6459;
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0 0 1rem;
	border-inline-start: 3px solid #d8c9a8;
	padding-inline-start: 0.75rem;
}

.elhakem-bll__status {
	font-size: 13px;
	color: var(--bll-gold);
	margin: 0 0 12px;
	min-height: 20px;
}

.elhakem-bll__status[data-kind="error"] {
	color: #e74c3c;
}

.elhakem-bll.is-busy {
	cursor: progress;
}

.elhakem-bll.is-busy .elhakem-bll__screen {
	opacity: 0.65;
}

@media (max-width: 560px) {
	.elhakem-bll {
		padding: 12px;
	}

	.elhakem-bll__screen {
		padding: 14px;
	}

	.elhakem-bll__question {
		font-size: 17px;
	}

	.elhakem-bll__phases li {
		font-size: 11px;
		padding: 6px 2px;
	}
}

/* ---------- topic chooser ---------- */

.elhakem-bll__topics {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	margin-top: 12px;
}

.elhakem-bll__topics button {
	background: var(--bll-surface-2);
	color: var(--bll-cream);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 12px 14px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.elhakem-bll__topics button:hover {
	border-color: var(--bll-gold);
	color: var(--bll-gold);
}

/* ---------- erase ---------- */

.elhakem-bll__erase-copy {
	font-size: 15px;
	color: var(--bll-text);
	margin: 0 0 8px;
}

.elhakem-bll__erase-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

.elhakem-bll__erase-action {
	background: rgba(231, 76, 60, 0.15);
	color: #e74c3c;
	border: 1px solid rgba(231, 76, 60, 0.5);
	border-radius: var(--bll-radius-sm);
	padding: 11px 18px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.elhakem-bll__erase-action:hover {
	background: rgba(231, 76, 60, 0.25);
}

.elhakem-bll__erase-cancel {
	background: transparent;
	color: var(--bll-text);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 11px 18px;
	font: inherit;
	cursor: pointer;
}

.elhakem-bll__safety-region {
	margin: 14px 0;
}

.elhakem-bll__safety-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

.elhakem-bll__safety-actions button {
	background: transparent;
	color: var(--bll-text);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 10px 16px;
	font: inherit;
	cursor: pointer;
}

.elhakem-bll__proposal-lead {
	font-size: 15px;
	color: var(--bll-cream);
	margin: 0 0 6px;
	font-weight: 600;
}

.elhakem-bll__proposal-edit {
	display: grid;
	gap: 10px;
	margin-top: 14px;
}

.elhakem-bll__proposal-edit[hidden] {
	display: none;
}

.elhakem-bll__decline-action {
	margin-top: 14px;
	background: transparent;
	color: var(--bll-muted);
	border: 1px solid var(--bll-border);
	border-radius: var(--bll-radius-sm);
	padding: 9px 16px;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}

.elhakem-bll__decline-action:hover {
	color: var(--bll-text);
	border-color: var(--bll-gold);
}

/*
 * What the engine did with the last answer.
 *
 * Deliberately quieter than the question and warmer than the reason line: it is neither the
 * thing being asked nor the explanation of it, it is the sentence that says why the question
 * changed. Left unstyled it would compete with the question for the eye, which is the wrong
 * priority when the visitor is trying to answer something.
 */
.elhakem-bll__note {
	color: #b08d3f;
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0 0 0.75rem;
	border-inline-start: 3px solid #b08d3f;
	padding-inline-start: 0.75rem;
}

/*
 * The debrief.
 *
 * A summary is easy to write and hard to write honestly, so this is laid out as four fixed
 * sections rather than a paragraph. The third is the one that matters: "اللي لسه مش محسوم"
 * is longer than the findings on most sessions, and giving it its own heading is what stops
 * a reader skimming to the end and taking "the belief was examined" as a result.
 */
.elhakem-bll__debrief {
	margin: 1.5rem 0 0;
	padding: 1.25rem;
	border: 1px solid #2c2a26;
	border-radius: 6px;
	background: #14141a;
}

.elhakem-bll__debrief-heading {
	color: var(--bll-gold);
	font-size: 0.8rem;
	letter-spacing: 0.02em;
	margin: 0 0 0.35rem;
	text-transform: none;
}

.elhakem-bll__debrief-heading:not(:first-child) {
	margin-top: 1.1rem;
}

.elhakem-bll__debrief-belief,
.elhakem-bll__debrief-next {
	color: #e8e2d6;
	font-size: 1rem;
	line-height: 1.7;
	margin: 0;
}

.elhakem-bll__debrief-found,
.elhakem-bll__debrief-unresolved {
	color: #b9b2a4;
	font-size: 0.92rem;
	line-height: 1.7;
	margin: 0;
	padding-inline-start: 1.1rem;
}

.elhakem-bll__debrief-unresolved {
	color: #cfc6b4;
}

.elhakem-bll__debrief-reflection {
	color: #8a7f6d;
	font-size: 0.88rem;
	line-height: 1.6;
	margin: 0.75rem 0 0;
	border-inline-start: 3px solid #6b6459;
	padding-inline-start: 0.75rem;
}
