/* محرّر الخرائط الذهنية. النطاق .mm حتى لا يمس أنماط الأدوات الأخرى. */
.mm {
	--mm-bg: #12070a;
	--mm-panel: #1c0d12;
	--mm-line: rgba(242, 242, 242, 0.14);
	--mm-text: #f2f2f2;
	--mm-muted: #b7a8ac;
	--mm-ruby: #8a0917;
	--mm-lime: #d9ff00;
	--mm-danger: #ffb4b4;
	width: 100%;
	margin: 0;
	color: var(--mm-text);
	font-family: inherit;
	box-sizing: border-box;
}
.mm *,
.mm *::before,
.mm *::after { box-sizing: border-box; }
.mm button,
.mm input,
.mm textarea,
.mm select { font-family: inherit; color: inherit; }
.mm-start {
	min-height: 70vh;
	display: grid;
	align-content: center;
	gap: 18px;
	padding: 28px 20px 40px;
	background:
		radial-gradient(900px 420px at 80% 0%, rgba(138, 9, 23, 0.45), transparent 60%),
		var(--mm-bg);
}
.mm-start-inner { width: min(920px, 100%); margin-inline: auto; }
.mm-kicker { margin: 0 0 8px; color: var(--mm-lime); font-size: 0.85rem; letter-spacing: 0; }
.mm-start h2 { margin: 0 0 8px; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.35; }
.mm-lead { margin: 0 0 22px; max-width: 62ch; color: var(--mm-muted); line-height: 1.8; }
.mm-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mm-choice, .mm-map-card, .mm-btn, .mm-iconbtn {
	border: 1px solid var(--mm-line);
	background: rgba(255, 255, 255, 0.03);
	border-radius: 14px;
	cursor: pointer;
	text-align: start;
}
.mm-choice { padding: 16px 16px 14px; color: var(--mm-text); }
.mm-choice strong, .mm-map-card strong { display: block; margin-bottom: 4px; }
.mm-choice span, .mm-map-card span, .mm-note { color: var(--mm-muted); line-height: 1.6; font-size: 0.92rem; }
.mm-choice:hover, .mm-map-card:hover, .mm-btn:hover, .mm-iconbtn:hover { border-color: rgba(217, 255, 0, 0.55); }
.mm-choice:focus-visible, .mm-btn:focus-visible, .mm-iconbtn:focus-visible, .mm-field:focus-visible {
	outline: 2px solid var(--mm-lime);
	outline-offset: 2px;
}
.mm-saved { margin-top: 22px; }
.mm-saved h3 { margin: 0 0 10px; font-size: 1rem; }
.mm-map-list { display: grid; gap: 8px; }
.mm-map-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 8px 8px 14px; width: 100%; }
.mm-map-open { flex: 1; background: transparent; border: 0; color: inherit; text-align: start; cursor: pointer; padding: 6px 0; }
.mm-editor { display: none; min-height: 78vh; background: var(--mm-bg); }
.mm.is-editor .mm-start { display: none; }
.mm.is-editor .mm-editor { display: grid; grid-template-rows: auto auto minmax(420px, 1fr) auto; grid-template-columns: minmax(0, 1fr) 300px; }
.mm-top, .mm-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--mm-line); background: #16090d; }
.mm-tools { flex-direction: column; align-items: stretch; padding-top: 8px; padding-bottom: 8px; }
.mm-tools-main, .mm-tools-extra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mm-tools-extra { margin-top: 8px; }
.mm-only-narrow, .mm-sheet-close { display: none; }
.mm-title {
	flex: 1 1 220px;
	min-width: 160px;
	background: transparent;
	border: 0;
	border-bottom: 1px solid transparent;
	font-size: 1.05rem;
	font-weight: 700;
	padding: 6px 2px;
}
.mm-title:focus { border-bottom-color: var(--mm-lime); outline: none; }
.mm-status-text { color: var(--mm-muted); font-size: 0.82rem; }
.mm-btn, .mm-iconbtn { padding: 8px 12px; background: #2a1218; min-height: 40px; }
.mm-btn.primary { background: var(--mm-lime); color: #14080b; font-weight: 800; border-color: transparent; }
.mm-btn.warn { color: var(--mm-danger); }
.mm-iconbtn { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; font-size: 1.05rem; }
.mm-stage { position: relative; min-height: 420px; overflow: hidden; background: radial-gradient(circle at 20% 10%, rgba(138, 9, 23, 0.25), transparent 36%), var(--mm-canvas, var(--mm-bg)); touch-action: none; }
.mm-stage svg { width: 100%; height: 100%; display: block; cursor: grab; }
.mm-stage.is-drag svg { cursor: grabbing; }
.mm-node { cursor: pointer; }
.mm-node.is-selected rect, .mm-node.is-selected ellipse { stroke: var(--mm-lime); stroke-width: 2.5px; }
.mm-node.is-hit rect { stroke: #fff; }
.mm-zoom {
	position: absolute;
	z-index: 2;
	display: flex;
	gap: 6px;
	align-items: center;
	background: rgba(12, 6, 8, 0.88);
	border: 1px solid var(--mm-line);
	border-radius: 12px;
	padding: 6px;
	inset-inline-start: 12px;
	bottom: calc(12px + env(safe-area-inset-bottom));
}
.mm-search {
	position: static;
	display: flex;
	flex: 1 1 150px;
	max-width: 240px;
	background: transparent;
	border: 0;
	padding: 0;
}
.mm-search input, .mm-field, .mm-props textarea, .mm-props select {
	background: #12080c;
	border: 1px solid var(--mm-line);
	border-radius: 10px;
	padding: 8px 10px;
	width: 100%;
	font-size: 16px;
}
.mm-tools-extra .mm-field { width: auto; min-width: 9.5rem; }
.mm-props-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mm-props-head h3 { margin: 0; }
.mm-props {
	grid-column: 2;
	grid-row: 3;
	border-inline-start: 1px solid var(--mm-line);
	background: var(--mm-panel);
	padding: 14px;
	overflow: auto;
	max-height: 100%;
}
.mm.is-props-closed .mm-props { display: none; }
.mm.is-props-closed .mm-editor { grid-template-columns: minmax(0, 1fr); }
.mm-props h3 { margin: 0 0 12px; font-size: 1rem; }
.mm-props label { display: block; margin: 10px 0 4px; color: var(--mm-muted); font-size: 0.82rem; }
.mm-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); cursor: pointer; padding: 0; }
.mm-row { display: flex; gap: 8px; }
.mm-row > * { flex: 1; }
.mm-foot {
	grid-column: 1 / -1;
	display: flex;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	padding: 8px 12px;
	color: var(--mm-muted);
	font-size: 0.82rem;
	border-top: 1px solid var(--mm-line);
}
.mm-menu, .mm-modal { position: absolute; z-index: 5; }
.mm-menu {
	top: 58px;
	inset-inline-end: 12px;
	background: #1c0d12;
	border: 1px solid var(--mm-line);
	border-radius: 12px;
	padding: 6px;
	display: none;
	min-width: 220px;
}
.mm-menu.is-open { display: grid; }
.mm-menu button { background: transparent; border: 0; text-align: start; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mm-menu button:hover { background: rgba(255,255,255,.06); }
.mm-modal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.62);
	display: none;
	place-items: center;
	padding: 18px;
	z-index: 80;
}
.mm-modal.is-open { display: grid; }
.mm-dialog {
	width: min(560px, 100%);
	background: #1c0d12;
	border: 1px solid var(--mm-line);
	border-radius: 16px;
	padding: 18px;
	max-height: min(80vh, 720px);
	overflow: auto;
}
.mm-dialog h3 { margin: 0 0 8px; }
.mm-dialog p { color: var(--mm-muted); line-height: 1.7; }
.mm-keys { width: 100%; border-collapse: collapse; }
.mm-keys td { padding: 6px 4px; border-bottom: 1px solid var(--mm-line); vertical-align: top; }
.mm-keys kbd { font-family: inherit; background: #2a1218; border-radius: 6px; padding: 1px 6px; }
.mm-banner {
	display: none;
	margin: 0;
	padding: 10px 12px;
	background: #3a1218;
	color: #fff;
}
.mm-banner.is-on { display: block; }
.mm-theme-dark .mm-stage { --mm-canvas: #12070a; }
.mm-theme-light .mm-stage { --mm-canvas: #f7f4f2; }
.mm-theme-study .mm-stage { --mm-canvas: #f3f7f4; }
@media (max-width: 1100px) {
	.mm.is-editor .mm-editor { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 900px) {
	.mm-choices { grid-template-columns: 1fr; }
	.mm-only-narrow { display: inline-flex; }
	.mm-tools-extra { display: none; margin-top: 0; }
	.mm.is-more .mm-tools-extra { display: flex; margin-top: 8px; }
	.mm.is-editor .mm-editor {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto minmax(58dvh, 1fr) auto;
		min-height: calc(100dvh - 96px);
	}
	.mm-stage { min-height: 58dvh; }
	.mm-top { gap: 6px; }
	.mm-search { flex: 1 1 100%; max-width: none; }
	.mm-status-text { flex-basis: 100%; }
	.mm-tools-main { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
	.mm-tools-main .mm-btn { flex: 0 0 auto; }
	.mm-props {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 30;
		max-height: min(70dvh, 520px);
		border-radius: 16px 16px 0 0;
		border: 1px solid var(--mm-line);
		display: none;
		padding-bottom: calc(16px + env(safe-area-inset-bottom));
	}
	.mm.is-sheet .mm-props { display: block; }
	.mm-sheet-close { display: inline-flex; }
	.mm-menu {
		position: fixed;
		top: auto;
		bottom: calc(12px + env(safe-area-inset-bottom));
		inset-inline: 12px;
	}
	.mm-btn, .mm-iconbtn, .mm-field { min-height: 44px; }
}
@media (max-width: 900px) and (max-height: 520px) {
	.mm.is-editor .mm-editor { grid-template-rows: auto auto minmax(42dvh, 1fr) auto; }
	.mm-foot { display: none; }
	.mm-stage { min-height: 42dvh; }
}
@media (min-width: 900px) {
	.tool-page:has(.mm) .wrap { max-width: 1180px !important; }
}
@media (prefers-reduced-motion: reduce) {
	.mm * { transition: none !important; }
}
.mm-btn:disabled, .mm-iconbtn:disabled { opacity: .35; cursor: default; }
.mm-hint {
	position: absolute;
	z-index: 1;
	inset-inline: 18px;
	top: 62%;
	margin: 0;
	text-align: center;
	color: var(--mm-muted);
	pointer-events: none;
}
.mm-path {
	position: absolute;
	z-index: 2;
	inset-inline: 12px;
	bottom: calc(64px + env(safe-area-inset-bottom));
	margin: 0;
	color: var(--bone);
	font-size: 0.82rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}
.mm-dock {
	position: absolute;
	z-index: 3;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 6px;
	padding: 6px;
	background: rgba(12, 6, 8, 0.92);
	border: 1px solid var(--mm-line);
	border-radius: 14px;
	max-width: calc(100% - 24px);
}
.tool-page:has(.mm.is-editor) .tool-cover,
.tool-page:has(.mm.is-editor) .section-head { display: none; }
.tool-page:has(.mm.is-editor) nav { margin-bottom: 8px !important; }
