/* adr: adr/topbar-drawer-layout.md */
.people-drawer-prototype #domain-dock{display:none}
.people-drawer-prototype :is(#goals,#side,#log,#card){right:118px;top:var(--village-panel-top,158px);transform:none;width:min(370px,calc(100vw - 142px));max-width:none;max-height:calc(100dvh - 250px);z-index:6}
.people-drawer-prototype #build:not(.folded){left:16px;right:118px;transform:none;width:auto;max-width:none;z-index:6}
.people-drawer-prototype :is(#goals,#side,#log,#card){background:#2b2016;background-image:none;border:1px solid #8d6e3f;border-radius:4px;color:#ead9b5;box-shadow:0 8px 24px #0008;scrollbar-width:thin;scrollbar-color:#80623b #2b2016}
.people-drawer-prototype :is(#goals,#side,#log,#card)::before{display:none}.people-drawer-prototype :is(#goals,#side,#log,#card)::-webkit-scrollbar{width:9px}.people-drawer-prototype :is(#goals,#side,#log,#card)::-webkit-scrollbar-track{background:#2b2016}.people-drawer-prototype :is(#goals,#side,#log,#card)::-webkit-scrollbar-thumb{background:#80623b;border:2px solid #2b2016;border-radius:5px}.people-drawer-prototype :is(#goals,#side,#log,#card)::-webkit-scrollbar-thumb:hover{background:#a98750}
.people-drawer-prototype #goals{background:#2b2016;background-image:none;border:1px solid #8d6e3f;border-radius:4px;box-shadow:0 8px 24px #0008;color:#ead9b5;scrollbar-width:thin;scrollbar-color:#80623b #2b2016}
.people-drawer-prototype #goals::before{display:none}.people-drawer-prototype #goals::-webkit-scrollbar{width:9px}.people-drawer-prototype #goals::-webkit-scrollbar-track{background:#2b2016}.people-drawer-prototype #goals::-webkit-scrollbar-thumb{background:#80623b;border:2px solid #2b2016;border-radius:5px}.people-drawer-prototype #goals::-webkit-scrollbar-thumb:hover{background:#a98750}
.people-drawer-prototype :is(#goals,#side,#log,#card) h2{color:#f0d79e;text-shadow:none}
.people-drawer-prototype #goals .how b{color:#f0d79e}
.people-drawer-prototype :is(#goals,#side,#log,#card) p,.people-drawer-prototype :is(#goals,#side,#log,#card) .where,.people-drawer-prototype :is(#goals,#side,#log,#card) .row span,.people-drawer-prototype :is(#goals,#side,#log,#card) .sec h3,.people-drawer-prototype :is(#goals,#side,#log,#card) .sub,.people-drawer-prototype :is(#goals,#side,#log,#card) .adv,.people-drawer-prototype :is(#goals,#side,#log,#card) .ev{color:#c9b48b}
.people-drawer-prototype #goals .obj{color:#bda77d}.people-drawer-prototype #goals .obj b{color:#f0c36a}.people-drawer-prototype #goals li{color:#c9b48b;border-color:#80613a}.people-drawer-prototype #goals li.now{color:#f0d79e}.people-drawer-prototype #goals li.done{color:#8eb86d}
.people-drawer-prototype :is(#goals,#side,#log,#card) .btn,.people-drawer-prototype :is(#goals,#side,#log,#card) select{color:#ead9b5;background:#3b2a19;border-color:#80623b}
.people-drawer-prototype :is(#goals,#side,#log,#card) .fold,.people-drawer-prototype #card .x{color:#d7b56f}

#people-prototype-menu{position:fixed;right:14px;top:50%;z-index:12;display:flex;flex-direction:column;gap:3px;transform:translateY(-50%);padding:6px;background:#2b2016;border:1px solid #8d6e3f;border-radius:4px;box-shadow:0 8px 24px #0008}
#people-prototype-menu button{position:relative;width:78px;padding:8px 6px;color:#dec79b;background:#3b2a19;border:1px solid #6d502d;border-radius:3px;font:12px/1.1 Georgia,serif;text-align:center;cursor:pointer}
#people-prototype-menu button:hover,#people-prototype-menu button[aria-pressed=true]{color:#261a0d;background:#d7b56f;border-color:#f1d38c}
#people-prototype-menu button:focus-visible{outline:2px solid #f0c36a;outline-offset:2px}
#people-prototype-menu .menu-badge{position:absolute;right:7px;top:50%;transform:translateY(-50%);color:#f07f65;font:16px/1 Georgia,serif;font-style:normal}
#people-prototype-toggle{display:none;position:fixed;right:7px;top:50%;z-index:13;transform:translateY(-50%);padding:10px 7px;color:#dec79b;background:#2b2016;border:1px solid #8d6e3f;border-radius:4px;box-shadow:0 8px 24px #0008;font:12px Georgia,serif;cursor:pointer;writing-mode:vertical-rl}
#people-prototype-toggle[aria-expanded=true]{color:#261a0d;background:#d7b56f;border-color:#f1d38c}
#people-prototype-toggle .menu-badge{color:#f07f65;font:16px/1 Georgia,serif;font-style:normal;margin-top:5px}

#people-drawer-prototype{position:fixed;top:var(--village-panel-top,158px);right:118px;bottom:auto;transform:none;z-index:11;width:min(390px,calc(100vw - 142px));max-height:calc(100dvh - 176px);pointer-events:none}
#people-drawer-prototype[hidden]{display:none}
.people-drawer-surface{max-height:inherit;overflow:auto;scrollbar-width:thin;scrollbar-color:#80623b #2b2016;pointer-events:auto;color:#ead9b5;background:#2b2016;border:1px solid #8d6e3f;border-radius:4px;box-shadow:0 8px 24px #0008;font-family:Georgia,serif}
.people-drawer-surface::-webkit-scrollbar{width:9px}.people-drawer-surface::-webkit-scrollbar-track{background:#2b2016}.people-drawer-surface::-webkit-scrollbar-thumb{background:#80623b;border:2px solid #2b2016;border-radius:5px}.people-drawer-surface::-webkit-scrollbar-thumb:hover{background:#a98750}
.people-drawer-header{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;background:#352619;border-bottom:1px solid #8d6b3a}
.people-drawer-header small{display:block;color:#bda77d;font:10px/1.1 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase}
.people-drawer-header h2{margin:4px 0 0;color:#f0d79e;font:22px/1 Georgia,serif}
.people-drawer-header button{width:28px;height:28px;color:#e8d5a7;background:#4a3520;border:1px solid #987846;border-radius:3px;font:22px/24px Georgia,serif;text-align:center;cursor:pointer}
.people-drawer-header button:hover{color:#24180c;background:#d7b56f}
.people-drawer-header button:focus-visible{outline:2px solid #f0c36a;outline-offset:2px}
.people-drawer-content{padding:14px 16px 18px}
.people-drawer-content .heritage-ledger{padding:0;background:none;border:0;color:#ead9b5;overflow:visible}
.people-drawer-content .ledger-heading small{display:none}
.people-drawer-content .ledger-heading h2{display:none}
.people-drawer-content .ledger-heading p,.people-drawer-content .ledger-note{color:#c9b48b;font:13px/1.45 Georgia,serif}
.people-drawer-content .ledger-heading p{margin:14px 0 8px}
.people-drawer-content .ledger-warning{color:#f0a18b!important}
.people-drawer-content .resident-list{display:flex;flex-direction:column;gap:0}
.people-drawer-content .resident-row{display:grid;grid-template-columns:34px minmax(0,1fr) 104px;gap:8px;align-items:center;padding:10px 0;border-bottom:1px solid #5c4529}
.people-drawer-content .resident-portrait{width:34px;height:40px;background-size:400% 400%;background-position:33.333% 66.667%;background-repeat:no-repeat;border-radius:2px}
.people-drawer-content .resident-row strong{display:block;color:#f0dfbc;font:14px/1.15 Georgia,serif}
.people-drawer-content .resident-row small,.people-drawer-content .resident-row p{display:block;margin:3px 0 0;color:#bca77e;font:11px/1.2 Georgia,serif}
.people-drawer-content .resident-row select{width:100%;padding:6px 5px;color:#f0dfbc;background:#3b2a19;border:1px solid #80623b;border-radius:3px;font:12px Georgia,serif}
.people-drawer-content .resident-row .find-home{color:#d7b56f;font:11px Georgia,serif;text-decoration:underline;cursor:pointer}
.people-drawer-toggle{display:block;width:100%;margin:12px 0 2px;padding:8px 10px;color:#2b1c0e;background:#d7b56f;border:1px solid #f0d38d;border-radius:3px;font:13px Georgia,serif;text-align:left;cursor:pointer}
.people-drawer-toggle:hover{background:#ebca84}
.people-drawer-toggle:focus-visible{outline:2px solid #f0c36a;outline-offset:2px}
.people-drawer-content .ledger{display:flex;flex-wrap:wrap;gap:6px 12px;padding:10px 0;border-bottom:1px solid #80613a;color:#c9b48b;font:11px Georgia,serif}
.people-drawer-content .ledger b{color:#f0d79e;font-weight:600}
.people-drawer-content .ledger .q{color:#ef9d82}
.people-drawer-content .bar{display:flex;flex-direction:column;gap:6px;margin-top:12px}
.people-drawer-content .bar button{display:grid;grid-template-columns:42px minmax(0,1fr);grid-template-areas:'icon name' 'icon desc' 'icon costs';align-items:center;column-gap:10px;width:100%;min-height:66px;padding:7px 9px;color:#ead9b5;background:#3b2a19;border:1px solid #6d502d;border-radius:3px;text-align:left;cursor:pointer}
.people-drawer-content .bar button:hover,.people-drawer-content .bar button[aria-pressed=true]{background:#554025;border-color:#d7b56f}
.people-drawer-content .bar button.cant{opacity:.65}
.people-drawer-content .bar button .build-thumb{grid-area:icon;width:40px;height:48px;background-size:300% 400%;border-radius:2px}
.people-drawer-content .bar button .n{grid-area:name;color:#f0dfbc;font:15px/1.1 Georgia,serif;text-align:left}
.people-drawer-content .bar button .build-description{grid-area:desc;color:#bda77d;font:11px/1.2 Georgia,serif}
.people-drawer-content .bar button .build-costs{grid-area:costs;display:flex;gap:8px;align-items:baseline;color:#d7b56f;font:11px/1.2 Georgia,serif}
.people-drawer-content .bar button .build-costs b{font-weight:600;color:#f0c36a}
.people-drawer-content .bar button .build-costs small{color:#c9b48b;font:inherit}
.people-drawer-content .bar button .c{display:none}

/* Older paper rules must resolve to the same readable palette when the
   contextual panels are shown on the dark prototype surface. */
.people-drawer-prototype #side b,.people-drawer-prototype #side .row b{color:#f0d79e}
.people-drawer-prototype #side .job.short .k b{color:#ef8f78}
.people-drawer-prototype #side .job.over .k b{color:#f0c36a}
.people-drawer-prototype #card .cols h4{color:#c9b48b}
.people-drawer-prototype #card .cols div{color:#ead9b5}

.balance-drawer-content{color:#ead9b5;font:13px/1.35 Georgia,serif}
.balance-location{padding:0 0 12px;border-bottom:1px solid #80613a}
.balance-location small{display:block;color:#bda77d;font:10px/1.1 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase}
.balance-location strong{display:block;margin-top:4px;color:#f0d79e;font:20px/1.1 Georgia,serif}
.balance-location-tabs{display:flex;flex-wrap:wrap;gap:5px;margin-top:10px}
.balance-location-tabs button{padding:5px 8px;color:#c9b48b;background:#3b2a19;border:1px solid #6d502d;border-radius:3px;font:11px Georgia,serif;cursor:pointer}
.balance-location-tabs button[aria-pressed=true],.balance-location-tabs button:hover{color:#2b1c0e;background:#d7b56f;border-color:#f0d38d}
.balance-location-select{display:flex;align-items:center;gap:6px;min-width:0;color:#bda77d;font:10px system-ui,sans-serif;letter-spacing:.08em;text-transform:uppercase}
.balance-location-select select{min-width:0;flex:1;padding:5px 6px;color:#ead9b5;background:#3b2a19;border:1px solid #80623b;border-radius:3px;font:11px Georgia,serif;letter-spacing:normal;text-transform:none}
.balance-section{padding:12px 0;border-bottom:1px solid #80613a}
.balance-section h3{margin:0 0 9px;color:#f0d79e;font:15px/1.1 Georgia,serif}
.balance-forecast-grid,.balance-value-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px 12px}
.balance-forecast-grid div,.balance-value-grid div{display:flex;justify-content:space-between;gap:8px}
.balance-forecast-grid span,.balance-value-grid span{color:#c9b48b}
.balance-forecast-grid b,.balance-value-grid b{color:#f0d79e;font-weight:600;text-align:right}
.balance-section>p{margin:8px 0 0;color:#bda77d;font:11px/1.35 Georgia,serif}
.balance-meter-row{margin:9px 0 0}
.balance-meter-row>div:first-child{display:flex;justify-content:space-between;gap:8px}
.balance-meter-row span{color:#c9b48b}.balance-meter-row b{color:#f0d79e;font-weight:600}
.balance-meter{height:7px;margin-top:5px;background:#241b13;border:1px solid #6d502d;border-radius:2px;overflow:hidden}
.balance-meter i{display:block;height:100%;background:linear-gradient(90deg,#80623b,#d7b56f)}
.balance-morale-details{margin-top:10px;padding-top:9px;border-top:1px solid #5c4529}
.balance-change-heading,.balance-change-list li{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.balance-change-heading span,.balance-change-list span{color:#bda77d}
.balance-change-heading b,.balance-change-list b{color:#f0d79e;font-weight:600;text-align:right}
.balance-change-list{display:flex;flex-direction:column;gap:5px;margin:8px 0 0;padding:0;list-style:none;font-size:11px}
.balance-morale-details>p{margin:8px 0 0;color:#8f7b5d;font:11px/1.3 Georgia,serif}

/* The top bar keeps the original stat treatment while adding navigation.
   The people tray is progressive disclosure; the map remains the primary people surface. */
#top .stat:has(#people),#top .stat:has(#parcels){display:none!important}
#top .stat.season{order:1}
#top .stat.season.tray-open{background:#d7b56f18}
#top .season-selector-main{display:flex;align-items:center;gap:clamp(3px,.5vw,8px);min-width:0;padding:0;color:inherit;background:transparent;border:0;text-align:left;cursor:pointer}
#top .season-selector-main:hover{color:#fff1c9}
#top .next-season-svg,#top .more-icon{display:none}
#top .gold-selector-main{display:flex;align-items:center;gap:clamp(3px,.5vw,8px);min-width:0;padding:0;color:inherit;background:transparent;border:0;text-align:left;cursor:pointer}
#top .gold-selector-main:hover{color:#fff1c9}
#top .stat:has(#coins){order:2}
#top #territory-selector{order:3}
#top #people-selector{order:4}
#top #unit-selector{order:5}
#top .stat:has(#cryst){order:6}
#top #speed{order:7}
#top .utility-ctl{order:8}
#top .selector-stat{position:relative;min-width:0}
#top .selector-stat[hidden]{display:none!important}
#top .selector-row{display:grid;grid-template-columns:20px minmax(0,1fr) 20px;align-items:center;min-width:0;width:100%;min-height:32px;border-radius:2px}
#top .selector-stat:hover .selector-row,#top .selector-stat.tray-open .selector-row,#top .selector-stat.people-focused .selector-row{background:#d7b56f18}
#top .selector-main{display:flex;align-items:center;gap:clamp(3px,.5vw,8px);min-width:0;padding:0;color:#f0dfb8;background:transparent;border:0;text-align:left;cursor:pointer}
#top .selector-icon{display:block;width:clamp(12px,1.5vw,20px);height:clamp(12px,1.5vw,20px);flex:none}
#top .selector-copy{display:grid;min-width:0;gap:1px}
#top .selector-copy b{display:block;overflow:hidden;color:#f0d79e;font-size:clamp(10px,.9vw,14px);font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis}
#top .selector-copy>span{display:block;overflow:hidden;color:#b1b29a;font-size:clamp(8px,.7vw,9.5px);letter-spacing:.07em;text-transform:uppercase;white-space:nowrap;text-overflow:ellipsis}
#top .selector-arrow{align-self:center;width:22px;height:32px;padding:0;color:#d7b56f;background:transparent;border:0;font:20px/1 Georgia,serif;cursor:pointer}
#top .selector-arrow:hover{color:#fff1c9;background:transparent}
#top .selector-arrow:disabled{opacity:.35;cursor:default}
#top .selector-tray{position:absolute;top:calc(100% + 8px);left:50%;z-index:30;width:min(260px,calc(100vw - 24px));box-sizing:border-box;padding:12px 14px;text-align:left;background:#2b2016;border:1px solid #8d6e3f;border-radius:4px;box-shadow:0 12px 30px #000b;color:#ead9b5;transform:translateX(-50%)}
#top .selector-tray[hidden]{display:none}
#top .selector-tray-current{display:grid;gap:3px}
#top .selector-tray-current small{color:#bda77d;font:9px/1 system-ui,sans-serif;letter-spacing:.1em;text-transform:uppercase}
#top .selector-tray-current span{color:#bda77d;font:10px/1.25 Georgia,serif}
#top .selector-tray-current .selector-tray-note{margin-top:5px}
#top .selector-tray-warning{color:#f09a82!important}
#top .selector-tray-warning[hidden]{display:none}
#top .selector-tray-action{width:100%;margin-top:7px;padding:6px 7px;color:#ead9b5;background:#3b2a19;border:1px solid #80623b;border-radius:3px;text-align:left;font:11px Georgia,serif;cursor:pointer}
#top .selector-tray-action[hidden]{display:none!important}
#top .selector-tray-action>span{display:inline;color:inherit;font:inherit}
#top .selector-tray-action:hover,#top .selector-tray-action[aria-pressed=true]{color:#2b2016;background:#d7b56f;border-color:#f0d38d}
#top .selector-targets{display:grid;gap:3px;margin-top:5px;padding:6px;background:#21180f;border:1px solid #5c4529}
#top .selector-targets[hidden]{display:none}
#top .selector-target{display:grid;grid-template-columns:minmax(0,1fr) 19px 14px 19px;align-items:center;gap:3px;color:#bda77d;font:10px Georgia,serif}
#top .selector-target b{color:#f0d79e;text-align:center;font-weight:600}
#top .selector-target button{width:19px;height:19px;padding:0;color:#d7b56f;background:#3b2a19;border:1px solid #80623b;border-radius:2px;font:14px/1 Georgia,serif;cursor:pointer}
#top .selector-target button:hover{color:#2b2016;background:#d7b56f}
#top .selector-target button:disabled{opacity:.35;cursor:default}
#top .season-selector-tray{left:0;transform:none}
#top .season-selector-tray .sub,#top .season-selector-tray .adv{margin:6px 0;color:#c9b48b;font:12px/1.5 Georgia,serif}
#top .season-selector-tray .cols{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:10px 0;padding:8px 0;border-top:1px solid #80613a;border-bottom:1px solid #80613a;color:#ead9b5}
#top .season-selector-tray .cols h4{margin:0 0 4px;color:#c9b48b;font:10px/1 system-ui,sans-serif;letter-spacing:.1em;text-transform:uppercase}
#top .season-selector-tray .ev{margin:7px 0;color:#ead9b5}
#top .season-selector-tray .morale-report{color:#f0d79e}
#top .season-selector-tray .season-report-close{position:absolute;top:7px;right:7px;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;color:#d7b56f;background:transparent;border:0;cursor:pointer}
#top .season-selector-tray .season-report-close:hover{color:#fff1c9}
#top .topbar-drawer-content{color:#ead9b5;font:12px/1.35 Georgia,serif}
#top .topbar-drawer-content>small{display:block;color:#bda77d;font:9px/1 system-ui,sans-serif;letter-spacing:.1em;text-transform:uppercase}
#top .topbar-drawer-content h3{margin:6px 0 8px;color:#f0d79e;font:18px/1.1 Georgia,serif}
#top .topbar-drawer-content p{margin:6px 0;color:#c9b48b;font:12px/1.35 Georgia,serif}
#top .topbar-drawer-warning{color:#f09a82!important}
#top .tax-options{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}
#top .tax-options .selector-tray-action{margin-top:0;text-align:center}
#top .unit-recruit-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:center;padding:6px 0;border-top:1px solid #5c4529}
#top .unit-recruit-row>span:first-child{color:#ead9b5;text-transform:capitalize}
#top .unit-recruit-row small{display:block;margin-top:2px;color:#bda77d;font:10px Georgia,serif}
#top .unit-recruit-row>span:last-child{display:flex;gap:3px}
#top .unit-recruit-row .selector-tray-action{width:auto;min-width:25px;margin:0;padding:5px 6px;text-align:center}

#top .utility-menu{position:relative;display:flex;align-items:center}
#top .utility-toggle{padding:6px 8px;color:#e4ce9c;background:#352b1e;border:1px solid #ad915a55;border-radius:2px;cursor:pointer}
#top .utility-toggle:hover,#top .utility-toggle[aria-expanded=true]{color:#2b2016;background:#b7985f;border-color:#d7b56f}
#top .utility-tray{position:absolute;top:calc(100% + 8px);right:0;z-index:31;display:grid;grid-template-columns:1fr 1fr;gap:4px;width:170px;padding:7px;background:#2b2016;border:1px solid #8d6e3f;border-radius:4px;box-shadow:0 12px 30px #000b}
#top .utility-tray[hidden]{display:none}
#top .utility-tray button{width:100%;min-height:30px;padding:5px 6px;color:#ead9b5;background:#3b2a19;border:1px solid #80623b;border-radius:3px;font:11px Georgia,serif;cursor:pointer}
#top .utility-ctl:last-child .utility-tray button{justify-content:flex-start;text-align:left}
#top .utility-tray button:hover{color:#2b2016;background:#d7b56f;border-color:#f0d38d}
#top .game-ctl{gap:3px;padding-left:0;margin-left:9px}
#top #speed button[data-speed]{width:32px;min-width:32px;flex:0 0 32px}
#top #skip{margin-left:0}
#top .utility-ctl{margin-left:7px;padding-left:0}

@media(min-width:701px){
  #top{left:50%;right:auto;width:max-content;max-width:calc(100vw - 24px);transform:translateX(-50%)}
  #top .body{justify-content:flex-start;width:max-content;max-width:100%}
  #top .stat,#top .stat.season{flex:1 1 130px;min-width:0;width:auto}
  #top #speed{width:auto}
  #top .utility-ctl{width:auto}
}

@media(min-width:1151px){
  #top .stat,#top .stat.season{flex:0 0 130px;width:130px}
  #top .selector-copy>span{overflow:visible;text-overflow:clip}
}

@media(min-width:701px) and (max-width:1150px){
  #top{width:calc(100vw - 24px)}
  #top .body{width:100%;max-width:none}
  #top .stat{padding:2px 5px;gap:4px}
  #top .stat svg:not(.clock){display:block!important;width:16px;height:16px}
  #top .stat b,#top .stat span{white-space:nowrap}
  #top #speed,#top .utility-ctl{flex:0 0 auto}
  #top #speed{width:auto;margin-left:7px;gap:2px}
  #top #speed button[data-speed]{width:28px;min-width:28px;flex-basis:28px}
  #top #speed button{padding-left:3px;padding-right:3px;font-size:10px}
  #top #skip{padding-left:5px;padding-right:5px;font-size:10px}
  #top .utility-ctl{margin-left:6px}
  #top .utility-toggle{padding-left:6px;padding-right:6px}
}

@media(min-width:701px) and (max-width:950px){
  #top #speed button[data-speed]{width:26px;min-width:26px;flex-basis:26px}
  #top #skip{font-size:9px}
}

#person-focus-float{position:fixed;z-index:9;display:flex;align-items:center;gap:5px;max-width:calc(100vw - 16px);padding:4px 7px;color:#ead9b5;background:#2b2016e8;border-left:3px solid #d7b56f;box-shadow:0 5px 14px #0008;transform:translate(-50%,-100%);font:12px Georgia,serif;white-space:nowrap;pointer-events:auto}
#person-focus-float[hidden]{display:none}
#person-focus-float strong{color:#f0d79e;font-weight:500}
.person-focus-job-wrap{position:relative;display:inline-flex}
#person-focus-job{display:inline-flex;align-items:center;gap:3px;max-width:112px;padding:1px 4px;color:#f0d79e;background:#3b2a19;border:1px solid #80623b;border-radius:2px;font:12px Georgia,serif;cursor:pointer}
#person-focus-job:hover,#person-focus-job[aria-expanded=true]{background:#554025;border-color:#d7b56f}
#person-focus-job-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#person-focus-job-menu{position:fixed;inset:auto;margin:0;max-height:calc(100dvh - 16px);overflow-y:auto;z-index:2;display:grid;gap:2px;min-width:128px;padding:4px;background:#2b2016;border:1px solid #8d6e3f;border-radius:3px;box-shadow:0 8px 18px #000b}
#person-focus-job-menu[hidden]{display:none}
#person-focus-job-menu button{width:100%;padding:4px 6px;color:#ead9b5;background:transparent;border:0;text-align:left;font:11px Georgia,serif;cursor:pointer}
#person-focus-job-menu button:hover,#person-focus-job-menu button[aria-selected=true]{color:#2b2016;background:#d7b56f}
#person-focus-float #person-focus-morale{color:#d7b56f}
#person-focus-float button{padding:0 4px;color:#d7b56f;background:transparent;border:0;border-left:1px solid #80613a;font:11px Georgia,serif;text-decoration:underline;cursor:pointer}
#person-focus-float button:hover{color:#fff1c9}
#person-focus-float button[hidden]{display:none}
#unit-focus-float{position:fixed;z-index:9;display:flex;align-items:center;gap:5px;max-width:calc(100vw - 16px);padding:4px 7px;color:#ead9b5;background:#2b2016e8;border-left:3px solid #d7b56f;box-shadow:0 5px 14px #0008;transform:translate(-50%,-100%);font:12px Georgia,serif;white-space:nowrap;pointer-events:auto}
#unit-focus-float[hidden]{display:none}
#unit-focus-float strong{color:#f0d79e;font-weight:500;text-transform:capitalize}
#unit-focus-float #unit-focus-ap{color:#d7b56f}
#unit-focus-float button{padding:0 4px;color:#d7b56f;background:transparent;border:0;border-left:1px solid #80613a;font:11px Georgia,serif;text-decoration:underline;cursor:pointer}
#unit-focus-float button:hover{color:#fff1c9}
#unit-focus-float button[hidden]{display:none}

@media(max-width:700px){
  #top .stat:has(#coins){order:2}
  #top #territory-selector{order:3}
  #top #people-selector{order:4}
  #top #unit-selector{order:5}
  #top .stat:has(#cryst){order:6}
  #top .selector-tray{top:calc(100% + 6px);left:auto;right:0;width:min(280px,calc(100vw - 24px));max-height:calc(100dvh - 120px);overflow:auto;transform:none}
  #top .season-selector-tray{left:0;right:auto}
  #top .utility-tray{top:calc(100% + 6px);right:0;width:160px}
  #top .utility-ctl{margin-left:2px;padding-left:5px}
  #people-prototype-menu{display:none;right:7px}
  #people-prototype-menu.mobile-open{display:flex}
  #people-prototype-toggle{display:block;right:0;top:auto;bottom:88px;transform:none;writing-mode:horizontal-tb;border-radius:4px 0 0 4px;padding:9px 8px}
  #people-prototype-menu button{width:62px;padding:8px 3px;font-size:11px}
  #people-drawer-prototype{right:8px;width:calc(100vw - 16px);top:8px;bottom:auto;max-height:calc(100dvh - 16px)}
  #people-prototype-menu.mobile-open~#people-drawer-prototype{right:80px;width:calc(100vw - 94px)}
  .people-drawer-content{padding-left:12px;padding-right:12px}
  .people-drawer-content .resident-row{grid-template-columns:28px minmax(0,1fr);gap:7px}
  .people-drawer-content .resident-portrait{width:28px;height:34px}
  .people-drawer-content .resident-row select{grid-column:2}
  #people-drawer-prototype{top:96px;right:8px;bottom:8px;transform:none;width:calc(100vw - 16px);height:calc(100dvh - 104px);max-height:none;z-index:40}
  .people-drawer-prototype :is(#goals,#side,#log,#card){top:96px!important;max-height:none!important}
  #people-prototype-menu{z-index:41}
  #people-prototype-toggle{z-index:42}
  .people-drawer-prototype :is(#goals,#side,#build,#log,#card){left:8px!important;right:8px!important;top:96px!important;bottom:8px!important;transform:none!important;width:auto!important;max-width:none!important;max-height:none!important;height:auto!important;z-index:40!important}
  .people-drawer-prototype #build:not(.folded){left:8px!important;right:8px!important;bottom:8px!important;width:auto!important;max-width:none!important}
}

/* Mobile header owns its rows and icon geometry. */
#top .pause-label{display:none}
#top .next-season-svg,#top .more-icon{flex:none;width:20px;height:20px}
@media(max-width:700px){
  #top .body{position:relative;display:grid;grid-template-columns:repeat(11,minmax(0,1fr)) 32px;gap:2px;align-items:center}
  #top .stat{padding:0;min-width:0}
  #top .stat.season{grid-column:1/3;grid-row:1;order:initial}
  #top #gold-selector{grid-column:3/5;grid-row:1;order:initial}
  #top .stat:has(#cryst){grid-column:5/7;grid-row:1;order:initial}
  #top .stat b{font-size:13px}
  #top .stat span{font-size:9px;letter-spacing:0}
  #top .season-selector-main,#top .gold-selector-main{min-height:36px;width:100%;justify-content:center}
  #top .ctl.utility-ctl{grid-column:12;grid-row:2;justify-self:end;position:static;width:32px;margin:0;padding:0;display:block}
  #top .utility-toggle{display:grid;place-items:center;width:32px;height:36px;padding:0!important;position:relative}
  #top .utility-toggle>span{display:none}
  #top .ctl.utility-ctl .more-icon{display:block;width:20px;height:20px}
  #top .utility-tray{display:grid;width:160px;padding:5px;gap:3px;max-width:calc(100vw - 40px);max-height:calc(100dvh - 100px);overflow:auto}
  #top .utility-tray[hidden]{display:none}
  #top .ctl.utility-ctl .utility-tray button{min-height:30px;padding:4px 6px;font-size:11px!important}
  #top #homeBtn{display:block}
  #top #speed{grid-column:7/13;grid-row:1;display:flex;width:100%;margin:0;padding:0;gap:2px}
  #top #speed button[data-speed]{width:auto;min-width:0;height:32px;flex:1 1 0;padding:0}
  #top #speed .pause-label{display:none}
  #top #speed #skip{flex:1 1 0;min-width:0;height:32px;margin-left:2px;padding:0;font-size:0}
  #top #skip .next-season-label{display:none}
  #top #skip .next-season-svg{display:block;width:18px;height:18px}
  #top #territory-selector{grid-column:1/5;grid-row:2;order:initial}
  #top #people-selector{grid-column:5/9;grid-row:2;order:initial}
  #top #unit-selector{grid-column:9/12;grid-row:2;order:initial}
  #top .selector-row{grid-template-columns:22px minmax(0,1fr) 22px;grid-template-rows:36px;background:transparent;border:0;box-sizing:border-box}
  #top .selector-main{grid-column:2;grid-row:1;justify-content:center;width:100%;height:36px;text-align:left;background:transparent;overflow:hidden}
  #top .selector-main .selector-copy{display:flex;align-items:baseline;justify-content:flex-start;gap:3px;flex-wrap:nowrap;overflow:hidden}
  #top .selector-copy>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;letter-spacing:0;text-transform:none;color:#cfbd98}
  #top .selector-arrow{grid-row:1;width:22px;min-width:0;height:36px;font-size:24px;text-align:center;display:grid;place-items:center}
  #top .selector-copy b{flex:none}
  #top .selector-arrow svg{display:block!important;width:16px;height:16px}
  #top .selector-tray{position:fixed;top:var(--hud-bottom,96px);left:8px;right:8px;width:auto;max-height:calc(100dvh - var(--hud-bottom,96px) - 16px);transform:none}
  #resources-drawer{top:var(--hud-bottom,96px);z-index:5}
  #resource-toggle{min-height:32px;padding:0 8px 0 12px;gap:8px;font:12px "Barlow Semi Condensed",sans-serif}
  #mobile-stores-label{color:#c9b48b;white-space:nowrap}
  #mobile-stores-summary{flex:1;text-align:right;color:#f0dfb8;font-variant-numeric:tabular-nums}
  #resource-toggle .resource-chevron{display:grid;place-items:center;flex:0 0 24px;height:24px;color:#d7b56f}
  #resource-toggle .resource-chevron svg{display:block;transition:transform 120ms ease}
  #resource-toggle[aria-expanded=true] .resource-chevron svg{transform:rotate(180deg)}
}
@media(prefers-reduced-motion:reduce){#resource-toggle .resource-chevron svg{transition:none}}

#person-focus-float{flex-wrap:wrap}
.person-work-status{flex-basis:100%;font-size:10px;white-space:normal}
#top:has(#people-selector-tray:not([hidden])){z-index:10}
/* Drawer prose must not inherit the top bar's compact uppercase stat labels. */
#top #people-selector-tray{font:12px/1.5 Georgia,serif;text-align:left;padding:12px 14px}
#top #people-selector-tray span{font:inherit;letter-spacing:normal;text-transform:none;white-space:normal;color:#c9b48b}
#top #people-selector-tray .selector-tray-current{gap:0}
#top #people-selector-tray-context{text-align:center}
#top #people-selector-summary{padding-bottom:12px;border-bottom:1px solid #80613a}
#top #people-selector-tray .selector-tray-warning{margin-top:12px}
#top #people-selector-tray .selector-tray-note{margin:12px 0 5px}
#top #people-selector-mode-help{margin:12px 0;padding-bottom:12px;border-bottom:1px solid #80613a;color:#bda77d;font:12px/1.5 Georgia,serif;text-transform:none}
#top #people-selector-tray .selector-target{padding:3px 0}
#top #people-selector-tray .selector-target span{font-size:12px}

/* One heading scale and context treatment for every top-bar drawer. */
#top :is(#people-selector-heading,.balance-location>strong,.topbar-drawer-content>h3,.season-selector-tray>h2){display:block;margin:6px 0 12px;color:#f0d79e;font:18px/1.1 Georgia,serif;text-align:center;letter-spacing:normal;text-transform:none}
#top :is(#people-selector-tray-context,.balance-location>small,.topbar-drawer-content>small,.drawer-context){display:block;margin:0;color:#bda77d;font:9px/1.1 system-ui,sans-serif;text-align:center;letter-spacing:.1em;text-transform:uppercase}
#top :is(.selector-tray,.balance-drawer-content,.topbar-drawer-content){font:12px/1.5 Georgia,serif;text-align:left}
#top :is(.season-selector-tray,.topbar-drawer-content) p{line-height:1.5}
#top :is(.season-selector-main,.gold-selector-main){min-height:32px;border-radius:2px}
#top :is(#season-selector,#gold-selector):hover>button,#top :is(#season-selector,#gold-selector).tray-open>button{background:#d7b56f18}
#top .stat.season.tray-open{background:transparent}

#top #gold-tax-rate{display:block;margin-left:8px;text-align:left}
#top #gold-tax-rate>span{font:inherit;font-size:9px;letter-spacing:.07em;text-transform:uppercase;color:#b1b29a}
#top :is(.season-selector-main,.gold-selector-main,.crystal-selector-main){display:flex;align-items:center;flex:1;width:100%;box-sizing:border-box;min-height:40px;padding:5px 8px;gap:8px;color:inherit;background:transparent;border:0;border-radius:2px;text-align:left;cursor:pointer}
#top :is(#season-selector,#gold-selector,#crystal-selector){align-self:stretch}
#top #crystal-selector:hover>button,#top #crystal-selector.tray-open>button{background:#d7b56f18}
#top #crystal-selector{position:relative}
#top #crystal-selector-tray{max-height:calc(100dvh - var(--hud-bottom,96px) - 16px);overflow:auto}
#top .crystal-location{display:block;margin:8px 0;padding:8px 0;border-top:1px solid #80613a}
#top .crystal-location button{width:100%;padding:7px;color:#ead9b5;background:#3b2a19;border:1px solid #80623b;border-radius:3px;font:12px Georgia,serif;text-align:left;cursor:pointer}
#top .crystal-location p{margin:5px 0;font:11px/1.5 Georgia,serif;color:#bda77d}
@media(max-width:700px){
  #top .body{grid-template-columns:repeat(11,minmax(0,1fr)) 32px}
  #top .stat.season{grid-column:1/3}
  #top #gold-selector{grid-column:3/5}
  #top .stat#crystal-selector{grid-column:5/7}
  #top #speed{grid-column:7/13;grid-row:1}
  #top :is(.season-selector-main,.gold-selector-main,.crystal-selector-main){min-height:36px;padding:4px 2px;gap:4px;justify-content:center}
  #top #gold-tax-rate{display:none}
}

@media(min-width:701px){
  #top #gold-selector-main{display:grid;grid-template-columns:auto minmax(max-content,1fr) auto;gap:4px;padding:5px 12px}
  #top #gold-tax-rate{margin-left:12px}
  #top #gold-selector{min-width:max-content}
  #top #coins{min-width:7ch}
  #top #gold-tax-rate>b{font-size:clamp(10px,.72vw,12px)}
}
