/* Aniiland 3.1.8 local visual tune: only UI surfaces, not text, images or video. */
/* Primary dark-mode surfaces ~10% darker; raised/bright surfaces ~15% darker. */
html[data-design="2"]:not([data-mode="light"]) {
  --bg:#151f32;
  --panel:#233047;
  --raised:#2d3e54;
  --line:#536782;
}
html[data-design="2"]:not([data-mode="light"]) body,
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland,
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell {
  --bg:#151f32!important;
  --panel:#233047!important;
  --raised:#2d3e54!important;
  --line:#536782!important;
  background-color:#151f32!important;
}
html[data-design="2"]:not([data-mode="light"]) body .hub-header {
  background:linear-gradient(110deg,#0d1423f0,#151a2eee)!important;
}
html[data-design="2"]:not([data-mode="light"]) .homeland-subnav {
  background:#222f43f5!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(
  .metric,.production-card,.flow-card,.upgrade-card,.focus-col,.rf-row,.advanced-facility-card,
  .section-card,.facility-card,.content-card,.panel,.workspace,.event-card,.egg-card,
  .rt-creature-card,.rt-toolbar,.event-strategy-card,.event-strategy-hero,.tool-card
) {
  border-color:#4c607c!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(.metric,.production-card,.flow-card,.upgrade-card,.section-card,.facility-card,.content-card,.panel,.workspace,.rt-toolbar) {
  background-color:var(--panel)!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(.focus-dialog,.advanced-setup-dialog,.myrv-dialog) {
  background-color:#1d293d!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(.focus-col,.rf-row,.advanced-facility-card,.rs-row,.focus-note) {
  background-color:#1e2c43!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
  background-color:#2d3e54!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(.tool-card,.egg-card,.event-card) {
  background:linear-gradient(150deg,#203047,#151d32)!important;
}
html[data-design="2"]:not([data-mode="light"]) body :is(.metric:first-child,.upgrade-part,.owned-stock-duration) {
  background-color:#24354a!important;
}
/* Recipe Focus header and selected duration do not scroll away with ingredients. */
#focus-dialog[open] { max-height:calc(100dvh - 24px); overflow:hidden; display:flex; flex-direction:column; min-height:0; }
#focus-dialog .advanced-setup-head {flex:0 0 auto!important;min-height:auto!important;overflow:visible!important;align-items:flex-start;}
#focus-dialog .advanced-setup-head>div:first-child {min-width:0;flex:1}
#focus-dialog .advanced-setup-head .advanced-dialog-close {flex:0 0 auto}
#focus-dialog .owned-stock-duration {flex:0 0 auto;display:flex;align-items:center;flex-wrap:wrap;gap:8px 13px;padding:11px 16px;margin:0 20px 10px;max-width:calc(100% - 40px);}
#focus-dialog .owned-stock-duration>b {flex:0 0 auto;}
#focus-dialog .owned-stock-duration>small {flex:1 1 210px;line-height:1.5;}
#focus-dialog .owned-stock-segment {flex:0 1 auto;min-width:0;max-width:100%;}
#focus-dialog #rf-problems {flex:0 1 auto;max-height:24dvh;overflow-y:auto;}
#focus-dialog .focus-grid {flex:1 1 auto;min-height:100px;overflow-y:auto;align-content:start;overscroll-behavior:contain;}
#focus-dialog .focus-col {min-width:0;}
#focus-dialog .advanced-setup-footer {flex:0 0 auto;}
@media(max-width:760px){
 #focus-dialog .advanced-setup-head {padding:13px 16px 10px!important;gap:8px;}
 #focus-dialog .advanced-setup-head h2 {font-size:20px!important;line-height:1.2}
 #focus-dialog .advanced-setup-head p {font-size:12px;line-height:1.45}
 #focus-dialog .owned-stock-duration {margin:0 12px 7px;max-width:calc(100% - 24px);padding:8px 10px;}
 #focus-dialog .owned-stock-duration>small{font-size:11px;flex-basis:100%;}
 #focus-dialog .owned-stock-segment{width:100%;max-width:100%;}
 #focus-dialog .owned-stock-segment button{flex:1;padding:9px 5px;font-size:12px;}
 #focus-dialog .focus-grid{min-height:90px;padding:10px;}
}

/* Local visual V4: sidebar background tracks the full shell/column height.
   Top sticky controls remain scrollable, anchored flush to the actual column. */
@media (min-width:1025px){
 html[data-design="2"] body.nightfall-homeland .shell{
   position:relative!important;isolation:isolate;overflow:visible!important;align-items:stretch!important;
 }
 html[data-design="2"] body.nightfall-homeland .shell::before{
   content:"";position:absolute;left:0;top:0;bottom:0;
   width:320px;z-index:0;pointer-events:none;
   background:#182234;border-right:1px solid #3a4d61;
 }
 html[data-design="2"] body.nightfall-homeland .shell>.planner-sidebar{
   position:sticky!important;align-self:start!important;
   top:calc(var(--homeland-nav-height,62px) + 9px)!important;
   height:auto!important;max-height:calc(100dvh - var(--homeland-nav-height,62px) - 18px)!important;
   overflow-y:auto!important;overscroll-behavior-y:contain;
   z-index:3!important;background:#182234!important;
   border-right:1px solid #3a4d61!important;
   border-radius:0!important;box-shadow:none!important;
 }
 html[data-design="2"] body.nightfall-homeland .shell>main#content{position:relative;z-index:1}
}
@media(min-width:1025px) and (max-width:1380px){
 html[data-design="2"] body.nightfall-homeland .shell::before{width:244px!important}
}
@media(max-width:1024px){
 html[data-design="2"] body.nightfall-homeland .shell::before{content:none!important}
}
/* Darken surfaces by ~8% more, and the brightest text/accent tones by ~20%.
   Do not dim sprites, Aniimo artwork, icons, embedded ads or screenshots. */
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland,
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell{
 --bg:#131c2e!important;
 --panel:#202c41!important;
 --raised:#29384c!important;
 --line:#4e5f76!important;
 --text:#c9ccd6!important;
 --muted:#a7b3c4!important;
 --mint:#96c8aa!important;
 --violet:#b69abc!important;
 color:var(--text)!important;
}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland,
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell {background-color:var(--bg)!important;}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell :is(.metric,.production-card,.flow-card,.upgrade-card,.section-card,.facility-card,.content-card,.panel,.workspace) {background-color:#202c41!important;}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background-color:#29384c!important;color:#c9ccd6!important;}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell :is(.qty,.profit,.positive,.net-positive,.metric-net,.metric .value.positive){color:#8bc9a7!important;}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell .production-use-tag.sell-use{color:#9acdb4!important;border-color:#39785e!important;background:#15352e!important;}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland :is(.production-use-tag.recipe-use,.eyebrow,.sidebar-title){color:#b89cc8!important;}
html[data-design="2"]:not([data-mode="light"]) body.nightfall-homeland .shell :is(.setup-mode-switch button.active,.segmented button.active,.goal-btn.active,.primary){background:#76549c!important;color:#e2d5e6!important;}
/* Recipe Focus 24H / 7D / Until Next RV is separate from the main plan.
   Stay visible at the top of the popup and next to Recipe Focus in the sidebar. */
.sidebar-stock-duration{
 display:flex;flex-direction:column;gap:6px;margin:7px 0 12px;
 padding:10px;border:1px solid #56617b;border-radius:10px;
 background:#243449;color:#d7cee7;
}
.sidebar-stock-duration strong{font-size:11px;font-weight:750;line-height:1.3}
.sidebar-stock-duration small{font-size:10px;line-height:1.4;color:#b6bbce}
.sidebar-stock-duration .owned-stock-segment{display:flex;gap:4px;min-width:0;width:100%}
.sidebar-stock-duration .owned-stock-segment button{
 font-size:10px!important;line-height:1.25!important;padding:7px 4px!important;
 min-height:34px!important;min-width:0!important;flex:1 1 auto!important;
 border:1px solid #52647f!important;border-radius:7px!important;
 color:#dad6e9!important;background:#2f3c53!important;
}
.sidebar-stock-duration .owned-stock-segment button[data-stock-duration="rv"]{flex:1.8 1 auto!important}
.sidebar-stock-duration .owned-stock-segment button[aria-pressed="true"]{
 color:#fff!important;background:#7342ae!important;border-color:#8f65c4!important;
}
#focus-dialog[open]{
 display:flex!important;flex-direction:column!important;
 width:min(1040px,calc(100vw - 18px))!important;
 height:min(790px,calc(100dvh - 18px))!important;
 max-height:calc(100dvh - 18px)!important;
 margin:auto!important;inset:0!important;overflow:hidden!important;
}
#focus-dialog .advanced-setup-head{flex:0 0 auto!important;overflow:visible!important;min-height:0!important}
#focus-dialog>.owned-stock-duration{
 flex:0 0 auto!important;display:flex!important;flex-wrap:wrap;align-items:center;
 max-width:none!important;width:auto!important;
 margin:0 17px 8px!important;padding:9px 12px!important;
 gap:6px 12px;border:1px solid #6b5b8d!important;border-radius:10px!important;
 background:#27384e!important;visibility:visible!important;
}
#focus-dialog>.owned-stock-duration>b{font-size:13px;font-weight:800;white-space:normal;color:#ccb2ed}
#focus-dialog>.owned-stock-duration>small{flex:1 1 160px;font-size:11px;line-height:1.4;color:#a8b6c9}
#focus-dialog>.owned-stock-duration .owned-stock-segment{
 display:flex;flex-wrap:nowrap;gap:4px;max-width:100%;min-width:0;
}
#focus-dialog>.owned-stock-duration .owned-stock-segment button{
 display:inline-flex;justify-content:center;align-items:center;
 width:auto!important;min-height:36px!important;min-width:45px!important;
 padding:7px 10px!important;border-radius:8px!important;
 background:#314560!important;color:#e4dcf0!important;
}
#focus-dialog>.owned-stock-duration .owned-stock-segment button[aria-pressed="true"]{
 background:#7342ae!important;color:#fff!important;border-color:#8f65c4!important;
}
#focus-dialog #rf-problems{flex:0 1 auto;max-height:22dvh;overflow-y:auto}
#focus-dialog .focus-grid{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;align-content:start}
#focus-dialog .advanced-setup-footer{
 flex:0 0 auto!important;display:flex!important;
 padding:11px 16px!important;gap:9px!important;align-items:center!important;
 justify-content:space-between!important;background:#172338!important;
}
#focus-dialog .advanced-setup-footer>div:last-child{display:flex!important;gap:8px!important}
/* Purple RV advisory, same treatment in Simple and Custom Setup. */
html[data-design="2"] body.nightfall-homeland #content .custom-resource-upgrade-warning{
 color:#dbc4fb!important;background:rgba(100,61,139,.20)!important;
 border:1px solid #926abf!important;border-left:4px solid #ab80de!important;
 padding:12px 15px!important;margin:12px 0!important;
 border-radius:10px!important;font-weight:600!important;
}
html[data-design="2"] body.nightfall-homeland #content .custom-resource-upgrade-warning span{color:inherit!important}
@media(max-width:760px){
 #focus-dialog[open]{height:calc(100dvh - 8px)!important;max-height:calc(100dvh - 8px)!important}
 #focus-dialog .advanced-setup-head{padding:12px 12px 8px!important}
 #focus-dialog .advanced-setup-head p{font-size:11px;line-height:1.3}
 #focus-dialog>.owned-stock-duration{margin:0 9px 7px!important;padding:7px 8px!important;gap:5px!important}
 #focus-dialog>.owned-stock-duration>small{display:none!important}
 #focus-dialog>.owned-stock-duration .owned-stock-segment{width:100%;display:flex;flex:1 1 100%}
 #focus-dialog>.owned-stock-duration .owned-stock-segment button{padding:7px 5px!important;flex:1 1 0!important;min-width:0!important;font-size:11px!important}
 #focus-dialog .advanced-setup-footer>span.hint{display:none!important}
 #focus-dialog .advanced-setup-footer{padding:9px!important}
 #focus-dialog .advanced-setup-footer>div:last-child{width:100%;justify-content:flex-end}
}

/* v6: explicitly surface independently controlled stock duration for every Homeland route. */
#sidebar-stock-duration {display:flex!important;flex-direction:column!important;position:relative;visibility:visible!important;opacity:1!important}
#focus-dialog[open] > .owned-stock-duration {display:flex!important;visibility:visible!important;opacity:1!important;position:relative!important;z-index:1!important;flex-shrink:0!important}
#focus-dialog[open] > .owned-stock-duration .owned-stock-segment {display:flex!important}
#focus-dialog[open] > .owned-stock-duration .owned-stock-segment button {display:inline-flex!important}

/* Shared Homeland dialog overflow repair (2026-11-04).
   The old flex:0 1 auto / min-height:0 / overflow:auto on dialog headers
   let the header collapse behind the content and hide descriptions.
   Keep headings and controls measurable; scroll only the actual data region. */
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-head,
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-toolbar {
  flex:0 0 auto!important;
  min-height:auto!important;
  overflow:visible!important;
}
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-head > div:first-child {
  flex:1 1 auto;
  min-width:0;
}
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-head :is(h2,p) {
  height:auto!important;
  max-width:100%;
  white-space:normal!important;
  overflow-wrap:anywhere;
  text-overflow:clip!important;
  line-height:1.35;
}
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-head > .advanced-dialog-close {
  flex:0 0 auto;
}
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-content {
  flex:1 1 auto;
  min-height:0!important;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
}
body.nightfall-homeland dialog.advanced-setup-dialog[open] > .advanced-setup-footer {
  flex:0 0 auto!important;
  min-height:auto!important;
}
/* RV Resources has exactly two actions, unlike the three-action Custom Setup.
   The generic phone 3-column grid can strand Save on a separate, tall row. */
body.nightfall-homeland #rv-resources-dialog[open] > .advanced-setup-footer {
  justify-content:flex-end!important;
  align-items:center!important;
  padding:12px 16px!important;
  gap:8px!important;
}
body.nightfall-homeland #rv-resources-dialog[open] > .advanced-setup-footer > div {
  display:flex!important;
  width:auto!important;
  min-width:0;
  flex:0 1 auto;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
  gap:9px!important;
}
body.nightfall-homeland #rv-resources-dialog[open] > .advanced-setup-footer > div > button {
  width:auto!important;
  min-width:75px;
  min-height:42px;
  padding:9px 16px!important;
  margin:0!important;
  flex:0 0 auto;
  white-space:normal!important;
}
@media (max-width:560px) {
  body.nightfall-homeland #rv-resources-dialog[open] > .advanced-setup-footer > div {
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%!important;
    gap:8px!important;
  }
  body.nightfall-homeland #rv-resources-dialog[open] > .advanced-setup-footer > div > button {
    width:100%!important;
    min-width:0;
  }
}
/* The import confirmation uses the same dialog shell but has no scrollable
   content panel. Allow the complete prompt and its actions to scroll together. */
body.nightfall-homeland dialog.advanced-setup-dialog.myrv-ask[open] {
  display:block!important;
  overflow-y:auto!important;
}
/* Other native popup families scroll themselves; permit translated strings,
   lengthy resource names and small-screen explanatory copy to wrap. */
body.nightfall-homeland :is(
  dialog.info-dialog,dialog.recipe-lock-dialog,dialog.roster-dialog,
  dialog.myrv-dialog,dialog.event-center-dialog,dialog.aniiland-update-dialog
) :is(h1,h2,h3,p,small,label) {
  overflow-wrap:anywhere;
}
