/* Docked construction drawers and a single vertical camera/history rail. */
#world[data-navigation="true"]{cursor:grab}
#world[data-navigation="true"]:active{cursor:grabbing}
#game{min-height:0;--ui-top:90px;--dock-space:116px;--edge:max(12px,env(safe-area-inset-right));--left-edge:max(12px,env(safe-area-inset-left))}
#game[data-tools-open="false"]{--dock-space:52px}
#game .topbar{z-index:5;top:max(12px,env(safe-area-inset-top));left:var(--left-edge);right:var(--edge)}
#file-menu{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px}
#file-menu span{margin:0}.village-icon{display:none}
#game #construction-palette{z-index:3;top:var(--ui-top);bottom:var(--dock-space);left:env(safe-area-inset-left,0px);width:270px;max-width:calc(100% - 90px);max-height:none;overflow-y:auto;overscroll-behavior:contain;padding:0 18px 20px;border-radius:0 16px 16px 0;background:rgb(252 252 248 / 92%);scrollbar-width:thin}
#game #construction-palette .drawer-handle{position:sticky;top:0;z-index:1;margin:0 -18px 15px;width:calc(100% + 36px);background:var(--paper);border-bottom:1px solid var(--line)}
#game #construction-palette h2{display:block;font-size:23px;margin:0 0 10px}
#game #construction-palette p{min-height:0;margin-bottom:14px}
#game #construction-palette #tool-description{display:block;font-size:14px}
#game #construction-palette .field-label,#game #construction-palette>.label-row{display:block;font-size:14px}
#game #construction-palette>.label-row{display:flex}
#game #construction-palette select{font-size:16px;min-height:44px;padding:10px 8px}
#game #construction-palette input[type="text"]{font-size:16px;max-width:100%;min-height:44px}
#game #construction-palette>input,#game #construction-palette .range-ends,#game #construction-palette .palette-separator{display:block}
#game #construction-palette .range-ends{display:flex}
#game #construction-palette .swatches{grid-template-columns:repeat(6,1fr);gap:8px}
#game #construction-palette .swatch{width:28px;height:28px}
#game #construction-palette .label-row{font-size:14px}
#game #construction-palette .label-row>span:last-child{display:inline}
.drawer-handle{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:8px 16px;font-size:14px;font-weight:600;touch-action:none;user-select:none;cursor:pointer}
.drawer-handle>span:last-child{font-size:24px;line-height:1}
.drawer-tab{position:absolute;z-index:4;display:flex;align-items:center;justify-content:center;gap:8px;min-width:44px;min-height:44px;padding:10px 12px;font-size:14px;touch-action:none;user-select:none}
.palette-tab{left:env(safe-area-inset-left,0px);top:45%;border-radius:0 14px 14px 0;writing-mode:vertical-rl}
.tools-tab{bottom:env(safe-area-inset-bottom,0px);left:50%;transform:translateX(-50%);border-radius:14px 14px 0 0}
.tools-tab:active:not(:disabled){transform:translateX(-50%)}
#game #construction-tools{z-index:3;bottom:0;left:0;transform:none;width:100%;gap:0;padding:0 max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom,0px) max(8px,env(safe-area-inset-left));background:rgb(252 252 248 / 84%);border-top:1px solid #ffffffb3;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
#tools-hide{min-height:36px;align-self:center;gap:16px;padding:3px 18px;border-radius:10px}
#game #construction-tools .toolbar{width:100%;max-width:100%;justify-content:center;overflow-x:auto;overscroll-behavior-x:contain;border:0;box-shadow:none;background:transparent;border-radius:0;padding:4px 0 8px;gap:4px;scrollbar-width:thin}
#game #construction-tools .toolbar button{flex:0 0 auto;min-width:74px;min-height:56px;padding:5px 12px;font-size:14px;gap:4px}
#game #construction-tools .controls-hint{display:none}
#view-controls{position:absolute;z-index:2;top:var(--ui-top);right:var(--edge);bottom:var(--dock-space);width:112px;display:flex;flex-direction:column;align-items:flex-end;gap:8px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;pointer-events:none}
#view-controls>*{pointer-events:auto;flex-shrink:0}
#view-controls .compass{position:static;width:112px;height:112px;pointer-events:none}
.cardinal-initial{display:none}
#view-controls .camera-controls,#view-controls .history{position:static;display:flex;flex-direction:column;align-items:center;padding:4px;gap:2px;border-radius:14px}
#view-controls .camera-controls button,#view-controls .history button{width:40px;height:40px;min-height:40px;font-size:25px}
#view-controls .camera-controls>span{display:block;width:24px;height:1px;margin:2px 0}
#view-controls .stats{position:static;width:72px;display:grid;grid-template-columns:auto auto;gap:4px;font-size:12px;padding:7px 5px;text-align:center;letter-spacing:0;background:rgb(252 252 248 / 87%);border-radius:10px}
#view-controls .stats>span{display:none}
#game .island-caption{right:140px;bottom:calc(var(--dock-space) + 15px)}
#game #village-menu{z-index:6;top:76px;right:var(--edge);max-height:calc(100dvh - 90px - env(safe-area-inset-bottom,0px));overflow-y:auto;overscroll-behavior:contain;width:290px;max-width:calc(100% - 24px)}
#village-menu label{display:block;margin:9px 10px;font-size:14px}
#village-menu select{width:calc(100% - 20px);margin:0 10px 8px;font-size:16px;min-height:44px}
#village-menu #grid,#village-menu #diada-toggle,#village-menu #animal-motion-toggle{margin:0;padding:12px 10px;font-size:14px;min-height:44px}
#game #toast{z-index:7;bottom:calc(var(--dock-space) + 12px)}
@media(max-width:1100px){#game #construction-tools .toolbar{justify-content:flex-start}}
@media(max-width:740px),(pointer:coarse) and (max-height:500px){
  #game{--ui-top:calc(64px + env(safe-area-inset-top,0px));--dock-space:calc(108px + env(safe-area-inset-bottom,0px));--edge:max(8px,env(safe-area-inset-right));--left-edge:max(8px,env(safe-area-inset-left))}
  #game[data-tools-open="false"]{--dock-space:calc(50px + env(safe-area-inset-bottom,0px))}
  #game .topbar{display:flex;flex-wrap:nowrap;align-items:center;gap:8px;top:max(8px,env(safe-area-inset-top))}
  #game .topbar .region-switch{display:none}
  #game .brand{min-width:0;gap:0;flex:1}
  #game .brand-mark,#game .brand p{display:none}
  #game .brand h1{font-size:18px;letter-spacing:-.5px;line-height:1.1}
  #game .top-actions{display:flex;gap:3px;flex-shrink:0;margin:0}
  #game .top-actions .icon-button,#game #file-menu{height:44px;width:40px;min-width:40px;padding:0}
  #game #file-menu{border-radius:12px}
  #file-menu .village-icon{display:block;width:25px;height:25px}
  #file-menu .village-label,#file-menu .village-chevron{display:none}
  #game #construction-palette{width:252px;max-width:calc(100% - 76px);padding:0 14px 16px}
  #game #construction-palette .drawer-handle{margin:0 -14px 12px;width:calc(100% + 28px);font-size:14px;padding:8px 10px}
  #game #construction-palette .swatches{gap:5px}
  #game #construction-palette .swatch{width:26px;height:26px}
  #game #construction-palette p.tree-note,#game #construction-palette p.roof-note{font-size:13px}
  #game #construction-tools .toolbar button{min-width:66px;padding:5px 8px;font-size:14px;min-height:56px}
  #tools-hide{font-size:14px}
  #view-controls{width:64px;gap:6px}
  #view-controls .compass{width:64px;height:64px}
  #view-controls .compass text{font-size:28px}
  .cardinal-name{display:none}.cardinal-initial{display:inline}
  #view-controls .stats{width:64px}
  #game .island-caption{display:none}
  #game #village-menu{top:calc(60px + env(safe-area-inset-top,0px));max-height:calc(100dvh - 76px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}
}

/* Daylight remains available independently of the construction drawers. */
#village-menu #daylight-settings{padding:8px 10px 12px}
#village-menu #daylight-settings label{display:flex;justify-content:space-between;gap:10px;margin:0 0 8px;font-size:14px}
#daylight-settings .label-row>span:last-child{display:inline}
#daylight-settings #light{display:block;width:100%;min-height:28px;margin:0;accent-color:var(--accent)}
#daylight-settings .range-ends{display:flex;justify-content:space-between;font-size:13px}
#game #update-notice{position:absolute;z-index:8;left:50%;transform:translateX(-50%);bottom:calc(var(--dock-space) + 12px);width:420px;max-width:calc(100% - 24px);padding:16px;background:var(--paper);border:1px solid var(--accent);border-radius:14px;max-height:calc(100dvh - var(--ui-top) - var(--dock-space) - 24px);overflow-y:auto}
#update-message{margin:0 0 12px;font-size:16px;line-height:1.45}
.update-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
#update-notice button{min-height:44px;padding:8px 14px;font-size:14px;margin:0}
#village-menu #update-menu{color:var(--accent);font-weight:600}
