/* =============================================
   mindmap.css — MindMap Application Styles v2
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Variables ── */
:root {
  --header-bg: #3d8b99;
  --header-text: #fff;
  --toolbar-bg: #f5f6f8;
  --toolbar-border: #dce0e4;
  --tab-active: #3d8b99;
  --tab-hover: #e8eef0;
  --canvas-bg: #f6f7f9;
  --node-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  --node-selected: 0 0 0 2.5px #3d8bdd;
  --radial-center: #3d8b99;
  --radial-item-bg: rgba(255, 255, 255, 0.97);
  --radial-item-hover: #e8f5fd;
  --minimap-bg: rgba(255, 255, 255, 0.92);
  --transition-speed: 0.18s;
  --btn-disabled-opacity: 0.35;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--canvas-bg);
  overflow: hidden;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

html,
body.mm-page {
  height: 100%;
}

body.mm-page .site-header {
  z-index: 220;
}

/* MindMap uses a full-width workspace, so keep the top site brand flush-left. */
body.mm-page .site-header .container.nav-row {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 18px;
  min-height: 68px;
}

body.mm-page .brand-logo {
  width: 36px;
  height: 36px;
}

body.mm-page .brand-word {
  font-size: 26px;
  letter-spacing: -0.5px;
}

.mm-page-main {
  display: flex;
  width: 100%;
  max-width: none !important;
  flex: 1;
  flex-basis: auto;
  min-height: 0;
  padding: 0 !important;
  margin: 0 !important;
  background: var(--canvas-bg) !important;
}

body.mm-page.mm-immersive .site-header {
  display: none;
}

/* ── Header ── */
.mm-header {
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 16px;
  gap: 10px;
  z-index: 100;
  position: relative;
}

.mm-header-logo {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mm-header-logo svg {
  width: 22px;
  height: 22px;
}

.mm-title-input {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  padding: 4px 10px;
  outline: none;
  width: 220px;
  transition: background var(--transition-speed);
}

.mm-title-input:focus {
  background: rgba(255, 255, 255, 0.22);
}

.mm-header-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.mm-header-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background var(--transition-speed);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mm-header-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mm-header-btn .btn-dropdown {
  position: relative;
}

.mm-export-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
  min-width: 160px;
  padding: 4px 0;
  z-index: 200;
}

.mm-export-menu.open {
  display: block;
}

.mm-export-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: #333;
  transition: background var(--transition-speed);
}

.mm-export-menu-item:hover {
  background: #f0f4f8;
}

.mm-header-status {
  font-size: 11px;
  opacity: 0.65;
  margin-left: 8px;
}

.mm-header-node-count {
  font-size: 11px;
  opacity: 0.65;
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Tabs (now inside header bar) ── */
.mm-header-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-left: 12px;
}

.mm-header-spacer {
  flex: 1;
}

.mm-tabs {
  display: none;
  /* Old standalone tabs row — hidden since tabs moved to header */
}

.mm-tab {
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-speed);
  user-select: none;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.mm-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
}

.mm-tab.active {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Toolbars ── */
.mm-toolbar {
  display: none;
  align-items: center;
  padding: 6px 12px;
  gap: 6px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
  flex-wrap: wrap;
  z-index: 40;
}

.mm-toolbar.active {
  display: flex;
}

.mm-tb-separator {
  width: 1px;
  height: 26px;
  background: #d0d5db;
  margin: 0 4px;
  flex-shrink: 0;
}

.mm-tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  background: #fff;
  color: #444;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-speed);
  user-select: none;
  white-space: nowrap;
}

.mm-tb-btn:hover {
  background: #e8eef3;
  border-color: #b5bfc8;
}

.mm-tb-btn:active {
  background: #dce2e8;
}

.mm-tb-btn.active {
  background: #d5e8f5;
  border-color: #90b8d5;
}

.mm-tb-btn.disabled {
  opacity: var(--btn-disabled-opacity);
  pointer-events: none;
  cursor: default;
}

.mm-tb-btn svg {
  width: 16px;
  height: 16px;
}

.mm-tb-dropdown-wrap {
  position: relative;
}

.mm-tb-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  background: #fff;
  color: #444;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-speed);
  user-select: none;
}

.mm-tb-dropdown-btn:hover {
  background: #e8eef3;
}

.mm-tb-dropdown-btn .arrow {
  font-size: 8px;
  margin-left: 3px;
}

.mm-tb-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
  min-width: 140px;
  padding: 4px 0;
  z-index: 200;
}

.mm-tb-dropdown-menu.open {
  display: block;
}

.mm-tb-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  color: #333;
  transition: background var(--transition-speed);
}

.mm-tb-dropdown-item:hover {
  background: #f0f4f8;
}

.mm-tb-dropdown-item.selected {
  color: var(--tab-active);
  font-weight: 600;
}

.mm-tb-dropdown-item .shape-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

/* Font size input */
.mm-tb-input {
  width: 50px;
  height: 28px;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  padding: 0 4px;
  outline: none;
}

.mm-tb-input:focus {
  border-color: var(--tab-active);
}

.mm-tb-select {
  height: 28px;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  font-size: 12px;
  padding: 0 6px;
  outline: none;
  cursor: pointer;
  background: #fff;
}

/* Priority buttons */
.mm-priority-group,
.mm-progress-group {
  display: flex;
  gap: 2px;
  align-items: center;
}

.mm-priority-btn,
.mm-progress-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #ccc;
  cursor: pointer;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #666;
  transition: transform 0.1s;
}

.mm-priority-btn:hover,
.mm-progress-btn:hover {
  transform: scale(1.2);
}

.mm-priority-btn.p1 {
  background: #e74c3c;
  color: #fff;
  border-color: #c0392b;
}

.mm-priority-btn.p2 {
  background: #e67e22;
  color: #fff;
  border-color: #d35400;
}

.mm-priority-btn.p3 {
  background: #f1c40f;
  color: #fff;
  border-color: #f39c12;
}

/* Label input */
.mm-label-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mm-label-input {
  width: 80px;
  height: 26px;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  font-size: 12px;
  padding: 0 6px;
  outline: none;
}

.mm-label-input:focus {
  border-color: var(--tab-active);
}

/* ── Canvas ── */
.mm-canvas-wrap {
  width: 100%;
  flex: 1;
  min-height: 0;
  background: var(--canvas-bg);
  overflow: hidden;
  position: relative;
  cursor: default;
}

.mm-canvas-wrap.panning {
  cursor: grabbing;
}

.mm-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
}

.mm-svg {
  width: 100%;
  height: 100%;
}

.mm-focus-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 35;
  border: 1px solid #c7d4e2;
  background: rgba(255, 255, 255, 0.96);
  color: #2d3a47;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mm-focus-toggle:hover {
  background: #eef4fb;
  border-color: #97b2ce;
}

.mm-focus-toggle.active {
  background: #1f5cb8;
  border-color: #1f5cb8;
  color: #fff;
}

.mm-immersive-icon {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mm-focus-toggle .mm-immersive-icon {
  width: 20px;
  height: 20px;
}

/* ── Connections ── */
.mm-connection {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.7;
}

/* ── Nodes ── */
.mm-node {
  cursor: pointer;
}

.mm-node .mm-node-rect {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.08));
  transition: filter 0.15s;
}

.mm-node:hover .mm-node-rect {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

.mm-node.selected .mm-node-rect {
  filter: drop-shadow(0 0 0 transparent);
  stroke: #3d8bdd !important;
  stroke-width: 2.5px !important;
}

.mm-node-text {
  pointer-events: none;
  user-select: none;
}

.mm-text-checked {
  opacity: 0.55;
}

.mm-node.checked .mm-node-rect {
  opacity: 0.6;
}

/* ── Checkbox ── */
.mm-checkbox {
  transition: fill 0.15s;
}

.mm-checkbox:hover {
  filter: brightness(0.92);
}

.mm-checkbox-check {
  pointer-events: none;
}

/* ── Badges ── */
.mm-badge-priority {
  font-size: 9px;
  font-weight: 700;
  fill: #fff;
}

.mm-badge-progress-ring {
  fill: none;
  stroke-width: 2;
}

.mm-badge-progress-bg {
  stroke: #e0e0e0;
}

.mm-badge-progress-fg {
  stroke: #4caf50;
  transition: stroke-dashoffset 0.3s;
}

/* ── Labels ── */
.mm-node-label-bg {
  opacity: 0.85;
}

.mm-node-label {
  font-size: 9px;
  fill: #fff;
  font-weight: 600;
}

/* ── Link icon ── */
.mm-node-link-icon {
  cursor: pointer;
  user-select: none;
}

.mm-node-link-icon:hover {
  filter: brightness(1.2);
}

/* ── Collapse button ── */
.mm-collapse-btn {
  cursor: pointer;
}

.mm-collapse-btn circle {
  transition: fill 0.15s;
}

.mm-collapse-btn:hover circle {
  fill: #e8f0f5;
}

/* ── Drag & Drop ── */
.mm-drag-ghost {
  position: fixed;
  z-index: 9999;
  background: rgba(61, 139, 153, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  animation: ghost-fade-in 0.15s ease-out;
}

@keyframes ghost-fade-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.mm-drop-indicator {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  transition: all 0.1s ease;
}

.mm-drop-indicator.mm-drop-child {
  border: 2px dashed #3d8bdd;
  border-radius: 6px;
  background: rgba(61, 139, 221, 0.08);
}

.mm-drop-indicator.mm-drop-sibling {
  background: #3d8bdd;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(61, 139, 221, 0.5);
}

/* ── Inline Editor ── */
.mm-inline-editor {
  position: fixed;
  z-index: 500;
  background: #fff;
  border: 2px solid var(--tab-active);
  border-radius: 5px;
  padding: 4px 10px;
  font-family: 'Inter', sans-serif;
  outline: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
  min-width: 80px;
  white-space: nowrap;
}

/* ── Radial Menu ── */
.mm-radial {
  position: fixed;
  z-index: 600;
  display: none;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.mm-radial.open {
  display: block;
  pointer-events: auto;
}

.mm-radial-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--radial-center);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.15s;
  z-index: 3;
}

.mm-radial-center:hover {
  background: #35808e;
}

.mm-radial-item {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--radial-item-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #444;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -50%);
  transition: all 0.15s;
  z-index: 2;
  flex-direction: column;
  gap: 1px;
  text-align: center;
  line-height: 1.1;
}

.mm-radial-item:hover {
  background: var(--radial-item-hover);
  transform: translate(-50%, -50%) scale(1.12);
}

.mm-radial-item svg {
  width: 16px;
  height: 16px;
}

.mm-radial-outer {
  position: absolute;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--radial-item-bg);
  font-size: 10px;
  color: #555;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -50%);
  transition: all 0.15s;
  white-space: nowrap;
  z-index: 1;
}

.mm-radial-outer:hover {
  background: var(--radial-item-hover);
  transform: translate(-50%, -50%) scale(1.08);
}

/* ── Blank-Space Context Menu ── */
.mm-space-menu {
  position: fixed;
  z-index: 640;
  min-width: 250px;
  max-width: min(320px, 90vw);
  max-height: min(78vh, 640px);
  overflow-y: auto;
  display: none;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d7dde4;
  border-radius: 10px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
  padding: 6px 0;
  backdrop-filter: blur(8px);
}

.mm-space-menu.open {
  display: block;
}

.mm-space-menu-item {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  color: #2f3742;
  cursor: pointer;
  transition: background 0.12s ease;
}

.mm-space-menu-item:hover {
  background: #edf3f9;
}

.mm-space-menu-divider {
  height: 1px;
  background: #e4e8ee;
  margin: 4px 0;
}

/* ── Minimap ── */
.mm-minimap {
  position: absolute;
  right: 16px;
  bottom: 60px;
  width: 180px;
  height: 120px;
  background: var(--minimap-bg);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 30;
  border: 1px solid #e0e3e6;
  transition: opacity var(--transition-speed);
}

.mm-minimap.hidden {
  opacity: 0;
  pointer-events: none;
}

.mm-minimap svg {
  width: 100%;
  height: 100%;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.mm-minimap.dragging svg {
  cursor: grabbing;
}

.mm-minimap-viewport {
  fill: none;
  stroke: var(--tab-active);
  stroke-width: 2;
  opacity: 0.5;
  rx: 2;
  pointer-events: none;
}

/* ── Zoom Controls ── */
.mm-zoom-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 4px 6px;
  z-index: 30;
  border: 1px solid #e0e3e6;
}

.mm-zoom-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #444;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#zoom-max .mm-immersive-icon {
  width: 16px;
  height: 16px;
}

.mm-zoom-btn:hover {
  background: #e8eef3;
}

.mm-zoom-level {
  font-size: 11px;
  color: #666;
  min-width: 40px;
  text-align: center;
  user-select: none;
}

/* ── Note Sidebar ── */
.mm-note-sidebar {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  max-width: 90vw;
  background: #fff;
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.08);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.mm-note-sidebar.open {
  transform: translateX(0);
}

.mm-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.mm-note-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mm-note-save {
  height: 26px;
  border: 1px solid #b8c6d7;
  border-radius: 6px;
  background: #edf4fc;
  color: #224a7c;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.mm-note-save:hover {
  background: #dcebf9;
}

.mm-note-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mm-note-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
}

.mm-note-close:hover {
  color: #333;
}

.mm-note-body {
  flex: 1;
  padding: 12px 16px;
}

.mm-note-editor {
  width: 100%;
  height: 100%;
  border: 1px solid #e0e3e6;
  border-radius: 6px;
  padding: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  resize: none;
  outline: none;
  color: #333;
}

.mm-note-editor:focus {
  border-color: var(--tab-active);
}

/* ── Search Bar ── */
.mm-search-bar {
  position: absolute;
  top: 8px;
  right: 200px;
  display: none;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  padding: 6px 12px;
  z-index: 50;
  border: 1px solid #e0e3e6;
}

.mm-search-bar.open {
  display: flex;
}

.mm-search-input {
  border: 1px solid #d5d9de;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  width: 180px;
  outline: none;
}

.mm-search-input:focus {
  border-color: var(--tab-active);
}

.mm-search-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #666;
  padding: 2px 4px;
  border-radius: 3px;
}

.mm-search-btn:hover {
  background: #eee;
}

.mm-search-info {
  font-size: 11px;
  color: #888;
  min-width: 50px;
  text-align: center;
}

/* ── Color Popover ── */
.mm-color-popover {
  display: none;
  position: fixed;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 10px;
  z-index: 300;
  border: 1px solid #e0e3e6;
}

.mm-color-popover.open {
  display: block;
}

.mm-color-palette {
  display: grid;
  grid-template-columns: repeat(8, 24px);
  gap: 3px;
}

.mm-color-cell {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: transform 0.1s;
}

.mm-color-cell:hover {
  transform: scale(1.2);
  z-index: 1;
}

/* ── Toast ── */
.mm-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 13px;
  padding: 8px 20px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

.mm-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  body.mm-page .site-header .container.nav-row {
    padding: 10px 12px;
    min-height: 62px;
  }

  body.mm-page .brand-logo {
    width: 32px;
    height: 32px;
  }

  body.mm-page .brand-word {
    font-size: 23px;
  }

  .mm-header {
    padding: 0 8px;
  }

  .mm-title-input {
    width: 120px;
  }

  .mm-toolbar {
    padding: 4px 6px;
    gap: 3px;
  }

  .mm-tb-btn {
    font-size: 11px;
    padding: 0 5px;
    height: 28px;
  }

  .mm-minimap {
    width: 120px;
    height: 80px;
  }

  .mm-focus-toggle {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* ── Keyboard Shortcuts Help Overlay ── */
.mm-shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.mm-shortcuts-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.mm-shortcuts-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  padding: 28px 32px;
  max-width: 820px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.2s ease;
}

.mm-shortcuts-overlay.open .mm-shortcuts-panel {
  transform: translateY(0) scale(1);
}

.mm-shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mm-shortcuts-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}

.mm-shortcuts-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.mm-shortcuts-close:hover {
  background: #f0f0f0;
  color: #333;
}

.mm-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px 28px;
}

.mm-shortcuts-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #888;
  margin: 0 0 10px;
}

.mm-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: #444;
  border-bottom: 1px solid #f5f5f5;
}

.mm-shortcut-row kbd {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  color: #374151;
  box-shadow: 0 1px 0 #c5c5c5;
}

.mm-shortcut-row span:first-child {
  color: #555;
}

.mm-shortcut-row span:last-child {
  color: #888;
  font-size: 11px;
  text-align: right;
}

/* ── Selection Box ── */
.mm-selection-box {
  position: fixed;
  border: 1px solid #0984e3;
  background: rgba(9, 132, 227, 0.15);
  pointer-events: none;
  z-index: 9999;
}
/* ── Mermaid Import Modal ── */
.mm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100000;
  align-items: center;
  justify-content: center;
}
.mm-modal-overlay.open {
  display: flex;
}
.mm-modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  padding: 28px 32px 24px;
  width: min(960px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
}
.mm-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 0 4px;
}
.mm-modal-close:hover { color: #333; }
.mm-modal-hint {
  margin: 0;
  font-size: 13px;
  color: #555;
}
.mm-modal-hint code {
  background: #f3f4f6;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.mm-modal-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mm-modal-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef6f8;
  color: #2f6470;
  border: 1.5px solid #bdd2d8;
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.mm-modal-file-btn input {
  display: none;
}
.mm-modal-file-name {
  font-size: 12px;
  color: #55606d;
  max-width: 64ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-modal-textarea {
  width: 100%;
  height: clamp(320px, 52vh, 620px);
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  line-height: 1.55;
  color: #1e293b;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  tab-size: 2;
  transition: border-color 0.15s;
}
.mm-modal-textarea:focus {
  border-color: #3d8b99;
  box-shadow: 0 0 0 3px rgba(61,139,153,0.15);
}
.mm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mm-modal-cancel {
  background: none;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
  transition: background 0.12s;
}
.mm-modal-cancel:hover { background: #f3f4f6; }
.mm-modal-submit {
  background: #3d8b99;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.mm-modal-submit:hover { background: #2e7280; }
