/* Original controls own their game state and handlers. Only the toolbar renders them. */
[data-scene-source], #cafe-status {
  position:fixed !important;
  inset:auto 0 0 auto !important;
  width:1px !important;
  min-width:0 !important;
  height:1px !important;
  min-height:0 !important;
  padding:0 !important;
  margin:0 !important;
  overflow:hidden !important;
  clip-path:inset(50%);
  pointer-events:none !important;
}

:where(#location-options, #location-options > nav:not([hidden]),
  #location-options #building-actions:not([hidden]), #keepers-shortcuts:not([hidden])) {
  display:contents;
}

#scene-action-bar[hidden], #scene-action-bar [hidden] {display:none}

#scene-action-bar {
  --action-gap:8px;
  --action-slot:76px;
  --action-disc:49px;
  --action-row-height:74px;
  position:fixed;
  z-index:3;
  bottom:calc(15px + env(safe-area-inset-bottom));
  left:50%;
  transform:translateX(-50%);
  width:max-content;
  max-width:calc(100dvw - max(14px, env(safe-area-inset-left)) - max(14px, env(safe-area-inset-right)));
  display:grid;
  justify-items:center;
  gap:7px;
  pointer-events:none;
}

#scene-action-bar [data-action-row], #scene-action-bar [data-action-overflow]:not([hidden]) {
  display:flex;
  gap:var(--action-gap);
  max-width:100%;
}

#scene-action-bar [data-action-row] {justify-content:center}

#scene-action-bar [data-action-overflow] {
  width:max-content;
  max-width:min(100%, calc(100dvw - 24px));
  overflow-x:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  padding:7px 8px 9px;
  border-radius:15px;
  background:#1b302bea;
  box-shadow:0 8px 22px #10211e4d;
  pointer-events:auto;
}

#scene-action-bar [data-action-feedback] {
  max-width:min(340px,100%);
  margin:0;
  padding:4px 9px;
  border-radius:12px;
  background:#20332be8;
  color:#fcf0d7;
  font-size:12px;
  line-height:1.35;
  text-align:center;
}

#scene-action-bar .scene-action-tile {
  isolation:isolate;
  display:grid;
  flex:0 0 var(--action-slot);
  grid-template-rows:var(--action-disc) minmax(16px,auto);
  align-items:center;
  justify-items:center;
  align-content:start;
  width:var(--action-slot);
  min-width:44px;
  min-height:var(--action-row-height);
  gap:3px;
  padding:0;
  border:0;
  border-radius:8px;
  background:none;
  box-shadow:none;
  color:#fff3d4;
  font:600 13px/1.2 system-ui,"PingFang SC","Microsoft Yahei",sans-serif;
  text-align:center;
  text-shadow:0 1px 2px #172c26,0 1px 5px #0b1714,0 0 8px #0c1d16;
  cursor:pointer;
  pointer-events:auto;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

.scene-action-glyph {
  display:block;
  flex:none;
  width:33px;
  height:33px;
  pointer-events:none;
}

#scene-action-bar .scene-action-glyph {
  box-sizing:content-box;
  width:37px;
  height:37px;
  padding:5px;
  border:1px solid #b9cfb467;
  border-radius:50%;
  background:radial-gradient(ellipse at 42% 18%,#415b48f2,#213a30ed 62%,#182e26f2);
  box-shadow:0 3px 9px #11251f75,inset 0 1px #dce2b535;
  transition:background .13s, border-color .13s, scale .13s;
}

#scene-action-bar .scene-action-tile:focus-visible {
  outline:2px solid #fae1a2;
  outline-offset:2px;
}

#scene-action-bar .scene-action-tile:is(:focus-visible,[data-selected],[aria-expanded=true]) .scene-action-glyph {
  border-color:#eed397;
  background:radial-gradient(ellipse at 44% 16%,#687050,#355746 68%,#2c4a39);
}

@media (hover:hover) {
  #scene-action-bar .scene-action-tile:hover:not([aria-disabled=true]) .scene-action-glyph {
    scale:1.08;
    border-color:#efd698;
  }
}
#scene-action-bar .scene-action-tile:active:not([aria-disabled=true]) .scene-action-glyph {scale:.94}
#scene-action-bar .scene-action-tile[aria-disabled=true] {
  color:#e2daca;
  cursor:default;
}
#scene-action-bar .scene-action-tile[aria-disabled=true] .scene-action-glyph {filter:grayscale(.72);opacity:.64}
#scene-action-bar .scene-action-tile[data-executing] .scene-action-glyph {
  border-color:#badeab;
  box-shadow:0 0 0 2px #badeab65;
}

@media (min-width:661px) and (any-pointer:fine) {
  body:has(#scene-action-bar:not([hidden])) #prompt {bottom:calc(104px + env(safe-area-inset-bottom))}
  body:has(#scene-action-overflow:not([hidden])) #prompt {bottom:calc(206px + env(safe-area-inset-bottom))}
}

button[data-action-icon]:not([hidden]) {
  display:inline-flex;
  flex-direction:column-reverse;
  align-items:center;
  justify-content:center;
  gap:2px;
  min-height:44px;
  touch-action:manipulation;
}
button[data-action-icon] > .scene-action-glyph {width:25px;height:25px}
#identity-actions button[data-action-icon] > .scene-action-glyph {width:33px;height:33px}

@media (max-width:660px), (any-pointer:coarse) {
  #scene-action-bar {
    --action-slot:60px;
    --action-disc:43px;
    --action-row-height:66px;
    --action-gap:5px;
    bottom:calc(10px + env(safe-area-inset-bottom));
  }
  #scene-action-bar .scene-action-tile {font-size:12px}
  #scene-action-bar .scene-action-glyph {width:33px;height:33px;padding:4px}
  /* Leave the bottom row centered even when the profile widget is visible. */
  body:has(#scene-action-bar:not([hidden])):not(:has(#touch-walk[hidden])) #player-identity {
    bottom:calc(85px + env(safe-area-inset-bottom));
  }
}
@media (orientation:landscape) and (max-height:520px) {
  #scene-action-bar {--action-row-height:60px;bottom:calc(7px + env(safe-area-inset-bottom))}
  body:has(#scene-action-bar:not([hidden])):not(:has(#touch-walk[hidden])) #player-identity {bottom:var(--identity-bottom)}
}
@media (max-width:350px) {
  #scene-action-bar {--action-slot:57px}
}

@media (prefers-reduced-motion:reduce) {
  #scene-action-bar .scene-action-glyph {transition:none}
}
