/* 章節心智圖（js/mind/view.js） */
html.is-mapping, html.is-mapping body { overflow: hidden; }
html.is-mapping .jump-fab, html.is-mapping .notes-fab { display: none !important; }
.mm-sheet { position: fixed; inset: 0; z-index: 110; display: flex; flex-direction: column; background: radial-gradient(120% 70% at 50% 0%, #1A2A4C 0%, #0A1120 60%, #060A13 100%); opacity: 0; transform: translateY(14px); transition: opacity .2s, transform .2s var(--ease); }
.mm-sheet.is-in { opacity: 1; transform: none; }
.mm-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px; border-bottom: 1px solid var(--line); }
.mm-top > b { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--serif); font-size: 1.05rem; letter-spacing: .08em; }
.mm-nav { display: flex; gap: 6px; }
.mm-nav button, .mm-x { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--text); }
.mm-nav button:disabled { opacity: .28; cursor: default; }
.mm-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); }
.mm-tip { margin-top: 16px; text-align: center; font-size: .78rem; color: var(--text-3); }

.mm-map { margin-inline: auto; }
.mm-map button { font: inherit; color: inherit; }
.mm-root { position: relative; z-index: 1; padding: 14px 16px; border-radius: 22px; text-align: center; background: linear-gradient(180deg, #FFE3A6, #F2C46D); color: #1B1406; box-shadow: 0 0 0 6px rgba(242, 196, 109, .16), 0 18px 44px -18px rgba(242, 196, 109, .8); }
.mm-root small { font-size: .76rem; font-weight: 700; letter-spacing: .18em; opacity: .75; }
.mm-root h2 { margin: 2px 0; font-family: var(--serif); font-weight: 900; font-size: 1.38rem; line-height: 1.35; letter-spacing: .06em; }
.mm-root p { font-size: .84rem; line-height: 1.55; opacity: .82; }

.mm-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; padding: 8px 12px 8px 8px; border: 0; border-radius: 999px; text-align: left; background: color-mix(in oklab, var(--c), #0A1120 72%); box-shadow: inset 0 0 0 1.5px var(--c); }
.mm-head i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c); color: #10172A; font-style: normal; font-weight: 700; font-size: .88rem; }
.mm-head b { font-family: var(--serif); font-size: 1.04rem; letter-spacing: .06em; }
.mm-head small { font-size: .74rem; white-space: nowrap; color: var(--c); }
.mm-kids { margin: 0; padding: 0; list-style: none; }
.mm-leaf { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; padding: 6px 10px 6px 12px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .055); text-align: left; font-size: .9rem; line-height: 1.5; }
.mm-leaf span { min-width: 0; }
.mm-leaf small { flex: none; font-size: .72rem; font-variant-numeric: tabular-nums; color: var(--text-3); }
.mm-leaf.is-key { background: color-mix(in oklab, var(--c), transparent 82%); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c), transparent 40%); font-weight: 700; }
.mm-leaf.is-key small { color: var(--c); }

/* 手機：中心往下一根主幹，大分支從主幹彎出去，小分支再從大分支彎出去 */
.mm-map.is-tall { max-width: 32rem; }
.mm-trunk { position: relative; padding-top: 6px; }
.mm-trunk .mm-branch { position: relative; padding: 14px 0 0 24px; }
.mm-trunk .mm-branch::before { content: ""; position: absolute; left: 8px; top: -8px; width: 16px; height: 45px; border-left: 2.5px solid var(--c); border-bottom: 2.5px solid var(--c); border-bottom-left-radius: 14px; }
.mm-trunk .mm-branch:not(:last-child)::after { content: ""; position: absolute; left: 8px; top: 22px; bottom: -8px; border-left: 2.5px solid rgba(255, 255, 255, .16); }
.mm-trunk .mm-kids li { position: relative; padding: 6px 0 0 30px; }
.mm-trunk .mm-kids li::before { content: ""; position: absolute; left: 14px; top: 0; width: 14px; height: 27px; border-left: 2px solid color-mix(in oklab, var(--c), transparent 35%); border-bottom: 2px solid color-mix(in oklab, var(--c), transparent 35%); border-bottom-left-radius: 11px; }
.mm-trunk .mm-kids li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 14px; bottom: 0; border-left: 2px solid color-mix(in oklab, var(--c), transparent 35%); }

.mm-chain { margin-top: 20px; padding: 12px 14px; border-radius: 16px; text-align: center; box-shadow: inset 0 0 0 1px var(--line-strong); }
.mm-chain small { font-size: .74rem; letter-spacing: .2em; color: var(--light-hi); }
.mm-chain p { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; margin-top: 6px; }
.mm-chain span { padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, .09); font-family: var(--serif); font-weight: 700; font-size: .95rem; }
.mm-chain em { font-style: normal; color: var(--light); }

/* 電腦：中心在中間，分支左右兩邊，用曲線接起來 */
.mm-map.is-wide { max-width: 78rem; }
.mm-wide { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px) minmax(0, 1fr); align-items: center; gap: 56px; min-height: 60vh; }
.mm-side { display: grid; gap: 26px; align-content: center; }
.mm-wide .mm-root { grid-column: 2; grid-row: 1; }
.mm-side.is-left { grid-column: 1; grid-row: 1; }
.mm-side.is-right { grid-column: 3; grid-row: 1; }
.mm-wide .mm-branch .mm-kids { display: grid; gap: 5px; margin-top: 7px; padding-left: 22px; border-left: 2px solid color-mix(in oklab, var(--c), transparent 45%); margin-left: 21px; }
.mm-wide .is-left .mm-kids { padding: 0 22px 0 0; margin: 7px 21px 0 0; border-left: 0; border-right: 2px solid color-mix(in oklab, var(--c), transparent 45%); }
.mm-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mm-lines path { fill: none; stroke-width: 3; opacity: .85; }
.mm-leaf:hover, .mm-head:hover { filter: brightness(1.18); }

/* 心智圖專欄 */
.mm-page { max-width: 44rem; margin-inline: auto; padding-bottom: 60px; }
.mm-pagehead { padding: 18px 16px 0; }
.mm-pagehead h1 { font-family: var(--serif); font-size: 1.6rem; letter-spacing: .12em; }
.mm-pagehead p { margin-top: 2px; font-size: .88rem; color: var(--text-2); }
.mm-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 16px 0; padding: 4px; border-radius: 16px; background: #16213A; }
.mm-tabs button { min-height: 44px; border: 0; border-radius: 12px; background: none; font-family: var(--serif); font-weight: 700; font-size: 1.05rem; letter-spacing: .14em; color: var(--text-2); }
.mm-tabs button[aria-selected="true"] { background: var(--light); color: var(--on-light); }
.mm-lib { padding: 0 16px; }
.mm-group h2 { margin: 20px 0 8px; font-size: .84rem; font-weight: 600; letter-spacing: .16em; color: var(--text-3); }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.mm-tile { display: grid; place-content: center; justify-items: center; min-width: 0; min-height: 66px; padding: 8px 4px; border-radius: 14px; text-align: center; text-decoration: none; line-height: 1.4; color: var(--text); background: rgba(242, 196, 109, .12); box-shadow: inset 0 0 0 1px rgba(242, 196, 109, .55); }
.mm-tile b { font-family: var(--serif); font-size: .96rem; letter-spacing: .04em; }
.mm-tile small { font-size: .72rem; color: var(--light-hi); }
.mm-tile.is-off { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-3); }
.mm-tile.is-off b { font-weight: 600; }
.mm-tile.is-off small { color: var(--text-3); opacity: .7; }
a.mm-tile:hover { filter: brightness(1.18); }
.mm-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin: 16px 0 4px; }
.mm-nums button { min-height: 40px; border: 0; border-radius: 11px; background: rgba(255, 255, 255, .07); font: inherit; font-variant-numeric: tabular-nums; color: var(--text); }
.mm-lib > .mm-card:first-child { margin-top: 16px; }
.mm-nums + .mm-card { margin-top: 12px; }
.mm-card { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; padding: 12px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); text-align: left; color: var(--text); }
.mm-card i { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--light); color: var(--on-light); font-family: var(--num); font-style: normal; font-weight: 700; font-size: 1.4rem; }
.mm-card > span:not(.icon) { flex: 1; display: grid; min-width: 0; line-height: 1.5; }
.mm-card b { font-size: 1rem; }
.mm-card small { font-size: .78rem; color: var(--text-3); }
/* 讀經時圖片左上角的「心智圖」鈕 */
.map-open { position: absolute; z-index: 4; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 11px; border: 0; border-radius: 999px; background: rgba(6, 10, 19, .68); color: #fff; font-size: .9rem; box-shadow: inset 0 0 0 1px rgba(242, 196, 109, .65); }
.map-open .icon { color: var(--light); }
.stage.is-full .map-open { display: none; }
.tabs .tab-map { flex: none; padding: 7px 14px; border: 0; border-radius: 999px; background: none; color: var(--light-hi); font: inherit; font-size: .92rem; white-space: nowrap; }

@supports not (background: color-mix(in oklab, red, blue)) {
  .mm-head { background: #1A2742; }
  .mm-leaf.is-key { background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px var(--c); }
  .mm-trunk .mm-kids li::before, .mm-trunk .mm-kids li:not(:last-child)::after { border-color: var(--c); }
}
