/* ============================================================
   MindFlow - スタイルシート
   ============================================================ */

/* ---- CSS変数（テーマ） ---- */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --bg-surface: #1e2a4a;
  --bg-hover: #253659;
  --bg-active: #2d4270;
  --text-primary: #e8eaf6;
  --text-secondary: #9fa8da;
  --text-muted: #5c6bc0;
  --accent: #4fc3f7;
  --accent-hover: #81d4fa;
  --accent-2: #a78bfa;
  --border: #2d3748;
  --border-light: #374151;
  --danger: #ef5350;
  --success: #66bb6a;
  --warning: #ffa726;
  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 240px;
  --right-panel-width: 220px;
  --menubar-height: 40px;
  --toolbar-height: 48px;
  --sheettabs-height: 36px;
  --transition: 0.15s ease;
}

/* ---- リセット ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: 'Segoe UI', 'Hiragino Sans', Meiryo, sans-serif; font-size: 13px; background: var(--bg-primary); color: var(--text-primary); }
button { background: none; border: none; cursor: pointer; color: inherit; font: inherit; }
input, textarea { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); font: inherit; border-radius: var(--radius); padding: 6px 10px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
svg { display: block; }

/* ============================================================
   メニューバー
   ============================================================ */
#menu-bar {
  display: flex;
  align-items: center;
  height: var(--menubar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  gap: 8px;
  position: relative;
  z-index: 200;
  user-select: none;
}
.menu-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-right: 12px;
  letter-spacing: 1px;
}
.menu-nav { display: flex; gap: 2px; }
.menu-item {
  position: relative;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.menu-item.open { background: var(--bg-hover); color: var(--text-primary); }

.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 300;
}
.menu-item.open .dropdown { display: block; }
.dropdown button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: background var(--transition);
}
.dropdown button:hover { background: var(--bg-hover); }
.kbd { font-size: 11px; color: var(--text-muted); background: var(--bg-tertiary); padding: 1px 5px; border-radius: 3px; }
.submenu-label { padding: 4px 10px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.marker-grid { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px; }
.marker-grid span { font-size: 18px; cursor: pointer; padding: 2px; border-radius: 4px; transition: background var(--transition); }
.marker-grid span:hover { background: var(--bg-hover); }
.color-grid { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px; }
.color-swatch { width: 20px; height: 20px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: border-color var(--transition); }
.color-swatch:hover { border-color: var(--text-primary); }

.menu-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
#collaborators-bar { display: flex; gap: -4px; }
.collab-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  border: 2px solid var(--bg-secondary);
  margin-left: -6px;
  cursor: default;
}
#user-name-area { display: flex; align-items: center; gap: 6px; }
#user-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--bg-primary); }
#user-name-display { color: var(--text-secondary); font-size: 12px; }
#btn-change-name { color: var(--text-muted); padding: 2px; font-size: 12px; }
#btn-change-name:hover { color: var(--text-primary); }

/* ============================================================
   メインレイアウト
   ============================================================ */
#main-layout {
  display: flex;
  height: calc(100vh - var(--menubar-height));   /* fallback */
  height: calc(100dvh - var(--menubar-height));  /* iOS/Android URL bar対応 */
  overflow: hidden;
}

/* ============================================================
   サイドバー
   ============================================================ */
#sidebar {
  width: var(--sidebar-width);
  min-width: 160px;
  max-width: 400px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar-btns { display: flex; gap: 2px; }
.sidebar-btns button { padding: 4px; border-radius: var(--radius); color: var(--text-muted); }
.sidebar-btns button:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-btns button svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
#sidebar-search { padding: 6px 8px; }
#sidebar-search-input { width: 100%; font-size: 12px; }

#directory-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
#directory-tree::-webkit-scrollbar { width: 4px; }
#directory-tree::-webkit-scrollbar-track { background: transparent; }
#directory-tree::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.tree-item {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: var(--radius);
  margin: 1px 4px;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.tree-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.tree-item.active { background: var(--bg-active); color: var(--text-primary); }
.tree-item.drag-over { background: var(--accent); color: var(--bg-primary); }
.tree-item.drag-above { border-top: 2px solid var(--accent); }
.tree-item.drag-below { border-bottom: 2px solid var(--accent); }
.tree-item.selected-dir { outline: 1px solid var(--accent); outline-offset: -1px; }

.tree-item .item-icon { font-size: 14px; flex-shrink: 0; }
.tree-item .item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .item-actions { display: none; gap: 2px; }
.tree-item:hover .item-actions { display: flex; }
.tree-item .item-actions button { padding: 2px 4px; font-size: 11px; border-radius: 3px; color: var(--text-muted); }
.tree-item .item-actions button:hover { background: var(--border); color: var(--text-primary); }

.tree-folder-toggle { width: 14px; font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.tree-children { margin-left: 12px; }

.tree-item[data-type="mindmap"] .item-icon::before { content: '🗺'; }
.tree-item[data-type="flowchart"] .item-icon::before { content: '📊'; }
.tree-item[data-type="folder"] .item-icon::before { content: '📁'; }
.tree-item[data-type="folder"].open .item-icon::before { content: '📂'; }

/* リサイザー */
#sidebar-resizer {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  transition: background var(--transition);
  flex-shrink: 0;
}
#sidebar-resizer:hover, #sidebar-resizer.dragging { background: var(--accent); }

/* ============================================================
   エディタエリア
   ============================================================ */
#editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ツールバー */
#toolbar {
  height: var(--toolbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  flex-shrink: 0;
}
.toolbar-section { display: flex; align-items: center; gap: 2px; flex: 1; }
.toolbar-section.hidden { display: none; }
.tb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 10px;
  transition: background var(--transition), color var(--transition);
  min-width: 40px;
}
.tb-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tb-btn.active { background: var(--accent); color: var(--bg-primary); }
.tb-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tb-sep { width: 1px; height: 30px; background: var(--border); margin: 0 4px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tb-check { display: flex; align-items: center; gap: 4px; color: var(--text-secondary); cursor: pointer; }
.tb-check input { width: auto; padding: 0; }

#zoom-control { display: flex; align-items: center; gap: 4px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 6px; }
#zoom-control button { padding: 2px 6px; border-radius: 3px; color: var(--text-secondary); }
#zoom-control button:hover { background: var(--bg-hover); color: var(--text-primary); }
#zoom-label { font-size: 12px; min-width: 40px; text-align: center; color: var(--text-secondary); }

/* パンくずリスト */
#breadcrumb {
  height: 28px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px 0 12px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  gap: 6px;
}
#breadcrumb.hidden { display: none; }
.bc-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-folder, .bc-file { color: var(--text-secondary); }
.bc-file { color: var(--text-primary); font-weight: 500; }
.bc-sheet { color: var(--accent); font-weight: 600; }
.bc-sep { color: var(--text-muted); padding: 0 4px; }

.bc-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.bc-copy-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary, rgba(255,255,255,0.06));
  border-color: var(--border);
}
.bc-copy-btn.copied {
  color: #34d399;
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}
.bc-copy-btn.copied::after {
  content: "✓";
  position: absolute;
  margin-left: 18px;
  font-size: 11px;
  color: #34d399;
  font-weight: 700;
  white-space: nowrap;
}
.bc-copy-btn svg { display: block; }

/* キャンバスコンテナ */
#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
  background-image: radial-gradient(circle, var(--border-light) 1px, transparent 1px);
  background-size: 20px 20px;
}
#canvas-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
}
#canvas-wrapper svg { width: 100%; height: 100%; touch-action: none; }

/* カーソルレイヤー */
#cursors-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 50;
}
.remote-cursor {
  position: absolute;
  pointer-events: none;
  transition: transform 0.1s ease;
}
.remote-cursor svg { width: 20px; height: 20px; }
.remote-cursor-label {
  position: absolute;
  top: 20px; left: 4px;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  font-weight: 600;
}

/* ウェルカム画面 */
#welcome-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 10;
}
#welcome-screen.hidden { display: none; }
.welcome-content { text-align: center; }
.welcome-logo { font-size: 48px; font-weight: 700; color: var(--accent); margin-bottom: 16px; letter-spacing: 2px; }
.welcome-content p { color: var(--text-secondary); margin-bottom: 24px; }
.welcome-btns { display: flex; gap: 12px; justify-content: center; }
.welcome-btns button {
  padding: 10px 24px;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition);
}
.welcome-btns button:hover { background: var(--accent-hover); }

/* シートタブ */
#sheet-tabs {
  height: var(--sheettabs-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  flex-shrink: 0;
}
#sheet-tabs-list { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
#sheet-tabs-list::-webkit-scrollbar { height: 0; }
.sheet-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
}
.sheet-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.sheet-tab.active { background: var(--bg-active); color: var(--text-primary); border-color: var(--border); }
.sheet-tab .tab-close { color: var(--text-muted); font-size: 10px; padding: 1px 3px; border-radius: 2px; }
.sheet-tab .tab-close:hover { background: var(--danger); color: white; }
#btn-add-sheet {
  padding: 4px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 16px;
}
#btn-add-sheet:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   右パネル（プロパティ）
   ============================================================ */
#right-panel {
  width: var(--right-panel-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
#right-panel-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* プロパティを閉じる ✕ ボタン（PCでは非表示、モバイルのみ表示） */
#btn-close-props {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius);
}
#btn-close-props:active { background: var(--bg-active); }
#properties-content { flex: 1; overflow-y: auto; padding: 12px; }
.prop-empty { color: var(--text-muted); font-size: 12px; text-align: center; margin-top: 20px; }
.prop-section { margin-bottom: 16px; }
.prop-section-title { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.prop-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.prop-label { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.prop-input { width: 100%; font-size: 12px; }
.prop-color-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  cursor: pointer;
}
.prop-colors { display: flex; flex-wrap: wrap; gap: 4px; }
.prop-color-swatch {
  width: 22px; height: 22px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--transition);
}
.prop-color-swatch:hover { border-color: var(--text-primary); transform: scale(1.1); }
.prop-color-swatch.selected { border-color: var(--accent); }
.prop-color-reset {
  background: var(--bg-secondary) !important;
  color: var(--text-muted);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border) !important;
}
.prop-btn-row { display: flex; gap: 6px; }
.prop-btn {
  flex: 1;
  padding: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  transition: background var(--transition), color var(--transition);
}
.prop-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.prop-btn.active { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); }
.prop-toggle { display: flex; gap: 4px; }
.prop-toggle button {
  flex: 1;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.prop-toggle button.active { background: var(--accent); color: var(--bg-primary); border-color: transparent; }
.markers-display { display: flex; flex-wrap: wrap; gap: 4px; }
.marker-tag { display: flex; align-items: center; gap: 3px; background: var(--bg-surface); border-radius: 3px; padding: 2px 6px; font-size: 12px; }
.marker-tag .remove-marker { color: var(--text-muted); cursor: pointer; }
.marker-tag .remove-marker:hover { color: var(--danger); }

/* ============================================================
   マインドマップ（SVG要素）
   ============================================================ */
.mm-node { cursor: pointer; }
.mm-node rect, .mm-node path {
  transition: filter 0.1s;
}
.mm-node:hover rect { filter: brightness(1.2); }
.mm-node.selected rect { filter: brightness(1.3); stroke: #60a5fa !important; stroke-width: 2.5px !important; }
.mm-node text { pointer-events: none; user-select: none; }
.mm-link { pointer-events: none; }
.mm-toggle { cursor: pointer; }
.mm-toggle circle { transition: fill 0.1s; }
.mm-toggle:hover circle { fill: var(--accent) !important; }

/* SEQボタン */
.mm-seq-btn { cursor: pointer; }
.mm-seq-btn circle { transition: fill 0.15s, stroke 0.15s; }
.mm-seq-btn:hover circle { filter: brightness(1.3); }

/* ノード編集用インプット */
#mm-edit-input {
  position: absolute;
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  color: var(--text-primary);
  font-family: inherit;
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
  z-index: 100;
  min-width: 80px;
  resize: none;
  overflow: hidden;
  line-height: 1.35;
}

/* シートリンクピッカー */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay .modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(520px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.modal-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-overlay .modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-overlay .modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-overlay .modal-close:hover { background: var(--danger); color: white; }
.modal-overlay .modal-body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}
/* リンク先シート選択ボタン（プロパティパネル側） */
.prop-link-sheet-btn {
  flex: 1;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 4px;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.prop-link-sheet-btn.no-link {
  background: transparent;
  border: 1px dashed var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.prop-link-sheet-btn.no-link:hover {
  background: rgba(79, 195, 247, 0.12);
  border-style: solid;
}
.prop-link-sheet-btn.has-link {
  background: var(--bg-tertiary, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.prop-link-sheet-btn.has-link:hover {
  background: rgba(79, 195, 247, 0.08);
  border-color: var(--accent);
}

/* シートリンクピッカーモーダル — ディレクトリツリー */
.slp-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  user-select: none;
}
.slp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.slp-row:hover { background: var(--bg-tertiary, rgba(255,255,255,0.06)); }
.slp-row.dir { color: var(--text-secondary); font-weight: 600; }
.slp-row.file { color: var(--text-primary); }
.slp-row.sheet { color: var(--text-primary); }
.slp-row.sheet.current {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.12);
  color: var(--accent);
  font-weight: 600;
}
.slp-row.disabled {
  color: var(--text-muted);
  cursor: default;
}
.slp-row.disabled:hover { background: transparent; }
.slp-toggle {
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}
.slp-icon { width: 18px; flex-shrink: 0; text-align: center; }
.slp-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slp-empty { text-align: center; color: var(--text-muted); padding: 30px 20px; font-size: 12px; }

/* ============================================================
   ヘルプモーダル
   ============================================================ */
.help-overlay .help-modal {
  width: min(960px, 95vw);
  max-height: 90vh;
  height: 700px;
}
.help-header h3 { color: var(--text-primary); }
.help-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.help-nav {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.help-nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-family: inherit;
}
.help-nav-item:hover {
  background: var(--bg-tertiary, rgba(255,255,255,0.06));
  color: var(--text-primary);
}
.help-nav-item.active {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent);
  font-weight: 600;
}
.help-content {
  flex: 1;
  padding: 20px 28px;
  overflow-y: auto;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 13px;
  outline: none;
}
.help-content h2 {
  font-size: 20px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.help-content h3 {
  font-size: 15px;
  margin: 20px 0 8px;
  color: var(--accent);
}
.help-content p { margin: 8px 0; color: var(--text-secondary); }
.help-content ul { margin: 8px 0; padding-left: 22px; color: var(--text-secondary); }
.help-content li { margin: 4px 0; }
.help-content strong { color: var(--text-primary); }
.help-content em { color: var(--text-primary); font-style: normal; background: rgba(167, 139, 250, 0.15); padding: 0 4px; border-radius: 3px; }
.help-content .kbd {
  display: inline-block;
  background: var(--bg-tertiary, #11182f);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  font-family: 'Consolas','Menlo',monospace;
  font-size: 11px;
  color: var(--text-primary);
  margin: 0 2px;
  white-space: nowrap;
}
.help-content .hg-icon { font-size: 13px; }
.help-content .hg-mock {
  display: block;
  width: 100%;
  max-width: 540px;
  height: auto;
  margin: 12px auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.help-content .hg-code {
  background: #0d1326;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: 'Consolas','Menlo',monospace;
  font-size: 12px;
  color: #cfd8dc;
  overflow-x: auto;
  margin: 10px 0;
  white-space: pre;
}
.help-content .hg-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}
.help-content .hg-table th,
.help-content .hg-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.help-content .hg-table th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
}
.help-content .hg-table tbody tr:nth-child(odd) td {
  background: rgba(255,255,255,0.02);
}

/* レスポンシブ：狭い画面ではナビを上部にスタック */
@media (max-width: 720px) {
  .help-overlay .help-modal { height: 90vh; }
  .help-body { flex-direction: column; }
  .help-nav {
    width: 100%;
    height: auto;
    max-height: 120px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px;
  }
  .help-nav-item { white-space: nowrap; flex-shrink: 0; }
  .help-content { padding: 14px; }
}

/* ============================================================
   フロー図（SVG要素）
   ============================================================ */
.fc-shape { cursor: pointer; }
.fc-shape:hover .fc-shape-bg { filter: brightness(1.15); }
.fc-shape.selected .fc-shape-bg { filter: brightness(1.2); }
.fc-shape.selected .fc-selection-rect { display: block !important; }
.fc-selection-rect { display: none; }
.fc-shape text { pointer-events: none; user-select: none; }
.fc-connection { cursor: pointer; }
.fc-connection:hover path { stroke-width: 3 !important; }
.fc-connection.selected path { stroke-width: 3 !important; }
.fc-conn-label { cursor: pointer; }
.fc-resize-handle { cursor: nwse-resize; }
.fc-conn-point {
  cursor: crosshair;
  opacity: 0;
  transition: opacity 0.1s;
}
.fc-shape:hover .fc-conn-point { opacity: 1; }
.fc-temp-line { pointer-events: none; }

/* フロー図 テキスト編集 */
#fc-edit-input {
  position: absolute;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text-primary);
  font-family: inherit;
  text-align: center;
  outline: none;
  z-index: 100;
  resize: none;
  overflow: hidden;
}

/* グリッドスナップ表示 */
.fc-grid line { stroke: var(--border); stroke-width: 0.5; }

/* ============================================================
   モーダル
   ============================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
#modal-overlay.hidden { display: none; }
#modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 360px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
#modal-title { font-size: 15px; font-weight: 600; }
#modal-close { color: var(--text-muted); padding: 4px; border-radius: var(--radius); }
#modal-close:hover { background: var(--danger); color: white; }
#modal-body { padding: 16px; overflow-y: auto; flex: 1; }
#modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.modal-input-group { margin-bottom: 12px; }
.modal-input-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.modal-input-group input, .modal-input-group select, .modal-input-group textarea { width: 100%; }

.btn-primary {
  padding: 8px 20px;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  transition: background var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  padding: 8px 20px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border-radius: var(--radius);
  font-size: 13px;
  transition: background var(--transition);
}
.btn-secondary:hover { background: var(--bg-active); }
.btn-danger {
  padding: 8px 20px;
  background: var(--danger);
  color: white;
  border-radius: var(--radius);
  font-size: 13px;
  transition: opacity var(--transition);
}
.btn-danger:hover { opacity: 0.85; }

/* ============================================================
   コンテキストメニュー
   ============================================================ */
#context-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 4px;
  min-width: 180px;
  z-index: 500;
}
#context-menu.hidden { display: none; }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  transition: background var(--transition);
}
.ctx-item:hover { background: var(--bg-hover); }
.ctx-item.danger:hover { background: var(--danger); }
.ctx-item .ctx-icon { width: 16px; text-align: center; }
.ctx-sep { border-top: 1px solid var(--border); margin: 3px 0; }

/* ============================================================
/* ============================================================
   ノートパネル
   ============================================================ */
#note-panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 300px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: var(--shadow);
  transform: translateX(0);
  transition: transform var(--transition);
}
#note-panel.hidden { transform: translateX(100%); pointer-events: none; }
#note-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
#note-panel-close { color: var(--text-muted); padding: 4px 6px; border-radius: var(--radius); }
#note-panel-close:hover { background: var(--danger); color: white; }
#note-editor {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.8;
  outline: none;
  font-family: inherit;
}
#note-panel-footer {
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  height: 30px;
}

/* ============================================================
   添付ファイル表示
   ============================================================ */
.attachment-list { display: flex; flex-direction: column; gap: 4px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  font-size: 12px;
}
.attachment-item .att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.attachment-item .att-download { color: var(--accent); cursor: pointer; }
.attachment-item .att-delete { color: var(--text-muted); cursor: pointer; }
.attachment-item .att-delete:hover { color: var(--danger); }

/* ============================================================
   テーマ：ダーク
   ============================================================ */
body.theme-dark {
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-tertiary: #27272a;
  --bg-surface: #27272a;
  --bg-hover: #3f3f46;
  --bg-active: #52525b;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-2: #c084fc;
  --border: #3f3f46;
  --border-light: #52525b;
}

/* テーマ：オーシャン */
body.theme-ocean {
  --bg-primary: #0d1b2a;
  --bg-secondary: #1b263b;
  --bg-tertiary: #415a77;
  --bg-surface: #1b263b;
  --bg-hover: #22304d;
  --bg-active: #2d3f60;
  --text-primary: #e0e1dd;
  --text-secondary: #a8b2d8;
  --text-muted: #6b7fa3;
  --accent: #00b4d8;
  --accent-hover: #48cae4;
  --border: #2d3f60;
  --border-light: #415a77;
}

/* テーマ：フォレスト */
body.theme-forest {
  --bg-primary: #0d1f0d;
  --bg-secondary: #1a2e1a;
  --bg-tertiary: #2d4a2d;
  --bg-surface: #1a2e1a;
  --bg-hover: #243824;
  --bg-active: #2d4a2d;
  --text-primary: #e8f5e9;
  --text-secondary: #a5d6a7;
  --text-muted: #66bb6a;
  --accent: #69f0ae;
  --accent-hover: #b9f6ca;
  --border: #2d4a2d;
  --border-light: #3d6b3d;
}

/* テーマ：サンセット */
body.theme-sunset {
  --bg-primary: #1a0a0a;
  --bg-secondary: #2e1a1a;
  --bg-tertiary: #4a2c2c;
  --bg-surface: #2e1a1a;
  --bg-hover: #3d2424;
  --bg-active: #4a2c2c;
  --text-primary: #fce4ec;
  --text-secondary: #f48fb1;
  --text-muted: #e57373;
  --accent: #ff6e40;
  --accent-hover: #ff9e80;
  --border: #4a2c2c;
  --border-light: #6d3b3b;
}

/* ============================================================
   スクロールバー共通
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================================
   アニメーション
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dropdown { animation: fadeIn 0.12s ease; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.saving { animation: pulse 1s infinite; }

/* ============================================================
   マーカーレビューバー
   ============================================================ */
#marker-review-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  position: relative;
  z-index: 90;
}
#marker-review-bar.active { display: flex; }

#marker-review-bar .mrb-filter {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
#marker-review-bar .mrb-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
#marker-review-bar .mrb-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
#marker-review-bar .mrb-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
#marker-review-bar .mrb-count {
  font-size: 11px;
  opacity: 0.7;
}
#marker-review-bar .mrb-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
#marker-review-bar .mrb-nav button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
#marker-review-bar .mrb-nav button:hover { background: var(--bg-hover); }
#marker-review-bar .mrb-nav button:disabled { opacity: 0.3; cursor: default; }
#marker-review-bar .mrb-pos {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 12px;
}
#marker-review-bar .mrb-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
}
#marker-review-bar .mrb-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ハイライト */
.mm-node.review-highlight rect {
  stroke-width: 3 !important;
  filter: drop-shadow(0 0 8px var(--accent));
}

/* ============================================================
   ユーティリティ
   ============================================================ */
/* ============================================================
   ライトテーマ
   ============================================================ */
body.theme-light {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8eaf6;
  --bg-surface: #ffffff;
  --bg-hover: #e3e8f0;
  --bg-active: #c5cae9;
  --text-primary: #1a1a2e;
  --text-secondary: #3949ab;
  --text-muted: #7986cb;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-2: #7c3aed;
  --border: #d1d5db;
  --border-light: #e5e7eb;
  --danger: #ef5350;
  --success: #43a047;
  --warning: #fb8c00;
  --shadow: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

/* SVGキャンバス背景 */
body.theme-light #mm-canvas,
body.theme-light #fc-canvas {
  background-color: #f5f5f5;
}

/* ドット背景の色調整 */
body.theme-light .canvas-bg-dots {
  stroke: #d1d5db;
  opacity: 0.7;
}

.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

/* ============================================================
   モバイル対応 (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* ---- メニューバー ---- */
  #menu-bar {
    padding: 0 4px;
    gap: 2px;
    flex-wrap: nowrap;
    overflow: hidden;
    height: var(--menubar-height);
    min-height: var(--menubar-height);
  }
  .menu-logo { font-size: 13px; margin-right: 2px; flex-shrink: 0; white-space: nowrap; }
  /* モバイルではメニューナビを非表示（サイドバードロワーで代替） */
  .menu-nav { display: none; }
  /* ユーザー名を隠す */
  #user-name-display, #btn-change-name { display: none; }
  #user-avatar { width: 22px; height: 22px; font-size: 10px; flex-shrink: 0; }
  /* メニュー右側をコンパクト化 */
  .menu-right { gap: 2px; flex-shrink: 0; align-items: center; }
  #btn-delete-account { display: none; }
  #btn-change-password { display: none; }
  #btn-logout { padding: 2px 8px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
  #collaborators-bar { display: none; } /* モバイルでは共同編集アバター非表示 */

  /* ---- サイドバー：オーバーレイドロワー ---- */
  #sidebar {
    position: fixed;
    left: -280px;
    top: var(--menubar-height);
    width: 260px !important;
    max-width: 80vw;
    height: calc(100vh - var(--menubar-height));
    height: calc(100dvh - var(--menubar-height));
    z-index: 500;
    transition: left 0.25s ease;
    box-shadow: var(--shadow);
  }
  #sidebar.mobile-open { left: 0; }
  #sidebar-resizer { display: none; }

  /* サイドバー開閉オーバーレイ */
  #mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 490;
  }
  #mobile-sidebar-overlay.active { display: block; }

  /* ---- ツールバー ---- */
  #toolbar {
    height: var(--toolbar-height);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px;
    gap: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  #toolbar::-webkit-scrollbar { display: none; }
  /* ツールバーセクションをflexで均等分配 */
  .toolbar-section { flex: 1; flex-wrap: nowrap; gap: 2px; min-width: 0; }
  .tb-btn {
    flex: 1;
    min-width: 0;
    max-width: 36px;
    padding: 4px 1px;
    font-size: 9px;
  }
  .tb-btn svg { width: 14px; height: 14px; }
  .tb-btn span { display: none; }
  /* ズームコントロールは固定幅を維持 */
  .toolbar-right { margin-left: auto; flex-shrink: 0; gap: 4px; }
  #zoom-control { padding: 2px 2px; gap: 2px; }
  #zoom-label { min-width: 26px; font-size: 11px; }
  #zoom-control button { min-width: 22px; width: 22px; padding: 2px 1px; }

  /* ---- シートタブ ---- */
  #sheet-tabs-bar { font-size: 11px; }
  .sheet-tab { padding: 4px 10px; }

  /* ---- レビューバー ---- */
  #marker-review-bar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  #marker-review-bar .mrb-nav { margin-left: 0; }

  /* ---- モーダル ---- */
  #modal-overlay .modal { width: 95vw; max-width: 95vw; }

  /* ---- 右パネル ---- */
  #right-panel {
    position: fixed;
    right: -260px;
    top: var(--menubar-height);
    width: 240px;
    height: calc(100vh - var(--menubar-height));
    height: calc(100dvh - var(--menubar-height));
    z-index: 500;
    transition: right 0.25s ease;
    box-shadow: var(--shadow);
  }
  #right-panel.mobile-open { right: 0; }
  #btn-close-props { display: block; }

  /* パンくず非表示 */
  #breadcrumb { display: none; }

  /* 右パネルトグルボタン */
  #btn-mobile-props { display: flex; }

  /* メニューナビの文字（非表示だが念のため） */
  .menu-item { font-size: 11px; padding: 4px 5px; white-space: nowrap; }

  /* シートタブを使いやすく */
  .sheet-tab { padding: 5px 10px; font-size: 12px; }
  #btn-add-sheet { font-size: 18px; width: 32px; }
}

/* ---- モバイルノード操作バー ---- */
#mobile-node-bar {
  display: none; /* デフォルト非表示（PCも含む） */
}
@media (max-width: 768px) {
  /* デフォルトは非表示のまま（.visibleで表示） */
  #mobile-node-bar.visible {
    display: flex;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 6px 6px;
    gap: 4px;
    justify-content: space-between;
  }
  #mobile-node-bar button {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 2px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  #mobile-node-bar button:active { background: var(--bg-active); }
  #mobile-node-bar .mnb-danger { color: var(--danger); border-color: var(--danger); }
  #mobile-node-bar #mnb-fit { color: var(--accent); border-color: var(--accent); }
  /* 子・兄弟追加ボタンはアクセント色で「追加」を強調 */
  #mobile-node-bar #mnb-child,
  #mobile-node-bar #mnb-sib { color: var(--accent); border-color: var(--accent); }
  #mobile-node-bar button.active {
    background: var(--accent);
    color: #0a0a14;
    border-color: var(--accent);
  }
}

/* ---- タッチ専用デバイス（hover不可）: ホバーで出るUIを常時表示 ---- */
@media (hover: none), (max-width: 768px) {
  /* サイドバーのアクションボタン群: タッチ環境では常時表示 */
  .tree-item .item-actions { display: flex; }
}

/* ---- モバイル用ボトムシート（マーカーピッカー / その他操作） ---- */
#mobile-marker-sheet,
#mobile-more-sheet {
  display: none;
}
#mobile-marker-sheet.hidden,
#mobile-more-sheet.hidden { display: none; }
@media (max-width: 768px) {
  #mobile-marker-sheet:not(.hidden),
  #mobile-more-sheet:not(.hidden) {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1050;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    padding: 8px 12px 16px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
    animation: mms-slide-up .18s ease;
  }
  #mobile-marker-sheet .mms-handle,
  #mobile-more-sheet .mms-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 4px auto 8px;
  }
  #mobile-marker-sheet .mms-title,
  #mobile-more-sheet .mms-title {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 10px;
  }
  #mobile-marker-sheet .mms-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }
  #mobile-marker-sheet .mms-grid button {
    min-height: 48px;
    font-size: 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
  }
  #mobile-marker-sheet .mms-grid button.active {
    background: var(--accent);
    border-color: var(--accent);
  }
  /* その他操作シートの縦並びリスト */
  #mobile-more-sheet .mms-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
  }
  #mobile-more-sheet .mms-list button {
    min-height: 48px;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    padding: 0 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
  }
  #mobile-more-sheet .mms-list button:active { background: var(--bg-active); }
  #mobile-marker-sheet .mms-close,
  #mobile-more-sheet .mms-close {
    width: 100%;
    min-height: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  @keyframes mms-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

/* ---- モバイル用ハンバーガーボタン（デフォルト非表示） ---- */
#btn-mobile-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  flex-shrink: 0;
}
#btn-mobile-menu:hover { background: var(--bg-hover); color: var(--text-primary); }
#btn-mobile-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---- モバイル用プロパティパネルボタン（デフォルト非表示） ---- */
#btn-mobile-props {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  flex-shrink: 0;
}
#btn-mobile-props:hover { background: var(--bg-hover); color: var(--text-primary); }
#btn-mobile-props svg { width: 18px; height: 18px; }

/* モバイルで表示 */
@media (max-width: 768px) {
  #btn-mobile-menu { display: flex; }
  #btn-mobile-props { display: flex; }
}
