:root{--ink:#263c39;--teal:#176b65;--paper:#f8f6ef;--line:#dedfd5}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:14px/1.5 'Microsoft YaHei',system-ui,sans-serif}button,input,select{font:inherit}button,select{cursor:pointer}button{border:1px solid var(--line);background:#fffdfa;border-radius:7px;padding:9px 15px;color:var(--ink)}button:hover{border-color:var(--teal)}button.active,.primary{background:var(--teal);color:white;border-color:var(--teal)}header{height:78px;display:flex;align-items:center;gap:25px;padding:0 25px;border-bottom:1px solid var(--line);background:#fffdf8}header strong{font: bold 25px Georgia,'SimSun',serif;white-space:nowrap}i{display:inline-block;background:#a04e37;color:#fff;padding:4px 8px;font-style:normal}nav{display:flex;gap:8px}nav button{border:0;background:none}header input{margin-left:auto;width:300px;padding:11px;border:1px solid var(--line);border-radius:7px}.badge{font-size:11px;color:#8a7b61;border:1px solid #d6c9ad;border-radius:4px;padding:4px;white-space:nowrap}main{display:grid;grid-template-columns:minmax(0,1fr) 320px;min-height:570px}.canvas{position:relative;overflow:hidden;background:#e8e5d3}#map{width:100%;height:100%;min-height:570px;display:block}.topline{position:absolute;top:20px;left:24px;right:22px;display:flex;justify-content:space-between;align-items:start;z-index:1;pointer-events:none}.topline h1{margin:3px 0;font: bold 29px 'SimSun',serif}.topline p{font-size:12px;max-width:520px}.eyebrow{font-size:11px;letter-spacing:2px;color:#6c7e72}.modes{display:flex;pointer-events:auto}.layers{position:absolute;top:165px;left:24px;background:#fffdf5ef;padding:17px;width:188px;border:1px solid #d8dacd;border-radius:9px;box-shadow:0 5px 20px #50605013}.layers b{display:block;margin-bottom:12px}.layers label{display:flex;justify-content:space-between;margin:8px 0;font-size:12px}input{accent-color:var(--teal)}.layers input[type=range]{width:100%}.mapnote{position:absolute;bottom:12px;left:24px;font-size:11px;background:#fffdf5e8;padding:5px 9px;border-radius:4px}aside{background:#fffdf8;border-left:1px solid var(--line);padding:25px 24px;overflow:auto;max-height:650px}aside h2{font: bold 36px 'SimSun',serif;margin:10px 0}aside h3{margin-top:24px;font-size:15px}aside p{color:#697570;font-size:13px}aside dl{font-size:13px}aside dt{color:#8a9389;margin-top:14px}aside dd{margin:4px 0 0}aside .tag{display:inline-block;padding:4px 9px;background:#ece3cc;color:#77613c;border-radius:4px}aside .box{background:#eef1e8;padding:16px;border-radius:7px;margin:20px 0}aside button{margin:5px 3px 5px 0}.timepanel{padding:18px 25px 12px;border-top:1px solid var(--line)}.timehead{display:flex;align-items:center;gap:18px}.timehead h2{margin:0;font-size:25px;min-width:180px}.timehead select{padding:9px;background:white;border:1px solid var(--line);border-radius:6px}.timelineControl{flex:1}.timelineControl input{width:100%}.ticks{display:flex;justify-content:space-between;font-size:10px;color:#7f8a80}.parallelTitle{display:flex;justify-content:space-between;margin:18px 0 12px}.parallelTitle span,.foot{font-size:11px;color:#78877c}.lane{display:flex;align-items:center;height:31px;gap:14px}.laneName{width:68px;flex-shrink:0;font-size:12px}.track{height:22px;position:relative;background:#eeeee7;border-radius:4px;flex:1}.bar{position:absolute;height:22px;color:#fff;font-size:11px;border:0;border-radius:4px;padding:2px 8px;text-align:left;white-space:nowrap;overflow:hidden;opacity:.35}.bar.on{opacity:1;box-shadow:0 0 0 1px #ffffff,0 0 0 2px #72857a}.cursor{position:absolute;top:-3px;bottom:-3px;width:2px;background:#aa573a;pointer-events:none;z-index:2}.foot{display:flex;justify-content:space-between;align-items:center;margin-top:9px}.foot button{font-size:11px;padding:5px 10px}svg .city{cursor:pointer}svg text{font-family:'Microsoft YaHei',sans-serif}svg .city:focus{outline:2px solid #176b65}dialog{border:1px solid var(--line);border-radius:12px;max-width:540px;padding:30px}dialog::backdrop{background:#183f3960}.step{display:block;width:100%;text-align:left}.mini{font-size:11px}.notice{color:#a05a34!important}@media(min-width:1600px){main{min-height:650px}#map{min-height:650px}}@media(max-width:1050px){header{flex-wrap:wrap;height:auto;padding:12px;gap:8px}header input{width:240px}header strong{font-size:20px}.badge{display:none}main{grid-template-columns:minmax(0,1fr) 270px}.modes{display:none}.topline{left:15px}.layers{left:15px;width:150px}aside{padding:18px}.timehead{flex-wrap:wrap}.timelineControl{min-width:200px}}@media(max-width:700px){main{display:block}.canvas{height:500px}#map{min-height:500px}aside{max-height:none;border-top:1px solid var(--line)}header input{width:100%;margin:0}nav button{padding:7px}.layers{top:145px;width:130px;padding:10px}.parallelTitle{display:block}.parallelTitle span{display:block} .timepanel{padding:15px}.timehead{gap:9px}.timehead h2{min-width:160px}.mapnote{font-size:9px;left:8px;right:8px}.foot{align-items:start;gap:12px}}

.image-slot{display:flex;align-items:center;justify-content:center;flex-direction:column;background:linear-gradient(135deg,#e6e9df,#f3eddf);border:1px dashed #b7c0af;border-radius:7px;height:115px;margin:18px 0;color:#82917b;font-size:26px}.image-slot span{font-size:13px}.image-slot small{font-size:10px;color:#9aa18f}
.cursor{padding:0}aside{overflow-x:hidden}.image-slot{width:100%}

/* P1: compact camera buttons; original layout and styles above are unchanged. */
.camera-controls{position:absolute;right:20px;bottom:55px;display:flex;gap:5px}.camera-controls button{background:#f8f6ef}#map{touch-action:none}button:focus-visible,input:focus-visible,select:focus-visible,.city:focus-visible{outline:2px solid #176b65;outline-offset:3px}

/* Shared GIS integration: preserve original panels and palette. */
.canvas{isolation:isolate}#map{position:absolute;inset:0;z-index:0;background:#e8e5d3}.topline{z-index:500}.topline>div:first-child{background:#fffdf5e8;padding:5px 10px;border-radius:7px;max-width:65%}.layers{z-index:500}.camera-controls{z-index:500;bottom:125px}.mapnote{z-index:500;bottom:25px;right:18px;max-width:760px}.mapnote button{font-size:11px;padding:3px 8px}.layers select{width:100%;font-size:11px}.layers small{font-size:10px;color:#796f59}.leaflet-container{font-family:'Microsoft YaHei',sans-serif}.leaflet-container .leaflet-control-attribution{font-size:10px}#storyProgress{width:100%}#sourceBody{white-space:pre-wrap;overflow-wrap:anywhere}button:disabled{opacity:.5;cursor:default}.modes{gap:3px}#packageStatus:not(:empty){color:#a04e37}.leaflet-tooltip{font-size:11px}
@media(max-width:1050px){.modes{display:flex;flex-direction:column}.modes button{padding:6px}.topline h1{font-size:23px}}
@media(max-width:700px){.canvas{height:620px}#map{min-height:620px}.topline>div:first-child{max-width:65%}.layers{top:180px}.camera-controls{bottom:150px;right:10px}.mapnote{right:8px}.topline h1{font-size:21px}}

#sourceBody article{border-bottom:1px solid var(--line);padding:8px 0}#sourceDialog{max-width:650px;max-height:85vh;overflow:auto}#referenceNotice{color:#8a422a;font-weight:bold}.layers{max-height:calc(100% - 330px);overflow:auto}.camera-controls{bottom:170px}.mapnote{max-width:800px}.mapnote:empty{display:none}@media(max-width:700px){.canvas{height:730px}#map{min-height:730px}.layers{max-height:340px}.mapnote{font-size:10px}.camera-controls{bottom:195px}}
:root .leaflet-tooltip.city-label{background:transparent;border:0;box-shadow:none;padding:0;color:#526566;font-size:12px;text-shadow:0 1px 2px #fff,1px 0 2px #fff,-1px 0 2px #fff}
:root .leaflet-tooltip.city-label:before{display:none}
@media(max-width:1050px){.modes{display:flex;position:absolute;top:85px;left:0}.modes button{padding:5px 8px;font-size:12px}}
.reading{border-bottom:1px solid var(--line);padding:10px 0}.reading summary{cursor:pointer;font-weight:600;color:var(--teal)}.reading p{line-height:1.8}.reading small{display:block;color:#947448}
.event-hint{margin:4px 0 12px;color:#697570;font-size:12px}.timeline-scroll{overflow-x:auto;padding:4px 4px 10px;overscroll-behavior-x:contain}.timeline-scroll:focus-visible{outline:2px solid var(--teal)}.event-lane{display:flex;gap:14px;align-items:flex-start}.event-lane>.laneName{padding-top:12px}.event-track{position:relative;flex:1;height:var(--event-height);border-top:2px solid #a9b8a8}.timeline-event{position:absolute;width:168px;min-height:76px;padding:7px 9px;text-align:left;background:#fffdf8;z-index:3;line-height:1.4}.timeline-event strong{display:block;font-size:12px;margin-top:4px}.event-date{display:block;color:#85633c;font-size:11px}.timeline-event small{display:block;font-size:10px;color:#886843}.timeline-event.selected{background:#e2eee8;border:2px solid var(--teal)}.timeline-event:hover{background:#eef3eb}.event-stem{position:absolute;top:0;width:1px;background:#a9b8a8}.event-stem:before{content:'';position:absolute;top:-4px;left:-3px;width:7px;height:7px;border-radius:50%;background:var(--teal)}.event-track>.cursor{top:0;bottom:0;opacity:.5}.event-empty{font-size:12px;color:#78877c}.timeline-scroll .laneName{overflow-wrap:anywhere}
/* Responsive workspace: keep the map, reading panel and event controls inside the viewport. */
html,body{height:100%;overflow:hidden}body{height:100dvh;display:grid;grid-template-rows:54px minmax(0,1fr) 238px}header{height:auto;padding:7px 16px;gap:14px}header strong{font-size:21px}header input{width:220px;padding:7px}header nav button{padding:6px 10px}main{min-height:0!important;grid-template-columns:minmax(0,1fr) 320px;overflow:hidden}.canvas{height:auto!important;min-height:0}#map{min-height:0!important;height:100%}aside{max-height:none;min-height:0;padding:16px 18px;overscroll-behavior:contain}aside h2{font-size:25px;line-height:1.35;margin:8px 0}aside h3{margin:15px 0 8px}aside .image-slot{height:65px;margin:10px 0}.topline{top:10px;left:12px;right:12px}.topline h1{font-size:23px}.topline .eyebrow{display:none}.topline p{margin:4px 0;max-width:360px}.topline>div:first-child{max-width:58%}.modes{position:static;flex-direction:row;gap:3px}.modes button{font-size:12px;padding:6px 9px}.layers{top:102px;left:12px;width:160px;max-height:calc(100% - 160px);padding:9px 12px;overflow:auto}.layers summary{font-weight:600;cursor:pointer;list-style-position:inside}.layer-options{padding-top:8px}.layers label{margin:6px 0}.camera-controls{right:12px;bottom:54px!important}.camera-controls button{padding:6px 11px}.mapnote{left:12px;right:12px;bottom:8px;max-width:none;display:flex;gap:10px;align-items:center;padding:6px 9px;min-height:32px}.mapnote>span{flex:1;font-size:11px}.mapnote summary{cursor:pointer;color:var(--teal);white-space:nowrap}.map-info-body{position:absolute;left:0;right:0;bottom:36px;max-height:220px;overflow:auto;background:#fffdf8;border:1px solid var(--line);border-radius:8px;padding:12px;box-shadow:0 6px 24px #263c3922;font-size:12px;line-height:1.6}#packageStatus:not(:empty){position:absolute;top:8px;left:10px;right:10px;z-index:700;background:#fff4de;padding:8px;border-radius:5px}#packageStatus:empty{display:none}.timepanel{padding:8px 14px 5px;display:flex;flex-direction:column;gap:5px;min-width:0;overflow:hidden}.timehead{gap:10px;flex-wrap:nowrap;min-height:40px}.timehead h2{font-size:19px;min-width:146px}.timehead .eyebrow{display:none}.timehead button,.timehead select{padding:5px 8px;font-size:12px}.timelineControl{min-width:70px}.ticks{font-size:9px}.parallelTitle{margin:0;font-size:12px;min-height:18px}.parallelTitle span{font-size:10px}.timeline-scroll{padding:0;overflow:hidden;flex:1;min-height:0}#timelineContent{min-width:0!important}.event-lane{display:flex;position:relative;gap:6px;height:89px;padding-bottom:14px}.event-cards{display:flex;gap:6px;flex:1;min-width:0}.timeline-event{position:static;flex:1;width:0;min-width:0;min-height:0;height:75px;padding:5px 7px;overflow:hidden;line-height:1.25}.timeline-event strong{font-size:12px;line-height:1.35;margin-top:3px}.timeline-event small{font-size:9px}.event-date{font-size:10px}.event-page{width:28px;padding:0;font-size:23px;height:75px}.event-page-count{position:absolute;bottom:0;right:35px;font-size:10px;color:#78877c}.lane{height:22px;gap:8px}.laneName{width:86px;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.track{height:17px}.bar{height:17px;font-size:10px;padding:0 4px}.foot{margin:0;min-height:19px;font-size:10px}.foot button{padding:1px 7px;font-size:10px}.mobile-panel-tabs{display:none}.event-navigation .step{font-size:12px;padding:7px 9px}.event-navigation .mini{font-size:10px;margin:5px 0}
@media(max-width:1050px){body{grid-template-rows:52px minmax(0,1fr) 238px}header{flex-wrap:nowrap;gap:8px}header strong{font-size:19px}header input{width:180px}main{grid-template-columns:minmax(0,1fr) 285px}.modes{display:flex}.modes button{font-size:11px;padding:5px}.topline>div:first-child{max-width:51%}.topline p{font-size:10px}.topline h1{font-size:20px}}
@media(max-width:900px){body{grid-template-rows:52px 32px minmax(0,1fr) 238px}.mobile-panel-tabs{display:flex;justify-content:center;gap:6px;background:#fffdf8;border-bottom:1px solid var(--line);padding:2px}.mobile-panel-tabs button{min-width:110px;padding:2px 10px;font-size:12px}main{display:grid;grid-template-columns:1fr;position:relative}.canvas,aside{grid-area:1/1;min-width:0}aside{display:none;border:0}body[data-panel=detail] aside{display:block}body[data-panel=detail] .canvas{visibility:hidden}.topline>div:first-child{max-width:58%}header nav{display:none}.layers{width:155px}.timehead #speed{display:none}}
@media(max-width:600px){body{grid-template-rows:80px 32px minmax(0,1fr) 232px}header{display:grid;grid-template-columns:1fr;gap:4px;padding:5px 12px}header strong{font-size:18px;line-height:24px}header input{width:100%;padding:5px 8px;height:29px}header i{padding:1px 5px}.timepanel{padding:6px 8px 4px;gap:4px}.timehead{display:grid;grid-template-columns:1fr auto auto;gap:5px}.timehead h2{font-size:17px;min-width:0}.timelineControl{grid-column:1/-1;grid-row:2;height:20px}.ticks{display:none}.timehead #era{max-width:135px}.timehead button,.timehead select{font-size:11px}.parallelTitle{display:flex}.parallelTitle span{display:inline;font-size:9px}.event-lane{height:89px}.timeline-event strong{font-size:12px}.foot>span{font-size:9px}.foot button{white-space:nowrap}.topline{top:7px;left:8px;right:8px}.topline>div:first-child{padding:3px 6px;max-width:45%}.topline h1{font-size:18px}.topline p{max-height:30px;overflow:hidden}.modes{gap:2px;flex-direction:column}.modes button{font-size:10px;padding:3px 6px}.layers{top:88px;left:8px;width:145px;padding:6px 8px;max-height:calc(100% - 135px)}.camera-controls{right:8px;bottom:49px!important;gap:3px}.camera-controls button{padding:4px 8px}.mapnote{left:6px;right:6px;bottom:5px;gap:5px;padding:4px 6px}.mapnote>span{font-size:10px}.mapnote summary{font-size:10px}.map-info-body{max-height:180px}aside{padding:12px 15px}aside h2{font-size:23px}.laneName{width:65px}.event-navigation .step{padding:5px 8px}}
@media(max-height:600px) and (min-width:601px){body{grid-template-rows:42px minmax(0,1fr) 210px}.mobile-panel-tabs{display:none}main{display:grid;grid-template-columns:minmax(0,1fr) 280px}.canvas{visibility:visible!important}aside{display:block!important;grid-area:auto}.canvas{grid-area:auto}.timehead{min-height:30px}.parallelTitle{display:none}header strong{font-size:17px}.topline p{display:none}.layers{top:57px;max-height:calc(100% - 105px)}}
/* Reserve room for all three Han polity rows without hiding the final row. */
body{grid-template-rows:54px minmax(0,1fr) 260px}
@media(max-width:1050px){body{grid-template-rows:52px minmax(0,1fr) 260px}}
@media(max-width:900px){body{grid-template-rows:52px 32px minmax(0,1fr) 260px}}
@media(max-width:600px){body{grid-template-rows:80px 32px minmax(0,1fr) 272px}}
@media(max-height:600px) and (min-width:601px){body{grid-template-rows:42px minmax(0,1fr) 232px}}

/* Short landscape screens retain all polity lanes while freeing the map. */
.layers:not([open]){max-height:none}
.leaflet-tooltip.capital-tooltip{width:max-content;max-width:min(240px,calc(100vw - 24px));white-space:normal;overflow-wrap:anywhere;line-height:1.4}.capital-choices{display:flex;flex-direction:column;gap:4px;max-height:220px;overflow:auto}.capital-choices button{text-align:left;padding:5px 8px;font-size:12px}
.overview-title{margin:20px 0 3px;color:#315b54}.overview-section{margin:8px 0;border:1px solid #d8e1d7;border-radius:9px;background:#fffdfa;overflow:hidden}.overview-section>summary{display:flex;align-items:center;gap:7px;padding:11px 12px;cursor:pointer;list-style:none;background:#f1f5ed}.overview-section>summary::-webkit-details-marker{display:none}.overview-section>summary::before{content:'▸';color:#176b65}.overview-section[open]>summary::before{content:'▾'}.overview-section-title{font-weight:700;color:#24534c;flex:1}.overview-section>summary small{color:#748378;font-size:11px}.overview-section-body{padding:4px 10px 12px}.overview-section-body>button[data-select-polity],.overview-section-body>button[data-place]{display:block;width:100%;text-align:left}.overview-section-body h3{margin-top:15px}.detail-trail{display:flex;align-items:center;flex-wrap:wrap;gap:5px;color:#667c70;font-size:11px;line-height:1.35}.detail-trail strong{color:#263c39;overflow-wrap:anywhere}.detail-trail-home{border:0;background:transparent!important;color:#176b65;padding:0;text-decoration:underline;margin:0}.detail-back{margin:9px 0 3px;padding:5px 9px;color:#176b65;font-size:12px}.related-topics{margin-top:12px;border-top:1px solid #e1e7dd;padding-top:10px}.related-topics>summary{cursor:pointer;color:#42645b;font-weight:600}
.overview-context{margin:10px 0;color:#42645b;font-size:12px}.overview-context>summary{cursor:pointer}.overview-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:12px}.overview-heading .overview-title{margin:0}.overview-heading button{font-size:11px;padding:4px 8px;white-space:nowrap}.overview-heading+.mini{margin:4px 0 8px}
.overview-section{margin:5px 0}.overview-section>summary{padding:7px 10px}
@media(max-height:600px) and (min-width:601px){
 body{grid-template-rows:42px minmax(0,1fr) 196px}
 .timepanel{padding:4px 14px;gap:3px}.timehead{min-height:30px}
 .event-lane{height:66px}.timeline-event,.event-page{height:52px}
 .timeline-event strong{font-size:11px;margin-top:1px}.timeline-event small{display:none}
 .lane{height:18px}.track,.bar{height:15px}.foot{min-height:18px}
 .camera-controls{top:55px;bottom:auto!important}.map-info-body{max-height:115px}
}

.map-shortcuts{position:absolute;z-index:500;left:12px;bottom:52px;display:flex;flex-wrap:wrap;gap:5px;max-width:calc(100% - 155px)}.map-shortcuts button{font-size:11px;padding:6px 9px;background:#fffdf5f5}.map-shortcuts:empty{display:none}@media(max-width:600px){.map-shortcuts{left:8px;bottom:86px;max-width:calc(100% - 16px)}}@media(max-height:600px) and (min-width:601px){.map-shortcuts{bottom:47px;left:8px;max-width:calc(100% - 16px)}.map-shortcuts button{padding:3px 6px}}

/* Keep the fourth (Jin continuation) row visible without enlarging the page. */
#lanes:has(.lane:nth-child(4)) .lane{height:16px}#lanes:has(.lane:nth-child(4)) .track,#lanes:has(.lane:nth-child(4)) .bar{height:14px}
@media(max-height:600px) and (min-width:601px){#lanes:has(.lane:nth-child(4)) .lane{height:13px}#lanes:has(.lane:nth-child(4)) .track,#lanes:has(.lane:nth-child(4)) .bar{height:12px}}
/* Unregistered atlas images use a separate pixel-coordinate viewer in the shared map area. */
#atlasPanel{position:absolute;inset:0;z-index:350;background:#fffdf6}#atlasPanel[hidden]{display:none}#atlasMap{position:absolute;inset:55px 0 80px;background:#fff}
.atlas-heading{position:absolute;top:12px;left:12px;max-width:calc(100% - 230px);z-index:400}.atlas-heading b{display:block;font-size:15px}.atlas-heading small{display:block;font-size:11px;color:#716f59}
.atlas-toolbar{position:absolute;bottom:44px;left:12px;right:150px;display:flex;gap:4px;flex-wrap:wrap;z-index:400}.atlas-toolbar button{padding:6px 9px;font-size:12px}.atlas-toolbar span{display:flex;gap:4px}.atlas-caption{position:absolute;bottom:5px;left:12px;right:12px;display:flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:10px;line-height:1.4}.atlas-caption button{font-size:10px;padding:1px 5px}.atlas-caption a{color:#176b65;text-decoration:underline}
.canvas[data-atlas=true]>#map{visibility:hidden}.canvas[data-atlas=true]>.layers,.canvas[data-atlas=true]>.map-shortcuts,.canvas[data-atlas=true]>.mapnote{display:none}.canvas[data-atlas=true]>.topline{z-index:500}.canvas[data-atlas=true]>.topline>div:first-child{visibility:hidden}.canvas[data-atlas=true]>.camera-controls{z-index:600}
@media(max-width:600px){.atlas-heading{top:8px;left:8px;max-width:calc(100% - 90px)}.atlas-heading b{font-size:13px}.atlas-heading small{font-size:10px}#atlasMap{top:70px;bottom:106px}.atlas-toolbar{left:8px;right:8px;bottom:72px}.atlas-toolbar button{padding:5px 7px;font-size:11px}.atlas-caption{left:8px;right:8px;bottom:4px;max-width:calc(100% - 85px)}.canvas[data-atlas=true]>.camera-controls{bottom:7px!important;flex-direction:column;gap:2px}.canvas[data-atlas=true]>.camera-controls button{padding:3px 7px}}
@media(max-height:600px) and (min-width:601px){#atlasMap{top:42px;bottom:60px}.atlas-heading{top:6px}.atlas-heading small{font-size:9px}.atlas-toolbar{bottom:30px}.atlas-toolbar button{padding:2px 7px;font-size:10px}.atlas-caption{font-size:9px}}
.atlas-toolbar span{flex-wrap:wrap}
.atlas-place-marker{width:max-content!important}.atlas-place-button{white-space:nowrap;padding:4px 7px;font-size:11px;color:#264c45;background:#fffdf4;border:1px solid #8a7650;border-radius:4px;box-shadow:0 1px 3px #0003}.atlas-place-button:focus-visible{outline:3px solid #176b65}
@media(max-width:600px){.atlas-toolbar span{max-width:240px}#atlasMap{bottom:140px}}

/* Many simultaneous polities scroll inside the existing timeline, never under the footer. */
.timeline-scroll:has(#lanes .lane:nth-child(5)) #timelineContent{height:100%;display:flex;flex-direction:column}
.timeline-scroll:has(#lanes .lane:nth-child(5)) .event-lane{flex-shrink:0}
#lanes:has(.lane:nth-child(5)){overflow-y:auto;min-height:0;flex:1;scrollbar-width:thin;overscroll-behavior:contain}
#lanes:has(.lane:nth-child(5)) .lane{height:26px;min-height:26px}#lanes:has(.lane:nth-child(5)) .track,#lanes:has(.lane:nth-child(5)) .bar{height:22px}#lanes:has(.lane:nth-child(5)) .bar{font-size:11px}

/* Collapsible legend lists only colors actually drawn on the current map. */
.map-legend{position:absolute;z-index:500;left:12px;top:145px;width:160px;border:1px solid #d8dacd;border-radius:8px;background:#fffdf5f2;box-shadow:0 5px 20px #50605013;font-size:12px}
.map-legend[hidden]{display:none}.canvas:has(.layers[open]) .map-legend{visibility:hidden}.map-legend summary{cursor:pointer;font-weight:600;padding:7px 10px;color:#24534c}.map-legend-items{max-height:max(72px,min(190px,calc(100vh - 390px)));overflow:auto;overscroll-behavior:contain;padding:2px 5px 6px}.map-legend-items button{display:flex;align-items:center;gap:7px;width:100%;padding:5px;border:0;background:transparent;text-align:left;font-size:11px}.map-legend-items button:hover{background:#eef3eb}.map-legend-swatch{width:14px;height:14px;flex:none;border:1px solid #52675c;border-radius:3px}
@media(max-width:600px){.map-legend{left:8px;top:122px;width:145px}.map-legend summary{padding:6px 8px;font-size:11px}.map-legend-items{max-height:max(72px,min(150px,calc(100vh - 425px)))}}
@media(max-height:600px) and (min-width:601px){.map-legend{left:8px;top:91px;width:145px}.map-legend-items{max-height:90px}}
