/* The dock floats above the full-size scene. Its height only moves the other controls. */
.mobile-game .action-dock {
  --dock-border: #71977c70;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: center;
  width: min(480px, calc(100% - 20px));
  padding: 6px;
  border-color: var(--dock-border);
  background: #10332d;
  box-shadow: 0 5px 18px #09252165;
}

.action-dock > .draft-area { grid-column: 1; grid-row: 1; }
.action-dock > .recipe-goal { grid-column: 2; grid-row: 1; }
.action-dock > .selected-card,
.action-dock > .instant-actions,
.action-dock > .recipe-hints { grid-column: 1 / -1; min-width: 0; }
.mobile-game .action-dock:not(:has(> :not([hidden]))) { display: none; }
.action-dock:has(> .draft-area[hidden]) > .recipe-goal { justify-self: end; }
.action-dock:has(> .recipe-goal:not([hidden])):not(:has(> :not(.recipe-goal):not([hidden]))) {
  width: max-content;
}

.mobile-game .action-dock .draft-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}
.mobile-game .action-dock .draft-slot { width: 100%; height: 44px; }
.mobile-game .action-dock .draft-slot img { max-width: 100%; height: 41px; }
.action-dock .draft-area { gap: 5px; }
.action-dock .draft-navigation { flex-basis: 44px; }
.action-dock .draft-navigation button { width: 44px; }

.action-dock .recipe-goal { border: 0; padding: 0; }
.goal-selector > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 9px;
  border: 1px solid #a68ec878;
  border-radius: 7px;
  background: #3b315347;
  color: #e6d7f9;
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}
.goal-selector > summary::-webkit-details-marker { display: none; }
.goal-selector[open] > summary { border-color: #c9a9eb; background: #65507c69; }
.goal-selector > summary:focus-visible { outline: 2px solid #c9a9eb; outline-offset: 2px; }
.goal-popover {
  position: absolute;
  z-index: 1;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  width: min(350px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid #a68ec878;
  border-radius: 10px;
  background: #152f2d;
  box-shadow: 0 5px 18px #09252180;
}
.goal-popover .goal-list {
  display: grid;
  max-height: min(260px, 36dvh);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
}
.goal-popover .goal-chip { padding-inline-start: 4px; }
.goal-popover .goal-open small { margin-top: 2px; }

.action-dock .selected-card { min-height: 44px; gap: 4px; }
.action-dock .mini-gem { width: 35px; height: 41px; }
.action-dock .mini-identity { min-width: 0; }
.action-dock .mini-identity b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-dock .mini-identity small { font-size: 10px; margin-top: 2px; }
.action-dock .selected-details {
  align-self: stretch;
  min-height: 44px;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.action-dock .selected-details:hover { background: #79a17f22; }
.gem-info-mark { color: #bdceb5; font: 11px Arial, sans-serif; }
.action-dock .selection-close { height: 44px; flex: 0 0 30px; padding: 0; }
.action-dock .keep-action,
.action-dock .mini-replace { min-height: 44px; }
.action-dock .instant-actions,
.action-dock .recipe-hints { padding-block: 0; scrollbar-width: thin; scrollbar-color: #80977a transparent; }
.action-dock .instant-card { min-height: 44px; }
.action-dock .instant-card img { width: 30px; height: 32px; }
.mobile-game .action-dock.has-preview,
.mobile-game .action-dock.has-economy-preview { display: block; }

@media (max-width: 480px) {
  .goal-selector .goals-label { display: none; }
  .goal-popover .goals-heading { font-size: 11px; }
  .action-dock .mini-identity small { line-height: 1.25; }
  .action-dock .keep-action { padding-inline: 7px; }
  .action-dock .mini-rock { width: 25px; flex-shrink: 0; }
}

@media (min-width: 1040px), (min-width: 740px) and (max-height: 500px) and (orientation: landscape) {
  .mobile-game .action-dock {
    width: min(880px, calc(100% - 236px));
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }
  .action-dock > .recipe-goal { grid-column: 3; }
  .action-dock > .selected-card { grid-column: 2; grid-row: 1; }
  .action-dock:has(> .draft-area[hidden]) > .selected-card { grid-column: 1 / 3; }
  .action-dock:has(> .selected-card[hidden]) > .draft-area { grid-column: 1 / 3; max-width: 340px; }
  .mobile-game .map-tools,
  .mobile-game .time-controls { bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
}

.mobile-game .action-dock.has-preview {
  width: min(620px, calc(100% - 20px));
  padding: 8px 10px;
}
.action-dock #synthesis-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  grid-template-areas: "result destinations" "actions actions";
  align-items: center;
  gap: 7px 14px;
}
#synthesis-preview .preview-heading { grid-area: result; min-width: 0; }
#synthesis-preview .preview-heading > img {
  flex: 0 0 auto;
  width: 80px;
  height: 80px;
}
#synthesis-preview .preview-heading b { font-size: 24px; margin: 0 0 3px; }
#synthesis-preview .preview-heading small { margin-top: 3px; }
#synthesis-preview .preview-destination { grid-area: destinations; min-width: 0; }
#synthesis-preview .preview-anchor-hint { margin: 0 2px 3px 0; text-align: right; }
#synthesis-preview .preview-ingredients {
  justify-content: flex-end;
  margin: 0;
  padding: 3px;
  max-height: 128px;
  scrollbar-width: thin;
  scrollbar-color: #80977a transparent;
}
#synthesis-preview .preview-anchor-choice { height: 54px; padding-bottom: 13px; }
#synthesis-preview .preview-anchor-choice > img { width: 34px; height: 33px; }
#synthesis-preview .preview-anchor-choice > small { font-size: 10px; }
#synthesis-preview .preview-buttons { grid-area: actions; }

@media (max-width: 480px) {
  .action-dock #synthesis-preview { gap: 6px 8px; }
  #synthesis-preview .preview-heading { gap: 5px; }
  #synthesis-preview .preview-heading > img { width: 59px; height: 62px; }
  #synthesis-preview .preview-heading b { font-size: 18px; }
  #synthesis-preview .preview-heading span { display: block; line-height: 1.25; }
  #synthesis-preview .preview-anchor-choice { flex-basis: 44px; width: 44px; }
  .action-dock #synthesis-preview:has(.preview-anchor-choice:nth-child(4)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "result" "destinations" "actions";
  }
}

@media (min-width: 740px) and (max-height: 500px) and (orientation: landscape) {
  .mobile-game .action-dock.has-preview { width: min(620px, calc(100% - 236px)); }
  #synthesis-preview .preview-ingredients { max-height: 68px; }
}
