#studyMap{padding:22px;margin:18px 0;background:#fff;border:1px solid var(--line);border-top:4px solid var(--teal);border-radius:16px;scroll-margin-top:15px}
.map-heading{display:flex;align-items:center;gap:12px;justify-content:space-between}.map-heading h2{margin:0;font-size:1.35rem}
.map-muted{color:var(--ink-soft);font-size:.9rem;overflow-wrap:anywhere}.map-note{padding:12px 16px;background:var(--amber-soft);border-radius:8px;font-size:.9rem}
.map-controls select{max-width:100%;padding:7px 12px;border:1px solid var(--line);border-radius:8px;background:white;color:var(--ink)}
.map-layout{display:grid;grid-template-columns:minmax(210px,30%) minmax(0,1fr);gap:22px}.map-nav,.map-detail{min-width:0}.map-tabs{display:flex;gap:8px;flex-wrap:wrap}.map-topic-list{max-height:560px;overflow:auto;display:flex;flex-direction:column;gap:6px;padding:3px}.map-topic{padding:12px;text-align:left;border:1px solid var(--line);border-radius:8px;background:var(--paper);color:var(--ink);font-size:.95rem;overflow-wrap:anywhere}.map-topic.active{border-color:var(--teal);background:var(--teal-soft);font-weight:700}
.map-detail{border-left:1px solid var(--line);padding-left:22px}.map-detail h3{margin-top:0;font-size:1.2rem}.map-detail h4{margin:20px 0 8px;font-size:1rem}.map-count{font-weight:700;color:var(--teal)}.map-question{border:1px solid var(--line);padding:16px;margin:12px 0;border-radius:10px}.map-question p{margin:8px 0}.map-original{margin-top:20px;padding-top:12px;border-top:1px solid var(--line)}.map-original summary{cursor:pointer;font-weight:700;min-height:44px;padding:8px 0}.map-source{line-height:1.8}.map-source h2,.map-source h3,.map-source h4{margin:24px 0 12px}.map-table{overflow:auto}.map-table table{border-collapse:collapse;font-size:.9rem;width:100%;min-width:540px}.map-table td,.map-table th{border:1px solid var(--line);padding:10px;text-align:left}.map-table th{background:var(--paper)}.map-source a{overflow-wrap:anywhere;color:var(--teal)}
#mapReturnBar{margin:12px 0;padding:12px;background:var(--teal-soft);border-radius:8px}#mapQuestionLinks{padding:12px;margin-bottom:12px;border:1px solid var(--line);border-radius:8px;display:flex;flex-wrap:wrap;gap:8px;align-items:center}#mapQuestionLinks[hidden],#mapReturnBar[hidden]{display:none}
@media(max-width:760px){#studyMap{padding:16px}.map-layout{grid-template-columns:1fr}.map-detail{padding:0;border-left:0;border-top:1px solid var(--line);padding-top:18px}.map-topic-list{max-height:230px}.map-heading{align-items:flex-start}.map-heading .tag{white-space:nowrap}.map-tabs .btn{flex:1}}
/* Keep long summaries and source tables within the study panel. */
.study-map-fold{margin:18px 0;background:var(--surface);border:1px solid var(--line);border-top:4px solid var(--teal);border-radius:var(--radius);min-width:0;max-width:100%}
.study-map-fold>summary{padding:16px 20px;cursor:pointer;font-weight:800;min-height:56px;overflow-wrap:anywhere}
.study-map-fold>summary span{font-size:.9rem;font-weight:400;color:var(--ink-soft);margin-left:8px}
.study-map-fold #studyMap{border:0;border-radius:0;margin:0;padding-top:0;max-width:100%;min-width:0}
#studyMap .map-original,#studyMap .map-source,#studyMap .map-layout,#studyMap .map-question,#studyMap .map-controls{min-width:0;max-width:100%}
#studyMap .map-source,#studyMap .map-detail,#studyMap .map-question{overflow-wrap:anywhere}
#studyMap .map-table{max-width:100%;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
#studyMap .btn,#mapQuestionLinks .btn{display:inline-flex;align-items:center;justify-content:center;white-space:normal;max-width:100%;overflow-wrap:anywhere;text-decoration:none;margin:4px 4px 4px 0}
#mapQuestionLinks{min-width:0;max-width:100%}
#mapQuestionLinks>strong{flex-basis:100%}
.map-heading{flex-wrap:wrap}
.map-controls label{display:block;max-width:440px;width:100%}
@media(min-width:761px) and (max-width:1120px){.workspace{grid-template-columns:230px minmax(0,1fr)}}
@media(max-width:760px){.study-map-fold>summary{padding:14px 16px}.study-map-fold>summary span{display:block;margin-left:18px}.study-map-fold #studyMap{padding:0 16px 16px}.map-topic-list{max-height:200px}.map-detail ul,.map-detail ol,.map-source ul{padding-left:22px}}

/* Reading layout: normal wrapping, compact rhythm and bounded table scrolling. */
#studyMap .map-source{line-height:1.55;font-size:.95rem;white-space:normal}
#studyMap .map-source p{margin:.45em 0}
#studyMap .map-source h2,#studyMap .map-source h3,#studyMap .map-source h4{margin:1.15em 0 .4em;line-height:1.4}
#studyMap .map-source ul,#studyMap .map-source ol{margin:.45em 0;padding-left:1.5em}
#studyMap .map-source li{margin:.2em 0;line-height:1.55}
#studyMap .map-source pre{white-space:pre-wrap;overflow-wrap:anywhere;margin:.6em 0;padding:10px 12px;background:var(--paper);border-radius:8px;font:inherit;line-height:1.5}
#studyMap .map-source pre code{font:inherit}
#studyMap .map-source blockquote{margin:.6em 0;padding:6px 12px;border-left:3px solid var(--teal);background:var(--paper)}
#studyMap .map-table{margin:.6em 0;overscroll-behavior-x:contain}
#studyMap .map-table table{min-width:460px;table-layout:auto}
#studyMap .map-table td,#studyMap .map-table th{padding:7px 9px;vertical-align:top;line-height:1.5;white-space:normal}
#studyMap .map-original{margin-top:14px;padding-top:8px}
@media(max-width:760px){#studyMap .map-source{font-size:.92rem}#studyMap .map-table table{min-width:420px}.map-layout{gap:14px}}

/* One column grid per table, shared by its header and every body row. */
#studyMap .map-table table{table-layout:fixed;border-spacing:0}
#studyMap .map-table thead{display:table-header-group}
#studyMap .map-table tbody{display:table-row-group}
#studyMap .map-table tr{display:table-row}
#studyMap .map-table th,#studyMap .map-table td{display:table-cell;box-sizing:border-box;overflow-wrap:break-word;word-break:normal}
